|
22 | 22 | #include <linux/power_supply.h> |
23 | 23 |
|
24 | 24 | #include "wil6210.h" |
| 25 | +#include "wmi.h" |
25 | 26 | #include "txrx.h" |
26 | 27 |
|
27 | 28 | /* Nasty hack. Better have per device instances */ |
@@ -728,16 +729,79 @@ static const struct file_operations fops_txdesc = { |
728 | 729 | }; |
729 | 730 |
|
730 | 731 | /*---------beamforming------------*/ |
| 732 | +static char *wil_bfstatus_str(u32 status) |
| 733 | +{ |
| 734 | + switch (status) { |
| 735 | + case 0: |
| 736 | + return "Failed"; |
| 737 | + case 1: |
| 738 | + return "OK"; |
| 739 | + case 2: |
| 740 | + return "Retrying"; |
| 741 | + default: |
| 742 | + return "??"; |
| 743 | + } |
| 744 | +} |
| 745 | + |
| 746 | +static bool is_all_zeros(void * const x_, size_t sz) |
| 747 | +{ |
| 748 | + /* if reply is all-0, ignore this CID */ |
| 749 | + u32 *x = x_; |
| 750 | + int n; |
| 751 | + |
| 752 | + for (n = 0; n < sz / sizeof(*x); n++) |
| 753 | + if (x[n]) |
| 754 | + return false; |
| 755 | + |
| 756 | + return true; |
| 757 | +} |
| 758 | + |
731 | 759 | static int wil_bf_debugfs_show(struct seq_file *s, void *data) |
732 | 760 | { |
| 761 | + int rc; |
| 762 | + int i; |
733 | 763 | struct wil6210_priv *wil = s->private; |
734 | | - seq_printf(s, |
735 | | - "TSF : 0x%016llx\n" |
736 | | - "TxMCS : %d\n" |
737 | | - "Sectors(rx:tx) my %2d:%2d peer %2d:%2d\n", |
738 | | - wil->stats.tsf, wil->stats.bf_mcs, |
739 | | - wil->stats.my_rx_sector, wil->stats.my_tx_sector, |
740 | | - wil->stats.peer_rx_sector, wil->stats.peer_tx_sector); |
| 764 | + struct wmi_notify_req_cmd cmd = { |
| 765 | + .interval_usec = 0, |
| 766 | + }; |
| 767 | + struct { |
| 768 | + struct wil6210_mbox_hdr_wmi wmi; |
| 769 | + struct wmi_notify_req_done_event evt; |
| 770 | + } __packed reply; |
| 771 | + |
| 772 | + for (i = 0; i < ARRAY_SIZE(wil->sta); i++) { |
| 773 | + u32 status; |
| 774 | + |
| 775 | + cmd.cid = i; |
| 776 | + rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, &cmd, sizeof(cmd), |
| 777 | + WMI_NOTIFY_REQ_DONE_EVENTID, &reply, |
| 778 | + sizeof(reply), 20); |
| 779 | + /* if reply is all-0, ignore this CID */ |
| 780 | + if (rc || is_all_zeros(&reply.evt, sizeof(reply.evt))) |
| 781 | + continue; |
| 782 | + |
| 783 | + status = le32_to_cpu(reply.evt.status); |
| 784 | + seq_printf(s, "CID %d {\n" |
| 785 | + " TSF = 0x%016llx\n" |
| 786 | + " TxMCS = %2d TxTpt = %4d\n" |
| 787 | + " SQI = %4d\n" |
| 788 | + " Status = 0x%08x %s\n" |
| 789 | + " Sectors(rx:tx) my %2d:%2d peer %2d:%2d\n" |
| 790 | + " Goodput(rx:tx) %4d:%4d\n" |
| 791 | + "}\n", |
| 792 | + i, |
| 793 | + le64_to_cpu(reply.evt.tsf), |
| 794 | + le16_to_cpu(reply.evt.bf_mcs), |
| 795 | + le32_to_cpu(reply.evt.tx_tpt), |
| 796 | + reply.evt.sqi, |
| 797 | + status, wil_bfstatus_str(status), |
| 798 | + le16_to_cpu(reply.evt.my_rx_sector), |
| 799 | + le16_to_cpu(reply.evt.my_tx_sector), |
| 800 | + le16_to_cpu(reply.evt.other_rx_sector), |
| 801 | + le16_to_cpu(reply.evt.other_tx_sector), |
| 802 | + le32_to_cpu(reply.evt.rx_goodput), |
| 803 | + le32_to_cpu(reply.evt.tx_goodput)); |
| 804 | + } |
741 | 805 | return 0; |
742 | 806 | } |
743 | 807 |
|
|
0 commit comments