All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: Mans Rullgard <mans@mansr.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chen-Yu Tsai <wens@csie.org>, Jose Abreu <joabreu@synopsys.com>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	"David S. Miller" <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] net: ethernet: dwmac-sun8i: show message only when switching to promisc
Date: Fri, 18 Oct 2019 16:29:17 +0200	[thread overview]
Message-ID: <20191018142917.GA26078@Red> (raw)
In-Reply-To: <20191018140514.21454-1-mans@mansr.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Corentin Labbe <clabbe.montjoie@gmail.com>
To: Mans Rullgard <mans@mansr.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chen-Yu Tsai <wens@csie.org>,
	"David S. Miller" <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] net: ethernet: dwmac-sun8i: show message only when switching to promisc
Date: Fri, 18 Oct 2019 16:29:17 +0200	[thread overview]
Message-ID: <20191018142917.GA26078@Red> (raw)
In-Reply-To: <20191018140514.21454-1-mans@mansr.com>

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

  reply	other threads:[~2019-10-18 14:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2019-10-18 14:29   ` Corentin Labbe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191018142917.GA26078@Red \
    --to=clabbe.montjoie@gmail.com \
    --cc=alexandre.torgue@st.com \
    --cc=davem@davemloft.net \
    --cc=joabreu@synopsys.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mans@mansr.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.