Skip to content

Commit 79c0c46

Browse files
ahduyckPaolo Abeni
authored andcommitted
eth: fbnic: add MAC address TCAM to debugfs
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 <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent fa79617 commit 79c0c46

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,40 @@
1010

1111
static struct dentry *fbnic_dbg_root;
1212

13+
static void fbnic_dbg_desc_break(struct seq_file *s, int i)
14+
{
15+
while (i--)
16+
seq_putc(s, '-');
17+
18+
seq_putc(s, '\n');
19+
}
20+
21+
static int fbnic_dbg_mac_addr_show(struct seq_file *s, void *v)
22+
{
23+
struct fbnic_dev *fbd = s->private;
24+
char hdr[80];
25+
int i;
26+
27+
/* Generate Header */
28+
snprintf(hdr, sizeof(hdr), "%3s %s %-17s %s\n",
29+
"Idx", "S", "TCAM Bitmap", "Addr/Mask");
30+
seq_puts(s, hdr);
31+
fbnic_dbg_desc_break(s, strnlen(hdr, sizeof(hdr)));
32+
33+
for (i = 0; i < FBNIC_RPC_TCAM_MACDA_NUM_ENTRIES; i++) {
34+
struct fbnic_mac_addr *mac_addr = &fbd->mac_addr[i];
35+
36+
seq_printf(s, "%02d %d %64pb %pm\n",
37+
i, mac_addr->state, mac_addr->act_tcam,
38+
mac_addr->value.addr8);
39+
seq_printf(s, " %pm\n",
40+
mac_addr->mask.addr8);
41+
}
42+
43+
return 0;
44+
}
45+
DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_mac_addr);
46+
1347
static int fbnic_dbg_pcie_stats_show(struct seq_file *s, void *v)
1448
{
1549
struct fbnic_dev *fbd = s->private;
@@ -48,6 +82,8 @@ void fbnic_dbg_fbd_init(struct fbnic_dev *fbd)
4882
fbd->dbg_fbd = debugfs_create_dir(name, fbnic_dbg_root);
4983
debugfs_create_file("pcie_stats", 0400, fbd->dbg_fbd, fbd,
5084
&fbnic_dbg_pcie_stats_fops);
85+
debugfs_create_file("mac_addr", 0400, fbd->dbg_fbd, fbd,
86+
&fbnic_dbg_mac_addr_fops);
5187
}
5288

5389
void fbnic_dbg_fbd_exit(struct fbnic_dev *fbd)

0 commit comments

Comments
 (0)