Re: [PATCH] net: fec: properly guard irq coalesce setup

From: Alexander Stein
Date: Tue Dec 06 2022 - 01:16:25 EST


Am Montag, 5. Dezember 2022, 21:46:04 CET schrieb Rasmus Villemoes:
> Prior to the Fixes: commit, the initialization code went through the
> same fec_enet_set_coalesce() function as used by ethtool, and that
> function correctly checks whether the current variant has support for
> irq coalescing.
>
> Now that the initialization code instead calls fec_enet_itr_coal_set()
> directly, that call needs to be guarded by a check for the
> FEC_QUIRK_HAS_COALESCE bit.
>
> Fixes: df727d4547de (net: fec: don't reset irq coalesce settings to defaults
> on "ip link up") Reported-by: Greg Ungerer <gregungerer@xxxxxxxxxxxxxx>
> Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
> ---
> drivers/net/ethernet/freescale/fec_main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c index
> 2ca2b61b451f..23e1a94b9ce4 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1220,7 +1220,8 @@ fec_restart(struct net_device *ndev)
> writel(0, fep->hwp + FEC_IMASK);
>
> /* Init the interrupt coalescing */
> - fec_enet_itr_coal_set(ndev);
> + if (fep->quirks & FEC_QUIRK_HAS_COALESCE)
> + fec_enet_itr_coal_set(ndev);
> }
>
> static int fec_enet_ipc_handle_init(struct fec_enet_private *fep)

I'm wondering if this check should be added to fec_enet_itr_coal_set()
instead. Right now any additional caller has to do it's own check for
FEC_QUIRK_HAS_COALESCE, so why not do check in fec_enet_itr_coal_set?
But I'm okay with this change as well.

Best regards,
Alexander