[OpenWrt-Devel] [PATCH 1/2] iwinfo: nl80211: add more stats to assoclist.

Daniel Danzberger daniel at dd-wrt.com
Tue Jul 3 09:32:10 EDT 2018


+ NL80211_STA_INFO_SIGNAL_AVG
+ NL80211_STA_INFO_RX_DROP_MISC
+ NL80211_STA_INFO_CONNECTED_TIME

Signed-off-by: Daniel Danzberger <daniel at dd-wrt.com>
---
 include/iwinfo.h |  3 +++
 iwinfo_nl80211.c | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 929f697..4111205 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -105,10 +105,13 @@ struct iwinfo_rate_entry {
 struct iwinfo_assoclist_entry {
 	uint8_t	mac[6];
 	int8_t signal;
+	int8_t signal_avg;
 	int8_t noise;
 	uint32_t inactive;
+	uint32_t connected_time;
 	uint32_t rx_packets;
 	uint32_t tx_packets;
+	uint64_t rx_drop_misc;
 	struct iwinfo_rate_entry rx_rate;
 	struct iwinfo_rate_entry tx_rate;
 	uint32_t rx_bytes;
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index ecd2d6a..0e0206b 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -1694,10 +1694,13 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, void *arg)
 		[NL80211_STA_INFO_RX_BITRATE]    = { .type = NLA_NESTED },
 		[NL80211_STA_INFO_TX_BITRATE]    = { .type = NLA_NESTED },
 		[NL80211_STA_INFO_SIGNAL]        = { .type = NLA_U8     },
+		[NL80211_STA_INFO_SIGNAL_AVG]    = { .type = NLA_U8     },
 		[NL80211_STA_INFO_RX_BYTES]      = { .type = NLA_U32    },
 		[NL80211_STA_INFO_TX_BYTES]      = { .type = NLA_U32    },
 		[NL80211_STA_INFO_TX_RETRIES]    = { .type = NLA_U32    },
 		[NL80211_STA_INFO_TX_FAILED]     = { .type = NLA_U32    },
+		[NL80211_STA_INFO_CONNECTED_TIME]= { .type = NLA_U32    },
+		[NL80211_STA_INFO_RX_DROP_MISC]  = { .type = NLA_U64    },
 		[NL80211_STA_INFO_T_OFFSET]      = { .type = NLA_U64    },
 		[NL80211_STA_INFO_STA_FLAGS] =
 			{ .minlen = sizeof(struct nl80211_sta_flag_update) },
@@ -1725,9 +1728,15 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, void *arg)
 		if (sinfo[NL80211_STA_INFO_SIGNAL])
 			e->signal = nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]);
 
+		if (sinfo[NL80211_STA_INFO_SIGNAL_AVG])
+			e->signal_avg = nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]);
+
 		if (sinfo[NL80211_STA_INFO_INACTIVE_TIME])
 			e->inactive = nla_get_u32(sinfo[NL80211_STA_INFO_INACTIVE_TIME]);
 
+		if (sinfo[NL80211_STA_INFO_CONNECTED_TIME])
+			e->connected_time = nla_get_u32(sinfo[NL80211_STA_INFO_CONNECTED_TIME]);
+
 		if (sinfo[NL80211_STA_INFO_RX_PACKETS])
 			e->rx_packets = nla_get_u32(sinfo[NL80211_STA_INFO_RX_PACKETS]);
 
@@ -1759,6 +1768,9 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, void *arg)
 		if (sinfo[NL80211_STA_INFO_T_OFFSET])
 			e->t_offset = nla_get_u64(sinfo[NL80211_STA_INFO_T_OFFSET]);
 
+		if (sinfo[NL80211_STA_INFO_RX_DROP_MISC])
+			e->rx_drop_misc = nla_get_u64(sinfo[NL80211_STA_INFO_RX_DROP_MISC]);
+
 		if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT])
 			e->thr = nla_get_u32(sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]);
 
-- 
2.18.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list