aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/wil6210/debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/wil6210/debugfs.c')
-rw-r--r--drivers/net/wireless/ath/wil6210/debugfs.c119
1 files changed, 106 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 1caa31992a7e..1d09a4b0a0f4 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -26,9 +26,11 @@
26/* Nasty hack. Better have per device instances */ 26/* Nasty hack. Better have per device instances */
27static u32 mem_addr; 27static u32 mem_addr;
28static u32 dbg_txdesc_index; 28static u32 dbg_txdesc_index;
29static u32 dbg_vring_index; /* 24+ for Rx, 0..23 for Tx */
29 30
30static void wil_print_vring(struct seq_file *s, struct wil6210_priv *wil, 31static void wil_print_vring(struct seq_file *s, struct wil6210_priv *wil,
31 const char *name, struct vring *vring) 32 const char *name, struct vring *vring,
33 char _s, char _h)
32{ 34{
33 void __iomem *x = wmi_addr(wil, vring->hwtail); 35 void __iomem *x = wmi_addr(wil, vring->hwtail);
34 36
@@ -50,8 +52,8 @@ static void wil_print_vring(struct seq_file *s, struct wil6210_priv *wil,
50 volatile struct vring_tx_desc *d = &vring->va[i].tx; 52 volatile struct vring_tx_desc *d = &vring->va[i].tx;
51 if ((i % 64) == 0 && (i != 0)) 53 if ((i % 64) == 0 && (i != 0))
52 seq_printf(s, "\n"); 54 seq_printf(s, "\n");
53 seq_printf(s, "%s", (d->dma.status & BIT(0)) ? 55 seq_printf(s, "%c", (d->dma.status & BIT(0)) ?
54 "S" : (vring->ctx[i].skb ? "H" : "h")); 56 _s : (vring->ctx[i].skb ? _h : 'h'));
55 } 57 }
56 seq_printf(s, "\n"); 58 seq_printf(s, "\n");
57 } 59 }
@@ -63,14 +65,19 @@ static int wil_vring_debugfs_show(struct seq_file *s, void *data)
63 uint i; 65 uint i;
64 struct wil6210_priv *wil = s->private; 66 struct wil6210_priv *wil = s->private;
65 67
66 wil_print_vring(s, wil, "rx", &wil->vring_rx); 68 wil_print_vring(s, wil, "rx", &wil->vring_rx, 'S', '_');
67 69
68 for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) { 70 for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) {
69 struct vring *vring = &(wil->vring_tx[i]); 71 struct vring *vring = &(wil->vring_tx[i]);
70 if (vring->va) { 72 if (vring->va) {
73 int cid = wil->vring2cid_tid[i][0];
74 int tid = wil->vring2cid_tid[i][1];
71 char name[10]; 75 char name[10];
72 snprintf(name, sizeof(name), "tx_%2d", i); 76 snprintf(name, sizeof(name), "tx_%2d", i);
73 wil_print_vring(s, wil, name, vring); 77
78 seq_printf(s, "\n%pM CID %d TID %d\n",
79 wil->sta[cid].addr, cid, tid);
80 wil_print_vring(s, wil, name, vring, '_', 'H');
74 } 81 }
75 } 82 }
76 83
@@ -390,25 +397,40 @@ static const struct file_operations fops_reset = {
390 .write = wil_write_file_reset, 397 .write = wil_write_file_reset,
391 .open = simple_open, 398 .open = simple_open,
392}; 399};
393/*---------Tx descriptor------------*/
394 400
401/*---------Tx/Rx descriptor------------*/
395static int wil_txdesc_debugfs_show(struct seq_file *s, void *data) 402static int wil_txdesc_debugfs_show(struct seq_file *s, void *data)
396{ 403{
397 struct wil6210_priv *wil = s->private; 404 struct wil6210_priv *wil = s->private;
398 struct vring *vring = &(wil->vring_tx[0]); 405 struct vring *vring;
406 bool tx = (dbg_vring_index < WIL6210_MAX_TX_RINGS);
407 if (tx)
408 vring = &(wil->vring_tx[dbg_vring_index]);
409 else
410 vring = &wil->vring_rx;
399 411
400 if (!vring->va) { 412 if (!vring->va) {
401 seq_printf(s, "No Tx VRING\n"); 413 if (tx)
414 seq_printf(s, "No Tx[%2d] VRING\n", dbg_vring_index);
415 else
416 seq_puts(s, "No Rx VRING\n");
402 return 0; 417 return 0;
403 } 418 }
404 419
405 if (dbg_txdesc_index < vring->size) { 420 if (dbg_txdesc_index < vring->size) {
421 /* use struct vring_tx_desc for Rx as well,
422 * only field used, .dma.length, is the same
423 */
406 volatile struct vring_tx_desc *d = 424 volatile struct vring_tx_desc *d =
407 &(vring->va[dbg_txdesc_index].tx); 425 &(vring->va[dbg_txdesc_index].tx);
408 volatile u32 *u = (volatile u32 *)d; 426 volatile u32 *u = (volatile u32 *)d;
409 struct sk_buff *skb = vring->ctx[dbg_txdesc_index].skb; 427 struct sk_buff *skb = vring->ctx[dbg_txdesc_index].skb;
410 428
411 seq_printf(s, "Tx[%3d] = {\n", dbg_txdesc_index); 429 if (tx)
430 seq_printf(s, "Tx[%2d][%3d] = {\n", dbg_vring_index,
431 dbg_txdesc_index);
432 else
433 seq_printf(s, "Rx[%3d] = {\n", dbg_txdesc_index);
412 seq_printf(s, " MAC = 0x%08x 0x%08x 0x%08x 0x%08x\n", 434 seq_printf(s, " MAC = 0x%08x 0x%08x 0x%08x 0x%08x\n",
413 u[0], u[1], u[2], u[3]); 435 u[0], u[1], u[2], u[3]);
414 seq_printf(s, " DMA = 0x%08x 0x%08x 0x%08x 0x%08x\n", 436 seq_printf(s, " DMA = 0x%08x 0x%08x 0x%08x 0x%08x\n",
@@ -439,8 +461,13 @@ static int wil_txdesc_debugfs_show(struct seq_file *s, void *data)
439 } 461 }
440 seq_printf(s, "}\n"); 462 seq_printf(s, "}\n");
441 } else { 463 } else {
442 seq_printf(s, "TxDesc index (%d) >= size (%d)\n", 464 if (tx)
443 dbg_txdesc_index, vring->size); 465 seq_printf(s, "[%2d] TxDesc index (%d) >= size (%d)\n",
466 dbg_vring_index, dbg_txdesc_index,
467 vring->size);
468 else
469 seq_printf(s, "RxDesc index (%d) >= size (%d)\n",
470 dbg_txdesc_index, vring->size);
444 } 471 }
445 472
446 return 0; 473 return 0;
@@ -570,6 +597,68 @@ static const struct file_operations fops_temp = {
570 .llseek = seq_lseek, 597 .llseek = seq_lseek,
571}; 598};
572 599
600/*---------Station matrix------------*/
601static void wil_print_rxtid(struct seq_file *s, struct wil_tid_ampdu_rx *r)
602{
603 int i;
604 u16 index = ((r->head_seq_num - r->ssn) & 0xfff) % r->buf_size;
605 seq_printf(s, "0x%03x [", r->head_seq_num);
606 for (i = 0; i < r->buf_size; i++) {
607 if (i == index)
608 seq_printf(s, "%c", r->reorder_buf[i] ? 'O' : '|');
609 else
610 seq_printf(s, "%c", r->reorder_buf[i] ? '*' : '_');
611 }
612 seq_puts(s, "]\n");
613}
614
615static int wil_sta_debugfs_show(struct seq_file *s, void *data)
616{
617 struct wil6210_priv *wil = s->private;
618 int i, tid;
619
620 for (i = 0; i < ARRAY_SIZE(wil->sta); i++) {
621 struct wil_sta_info *p = &wil->sta[i];
622 char *status = "unknown";
623 switch (p->status) {
624 case wil_sta_unused:
625 status = "unused ";
626 break;
627 case wil_sta_conn_pending:
628 status = "pending ";
629 break;
630 case wil_sta_connected:
631 status = "connected";
632 break;
633 }
634 seq_printf(s, "[%d] %pM %s\n", i, p->addr, status);
635
636 if (p->status == wil_sta_connected) {
637 for (tid = 0; tid < WIL_STA_TID_NUM; tid++) {
638 struct wil_tid_ampdu_rx *r = p->tid_rx[tid];
639 if (r) {
640 seq_printf(s, "[%2d] ", tid);
641 wil_print_rxtid(s, r);
642 }
643 }
644 }
645 }
646
647 return 0;
648}
649
650static int wil_sta_seq_open(struct inode *inode, struct file *file)
651{
652 return single_open(file, wil_sta_debugfs_show, inode->i_private);
653}
654
655static const struct file_operations fops_sta = {
656 .open = wil_sta_seq_open,
657 .release = single_release,
658 .read = seq_read,
659 .llseek = seq_lseek,
660};
661
573/*----------------*/ 662/*----------------*/
574int wil6210_debugfs_init(struct wil6210_priv *wil) 663int wil6210_debugfs_init(struct wil6210_priv *wil)
575{ 664{
@@ -581,9 +670,13 @@ int wil6210_debugfs_init(struct wil6210_priv *wil)
581 670
582 debugfs_create_file("mbox", S_IRUGO, dbg, wil, &fops_mbox); 671 debugfs_create_file("mbox", S_IRUGO, dbg, wil, &fops_mbox);
583 debugfs_create_file("vrings", S_IRUGO, dbg, wil, &fops_vring); 672 debugfs_create_file("vrings", S_IRUGO, dbg, wil, &fops_vring);
584 debugfs_create_file("txdesc", S_IRUGO, dbg, wil, &fops_txdesc); 673 debugfs_create_file("stations", S_IRUGO, dbg, wil, &fops_sta);
585 debugfs_create_u32("txdesc_index", S_IRUGO | S_IWUSR, dbg, 674 debugfs_create_file("desc", S_IRUGO, dbg, wil, &fops_txdesc);
675 debugfs_create_u32("desc_index", S_IRUGO | S_IWUSR, dbg,
586 &dbg_txdesc_index); 676 &dbg_txdesc_index);
677 debugfs_create_u32("vring_index", S_IRUGO | S_IWUSR, dbg,
678 &dbg_vring_index);
679
587 debugfs_create_file("bf", S_IRUGO, dbg, wil, &fops_bf); 680 debugfs_create_file("bf", S_IRUGO, dbg, wil, &fops_bf);
588 debugfs_create_file("ssid", S_IRUGO | S_IWUSR, dbg, wil, &fops_ssid); 681 debugfs_create_file("ssid", S_IRUGO | S_IWUSR, dbg, wil, &fops_ssid);
589 debugfs_create_u32("secure_pcp", S_IRUGO | S_IWUSR, dbg, 682 debugfs_create_u32("secure_pcp", S_IRUGO | S_IWUSR, dbg,