Skip to content

Commit 36345ac

Browse files
Vladimir Kondratievlinvjw
authored andcommitted
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>
1 parent b7cde47 commit 36345ac

5 files changed

Lines changed: 72 additions & 49 deletions

File tree

‎drivers/net/wireless/ath/wil6210/debugfs.c‎

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/power_supply.h>
2323

2424
#include "wil6210.h"
25+
#include "wmi.h"
2526
#include "txrx.h"
2627

2728
/* Nasty hack. Better have per device instances */
@@ -728,16 +729,79 @@ static const struct file_operations fops_txdesc = {
728729
};
729730

730731
/*---------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+
731759
static int wil_bf_debugfs_show(struct seq_file *s, void *data)
732760
{
761+
int rc;
762+
int i;
733763
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+
}
741805
return 0;
742806
}
743807

‎drivers/net/wireless/ath/wil6210/txrx.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,6 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
414414
cid = wil_rxdesc_cid(d);
415415
stats = &wil->sta[cid].stats;
416416
stats->last_mcs_rx = wil_rxdesc_mcs(d);
417-
wil->stats.last_mcs_rx = stats->last_mcs_rx;
418417

419418
/* use radiotap header only if required */
420419
if (ndev->type == ARPHRD_IEEE80211_RADIOTAP)

‎drivers/net/wireless/ath/wil6210/wil6210.h‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -330,17 +330,6 @@ struct wil_tid_ampdu_rx {
330330
bool first_time; /* is it 1-st time this buffer used? */
331331
};
332332

333-
struct wil6210_stats {
334-
u64 tsf;
335-
u32 snr;
336-
u16 last_mcs_rx;
337-
u16 bf_mcs; /* last BF, used for Tx */
338-
u16 my_rx_sector;
339-
u16 my_tx_sector;
340-
u16 peer_rx_sector;
341-
u16 peer_tx_sector;
342-
};
343-
344333
enum wil_sta_status {
345334
wil_sta_unused = 0,
346335
wil_sta_conn_pending = 1,
@@ -433,7 +422,6 @@ struct wil6210_priv {
433422

434423
struct mutex mutex; /* for wil6210_priv access in wil_{up|down} */
435424
/* statistics */
436-
struct wil6210_stats stats;
437425
atomic_t isr_count_rx, isr_count_tx;
438426
/* debugfs */
439427
struct dentry *debug;

‎drivers/net/wireless/ath/wil6210/wmi.c‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -482,33 +482,6 @@ static void wmi_evt_disconnect(struct wil6210_priv *wil, int id,
482482
mutex_unlock(&wil->mutex);
483483
}
484484

485-
static void wmi_evt_notify(struct wil6210_priv *wil, int id, void *d, int len)
486-
{
487-
struct wmi_notify_req_done_event *evt = d;
488-
489-
if (len < sizeof(*evt)) {
490-
wil_err(wil, "Short NOTIFY event\n");
491-
return;
492-
}
493-
494-
wil->stats.tsf = le64_to_cpu(evt->tsf);
495-
wil->stats.snr = le32_to_cpu(evt->snr_val);
496-
wil->stats.bf_mcs = le16_to_cpu(evt->bf_mcs);
497-
wil->stats.my_rx_sector = le16_to_cpu(evt->my_rx_sector);
498-
wil->stats.my_tx_sector = le16_to_cpu(evt->my_tx_sector);
499-
wil->stats.peer_rx_sector = le16_to_cpu(evt->other_rx_sector);
500-
wil->stats.peer_tx_sector = le16_to_cpu(evt->other_tx_sector);
501-
wil_dbg_wmi(wil, "Link status, MCS %d TSF 0x%016llx\n"
502-
"BF status 0x%08x SNR 0x%08x SQI %d%%\n"
503-
"Tx Tpt %d goodput %d Rx goodput %d\n"
504-
"Sectors(rx:tx) my %d:%d peer %d:%d\n",
505-
wil->stats.bf_mcs, wil->stats.tsf, evt->status,
506-
wil->stats.snr, evt->sqi, le32_to_cpu(evt->tx_tpt),
507-
le32_to_cpu(evt->tx_goodput), le32_to_cpu(evt->rx_goodput),
508-
wil->stats.my_rx_sector, wil->stats.my_tx_sector,
509-
wil->stats.peer_rx_sector, wil->stats.peer_tx_sector);
510-
}
511-
512485
/*
513486
* Firmware reports EAPOL frame using WME event.
514487
* Reconstruct Ethernet frame and deliver it via normal Rx
@@ -651,7 +624,6 @@ static const struct {
651624
{WMI_SCAN_COMPLETE_EVENTID, wmi_evt_scan_complete},
652625
{WMI_CONNECT_EVENTID, wmi_evt_connect},
653626
{WMI_DISCONNECT_EVENTID, wmi_evt_disconnect},
654-
{WMI_NOTIFY_REQ_DONE_EVENTID, wmi_evt_notify},
655627
{WMI_EAPOL_RX_EVENTID, wmi_evt_eapol_rx},
656628
{WMI_DATA_PORT_OPEN_EVENTID, wmi_evt_linkup},
657629
{WMI_WBE_LINKDOWN_EVENTID, wmi_evt_linkdown},

‎drivers/net/wireless/ath/wil6210/wmi.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ struct wmi_ready_event {
980980
* WMI_NOTIFY_REQ_DONE_EVENTID
981981
*/
982982
struct wmi_notify_req_done_event {
983-
__le32 status;
983+
__le32 status; /* beamforming status, 0: fail; 1: OK; 2: retrying */
984984
__le64 tsf;
985985
__le32 snr_val;
986986
__le32 tx_tpt;

0 commit comments

Comments
 (0)