bnge: skip dev_addr when building the VNIC unicast list
Vikas Gupta
maintainerPATCH 1/1 bnge: skip dev_addr when building the VNIC unicast list
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.
--- .../net/ethernet/broadcom/bnge/bnge_netdev.c | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-)
drivers/net/ethernet/broadcom/bnge/bnge_netdev.c +20 -8
@@ -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++;
Signature · 1 line
2.52.0
[email protected]
AI reviewThis is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
Hi!
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.
Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.
The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Vikas Gupta
maintainerHi,
This issue was found during code inspection.
Thanks,
Vikas
Quoted 18 lines · On Tue, Oct 6, 2026 at 7:55 PM <[email protected]> wrote:
Hi!
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.
Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.
The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Paolo Abeni
maintainerQuoted 14 lines · Vikas Gupta
The default VNIC programs the device's MAC as L2 filter 0 in
bnge_init_chip()viabnge_hwrm_set_vnic_filter(bn, 0, 0, dev_addr).bnge_cfg_rx_mode()then walksdev->ucand programs each unicast address as a further L2 filter, without excludingdev_addr.Skip
dev_addrwhen buildinguc_list, since it is already installed as filter 0. Asdev_addrnow takes neither auc_listslot nor an l2_filters[] slot, count only the non-dev_addr entries for theuc_listoverflow 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.
Quoted 7 lines
This issue was caught by Sashiko (nipa).
Tested on Thor Ultra device.
Fixes 9afad4a17174 ("bng_en: Configure default VNIC")Signed-off-by Vikas Gupta <[email protected]>Reviewed-by Dharmender Garg <[email protected]>
FTR, redirecting this to net-next, due to Linus guidance for smaller RCs and the above giving AFAICS some perf improvement in corner-cases over the original code dating back to its introduction.
/P
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 14 lines · On Tue, 6 Oct 2026 19:49:28 +0530 you wrote:
The default VNIC programs the device's MAC as L2 filter 0 in
bnge_init_chip()viabnge_hwrm_set_vnic_filter(bn, 0, 0, dev_addr).bnge_cfg_rx_mode()then walksdev->ucand programs each unicast address as a further L2 filter, without excludingdev_addr.Skip
dev_addrwhen buildinguc_list, since it is already installed as filter 0. Asdev_addrnow takes neither auc_listslot nor an l2_filters[] slot, count only the non-dev_addr entries for theuc_listoverflow 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.
Quoted 1 line
[...]
Here is the summary with links:
- [net] bnge: skip dev_addr when building the VNIC unicast list
https://git.kernel.org/netdev/net-next/c/0b3fc7fe6f3f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html