eth fbnic: Add debugfs hooks for firmware mailbox

This patch adds reporting the Rx and Tx information
interfacing with the firmware.

The result of reading fbnic/fw_mbx is:

 Rx
 Rdy: 1 Head: 11 Tail: 10
 Idx Len  E  Addr        F H   Raw
 ----------------------------------
 00  4096 0 000101fea000 0 1   1000000101fea001
 01  4096 0 000101feb000 0 1   1000000101feb001
 	.
 	.
 	.
 15  4096 0 000101fe9000 0 1   1000000101fe9001

 Tx
 Rdy: 1 Head: 4 Tail: 4
 Idx Len  E  Addr        F H   Raw
 ----------------------------------
 00  0004 1 00010321b000 1 1   000440010321b003
 01  0004 1 00010228d000 1 1   000440010228d003
 	.
 	.
 	.
 15  0004 1 00010321b000 1 1   000440010321b003

Signed-off-by: Mike Marciniszyn (Meta) <mike.marciniszyn@gmail.com>
Link: https://patch.msgid.link/20260127200644.11640-2-mike.marciniszyn@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Mike Marciniszyn (Meta) 2026-01-27 15:06:43 -05:00 committed by Jakub Kicinski
parent 44ecaff552
commit ac7b803c2d
3 changed files with 50 additions and 1 deletions

View File

@ -170,6 +170,52 @@ static int fbnic_dbg_ipo_dst_show(struct seq_file *s, void *v)
}
DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_ipo_dst);
static void fbnic_dbg_fw_mbx_display(struct seq_file *s,
struct fbnic_dev *fbd, int mbx_idx)
{
struct fbnic_fw_mbx *mbx = &fbd->mbx[mbx_idx];
char hdr[80];
int i;
/* Generate header */
seq_puts(s, mbx_idx == FBNIC_IPC_MBX_RX_IDX ? "Rx\n" : "Tx\n");
seq_printf(s, "Rdy: %d Head: %d Tail: %d\n",
mbx->ready, mbx->head, mbx->tail);
snprintf(hdr, sizeof(hdr), "%3s %-4s %s %-12s %s %-3s %-16s\n",
"Idx", "Len", "E", "Addr", "F", "H", "Raw");
seq_puts(s, hdr);
fbnic_dbg_desc_break(s, strnlen(hdr, sizeof(hdr)));
for (i = 0; i < FBNIC_IPC_MBX_DESC_LEN; i++) {
u64 desc = __fbnic_mbx_rd_desc(fbd, mbx_idx, i);
seq_printf(s, "%-3.2d %04lld %d %012llx %d %-3d %016llx\n",
i, FIELD_GET(FBNIC_IPC_MBX_DESC_LEN_MASK, desc),
!!(desc & FBNIC_IPC_MBX_DESC_EOM),
desc & FBNIC_IPC_MBX_DESC_ADDR_MASK,
!!(desc & FBNIC_IPC_MBX_DESC_FW_CMPL),
!!(desc & FBNIC_IPC_MBX_DESC_HOST_CMPL),
desc);
}
}
static int fbnic_dbg_fw_mbx_show(struct seq_file *s, void *v)
{
struct fbnic_dev *fbd = s->private;
fbnic_dbg_fw_mbx_display(s, fbd, FBNIC_IPC_MBX_RX_IDX);
/* Add blank line between Rx and Tx */
seq_puts(s, "\n");
fbnic_dbg_fw_mbx_display(s, fbd, FBNIC_IPC_MBX_TX_IDX);
return 0;
}
DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_fw_mbx);
static int fbnic_dbg_fw_log_show(struct seq_file *s, void *v)
{
struct fbnic_dev *fbd = s->private;
@ -249,6 +295,8 @@ void fbnic_dbg_fbd_init(struct fbnic_dev *fbd)
&fbnic_dbg_ipo_src_fops);
debugfs_create_file("ipo_dst", 0400, fbd->dbg_fbd, fbd,
&fbnic_dbg_ipo_dst_fops);
debugfs_create_file("fw_mbx", 0400, fbd->dbg_fbd, fbd,
&fbnic_dbg_fw_mbx_fops);
debugfs_create_file("fw_log", 0400, fbd->dbg_fbd, fbd,
&fbnic_dbg_fw_log_fops);
}

View File

@ -40,7 +40,7 @@ static void __fbnic_mbx_invalidate_desc(struct fbnic_dev *fbd, int mbx_idx,
fw_wr32(fbd, desc_offset + 1, 0);
}
static u64 __fbnic_mbx_rd_desc(struct fbnic_dev *fbd, int mbx_idx, int desc_idx)
u64 __fbnic_mbx_rd_desc(struct fbnic_dev *fbd, int mbx_idx, int desc_idx)
{
u32 desc_offset = FBNIC_IPC_MBX(mbx_idx, desc_idx);
u64 desc;

View File

@ -94,6 +94,7 @@ struct fbnic_fw_completion {
} u;
};
u64 __fbnic_mbx_rd_desc(struct fbnic_dev *fbd, int mbx_idx, int desc_idx);
void fbnic_mbx_init(struct fbnic_dev *fbd);
void fbnic_mbx_clean(struct fbnic_dev *fbd);
int fbnic_mbx_set_cmpl(struct fbnic_dev *fbd,