|
10 | 10 |
|
11 | 11 | static struct dentry *fbnic_dbg_root;
|
12 | 12 |
|
| 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 | + |
13 | 47 | static int fbnic_dbg_pcie_stats_show(struct seq_file *s, void *v)
|
14 | 48 | {
|
15 | 49 | struct fbnic_dev *fbd = s->private;
|
@@ -48,6 +82,8 @@ void fbnic_dbg_fbd_init(struct fbnic_dev *fbd)
|
48 | 82 | fbd->dbg_fbd = debugfs_create_dir(name, fbnic_dbg_root);
|
49 | 83 | debugfs_create_file("pcie_stats", 0400, fbd->dbg_fbd, fbd,
|
50 | 84 | &fbnic_dbg_pcie_stats_fops);
|
| 85 | + debugfs_create_file("mac_addr", 0400, fbd->dbg_fbd, fbd, |
| 86 | + &fbnic_dbg_mac_addr_fops); |
51 | 87 | }
|
52 | 88 |
|
53 | 89 | void fbnic_dbg_fbd_exit(struct fbnic_dev *fbd)
|
|
0 commit comments