mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Florian Fainelli <florian.fainelli@broadcom.com>
To: Jonas Gorski <jonas.gorski@gmail.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Russell King <linux@armlinux.org.uk>,
	"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net 3/5] net: dsa: b53: clear stale state when creating an ARL entry
Date: Wed, 28 Oct 2026 09:58:12 -0700	[thread overview]
Message-ID: <839ca732-c2a5-451b-bc9b-58afaaa01121@broadcom.com> (raw)
In-Reply-To: <CAOiHx=kFqW3AgzQ3_zJBxkdXcokg8j3-Ry1meV6h-RKb5mcTgA@mail.gmail.com>

On 10/28/26 02:52, Jonas Gorski wrote:
> On Tue, Oct 27, 2026 at 9:22 PM Florian Fainelli
> <florian.fainelli@broadcom.com> wrote:
>>
>> When an ARL lookup does not find the requested MAC and VID, b53_arl_read()
>> returns the first free bin index but leaves the entry populated with the
>> last bin examined. The multicast add path then ORs the requested port into
>> that unrelated entry's forwarding bitmap, potentially forwarding packets
>> to ports which are not members of the multicast group.
>>
>> Clear the entry before creating a new one. Also return without writing
>> anything when deleting an entry which is not present, instead of making
>> a new entry from stale bin contents.
>>
>> Fixes: 5d65b64a3d97 ("net: dsa: b53: Add support for MDB")
>> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
>> ---
>>   drivers/net/dsa/b53/b53_common.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
>> index 559d4b360c82..0871a10d8cbc 100644
>> --- a/drivers/net/dsa/b53/b53_common.c
>> +++ b/drivers/net/dsa/b53/b53_common.c
>> @@ -1992,6 +1992,10 @@ static int b53_arl_op(struct b53_device *dev, int op, int port,
>>                          addr, vid);
>>                  return is_valid ? ret : 0;
>>          case -ENOENT:
>> +               if (!is_valid)
>> +                       return 0;
> 
> Should we return 0, or should we pass on the -ENOENT? We failed to
> remove the entry, so implies there was a desync between hardware state
> and software state.
> 
> If we don't, we should at least report the issue. If we do, we don't
> need to, as dsa will do that. Though we then should also report
> -ENOSPC && !is_valid as -ENOENT.
> 
> Likewise when trying to add an entry that already exists.

Agreed, returning -ENOENT seems preferable so the missing hardware entry 
is visible to the caller. I'll propagate it for the -ENOENT case and 
translate -ENOSPC to -ENOENT when deleting.

For additions, finding an existing MAC/VID is not necessarily a 
desynchronization: an FDB add may move an entry or make a dynamically 
learned entry static, and an MDB add may extend the port bitmap. So I 
think we should retain the existing update behavior rather than return 
-EEXIST on a lookup match.

> 
>> +
>> +               memset(&ent, 0, sizeof(ent));
> 
> Just bikeshedding, but semantically it feels the memset should be
> below the comment/dev_dbg().

Yes, I took that change.

Thanks!
-- 
Florian

  reply	other threads:[~2026-10-28 16:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 20:22 [PATCH net 0/5] net: dsa: b53: Preliminary fixes Florian Fainelli
2026-10-27 20:22 ` [PATCH net 1/5] net: dsa: b53: initialize the jumbo frame size register offset Florian Fainelli
2026-10-28  9:09   ` Jonas Gorski
2026-10-27 20:22 ` [PATCH net 2/5] net: dsa: b53: fix the SRAB grant timeout check Florian Fainelli
2026-10-28  9:14   ` Jonas Gorski
2026-10-27 20:22 ` [PATCH net 3/5] net: dsa: b53: clear stale state when creating an ARL entry Florian Fainelli
2026-10-28  9:52   ` Jonas Gorski
2026-10-28 16:58     ` Florian Fainelli [this message]
2026-10-27 20:22 ` [PATCH net 4/5] net: dsa: b53: reject conflicting mirror destinations Florian Fainelli
2026-10-28  9:56   ` Jonas Gorski
2026-10-27 20:22 ` [PATCH net 5/5] net: dsa: b53: use the correct override register 2 Gbps bit Florian Fainelli
2026-10-28  9:58   ` Jonas Gorski
2026-10-27 20:26 ` [PATCH net 0/5] net: dsa: b53: Preliminary fixes netdev-bot+sinfo
2026-10-27 20:30   ` Florian Fainelli

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=839ca732-c2a5-451b-bc9b-58afaaa01121@broadcom.com \
    --to=florian.fainelli@broadcom.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=jonas.gorski@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /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

all inboxes | Powered by JetHome®