From: Vikas Gupta <vikas.gupta@broadcom.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
bhargava.marreddy@broadcom.com, rahul-rg.gupta@broadcom.com,
vsrama-krishna.nemani@broadcom.com,
rajashekar.hudumula@broadcom.com, dharmender.garg@broadcom.com,
ajit.khaparde@broadcom.com,
Vikas Gupta <vikas.gupta@broadcom.com>
Subject: [PATCH net] bnge: skip dev_addr when building the VNIC unicast list
Date: Tue, 6 Oct 2026 19:49:28 +0530 [thread overview]
Message-ID: <20261006141928.1432927-1-vikas.gupta@broadcom.com> (raw)
The default VNIC programs the device's MAC as L2 filter 0 in
bnge_init_chip() via bnge_hwrm_set_vnic_filter(bn, 0, 0, dev_addr).
bnge_cfg_rx_mode() then walks dev->uc and programs each unicast
address as a further L2 filter, without excluding dev_addr.
Skip dev_addr when building uc_list, since it is already installed as
filter 0. As dev_addr now takes neither a uc_list slot nor an
l2_filters[] slot, count only the non-dev_addr entries for the
uc_list overflow check too, otherwise an input such as
{dev_addr, A, B, C} would needlessly fall back to promiscuous mode
even though A, B and C fit in exact-match filters.
bnge_uc_list_updated() applies the same skip and count so the
change detection stays consistent and does not loop.
This issue was caught by Sashiko (nipa).
Tested on Thor Ultra device.
Fixes: 9afad4a17174 ("bng_en: Configure default VNIC")
Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Reviewed-by: Dharmender Garg <dharmender.garg@broadcom.com>
---
.../net/ethernet/broadcom/bnge/bnge_netdev.c | 28 +++++++++++++------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
index a4288f0258f8..92aea6f6f09f 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
@@ -2182,19 +2182,21 @@ static bool bnge_uc_list_updated(struct bnge_net *bn,
const struct netdev_hw_addr_list *uc)
{
struct bnge_vnic_info *vnic = &bn->vnic_info[BNGE_VNIC_DEFAULT];
+ struct net_device *dev = bn->netdev;
struct netdev_hw_addr *ha;
- int off = 0;
-
- if (netdev_hw_addr_list_count(uc) != (vnic->uc_filter_count - 1))
- return true;
+ int off = 0, count = 0;
netdev_hw_addr_list_for_each(ha, uc) {
+ if (ether_addr_equal(ha->addr, dev->dev_addr))
+ continue;
+ if (count >= vnic->uc_filter_count - 1)
+ return true;
if (!ether_addr_equal(ha->addr, vnic->uc_list + off))
return true;
-
off += ETH_ALEN;
+ count++;
}
- return false;
+ return count != vnic->uc_filter_count - 1;
}
static bool bnge_promisc_ok(struct bnge_net *bn)
@@ -2207,9 +2209,9 @@ static int bnge_cfg_rx_mode(struct bnge_net *bn, struct netdev_hw_addr_list *uc,
{
struct bnge_vnic_info *vnic = &bn->vnic_info[BNGE_VNIC_DEFAULT];
struct net_device *dev = bn->netdev;
+ int i, off = 0, rc, uc_count = 0;
struct bnge_dev *bd = bn->bd;
struct netdev_hw_addr *ha;
- int i, off = 0, rc;
if (!uc_update)
goto skip_uc;
@@ -2225,10 +2227,20 @@ static int bnge_cfg_rx_mode(struct bnge_net *bn, struct netdev_hw_addr_list *uc,
if (!snapshot)
netif_addr_lock_bh(dev);
- if (netdev_hw_addr_list_count(uc) > (BNGE_MAX_UC_ADDRS - 1)) {
+ /* dev_addr is already programmed as L2 filter 0, so it takes neither a
+ * uc_list slot nor an l2_filters[] slot. Count only the entries that
+ * will actually be programmed so the overflow check matches the fill
+ * loop below (and bnge_uc_list_updated()).
+ */
+ netdev_hw_addr_list_for_each(ha, uc)
+ if (!ether_addr_equal(ha->addr, dev->dev_addr))
+ uc_count++;
+ if (uc_count > BNGE_MAX_UC_ADDRS - 1) {
vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS;
} else {
netdev_hw_addr_list_for_each(ha, uc) {
+ if (ether_addr_equal(ha->addr, dev->dev_addr))
+ continue;
memcpy(vnic->uc_list + off, ha->addr, ETH_ALEN);
off += ETH_ALEN;
vnic->uc_filter_count++;
--
2.52.0
next reply other threads:[~2026-10-06 14:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 14:19 Vikas Gupta [this message]
2026-10-06 14:25 ` netdev-bot+sinfo
2026-10-06 14:28 ` Vikas Gupta
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=20261006141928.1432927-1-vikas.gupta@broadcom.com \
--to=vikas.gupta@broadcom.com \
--cc=ajit.khaparde@broadcom.com \
--cc=andrew+netdev@lunn.ch \
--cc=bhargava.marreddy@broadcom.com \
--cc=davem@davemloft.net \
--cc=dharmender.garg@broadcom.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rahul-rg.gupta@broadcom.com \
--cc=rajashekar.hudumula@broadcom.com \
--cc=vsrama-krishna.nemani@broadcom.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®