From: netdev-bot+sashiko@kernel.org
To: 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 09:12:12 +0000 [thread overview]
Message-ID: <179499313262.3136.12811016164943625265@kernel.org> (raw)
In-Reply-To: <20261116-mpnic-l2-oot-v1-3-8dc6eb3582b0@gmail.com>
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?
[ ... ]
> @@ -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.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116-mpnic-l2-oot-v1-0-8dc6eb3582b0%40gmail.com
next prev parent reply other threads:[~2026-11-18 9:12 UTC|newest]
Thread overview: 7+ 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-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 [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=179499313262.3136.12811016164943625265@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alexanderduyck@fb.com \
--cc=andrew+netdev@lunn.ch \
--cc=daniel.zahka@gmail.com \
--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@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 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.