From 2760220700ac830837742bad575630cd9bac8eba Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Pouiller?= Date: Mon, 27 Apr 2020 15:40:26 +0200 Subject: [PATCH] staging: wfx: show counters of all interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The device keep up to date three series of stats. One for each virtual interface and one for the whole device. Until to now, the stats for the whole device were unavailable. Moreover, it is interesting to retrieve counters for all interfaces even if they are not awake. Change the counters available in debugfs in order to retrieve stats from all interfaces. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200427134031.323403-13-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/debug.c | 25 ++++++++++++++++--------- drivers/staging/wfx/hif_tx_mib.c | 6 +++--- drivers/staging/wfx/hif_tx_mib.h | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c index 1164aba118a18..4dc4f6a0b92b4 100644 --- a/drivers/staging/wfx/debug.c +++ b/drivers/staging/wfx/debug.c @@ -61,19 +61,26 @@ const char *get_reg_name(unsigned long id) static int wfx_counters_show(struct seq_file *seq, void *v) { - int ret; + int ret, i; struct wfx_dev *wdev = seq->private; - struct hif_mib_extended_count_table counters; + struct hif_mib_extended_count_table counters[3]; + + for (i = 0; i < ARRAY_SIZE(counters); i++) { + ret = hif_get_counters_table(wdev, i, counters + i); + if (ret < 0) + return ret; + if (ret > 0) + return -EIO; + } - ret = hif_get_counters_table(wdev, &counters); - if (ret < 0) - return ret; - if (ret > 0) - return -EIO; + seq_printf(seq, "%-24s %12s %12s %12s\n", + "", "global", "iface 0", "iface 1"); #define PUT_COUNTER(name) \ - seq_printf(seq, "%24s %d\n", #name ":",\ - le32_to_cpu(counters.count_##name)) + seq_printf(seq, "%-24s %12d %12d %12d\n", #name, \ + le32_to_cpu(counters[2].count_##name), \ + le32_to_cpu(counters[0].count_##name), \ + le32_to_cpu(counters[1].count_##name)) PUT_COUNTER(tx_packets); PUT_COUNTER(tx_multicast_frames); diff --git a/drivers/staging/wfx/hif_tx_mib.c b/drivers/staging/wfx/hif_tx_mib.c index 16f4908055afa..6fdde5a4c9a1c 100644 --- a/drivers/staging/wfx/hif_tx_mib.c +++ b/drivers/staging/wfx/hif_tx_mib.c @@ -64,16 +64,16 @@ int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, HIF_MIB_ID_RCPI_RSSI_THRESHOLD, &arg, sizeof(arg)); } -int hif_get_counters_table(struct wfx_dev *wdev, +int hif_get_counters_table(struct wfx_dev *wdev, int vif_id, struct hif_mib_extended_count_table *arg) { if (wfx_api_older_than(wdev, 1, 3)) { // extended_count_table is wider than count_table memset(arg, 0xFF, sizeof(*arg)); - return hif_read_mib(wdev, 0, HIF_MIB_ID_COUNTERS_TABLE, + return hif_read_mib(wdev, vif_id, HIF_MIB_ID_COUNTERS_TABLE, arg, sizeof(struct hif_mib_count_table)); } else { - return hif_read_mib(wdev, 0, + return hif_read_mib(wdev, vif_id, HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, arg, sizeof(struct hif_mib_extended_count_table)); } diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index bb7c104a03d8d..b72770a4ba128 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -20,7 +20,7 @@ int hif_set_beacon_wakeup_period(struct wfx_vif *wvif, unsigned int listen_interval); int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, int rssi_thold, int rssi_hyst); -int hif_get_counters_table(struct wfx_dev *wdev, +int hif_get_counters_table(struct wfx_dev *wdev, int vif_id, struct hif_mib_extended_count_table *arg); int hif_set_macaddr(struct wfx_vif *wvif, u8 *mac); int hif_set_rx_filter(struct wfx_vif *wvif, -- 2.30.2