diff mbox series

[net-next,2/2] eth: fbnic: set IFF_UNICAST_FLT to avoid enabling promiscuous mode when adding unicast addrs

Message ID 20250204010038.1404268-2-kuba@kernel.org (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series [net-next,1/2] eth: fbnic: add MAC address TCAM to debugfs | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 2 maintainers not CCed: kernel-team@meta.com alexanderduyck@fb.com
netdev/build_clang success Errors and warnings before: 2 this patch: 2
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: 'promiscous' may be misspelled - perhaps 'promiscuous'?
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-02-04--15-00 (tests: 886)

Commit Message

Jakub Kicinski Feb. 4, 2025, 1 a.m. UTC
From: Alexander Duyck <alexanderduyck@meta.com>

I realized when we were adding unicast addresses we were enabling
promiscous mode. I did a bit of digging and realized we had overlooked
setting the driver private flag to indicate we supported unicast filtering.

Example below shows the table with 00deadbeef01 as the main NIC address,
and 5 additional addresses in the 00deadbeefX0 format.

  # cat $dbgfs/mac_addr
  Idx S TCAM Bitmap       Addr/Mask
  ----------------------------------
  00  0 00000000,00000000 000000000000
                          000000000000
  01  0 00000000,00000000 000000000000
                          000000000000
  02  0 00000000,00000000 000000000000
                          000000000000
  ...
  24  0 00000000,00000000 000000000000
                          000000000000
  25  1 00100000,00000000 00deadbeef50
                          000000000000
  26  1 00100000,00000000 00deadbeef40
                          000000000000
  27  1 00100000,00000000 00deadbeef30
                          000000000000
  28  1 00100000,00000000 00deadbeef20
                          000000000000
  29  1 00100000,00000000 00deadbeef10
                          000000000000
  30  1 00100000,00000000 00deadbeef01
                          000000000000
  31  0 00000000,00000000 000000000000
                          000000000000

Before rule 31 would be active. With this change it correctly sticks
to just the unicast filters.

Signed-off-by: Alexander Duyck <alexanderduyck@meta.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/meta/fbnic/fbnic_netdev.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Simon Horman Feb. 4, 2025, 12:48 p.m. UTC | #1
On Mon, Feb 03, 2025 at 05:00:38PM -0800, Jakub Kicinski wrote:
> From: Alexander Duyck <alexanderduyck@meta.com>
> 
> I realized when we were adding unicast addresses we were enabling
> promiscous mode. I did a bit of digging and realized we had overlooked
> setting the driver private flag to indicate we supported unicast filtering.
> 
> Example below shows the table with 00deadbeef01 as the main NIC address,
> and 5 additional addresses in the 00deadbeefX0 format.
> 
>   # cat $dbgfs/mac_addr
>   Idx S TCAM Bitmap       Addr/Mask
>   ----------------------------------
>   00  0 00000000,00000000 000000000000
>                           000000000000
>   01  0 00000000,00000000 000000000000
>                           000000000000
>   02  0 00000000,00000000 000000000000
>                           000000000000
>   ...
>   24  0 00000000,00000000 000000000000
>                           000000000000
>   25  1 00100000,00000000 00deadbeef50
>                           000000000000
>   26  1 00100000,00000000 00deadbeef40
>                           000000000000
>   27  1 00100000,00000000 00deadbeef30
>                           000000000000
>   28  1 00100000,00000000 00deadbeef20
>                           000000000000
>   29  1 00100000,00000000 00deadbeef10
>                           000000000000
>   30  1 00100000,00000000 00deadbeef01
>                           000000000000
>   31  0 00000000,00000000 000000000000
>                           000000000000
> 
> Before rule 31 would be active. With this change it correctly sticks
> to just the unicast filters.
> 
> Signed-off-by: Alexander Duyck <alexanderduyck@meta.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Simon Horman <horms@kernel.org>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
index 7a96b6ee773f..1db57c42333e 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
@@ -628,6 +628,8 @@  struct net_device *fbnic_netdev_alloc(struct fbnic_dev *fbd)
 	fbnic_rss_key_fill(fbn->rss_key);
 	fbnic_rss_init_en_mask(fbn);
 
+	netdev->priv_flags |= IFF_UNICAST_FLT;
+
 	netdev->features |=
 		NETIF_F_RXHASH |
 		NETIF_F_SG |