]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: Support ht-capability overrides mask.
authorBen Greear <greearb@candelatech.com>
Mon, 28 Nov 2011 18:40:22 +0000 (10:40 -0800)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 29 Nov 2011 08:58:12 +0000 (09:58 +0100)
Let user know which capabilities are supported.

ieee80211.h [new file with mode: 0644]
info.c
iw.h

diff --git a/ieee80211.h b/ieee80211.h
new file mode 100644 (file)
index 0000000..622b042
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef __IEEE80211
+#define __IEEE80211
+
+/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
+#define IEEE80211_HT_AMPDU_PARM_FACTOR          0x03
+#define IEEE80211_HT_AMPDU_PARM_DENSITY         0x1C
+
+#define IEEE80211_HT_CAP_SUP_WIDTH_20_40        0x0002
+#define IEEE80211_HT_CAP_SGI_40                 0x0040
+#define IEEE80211_HT_CAP_MAX_AMSDU              0x0800
+
+#define IEEE80211_HT_MCS_MASK_LEN               10
+
+/**
+ * struct ieee80211_mcs_info - MCS information
+ * @rx_mask: RX mask
+ * @rx_highest: highest supported RX rate. If set represents
+ *      the highest supported RX data rate in units of 1 Mbps.
+ *      If this field is 0 this value should not be used to
+ *      consider the highest RX data rate supported.
+ * @tx_params: TX parameters
+ */
+struct ieee80211_mcs_info {
+       __u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
+       __u16 rx_highest;
+       __u8 tx_params;
+       __u8 reserved[3];
+} __attribute__ ((packed));
+
+
+/**
+ * struct ieee80211_ht_cap - HT capabilities
+ *
+ * This structure is the "HT capabilities element" as
+ * described in 802.11n D5.0 7.3.2.57
+ */
+struct ieee80211_ht_cap {
+       __u16 cap_info;
+       __u8 ampdu_params_info;
+
+       /* 16 bytes MCS information */
+       struct ieee80211_mcs_info mcs;
+
+       __u16 extended_ht_cap_info;
+       __u32 tx_BF_cap_info;
+       __u8 antenna_selection_info;
+} __attribute__ ((packed));
+
+#endif /* __IEEE80211 */
diff --git a/info.c b/info.c
index b55b2828b1bb9cf98725ae0372f48cace0c1ecbd..9f085613bc9546036d35de943d03ece84eff9f85 100644 (file)
--- a/info.c
+++ b/info.c
@@ -400,6 +400,35 @@ broken_combination:
        if (tb_msg[NL80211_ATTR_SUPPORT_AP_UAPSD])
                printf("\tDevice supports AP-side u-APSD.\n");
 
+       if (tb_msg[NL80211_ATTR_HT_CAPABILITY_MASK]) {
+               struct ieee80211_ht_cap *cm;
+               printf("\tHT Capability overrides:\n");
+               if (nla_len(tb_msg[NL80211_ATTR_HT_CAPABILITY_MASK]) >= sizeof(*cm)) {
+                       cm = nla_data(tb_msg[NL80211_ATTR_HT_CAPABILITY_MASK]);
+                       printf("\t\t * MCS: %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx"
+                              " %02hhx %02hhx %02hhx %02hhx\n",
+                              cm->mcs.rx_mask[0], cm->mcs.rx_mask[1],
+                              cm->mcs.rx_mask[2], cm->mcs.rx_mask[3],
+                              cm->mcs.rx_mask[4], cm->mcs.rx_mask[5],
+                              cm->mcs.rx_mask[6], cm->mcs.rx_mask[7],
+                              cm->mcs.rx_mask[8], cm->mcs.rx_mask[9]);
+                       if (cm->cap_info & htole16(IEEE80211_HT_CAP_MAX_AMSDU))
+                               printf("\t\t * maximum A-MSDU length\n");
+                       if (cm->cap_info & htole16(IEEE80211_HT_CAP_SUP_WIDTH_20_40))
+                               printf("\t\t * supported channel width\n");
+                       if (cm->cap_info & htole16(IEEE80211_HT_CAP_SGI_40))
+                               printf("\t\t * short GI for 40 MHz\n");
+                       if (cm->ampdu_params_info & IEEE80211_HT_AMPDU_PARM_FACTOR)
+                               printf("\t\t * max A-MPDU length exponent\n");
+                       if (cm->ampdu_params_info & IEEE80211_HT_AMPDU_PARM_DENSITY)
+                               printf("\t\t * min MPDU start spacing\n");
+               } else {
+                       printf("\tERROR: capabilities mask is too short, expected: %d, received: %d\n",
+                              (int)(sizeof(*cm)),
+                              (int)(nla_len(tb_msg[NL80211_ATTR_HT_CAPABILITY_MASK])));
+               }
+       }
+
        return NL_SKIP;
 }
 
diff --git a/iw.h b/iw.h
index a50d447b34e0e505e93843a717f26ecf4f07afcd..3379a7fd673bca5fe7f08cf75dd25f917d79a2dd 100644 (file)
--- a/iw.h
+++ b/iw.h
@@ -6,8 +6,10 @@
 #include <netlink/genl/genl.h>
 #include <netlink/genl/family.h>
 #include <netlink/genl/ctrl.h>
+#include <endian.h>
 
 #include "nl80211.h"
+#include "ieee80211.h"
 
 #define ETH_ALEN 6