diff options
author | Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> | 2014-08-06 03:31:56 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-08-25 16:17:35 -0400 |
commit | 36345ac33ca8d381c215091c5535e62335668f01 (patch) | |
tree | c2f73ab7ddc674f588b8e3fc42628ad26b897e95 /drivers/net/wireless/ath/wil6210/debugfs.c | |
parent | b7cde47009640b88cb3629ee7078a43bc2642459 (diff) |
wil6210: fix beamforming data reporting
When reading 'bf' file on debugfs, query beam forming status from firmware.
Ignore CID's that return error or return all zeros.
Remove obsolete code that used to maintain statistics on per-device basis,
as now it is reported be per-CID and current.
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/wil6210/debugfs.c')
-rw-r--r-- | drivers/net/wireless/ath/wil6210/debugfs.c | 78 |
1 files changed, 71 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index 95269d234ca9..b1c6a7293390 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/power_supply.h> | 22 | #include <linux/power_supply.h> |
23 | 23 | ||
24 | #include "wil6210.h" | 24 | #include "wil6210.h" |
25 | #include "wmi.h" | ||
25 | #include "txrx.h" | 26 | #include "txrx.h" |
26 | 27 | ||
27 | /* Nasty hack. Better have per device instances */ | 28 | /* Nasty hack. Better have per device instances */ |
@@ -728,16 +729,79 @@ static const struct file_operations fops_txdesc = { | |||
728 | }; | 729 | }; |
729 | 730 | ||
730 | /*---------beamforming------------*/ | 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 | static int wil_bf_debugfs_show(struct seq_file *s, void *data) | 759 | static int wil_bf_debugfs_show(struct seq_file *s, void *data) |
732 | { | 760 | { |
761 | int rc; | ||
762 | int i; | ||
733 | struct wil6210_priv *wil = s->private; | 763 | struct wil6210_priv *wil = s->private; |
734 | seq_printf(s, | 764 | struct wmi_notify_req_cmd cmd = { |
735 | "TSF : 0x%016llx\n" | 765 | .interval_usec = 0, |
736 | "TxMCS : %d\n" | 766 | }; |
737 | "Sectors(rx:tx) my %2d:%2d peer %2d:%2d\n", | 767 | struct { |
738 | wil->stats.tsf, wil->stats.bf_mcs, | 768 | struct wil6210_mbox_hdr_wmi wmi; |
739 | wil->stats.my_rx_sector, wil->stats.my_tx_sector, | 769 | struct wmi_notify_req_done_event evt; |
740 | wil->stats.peer_rx_sector, wil->stats.peer_tx_sector); | 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 | return 0; | 805 | return 0; |
742 | } | 806 | } |
743 | 807 | ||