mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Daniel Zahka" <daniel.zahka@gmail.com>
To: <netdev-bot+sashiko@kernel.org>, <daniel.zahka@gmail.com>
Cc: <alexanderduyck@fb.com>, <kuba@kernel.org>,
	<kernel-team@meta.com>, <andrew+netdev@lunn.ch>,
	<davem@davemloft.net>, <edumazet@kernel.org>, <pabeni@redhat.com>,
	<dimitri.daskalakis1@gmail.com>, <mohsin.bashr@gmail.com>,
	<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 3/4] eth: mpnic: sync unicast and multicast address lists
Date: Wed, 18 Nov 2026 05:21:44 -0500	[thread overview]
Message-ID: <DMY9FTQ22U8T.JKYB4HL8J8PH@gmail.com> (raw)
In-Reply-To: <179499313262.3136.12811016164943625265@kernel.org>

On Wed Nov 18, 2026 at 4:12 AM EST, netdev-bot+sashiko wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] The unicast and multicast lists are synced in the wrong order
>   in __mpnic_set_rx_mode()…
>
> --
>
> eth: mpnic: sync unicast and multicast address lists
>
> This commit adds the secondary unicast and multicast addresses to the
> MACDA TCAM and advertises IFF_UNICAST_FLT. When either list outgrows the
> table, the driver falls back to promiscuous or all-multicast mode. A
> per-slot users count is kept so the same address can sit in both dev->uc
> and dev->mc.
>
>> diff --git a/drivers/net/ethernet/meta/mpnic/mpnic_netdev.c b/drivers/net/ethernet/meta/mpnic/mpnic_netdev.c
>> index 43547a7d6e5c7..c01e276c4a74d 100644
>> --- a/drivers/net/ethernet/meta/mpnic/mpnic_netdev.c
>> +++ b/drivers/net/ethernet/meta/mpnic/mpnic_netdev.c
>
> [ ... ]
>
>> @@ -35,7 +53,14 @@ static void __mpnic_set_rx_mode(struct mpnic_dev *mpd,
>>  		mac_addr->state = MPNIC_TCAM_S_ADD;
>>  	}
>>  
>> -	if (!netdev_hw_addr_list_empty(mc))
>> +	err = __hw_addr_sync_dev(uc, netdev, mpnic_addr_sync,
>> +				 mpnic_addr_unsync);
>> +	if (err == -ENOSPC)
>> +		uc_promisc = true;
>> +
>> +	err = __hw_addr_sync_dev(mc, netdev, mpnic_addr_sync,
>> +				 mpnic_addr_unsync);
>> +	if (err == -ENOSPC)
>>  		mc_promisc = true;
>
> [Severity: Medium]
> Can the device get stuck in unicast promiscuous mode here, even though a
> TCAM slot is free?
>
> The uc and mc lists share the same MACDA slots (between
> MPNIC_TCAM_MACDA_BROADCAST_IDX and MPNIC_TCAM_MACDA_HOST_ADDR_IDX). The
> whole uc pass, both its flush and its add phase, runs before the mc pass
> flushes stale multicast entries.
>
> Consider this sequence:
>
> 1. The table is full of multicast entries and a secondary unicast
>    address U is added. mpnic_macda_sync() returns -ENOSPC, U stays at
>    sync_cnt == 0, and mpnic_promisc_sync() enables unicast promisc.
>
> 2. A multicast address M is then removed. The core runs
>    netif_rx_mode_run()->mpnic_set_rx_mode()->__mpnic_set_rx_mode().
>
> 3. The uc pass retries U. M's slot is still MPNIC_TCAM_S_VALID, so
>    mpnic_macda_free() rejects it, mpnic_macda_sync() returns -ENOSPC
>    again, and uc_promisc is set.
>
> 4. The mc flush runs only after that. It calls mpnic_macda_unsync() on M:
>
> 	if (!--mac_addr->users)
> 		mac_addr->state = MPNIC_TCAM_S_DELETE;
>
>    mpnic_write_macda() then frees the slot.
>
> The reverse case works. A unicast removal can make room for a pending
> multicast address, because the uc flush runs before the mc add.
>
> Would it make sense to flush stale entries from both lists before either
> add phase runs?
>

I see this more as a low severity issue, because having the device be in
promiscuous mode when a slot is free is not incorrect, just not optimal.

If anything I would probably just rerun __hw_addr_sync_dev() on the uc
list again after the mc one, if the first call returned -ENOSPC. I
didn't think that was really worth it when this same comment came up in
local review though.

> [ ... ]
>
>> @@ -53,7 +78,7 @@ static int mpnic_set_rx_mode(struct net_device *netdev,
>>  	struct mpnic_net *mpn = netdev_priv(netdev);
>>  
>>  	if (netif_running(netdev))
>> -		__mpnic_set_rx_mode(mpn->mpd, mc);
>> +		__mpnic_set_rx_mode(mpn->mpd, uc, mc);
>>  
>>  	return 0;
>>  }
>
> Because mpnic_set_rx_mode() always returns 0, netif_rx_mode_run() never
> calls netif_rx_mode_schedule_retry() for the case above.
>
> mpnic_service_task() doesn't re-run the rx mode sync either. So U stays
> unsynced and the promisc entry (zero mask) stays installed until some
> unrelated rx-mode event happens. The commit message says:
>
>   Advertise IFF_UNICAST_FLT so we don't need to use promiscuous mode to
>   handle extra unicast addresses.
>
> The later patch in the series, "eth: mpnic: support changing the MAC
> address", keeps the same uc-then-mc ordering.


  reply	other threads:[~2026-11-18 10:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 21:11 [PATCH net-next 0/4] eth: mpnic: L2 address filtering Daniel Zahka
2026-11-16 21:11 ` [PATCH net-next 1/4] eth: mpnic: add filters for dev_addr and broadcast address Daniel Zahka
2026-11-16 21:11 ` [PATCH net-next 2/4] eth: mpnic: add promiscuous and all-multicast filters Daniel Zahka
2026-11-18  9:12   ` netdev-bot+sashiko
2026-11-18 10:04     ` Daniel Zahka
2026-11-16 21:11 ` [PATCH net-next 3/4] eth: mpnic: sync unicast and multicast address lists Daniel Zahka
2026-11-18  9:12   ` netdev-bot+sashiko
2026-11-18 10:21     ` Daniel Zahka [this message]
2026-11-16 21:11 ` [PATCH net-next 4/4] eth: mpnic: support changing the MAC address Daniel Zahka

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=DMY9FTQ22U8T.JKYB4HL8J8PH@gmail.com \
    --to=daniel.zahka@gmail.com \
    --cc=alexanderduyck@fb.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dimitri.daskalakis1@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mohsin.bashr@gmail.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®