staging: wfx: show counters of all interfaces
authorJérôme Pouiller <jerome.pouiller@silabs.com>
Mon, 27 Apr 2020 13:40:26 +0000 (15:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Apr 2020 12:14:28 +0000 (14:14 +0200)
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 <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200427134031.323403-13-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/debug.c
drivers/staging/wfx/hif_tx_mib.c
drivers/staging/wfx/hif_tx_mib.h

index 1164aba118a184255bccef468c7d8028d40a0f2d..4dc4f6a0b92b494fc8ca423f58a930380e846ab0 100644 (file)
@@ -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);
index 16f4908055afadee528ae5e5cbe4e5dce7e9e498..6fdde5a4c9a1c919d0aa67d5b636f0d14dba1187 100644 (file)
@@ -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));
        }
index bb7c104a03d8d478e8f12b0c6200bac43985e79b..b72770a4ba128205544fe2883e012d25fa318c3f 100644 (file)
@@ -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,