All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: dwmac-sun8i: show message only when switching to promisc
@ 2019-10-18 14:05 ` Mans Rullgard
  0 siblings, 0 replies; 4+ messages in thread
From: Mans Rullgard @ 2019-10-18 14:05 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu
  Cc: David S. Miller, Maxime Ripard, Chen-Yu Tsai, netdev,
	linux-arm-kernel, linux-kernel

Printing the info message every time more than the max number of mac
addresses are requested generates unnecessary log spam.  Showing it only
when the hw is not already in promiscous mode is equally informative
without being annoying.

Signed-off-by: Mans Rullgard <mans@mansr.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 79c91526f3ec..5be2de1f1179 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -646,7 +646,8 @@ static void sun8i_dwmac_set_filter(struct mac_device_info *hw,
 			}
 		}
 	} else {
-		netdev_info(dev, "Too many address, switching to promiscuous\n");
+		if (readl(ioaddr + EMAC_RX_FRM_FLT) != EMAC_FRM_FLT_RXALL)
+			netdev_info(dev, "Too many address, switching to promiscuous\n");
 		v = EMAC_FRM_FLT_RXALL;
 	}
 
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] net: ethernet: dwmac-sun8i: show message only when switching to promisc
@ 2019-10-18 14:05 ` Mans Rullgard
  0 siblings, 0 replies; 4+ messages in thread
From: Mans Rullgard @ 2019-10-18 14:05 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu
  Cc: Maxime Ripard, netdev, linux-kernel, Chen-Yu Tsai,
	David S. Miller, linux-arm-kernel

Printing the info message every time more than the max number of mac
addresses are requested generates unnecessary log spam.  Showing it only
when the hw is not already in promiscous mode is equally informative
without being annoying.

Signed-off-by: Mans Rullgard <mans@mansr.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 79c91526f3ec..5be2de1f1179 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -646,7 +646,8 @@ static void sun8i_dwmac_set_filter(struct mac_device_info *hw,
 			}
 		}
 	} else {
-		netdev_info(dev, "Too many address, switching to promiscuous\n");
+		if (readl(ioaddr + EMAC_RX_FRM_FLT) != EMAC_FRM_FLT_RXALL)
+			netdev_info(dev, "Too many address, switching to promiscuous\n");
 		v = EMAC_FRM_FLT_RXALL;
 	}
 
-- 
2.23.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: ethernet: dwmac-sun8i: show message only when switching to promisc
  2019-10-18 14:05 ` Mans Rullgard
@ 2019-10-18 14:29   ` Corentin Labbe
  -1 siblings, 0 replies; 4+ messages in thread
From: Corentin Labbe @ 2019-10-18 14:29 UTC (permalink / raw)
  To: Mans Rullgard
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Maxime Ripard,
	netdev, linux-kernel, Chen-Yu Tsai, David S. Miller,
	linux-arm-kernel

On Fri, Oct 18, 2019 at 03:05:14PM +0100, Mans Rullgard wrote:
> Printing the info message every time more than the max number of mac
> addresses are requested generates unnecessary log spam.  Showing it only
> when the hw is not already in promiscous mode is equally informative
> without being annoying.
> 
> Signed-off-by: Mans Rullgard <mans@mansr.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> index 79c91526f3ec..5be2de1f1179 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> @@ -646,7 +646,8 @@ static void sun8i_dwmac_set_filter(struct mac_device_info *hw,
>  			}
>  		}
>  	} else {
> -		netdev_info(dev, "Too many address, switching to promiscuous\n");
> +		if (readl(ioaddr + EMAC_RX_FRM_FLT) != EMAC_FRM_FLT_RXALL)
> +			netdev_info(dev, "Too many address, switching to promiscuous\n");
>  		v = EMAC_FRM_FLT_RXALL;
>  	}
>  

You need to mask the result, if EMAC_FRM_FLT_MULTICAST | EMAC_FRM_FLT_RXALL is set, you will still print the message.
Or shorter than masking, !(readl(ioaddr + EMAC_RX_FRM_FLT) & EMAC_FRM_FLT_RXALL)

I just realize that perhaps we need to set also IFF_PROMISC in dev->flags.

Thanks
Regards

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: ethernet: dwmac-sun8i: show message only when switching to promisc
@ 2019-10-18 14:29   ` Corentin Labbe
  0 siblings, 0 replies; 4+ messages in thread
From: Corentin Labbe @ 2019-10-18 14:29 UTC (permalink / raw)
  To: Mans Rullgard
  Cc: Alexandre Torgue, Maxime Ripard, netdev, linux-kernel,
	Chen-Yu Tsai, Jose Abreu, Giuseppe Cavallaro, David S. Miller,
	linux-arm-kernel

On Fri, Oct 18, 2019 at 03:05:14PM +0100, Mans Rullgard wrote:
> Printing the info message every time more than the max number of mac
> addresses are requested generates unnecessary log spam.  Showing it only
> when the hw is not already in promiscous mode is equally informative
> without being annoying.
> 
> Signed-off-by: Mans Rullgard <mans@mansr.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> index 79c91526f3ec..5be2de1f1179 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> @@ -646,7 +646,8 @@ static void sun8i_dwmac_set_filter(struct mac_device_info *hw,
>  			}
>  		}
>  	} else {
> -		netdev_info(dev, "Too many address, switching to promiscuous\n");
> +		if (readl(ioaddr + EMAC_RX_FRM_FLT) != EMAC_FRM_FLT_RXALL)
> +			netdev_info(dev, "Too many address, switching to promiscuous\n");
>  		v = EMAC_FRM_FLT_RXALL;
>  	}
>  

You need to mask the result, if EMAC_FRM_FLT_MULTICAST | EMAC_FRM_FLT_RXALL is set, you will still print the message.
Or shorter than masking, !(readl(ioaddr + EMAC_RX_FRM_FLT) & EMAC_FRM_FLT_RXALL)

I just realize that perhaps we need to set also IFF_PROMISC in dev->flags.

Thanks
Regards

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-18 14:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 14:05 [PATCH] net: ethernet: dwmac-sun8i: show message only when switching to promisc Mans Rullgard
2019-10-18 14:05 ` Mans Rullgard
2019-10-18 14:29 ` Corentin Labbe
2019-10-18 14:29   ` Corentin Labbe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.