Commit 27602207 authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman

staging: wfx: show counters of all interfaces

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: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200427134031.323403-13-Jerome.Pouiller@silabs.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6ae0878b
...@@ -61,19 +61,26 @@ const char *get_reg_name(unsigned long id) ...@@ -61,19 +61,26 @@ const char *get_reg_name(unsigned long id)
static int wfx_counters_show(struct seq_file *seq, void *v) static int wfx_counters_show(struct seq_file *seq, void *v)
{ {
int ret; int ret, i;
struct wfx_dev *wdev = seq->private; 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); seq_printf(seq, "%-24s %12s %12s %12s\n",
if (ret < 0) "", "global", "iface 0", "iface 1");
return ret;
if (ret > 0)
return -EIO;
#define PUT_COUNTER(name) \ #define PUT_COUNTER(name) \
seq_printf(seq, "%24s %d\n", #name ":",\ seq_printf(seq, "%-24s %12d %12d %12d\n", #name, \
le32_to_cpu(counters.count_##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_packets);
PUT_COUNTER(tx_multicast_frames); PUT_COUNTER(tx_multicast_frames);
......
...@@ -64,16 +64,16 @@ int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, ...@@ -64,16 +64,16 @@ int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif,
HIF_MIB_ID_RCPI_RSSI_THRESHOLD, &arg, sizeof(arg)); 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) struct hif_mib_extended_count_table *arg)
{ {
if (wfx_api_older_than(wdev, 1, 3)) { if (wfx_api_older_than(wdev, 1, 3)) {
// extended_count_table is wider than count_table // extended_count_table is wider than count_table
memset(arg, 0xFF, sizeof(*arg)); 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)); arg, sizeof(struct hif_mib_count_table));
} else { } else {
return hif_read_mib(wdev, 0, return hif_read_mib(wdev, vif_id,
HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, arg, HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, arg,
sizeof(struct hif_mib_extended_count_table)); sizeof(struct hif_mib_extended_count_table));
} }
......
...@@ -20,7 +20,7 @@ int hif_set_beacon_wakeup_period(struct wfx_vif *wvif, ...@@ -20,7 +20,7 @@ int hif_set_beacon_wakeup_period(struct wfx_vif *wvif,
unsigned int listen_interval); unsigned int listen_interval);
int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif, int hif_set_rcpi_rssi_threshold(struct wfx_vif *wvif,
int rssi_thold, int rssi_hyst); 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); struct hif_mib_extended_count_table *arg);
int hif_set_macaddr(struct wfx_vif *wvif, u8 *mac); int hif_set_macaddr(struct wfx_vif *wvif, u8 *mac);
int hif_set_rx_filter(struct wfx_vif *wvif, int hif_set_rx_filter(struct wfx_vif *wvif,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment