Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'eth-fbnic-add-debugfs-for-mbx-and-tx-rx'

Mike Marciniszyn says:

====================
eth fbnic: Add debugfs for mbx and tx/rx

This patches adds debugfs read of the firmware mailbox tx/rx
and of the tx/rx rings for each napi vector.
====================

Link: https://patch.msgid.link/20260127200644.11640-1-mike.marciniszyn@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+450 -2
+12
drivers/net/ethernet/meta/fbnic/fbnic_csr.h
··· 1019 1019 #define FBNIC_QUEUE_TWQ_CTL_ENABLE CSR_BIT(1) 1020 1020 #define FBNIC_QUEUE_TWQ0_TAIL 0x002 /* 0x008 */ 1021 1021 #define FBNIC_QUEUE_TWQ1_TAIL 0x003 /* 0x00c */ 1022 + #define FBNIC_QUEUE_TWQ0_PTRS 0x004 /* 0x010 */ 1023 + #define FBNIC_QUEUE_TWQ1_PTRS 0x005 /* 0x014 */ 1024 + #define FBNIC_QUEUE_TWQ_PTRS_HEAD_MASK CSR_GENMASK(31, 16) 1022 1025 1023 1026 #define FBNIC_QUEUE_TWQ0_SIZE 0x00a /* 0x028 */ 1024 1027 #define FBNIC_QUEUE_TWQ1_SIZE 0x00b /* 0x02c */ ··· 1045 1042 #define FBNIC_QUEUE_TCQ_CTL_ENABLE CSR_BIT(1) 1046 1043 1047 1044 #define FBNIC_QUEUE_TCQ_HEAD 0x081 /* 0x204 */ 1045 + #define FBNIC_QUEUE_TCQ_PTRS 0x082 /* 0x208 */ 1046 + #define FBNIC_QUEUE_TCQ_PTRS_TAIL_MASK CSR_GENMASK(31, 16) 1048 1047 1049 1048 #define FBNIC_QUEUE_TCQ_SIZE 0x084 /* 0x210 */ 1050 1049 #define FBNIC_QUEUE_TCQ_SIZE_MASK CSR_GENMASK(3, 0) ··· 1080 1075 #define FBNIC_QUEUE_RCQ_CTL_ENABLE CSR_BIT(1) 1081 1076 1082 1077 #define FBNIC_QUEUE_RCQ_HEAD 0x201 /* 0x804 */ 1078 + #define FBNIC_QUEUE_RCQ_PTRS 0x202 /* 0x808 */ 1079 + #define FBNIC_QUEUE_RCQ_PTRS_TAIL_MASK CSR_GENMASK(31, 16) 1080 + #define FBNIC_QUEUE_RCQ_PTRS_HEAD_MASK CSR_GENMASK(15, 0) 1083 1081 1084 1082 #define FBNIC_QUEUE_RCQ_SIZE 0x204 /* 0x810 */ 1085 1083 #define FBNIC_QUEUE_RCQ_SIZE_MASK CSR_GENMASK(3, 0) ··· 1098 1090 1099 1091 #define FBNIC_QUEUE_BDQ_HPQ_TAIL 0x241 /* 0x904 */ 1100 1092 #define FBNIC_QUEUE_BDQ_PPQ_TAIL 0x242 /* 0x908 */ 1093 + #define FBNIC_QUEUE_BDQ_HPQ_PTRS 0x243 /* 0x90c */ 1094 + #define FBNIC_QUEUE_BDQ_PPQ_PTRS 0x244 /* 0x910 */ 1095 + #define FBNIC_QUEUE_BDQ_PTRS_HEAD_MASK CSR_GENMASK(31, 16) 1096 + #define FBNIC_QUEUE_BDQ_PTRS_TAIL_MASK CSR_GENMASK(15, 0) 1101 1097 1102 1098 #define FBNIC_QUEUE_BDQ_HPQ_SIZE 0x247 /* 0x91c */ 1103 1099 #define FBNIC_QUEUE_BDQ_PPQ_SIZE 0x248 /* 0x920 */
+407
drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c
··· 7 7 #include <linux/seq_file.h> 8 8 9 9 #include "fbnic.h" 10 + #include "fbnic_txrx.h" 10 11 11 12 static struct dentry *fbnic_dbg_root; 13 + 14 + /* Descriptor Seq Functions */ 12 15 13 16 static void fbnic_dbg_desc_break(struct seq_file *s, int i) 14 17 { ··· 19 16 seq_putc(s, '-'); 20 17 21 18 seq_putc(s, '\n'); 19 + } 20 + 21 + static void fbnic_dbg_ring_show(struct seq_file *s) 22 + { 23 + struct fbnic_ring *ring = s->private; 24 + unsigned long doorbell_offset; 25 + u32 head = 0, tail = 0; 26 + u32 __iomem *csr_base; 27 + 28 + csr_base = fbnic_ring_csr_base(ring); 29 + doorbell_offset = ring->doorbell - csr_base; 30 + 31 + seq_printf(s, "doorbell CSR: %#05lx q_idx: %d\n", 32 + doorbell_offset, ring->q_idx); 33 + seq_printf(s, "size_mask: %#06x size: %zu flags: 0x%02x\n", 34 + ring->size_mask, ring->size, ring->flags); 35 + seq_printf(s, "SW: head: %#06x tail: %#06x\n", 36 + ring->head, ring->tail); 37 + 38 + switch (doorbell_offset) { 39 + case FBNIC_QUEUE_TWQ0_TAIL: 40 + tail = readl(csr_base + FBNIC_QUEUE_TWQ0_PTRS); 41 + head = FIELD_GET(FBNIC_QUEUE_TWQ_PTRS_HEAD_MASK, tail); 42 + break; 43 + case FBNIC_QUEUE_TWQ1_TAIL: 44 + tail = readl(csr_base + FBNIC_QUEUE_TWQ1_PTRS); 45 + head = FIELD_GET(FBNIC_QUEUE_TWQ_PTRS_HEAD_MASK, tail); 46 + break; 47 + case FBNIC_QUEUE_TCQ_HEAD: 48 + head = readl(csr_base + FBNIC_QUEUE_TCQ_PTRS); 49 + tail = FIELD_GET(FBNIC_QUEUE_TCQ_PTRS_TAIL_MASK, head); 50 + break; 51 + case FBNIC_QUEUE_BDQ_HPQ_TAIL: 52 + tail = readl(csr_base + FBNIC_QUEUE_BDQ_HPQ_PTRS); 53 + head = FIELD_GET(FBNIC_QUEUE_BDQ_PTRS_HEAD_MASK, tail); 54 + break; 55 + case FBNIC_QUEUE_BDQ_PPQ_TAIL: 56 + tail = readl(csr_base + FBNIC_QUEUE_BDQ_PPQ_PTRS); 57 + head = FIELD_GET(FBNIC_QUEUE_BDQ_PTRS_HEAD_MASK, tail); 58 + break; 59 + case FBNIC_QUEUE_RCQ_HEAD: 60 + head = readl(csr_base + FBNIC_QUEUE_RCQ_PTRS); 61 + tail = FIELD_GET(FBNIC_QUEUE_RCQ_PTRS_TAIL_MASK, head); 62 + break; 63 + } 64 + 65 + tail &= FBNIC_QUEUE_BDQ_PTRS_TAIL_MASK; 66 + head &= FBNIC_QUEUE_RCQ_PTRS_HEAD_MASK; 67 + 68 + seq_printf(s, "HW: head: %#06x tail: %#06x\n", head, tail); 69 + 70 + seq_puts(s, "\n"); 71 + } 72 + 73 + static void fbnic_dbg_twd_desc_seq_show(struct seq_file *s, int i) 74 + { 75 + struct fbnic_ring *ring = s->private; 76 + u64 twd = le64_to_cpu(ring->desc[i]); 77 + 78 + switch (FIELD_GET(FBNIC_TWD_TYPE_MASK, twd)) { 79 + case FBNIC_TWD_TYPE_META: 80 + seq_printf(s, "%04x %#06llx %llx %llx %llx %llx %llx %#llx %#llx %llx %#04llx %#04llx %llx %#04llx\n", 81 + i, FIELD_GET(FBNIC_TWD_LEN_MASK, twd), 82 + FIELD_GET(FBNIC_TWD_TYPE_MASK, twd), 83 + FIELD_GET(FBNIC_TWD_FLAG_REQ_COMPLETION, twd), 84 + FIELD_GET(FBNIC_TWD_FLAG_REQ_CSO, twd), 85 + FIELD_GET(FBNIC_TWD_FLAG_REQ_LSO, twd), 86 + FIELD_GET(FBNIC_TWD_FLAG_REQ_TS, twd), 87 + FIELD_GET(FBNIC_TWD_L4_HLEN_MASK, twd), 88 + FIELD_GET(FBNIC_TWD_CSUM_OFFSET_MASK, twd), 89 + FIELD_GET(FBNIC_TWD_L4_TYPE_MASK, twd), 90 + FIELD_GET(FBNIC_TWD_L3_IHLEN_MASK, twd), 91 + FIELD_GET(FBNIC_TWD_L3_OHLEN_MASK, twd), 92 + FIELD_GET(FBNIC_TWD_L3_TYPE_MASK, twd), 93 + FIELD_GET(FBNIC_TWD_L2_HLEN_MASK, twd)); 94 + break; 95 + default: 96 + seq_printf(s, "%04x %#06llx %llx %#014llx\n", i, 97 + FIELD_GET(FBNIC_TWD_LEN_MASK, twd), 98 + FIELD_GET(FBNIC_TWD_TYPE_MASK, twd), 99 + FIELD_GET(FBNIC_TWD_ADDR_MASK, twd)); 100 + break; 101 + } 102 + } 103 + 104 + static int fbnic_dbg_twq_desc_seq_show(struct seq_file *s, void *v) 105 + { 106 + struct fbnic_ring *ring = s->private; 107 + char hdr[80]; 108 + int i; 109 + 110 + /* Generate header on first entry */ 111 + fbnic_dbg_ring_show(s); 112 + snprintf(hdr, sizeof(hdr), "%4s %5s %s %s\n", 113 + "DESC", "LEN/MSS", "T", "METADATA/TIMESTAMP/BUFFER_ADDR"); 114 + seq_puts(s, hdr); 115 + fbnic_dbg_desc_break(s, strnlen(hdr, sizeof(hdr))); 116 + 117 + /* Display descriptor */ 118 + if (!ring->desc) { 119 + seq_puts(s, "Descriptor ring not allocated.\n"); 120 + return 0; 121 + } 122 + 123 + for (i = 0; i <= ring->size_mask; i++) 124 + fbnic_dbg_twd_desc_seq_show(s, i); 125 + 126 + return 0; 127 + } 128 + 129 + static int fbnic_dbg_tcq_desc_seq_show(struct seq_file *s, void *v) 130 + { 131 + struct fbnic_ring *ring = s->private; 132 + char hdr[80]; 133 + int i; 134 + 135 + /* Generate header on first entry */ 136 + fbnic_dbg_ring_show(s); 137 + snprintf(hdr, sizeof(hdr), "%4s %s %s %s %5s %-16s %-6s %-6s\n", 138 + "DESC", "D", "T", "Q", "STATUS", "TIMESTAMP", "HEAD1", "HEAD0"); 139 + seq_puts(s, hdr); 140 + fbnic_dbg_desc_break(s, strnlen(hdr, sizeof(hdr))); 141 + 142 + /* Display descriptor */ 143 + if (!ring->desc) { 144 + seq_puts(s, "Descriptor ring not allocated.\n"); 145 + return 0; 146 + } 147 + 148 + for (i = 0; i <= ring->size_mask; i++) { 149 + u64 tcd = le64_to_cpu(ring->desc[i]); 150 + 151 + switch (FIELD_GET(FBNIC_TCD_TYPE_MASK, tcd)) { 152 + case FBNIC_TCD_TYPE_0: 153 + seq_printf(s, "%04x %llx %llx %llx %#05llx %-17s %#06llx %#06llx\n", 154 + i, FIELD_GET(FBNIC_TCD_DONE, tcd), 155 + FIELD_GET(FBNIC_TCD_TYPE_MASK, tcd), 156 + FIELD_GET(FBNIC_TCD_TWQ1, tcd), 157 + FIELD_GET(FBNIC_TCD_STATUS_MASK, tcd), 158 + "", 159 + FIELD_GET(FBNIC_TCD_TYPE0_HEAD1_MASK, tcd), 160 + FIELD_GET(FBNIC_TCD_TYPE0_HEAD0_MASK, tcd)); 161 + break; 162 + case FBNIC_TCD_TYPE_1: 163 + seq_printf(s, "%04x %llx %llx %llx %#05llx %#012llx\n", 164 + i, FIELD_GET(FBNIC_TCD_DONE, tcd), 165 + FIELD_GET(FBNIC_TCD_TYPE_MASK, tcd), 166 + FIELD_GET(FBNIC_TCD_TWQ1, tcd), 167 + FIELD_GET(FBNIC_TCD_STATUS_MASK, tcd), 168 + FIELD_GET(FBNIC_TCD_TYPE1_TS_MASK, tcd)); 169 + break; 170 + default: 171 + break; 172 + } 173 + } 174 + 175 + return 0; 176 + } 177 + 178 + static int fbnic_dbg_bdq_desc_seq_show(struct seq_file *s, void *v) 179 + { 180 + struct fbnic_ring *ring = s->private; 181 + char hdr[80]; 182 + int i; 183 + 184 + /* Generate header on first entry */ 185 + fbnic_dbg_ring_show(s); 186 + snprintf(hdr, sizeof(hdr), "%4s %-4s %s\n", 187 + "DESC", "ID", "BUFFER_ADDR"); 188 + seq_puts(s, hdr); 189 + fbnic_dbg_desc_break(s, strnlen(hdr, sizeof(hdr))); 190 + 191 + /* Display descriptor */ 192 + if (!ring->desc) { 193 + seq_puts(s, "Descriptor ring not allocated.\n"); 194 + return 0; 195 + } 196 + 197 + for (i = 0; i <= ring->size_mask; i++) { 198 + u64 bd = le64_to_cpu(ring->desc[i]); 199 + 200 + seq_printf(s, "%04x %#04llx %#014llx\n", i, 201 + FIELD_GET(FBNIC_BD_DESC_ID_MASK, bd), 202 + FIELD_GET(FBNIC_BD_DESC_ADDR_MASK, bd)); 203 + } 204 + 205 + return 0; 206 + } 207 + 208 + static void fbnic_dbg_rcd_desc_seq_show(struct seq_file *s, int i) 209 + { 210 + struct fbnic_ring *ring = s->private; 211 + u64 rcd = le64_to_cpu(ring->desc[i]); 212 + 213 + switch (FIELD_GET(FBNIC_RCD_TYPE_MASK, rcd)) { 214 + case FBNIC_RCD_TYPE_HDR_AL: 215 + case FBNIC_RCD_TYPE_PAY_AL: 216 + seq_printf(s, "%04x %llx %llx %llx %#06llx %#06llx %#06llx\n", 217 + i, FIELD_GET(FBNIC_RCD_DONE, rcd), 218 + FIELD_GET(FBNIC_RCD_TYPE_MASK, rcd), 219 + FIELD_GET(FBNIC_RCD_AL_PAGE_FIN, rcd), 220 + FIELD_GET(FBNIC_RCD_AL_BUFF_OFF_MASK, rcd), 221 + FIELD_GET(FBNIC_RCD_AL_BUFF_LEN_MASK, rcd), 222 + FIELD_GET(FBNIC_RCD_AL_BUFF_ID_MASK, rcd)); 223 + break; 224 + case FBNIC_RCD_TYPE_OPT_META: 225 + seq_printf(s, "%04x %llx %llx %llx %llx %llx %#06llx %#012llx\n", 226 + i, FIELD_GET(FBNIC_RCD_DONE, rcd), 227 + FIELD_GET(FBNIC_RCD_TYPE_MASK, rcd), 228 + FIELD_GET(FBNIC_RCD_OPT_META_TYPE_MASK, rcd), 229 + FIELD_GET(FBNIC_RCD_OPT_META_TS, rcd), 230 + FIELD_GET(FBNIC_RCD_OPT_META_ACTION, rcd), 231 + FIELD_GET(FBNIC_RCD_OPT_META_ACTION_MASK, rcd), 232 + FIELD_GET(FBNIC_RCD_OPT_META_TS_MASK, rcd)); 233 + break; 234 + case FBNIC_RCD_TYPE_META: 235 + seq_printf(s, "%04x %llx %llx %llx %llx %llx %llx %llx %llx %llx %#06llx %#010llx\n", 236 + i, FIELD_GET(FBNIC_RCD_DONE, rcd), 237 + FIELD_GET(FBNIC_RCD_TYPE_MASK, rcd), 238 + FIELD_GET(FBNIC_RCD_META_ECN, rcd), 239 + FIELD_GET(FBNIC_RCD_META_L4_CSUM_UNNECESSARY, rcd), 240 + FIELD_GET(FBNIC_RCD_META_ERR_MAC_EOP, rcd), 241 + FIELD_GET(FBNIC_RCD_META_ERR_TRUNCATED_FRAME, rcd), 242 + FIELD_GET(FBNIC_RCD_META_ERR_PARSER, rcd), 243 + FIELD_GET(FBNIC_RCD_META_L4_TYPE_MASK, rcd), 244 + FIELD_GET(FBNIC_RCD_META_L3_TYPE_MASK, rcd), 245 + FIELD_GET(FBNIC_RCD_META_L2_CSUM_MASK, rcd), 246 + FIELD_GET(FBNIC_RCD_META_RSS_HASH_MASK, rcd)); 247 + break; 248 + } 249 + } 250 + 251 + static int fbnic_dbg_rcq_desc_seq_show(struct seq_file *s, void *v) 252 + { 253 + struct fbnic_ring *ring = s->private; 254 + char hdr[80]; 255 + int i; 256 + 257 + /* Generate header on first entry */ 258 + fbnic_dbg_ring_show(s); 259 + snprintf(hdr, sizeof(hdr), 260 + "%18s %s %s\n", "OFFSET/", "L", "L"); 261 + seq_puts(s, hdr); 262 + snprintf(hdr, sizeof(hdr), 263 + "%4s %s %s %s %s %s %s %s %s %s %-8s %s\n", 264 + "DESC", "D", "T", "F", "C", "M", "T", "P", "4", "3", "LEN/CSUM", "ID/TS/RSS"); 265 + seq_puts(s, hdr); 266 + fbnic_dbg_desc_break(s, strnlen(hdr, sizeof(hdr))); 267 + 268 + /* Display descriptor */ 269 + if (!ring->desc) { 270 + seq_puts(s, "Descriptor ring not allocated.\n"); 271 + return 0; 272 + } 273 + 274 + for (i = 0; i <= ring->size_mask; i++) 275 + fbnic_dbg_rcd_desc_seq_show(s, i); 276 + 277 + return 0; 278 + } 279 + 280 + static int fbnic_dbg_desc_open(struct inode *inode, struct file *file) 281 + { 282 + struct fbnic_ring *ring = inode->i_private; 283 + int (*show)(struct seq_file *s, void *v); 284 + 285 + switch (ring->doorbell - fbnic_ring_csr_base(ring)) { 286 + case FBNIC_QUEUE_TWQ0_TAIL: 287 + case FBNIC_QUEUE_TWQ1_TAIL: 288 + show = fbnic_dbg_twq_desc_seq_show; 289 + break; 290 + case FBNIC_QUEUE_TCQ_HEAD: 291 + show = fbnic_dbg_tcq_desc_seq_show; 292 + break; 293 + case FBNIC_QUEUE_BDQ_HPQ_TAIL: 294 + case FBNIC_QUEUE_BDQ_PPQ_TAIL: 295 + show = fbnic_dbg_bdq_desc_seq_show; 296 + break; 297 + case FBNIC_QUEUE_RCQ_HEAD: 298 + show = fbnic_dbg_rcq_desc_seq_show; 299 + break; 300 + default: 301 + return -EINVAL; 302 + } 303 + 304 + return single_open(file, show, ring); 305 + } 306 + 307 + static const struct file_operations fbnic_dbg_desc_fops = { 308 + .owner = THIS_MODULE, 309 + .open = fbnic_dbg_desc_open, 310 + .read = seq_read, 311 + .llseek = seq_lseek, 312 + .release = single_release, 313 + }; 314 + 315 + void fbnic_dbg_nv_init(struct fbnic_napi_vector *nv) 316 + { 317 + struct fbnic_dev *fbd = nv->fbd; 318 + char name[16]; 319 + int i, j; 320 + 321 + /* Generate a folder for each napi vector */ 322 + snprintf(name, sizeof(name), "nv.%03d", nv->v_idx); 323 + 324 + nv->dbg_nv = debugfs_create_dir(name, fbd->dbg_fbd); 325 + 326 + /* Generate a file for each Tx ring in the napi vector */ 327 + for (i = 0; i < nv->txt_count; i++) { 328 + struct fbnic_q_triad *qt = &nv->qt[i]; 329 + unsigned int hw_idx; 330 + 331 + hw_idx = fbnic_ring_csr_base(&qt->cmpl) - 332 + &fbd->uc_addr0[FBNIC_QUEUE(0)]; 333 + hw_idx /= FBNIC_QUEUE_STRIDE; 334 + 335 + snprintf(name, sizeof(name), "twq0.%03d", hw_idx); 336 + debugfs_create_file(name, 0400, nv->dbg_nv, &qt->sub0, 337 + &fbnic_dbg_desc_fops); 338 + 339 + snprintf(name, sizeof(name), "twq1.%03d", hw_idx); 340 + debugfs_create_file(name, 0400, nv->dbg_nv, &qt->sub1, 341 + &fbnic_dbg_desc_fops); 342 + 343 + snprintf(name, sizeof(name), "tcq.%03d", hw_idx); 344 + debugfs_create_file(name, 0400, nv->dbg_nv, &qt->cmpl, 345 + &fbnic_dbg_desc_fops); 346 + } 347 + 348 + /* Generate a file for each Rx ring in the napi vector */ 349 + for (j = 0; j < nv->rxt_count; j++, i++) { 350 + struct fbnic_q_triad *qt = &nv->qt[i]; 351 + unsigned int hw_idx; 352 + 353 + hw_idx = fbnic_ring_csr_base(&qt->cmpl) - 354 + &fbd->uc_addr0[FBNIC_QUEUE(0)]; 355 + hw_idx /= FBNIC_QUEUE_STRIDE; 356 + 357 + snprintf(name, sizeof(name), "hpq.%03d", hw_idx); 358 + debugfs_create_file(name, 0400, nv->dbg_nv, &qt->sub0, 359 + &fbnic_dbg_desc_fops); 360 + 361 + snprintf(name, sizeof(name), "ppq.%03d", hw_idx); 362 + debugfs_create_file(name, 0400, nv->dbg_nv, &qt->sub1, 363 + &fbnic_dbg_desc_fops); 364 + 365 + snprintf(name, sizeof(name), "rcq.%03d", hw_idx); 366 + debugfs_create_file(name, 0400, nv->dbg_nv, &qt->cmpl, 367 + &fbnic_dbg_desc_fops); 368 + } 369 + } 370 + 371 + void fbnic_dbg_nv_exit(struct fbnic_napi_vector *nv) 372 + { 373 + debugfs_remove_recursive(nv->dbg_nv); 374 + nv->dbg_nv = NULL; 22 375 } 23 376 24 377 static int fbnic_dbg_mac_addr_show(struct seq_file *s, void *v) ··· 529 170 } 530 171 DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_ipo_dst); 531 172 173 + static void fbnic_dbg_fw_mbx_display(struct seq_file *s, 174 + struct fbnic_dev *fbd, int mbx_idx) 175 + { 176 + struct fbnic_fw_mbx *mbx = &fbd->mbx[mbx_idx]; 177 + char hdr[80]; 178 + int i; 179 + 180 + /* Generate header */ 181 + seq_puts(s, mbx_idx == FBNIC_IPC_MBX_RX_IDX ? "Rx\n" : "Tx\n"); 182 + 183 + seq_printf(s, "Rdy: %d Head: %d Tail: %d\n", 184 + mbx->ready, mbx->head, mbx->tail); 185 + 186 + snprintf(hdr, sizeof(hdr), "%3s %-4s %s %-12s %s %-3s %-16s\n", 187 + "Idx", "Len", "E", "Addr", "F", "H", "Raw"); 188 + seq_puts(s, hdr); 189 + fbnic_dbg_desc_break(s, strnlen(hdr, sizeof(hdr))); 190 + 191 + for (i = 0; i < FBNIC_IPC_MBX_DESC_LEN; i++) { 192 + u64 desc = __fbnic_mbx_rd_desc(fbd, mbx_idx, i); 193 + 194 + seq_printf(s, "%-3.2d %04lld %d %012llx %d %-3d %016llx\n", 195 + i, FIELD_GET(FBNIC_IPC_MBX_DESC_LEN_MASK, desc), 196 + !!(desc & FBNIC_IPC_MBX_DESC_EOM), 197 + desc & FBNIC_IPC_MBX_DESC_ADDR_MASK, 198 + !!(desc & FBNIC_IPC_MBX_DESC_FW_CMPL), 199 + !!(desc & FBNIC_IPC_MBX_DESC_HOST_CMPL), 200 + desc); 201 + } 202 + } 203 + 204 + static int fbnic_dbg_fw_mbx_show(struct seq_file *s, void *v) 205 + { 206 + struct fbnic_dev *fbd = s->private; 207 + 208 + fbnic_dbg_fw_mbx_display(s, fbd, FBNIC_IPC_MBX_RX_IDX); 209 + 210 + /* Add blank line between Rx and Tx */ 211 + seq_puts(s, "\n"); 212 + 213 + fbnic_dbg_fw_mbx_display(s, fbd, FBNIC_IPC_MBX_TX_IDX); 214 + 215 + return 0; 216 + } 217 + DEFINE_SHOW_ATTRIBUTE(fbnic_dbg_fw_mbx); 218 + 532 219 static int fbnic_dbg_fw_log_show(struct seq_file *s, void *v) 533 220 { 534 221 struct fbnic_dev *fbd = s->private; ··· 654 249 &fbnic_dbg_ipo_src_fops); 655 250 debugfs_create_file("ipo_dst", 0400, fbd->dbg_fbd, fbd, 656 251 &fbnic_dbg_ipo_dst_fops); 252 + debugfs_create_file("fw_mbx", 0400, fbd->dbg_fbd, fbd, 253 + &fbnic_dbg_fw_mbx_fops); 657 254 debugfs_create_file("fw_log", 0400, fbd->dbg_fbd, fbd, 658 255 &fbnic_dbg_fw_log_fops); 659 256 }
+1 -1
drivers/net/ethernet/meta/fbnic/fbnic_fw.c
··· 40 40 fw_wr32(fbd, desc_offset + 1, 0); 41 41 } 42 42 43 - static u64 __fbnic_mbx_rd_desc(struct fbnic_dev *fbd, int mbx_idx, int desc_idx) 43 + u64 __fbnic_mbx_rd_desc(struct fbnic_dev *fbd, int mbx_idx, int desc_idx) 44 44 { 45 45 u32 desc_offset = FBNIC_IPC_MBX(mbx_idx, desc_idx); 46 46 u64 desc;
+1
drivers/net/ethernet/meta/fbnic/fbnic_fw.h
··· 94 94 } u; 95 95 }; 96 96 97 + u64 __fbnic_mbx_rd_desc(struct fbnic_dev *fbd, int mbx_idx, int desc_idx); 97 98 void fbnic_mbx_init(struct fbnic_dev *fbd); 98 99 void fbnic_mbx_clean(struct fbnic_dev *fbd); 99 100 int fbnic_mbx_set_cmpl(struct fbnic_dev *fbd,
+4
drivers/net/ethernet/meta/fbnic/fbnic_pci.c
··· 142 142 netif_tx_start_all_queues(fbn->netdev); 143 143 144 144 fbnic_service_task_start(fbn); 145 + 146 + fbnic_dbg_up(fbn); 145 147 } 146 148 147 149 void fbnic_down_noidle(struct fbnic_net *fbn) 148 150 { 151 + fbnic_dbg_down(fbn); 152 + 149 153 fbnic_service_task_stop(fbn); 150 154 151 155 /* Disable Tx/Rx Processing */
+19 -1
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
··· 39 39 40 40 #define FBNIC_XMIT_NOUNMAP ((void *)1) 41 41 42 - static u32 __iomem *fbnic_ring_csr_base(const struct fbnic_ring *ring) 42 + u32 __iomem *fbnic_ring_csr_base(const struct fbnic_ring *ring) 43 43 { 44 44 unsigned long csr_base = (unsigned long)ring->doorbell; 45 45 ··· 2255 2255 fbnic_wrfl(fbn->fbd); 2256 2256 } 2257 2257 2258 + void fbnic_dbg_down(struct fbnic_net *fbn) 2259 + { 2260 + int i; 2261 + 2262 + for (i = 0; i < fbn->num_napi; i++) 2263 + fbnic_dbg_nv_exit(fbn->napi[i]); 2264 + } 2265 + 2266 + void fbnic_dbg_up(struct fbnic_net *fbn) 2267 + { 2268 + int i; 2269 + 2270 + for (i = 0; i < fbn->num_napi; i++) 2271 + fbnic_dbg_nv_init(fbn->napi[i]); 2272 + } 2273 + 2258 2274 void fbnic_disable(struct fbnic_net *fbn) 2259 2275 { 2260 2276 struct fbnic_dev *fbd = fbn->fbd; ··· 2877 2861 2878 2862 for (i = 0; i < nv->txt_count; i++) 2879 2863 netif_wake_subqueue(fbn->netdev, nv->qt[i].sub0.q_idx); 2864 + fbnic_dbg_nv_init(nv); 2880 2865 } 2881 2866 2882 2867 static int fbnic_queue_start(struct net_device *dev, ··· 2912 2895 2913 2896 real = container_of(fbn->rx[idx], struct fbnic_q_triad, cmpl); 2914 2897 nv = fbn->napi[idx % fbn->num_napi]; 2898 + fbnic_dbg_nv_exit(nv); 2915 2899 2916 2900 napi_disable_locked(&nv->napi); 2917 2901 fbnic_nv_irq_disable(nv);
+6
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
··· 151 151 struct napi_struct napi; 152 152 struct device *dev; /* Device for DMA unmapping */ 153 153 struct fbnic_dev *fbd; 154 + struct dentry *dbg_nv; 154 155 155 156 u16 v_idx; 156 157 u8 txt_count; ··· 188 187 void fbnic_config_drop_mode(struct fbnic_net *fbn, bool tx_pause); 189 188 void fbnic_enable(struct fbnic_net *fbn); 190 189 void fbnic_disable(struct fbnic_net *fbn); 190 + void fbnic_dbg_up(struct fbnic_net *fbn); 191 + void fbnic_dbg_down(struct fbnic_net *fbn); 191 192 void fbnic_flush(struct fbnic_net *fbn); 192 193 void fbnic_fill(struct fbnic_net *fbn); 193 194 195 + u32 __iomem *fbnic_ring_csr_base(const struct fbnic_ring *ring); 194 196 void fbnic_napi_depletion_check(struct net_device *netdev); 195 197 int fbnic_wait_all_queues_idle(struct fbnic_dev *fbd, bool may_fail); 196 198 ··· 202 198 return nv->v_idx - FBNIC_NON_NAPI_VECTORS; 203 199 } 204 200 201 + void fbnic_dbg_nv_init(struct fbnic_napi_vector *nv); 202 + void fbnic_dbg_nv_exit(struct fbnic_napi_vector *nv); 205 203 #endif /* _FBNIC_TXRX_H_ */