]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: dump station rx bit rate information
authorFelix Fietkau <nbd@openwrt.org>
Thu, 11 Jul 2013 12:20:37 +0000 (14:20 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 11 Jul 2013 12:27:33 +0000 (14:27 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
iw.h
link.c
station.c

diff --git a/iw.h b/iw.h
index 8816e884a87b515df6ff92e51a14680d439ec361..854d356ef783c2015fd0b1c17cbe458bbf5877f9 100644 (file)
--- a/iw.h
+++ b/iw.h
@@ -170,7 +170,7 @@ enum print_ie_type {
 void print_ies(unsigned char *ie, int ielen, bool unknown,
               enum print_ie_type ptype);
 
-void parse_tx_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
+void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
 
 DECLARE_SECTION(set);
 DECLARE_SECTION(get);
diff --git a/link.c b/link.c
index b8acd5c91252a9e0b695753a1858223e42b7d285..f7818f5fc296098f67e020988453e2fc8d5f1e9d 100644 (file)
--- a/link.c
+++ b/link.c
@@ -165,7 +165,7 @@ static int print_link_sta(struct nl_msg *msg, void *arg)
        if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
                char buf[100];
 
-               parse_tx_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], buf, sizeof(buf));
+               parse_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], buf, sizeof(buf));
                printf("\ttx bitrate: %s\n", buf);
        }
 
index dde552f2065dd55289c2c6a46c0c8c03f90c19a0..5a161ebfd2cc68562fc03e2a87f81e0846d42ca3 100644 (file)
--- a/station.c
+++ b/station.c
@@ -43,7 +43,7 @@ static void print_power_mode(struct nlattr *a)
        }
 }
 
-void parse_tx_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen)
+void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen)
 {
        int rate = 0;
        char *pos = buf;
@@ -107,6 +107,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
                [NL80211_STA_INFO_SIGNAL] = { .type = NLA_U8 },
                [NL80211_STA_INFO_T_OFFSET] = { .type = NLA_U64 },
                [NL80211_STA_INFO_TX_BITRATE] = { .type = NLA_NESTED },
+               [NL80211_STA_INFO_RX_BITRATE] = { .type = NLA_NESTED },
                [NL80211_STA_INFO_LLID] = { .type = NLA_U16 },
                [NL80211_STA_INFO_PLID] = { .type = NLA_U16 },
                [NL80211_STA_INFO_PLINK_STATE] = { .type = NLA_U8 },
@@ -177,10 +178,17 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
        if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
                char buf[100];
 
-               parse_tx_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], buf, sizeof(buf));
+               parse_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], buf, sizeof(buf));
                printf("\n\ttx bitrate:\t%s", buf);
        }
 
+       if (sinfo[NL80211_STA_INFO_RX_BITRATE]) {
+               char buf[100];
+
+               parse_bitrate(sinfo[NL80211_STA_INFO_RX_BITRATE], buf, sizeof(buf));
+               printf("\n\trx bitrate:\t%s", buf);
+       }
+
        if (sinfo[NL80211_STA_INFO_LLID])
                printf("\n\tmesh llid:\t%d",
                        nla_get_u16(sinfo[NL80211_STA_INFO_LLID]));