]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - station.c
iw: Add printing of station tx duration and airtime weight
[thirdparty/iw.git] / station.c
index fd38043b1b86bb167970fafa2a899e96c99d684a..b731409502d480f9ae203d55a569d3b322629571 100644 (file)
--- a/station.c
+++ b/station.c
@@ -99,7 +99,8 @@ int parse_txq_stats(char *buf, int buflen, struct nlattr *tid_stats_attr, int he
        return pos - buf;
 
 }
-void parse_tid_stats(struct nlattr *tid_stats_attr)
+
+static void parse_tid_stats(struct nlattr *tid_stats_attr)
 {
        struct nlattr *stats_info[NL80211_TID_STATS_MAX + 1], *tidattr, *info;
        static struct nla_policy stats_policy[NL80211_TID_STATS_MAX + 1] = {
@@ -146,7 +147,7 @@ void parse_tid_stats(struct nlattr *tid_stats_attr)
                printf("\n\tTXQs:%s", txqbuf);
 }
 
-void parse_bss_param(struct nlattr *bss_param_attr)
+static void parse_bss_param(struct nlattr *bss_param_attr)
 {
        struct nlattr *bss_param_info[NL80211_STA_BSS_PARAM_MAX + 1], *info;
        static struct nla_policy bss_poilcy[NL80211_STA_BSS_PARAM_MAX + 1] = {
@@ -308,6 +309,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
                [NL80211_STA_INFO_TID_STATS] = { .type = NLA_NESTED },
                [NL80211_STA_INFO_BSS_PARAM] = { .type = NLA_NESTED },
                [NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 },
+               [NL80211_STA_INFO_TX_DURATION] = { .type = NLA_U64 },
                [NL80211_STA_INFO_ACK_SIGNAL] = {.type = NLA_U8 },
                [NL80211_STA_INFO_ACK_SIGNAL_AVG] = { .type = NLA_U8 },
        };
@@ -388,7 +390,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
 
        if (sinfo[NL80211_STA_INFO_BEACON_SIGNAL_AVG])
                printf("\n\tbeacon signal avg:\t%d dBm",
-                      nla_get_u8(sinfo[NL80211_STA_INFO_BEACON_SIGNAL_AVG]));
+                      (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_BEACON_SIGNAL_AVG]));
        if (sinfo[NL80211_STA_INFO_T_OFFSET])
                printf("\n\tToffset:\t%llu us",
                       (unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_T_OFFSET]));
@@ -400,6 +402,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
                printf("\n\ttx bitrate:\t%s", buf);
        }
 
+       if (sinfo[NL80211_STA_INFO_TX_DURATION])
+               printf("\n\ttx duration:\t%lld us",
+                      (unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_TX_DURATION]));
+
        if (sinfo[NL80211_STA_INFO_RX_BITRATE]) {
                char buf[100];
 
@@ -419,6 +425,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
                printf("\n\tavg ack signal:\t%d dBm",
                        (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_ACK_SIGNAL_AVG]));
 
+       if (sinfo[NL80211_STA_INFO_AIRTIME_WEIGHT]) {
+               printf("\n\tairtime weight: %d", nla_get_u16(sinfo[NL80211_STA_INFO_AIRTIME_WEIGHT]));
+       }
+
        if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]) {
                uint32_t thr;