netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] eth: fbnic: add MAC address TCAM to debugfs
@ 2025-02-04  1:00 Jakub Kicinski
  2025-02-04  1:00 ` [PATCH net-next 2/2] eth: fbnic: set IFF_UNICAST_FLT to avoid enabling promiscuous mode when adding unicast addrs Jakub Kicinski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jakub Kicinski @ 2025-02-04  1:00 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Alexander Duyck,
	Jakub Kicinski

From: Alexander Duyck <alexanderduyck@meta.com>

Add read only access to the 32-entry MAC address TCAM via debugfs.
BMC filtering shares the same table so this is quite useful
to access during debug. See next commit for an example output.

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

diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c b/drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c
index 59951b5abdb7..ac80981f67c0 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c
@@ -10,6 +10,40 @@
 
 static struct dentry *fbnic_dbg_root;
 
+static void fbnic_dbg_desc_break(struct seq_file *s, int i)
+{
+	while (i--)
+		seq_putc(s, '-');
+
+	seq_putc(s, '\n');
+}
+
+static int fbnic_dbg_mac_addr_show(struct seq_file *s, void *v)
+{
+	struct fbnic_dev *fbd = s->private;
+	char hdr[80];
+	int i;
+
+	/* Generate Header */
+	snprintf(hdr, sizeof(hdr), "%3s %s %-17s %s\n",
+		 "Idx", "S", "TCAM Bitmap", "Addr/Mask");
+	seq_puts(s, hdr);
+	fbnic_dbg_desc_break(s, strnlen(hdr, sizeof(hdr)));
+
+	for (i = 0; i < FBNIC_RPC_TCAM_MACDA_NUM_ENTRIES; i++) {
+		struct fbnic_mac_addr *mac_addr = &fbd->mac_addr[i];
+
+		seq_printf(s, "%02d  %d %64pb %pm\n",
+			   i, mac_addr->state, mac_addr->act_tcam,
+			   mac_addr->value.addr8);
+		seq_printf(s, "                        %pm\n",
+			   mac_addr->mask.addr8);
+	}
+
+	return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_mac_addr);
+
 static int fbnic_dbg_pcie_stats_show(struct seq_file *s, void *v)
 {
 	struct fbnic_dev *fbd = s->private;
@@ -48,6 +82,8 @@ void fbnic_dbg_fbd_init(struct fbnic_dev *fbd)
 	fbd->dbg_fbd = debugfs_create_dir(name, fbnic_dbg_root);
 	debugfs_create_file("pcie_stats", 0400, fbd->dbg_fbd, fbd,
 			    &fbnic_dbg_pcie_stats_fops);
+	debugfs_create_file("mac_addr", 0400, fbd->dbg_fbd, fbd,
+			    &fbnic_dbg_mac_addr_fops);
 }
 
 void fbnic_dbg_fbd_exit(struct fbnic_dev *fbd)
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/2] eth: fbnic: set IFF_UNICAST_FLT to avoid enabling promiscuous mode when adding unicast addrs
  2025-02-04  1:00 [PATCH net-next 1/2] eth: fbnic: add MAC address TCAM to debugfs Jakub Kicinski
@ 2025-02-04  1:00 ` Jakub Kicinski
  2025-02-04 12:48   ` Simon Horman
  2025-02-04 12:48 ` [PATCH net-next 1/2] eth: fbnic: add MAC address TCAM to debugfs Simon Horman
  2025-02-06 11:00 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2025-02-04  1:00 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Alexander Duyck,
	Jakub Kicinski

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(+)

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 |
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 1/2] eth: fbnic: add MAC address TCAM to debugfs
  2025-02-04  1:00 [PATCH net-next 1/2] eth: fbnic: add MAC address TCAM to debugfs Jakub Kicinski
  2025-02-04  1:00 ` [PATCH net-next 2/2] eth: fbnic: set IFF_UNICAST_FLT to avoid enabling promiscuous mode when adding unicast addrs Jakub Kicinski
@ 2025-02-04 12:48 ` Simon Horman
  2025-02-06 11:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2025-02-04 12:48 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, Alexander Duyck

On Mon, Feb 03, 2025 at 05:00:37PM -0800, Jakub Kicinski wrote:
> From: Alexander Duyck <alexanderduyck@meta.com>
> 
> Add read only access to the 32-entry MAC address TCAM via debugfs.
> BMC filtering shares the same table so this is quite useful
> to access during debug. See next commit for an example output.
> 
> Signed-off-by: Alexander Duyck <alexanderduyck@meta.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 2/2] eth: fbnic: set IFF_UNICAST_FLT to avoid enabling promiscuous mode when adding unicast addrs
  2025-02-04  1:00 ` [PATCH net-next 2/2] eth: fbnic: set IFF_UNICAST_FLT to avoid enabling promiscuous mode when adding unicast addrs Jakub Kicinski
@ 2025-02-04 12:48   ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2025-02-04 12:48 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, Alexander Duyck

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>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 1/2] eth: fbnic: add MAC address TCAM to debugfs
  2025-02-04  1:00 [PATCH net-next 1/2] eth: fbnic: add MAC address TCAM to debugfs Jakub Kicinski
  2025-02-04  1:00 ` [PATCH net-next 2/2] eth: fbnic: set IFF_UNICAST_FLT to avoid enabling promiscuous mode when adding unicast addrs Jakub Kicinski
  2025-02-04 12:48 ` [PATCH net-next 1/2] eth: fbnic: add MAC address TCAM to debugfs Simon Horman
@ 2025-02-06 11:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-06 11:00 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	alexanderduyck

Hello:

This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Mon,  3 Feb 2025 17:00:37 -0800 you wrote:
> From: Alexander Duyck <alexanderduyck@meta.com>
> 
> Add read only access to the 32-entry MAC address TCAM via debugfs.
> BMC filtering shares the same table so this is quite useful
> to access during debug. See next commit for an example output.
> 
> Signed-off-by: Alexander Duyck <alexanderduyck@meta.com>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] eth: fbnic: add MAC address TCAM to debugfs
    https://git.kernel.org/netdev/net-next/c/79c0c4689bdf
  - [net-next,2/2] eth: fbnic: set IFF_UNICAST_FLT to avoid enabling promiscuous mode when adding unicast addrs
    https://git.kernel.org/netdev/net-next/c/09717c28b76c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-06 11:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-04  1:00 [PATCH net-next 1/2] eth: fbnic: add MAC address TCAM to debugfs Jakub Kicinski
2025-02-04  1:00 ` [PATCH net-next 2/2] eth: fbnic: set IFF_UNICAST_FLT to avoid enabling promiscuous mode when adding unicast addrs Jakub Kicinski
2025-02-04 12:48   ` Simon Horman
2025-02-04 12:48 ` [PATCH net-next 1/2] eth: fbnic: add MAC address TCAM to debugfs Simon Horman
2025-02-06 11:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).