public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: DENG Qingfang <dqfext@gmail.com>
Cc: Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: dsa: mv88e6xxx: check for address type in port_db_load_purge
Date: Tue, 20 Jul 2021 15:45:41 +0200	[thread overview]
Message-ID: <YPbThTUcE1QXnZJM@lunn.ch> (raw)
In-Reply-To: <20210720092426.1998666-1-dqfext@gmail.com>

On Tue, Jul 20, 2021 at 05:24:26PM +0800, DENG Qingfang wrote:
> The same state value of an ATU entry can mean different states,
> depending on the entry's address type.
> Check for its address type instead of state, to determine if its
> portvec should be overridden.

Please could you expand this description. It is not obvious to me this
change correct.

> 
> Fixes: f72f2fb8fb6b ("net: dsa: mv88e6xxx: override existent unicast portvec in port_fdb_add")
> Signed-off-by: DENG Qingfang <dqfext@gmail.com>
> ---
>  drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index beb41572d04e..dd4d7fa0da8e 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -1741,7 +1741,7 @@ static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port,
>  		if (!entry.portvec)
>  			entry.state = 0;
>  	} else {
> -		if (state == MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC)
> +		if (is_unicast_ether_addr(addr))
>  			entry.portvec = BIT(port);
>  		else
>  			entry.portvec |= BIT(port);

I agree that MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC should only be used
with an address which is know to be unicast. If the address is
multicast, it means it should be considered as a management frame, and
given priority override.

But what exactly are we interested in here? The old code looked like
it wanted to match on static unicast entries. Your change will make it
match on static and dynamic unicast? Do we want dynamic as well? Why
is the fix not this?

> -		if (state == MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC)
> +		if (is_unicast_ether_addr(addr) && state == MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC)

which fixes the problem you describe in the commit message.

Thanks
	Andrew

      reply	other threads:[~2021-07-20 13:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20  9:24 [PATCH net] net: dsa: mv88e6xxx: check for address type in port_db_load_purge DENG Qingfang
2021-07-20 13:45 ` Andrew Lunn [this message]

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=YPbThTUcE1QXnZJM@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dqfext@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox