]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
add HT attribute printing
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 14 Oct 2008 16:46:23 +0000 (18:46 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Tue, 14 Oct 2008 16:46:23 +0000 (18:46 +0200)
Still missing pretty-printing of the HT set though

info.c
nl80211.h

diff --git a/info.c b/info.c
index 5f24df2e455a76f9215fe4b644209e09ae64c500..ced78dd09c14a2e9b781d180c5ce3aba91c2d5ca 100644 (file)
--- a/info.c
+++ b/info.c
@@ -66,6 +66,74 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
                nla_parse(tb_band, NL80211_BAND_ATTR_MAX, nla_data(nl_band),
                          nla_len(nl_band), NULL);
 
+#ifdef NL80211_BAND_ATTR_HT_CAPA
+               if (tb_band[NL80211_BAND_ATTR_HT_CAPA]) {
+                       unsigned short cap = nla_get_u16(tb_band[NL80211_BAND_ATTR_HT_CAPA]);
+#define PCOM(fmt, args...) do { printf("\t\t\t * " fmt "\n", ##args); } while (0)
+#define PBCOM(bit, args...) if (cap & (bit)) PCOM(args)
+                       printf("\t\tHT capabilities: 0x%.4x\n", cap);
+                       PBCOM(0x0001, "LPDC coding");
+                       if (cap & 0x0002)
+                               PCOM("20/40 MHz operation");
+                       else
+                               PCOM("20 MHz operation");
+                       switch ((cap & 0x000c) >> 2) {
+                       case 0:
+                               PCOM("static SM PS");
+                               break;
+                       case 1:
+                               PCOM("dynamic SM PS");
+                               break;
+                       case 2:
+                               PCOM("reserved SM PS");
+                               break;
+                       case 3:
+                               PCOM("SM PS disabled");
+                               break;
+                       }
+                       PBCOM(0x0010, "HT-greenfield");
+                       PBCOM(0x0020, "20 MHz short GI");
+                       PBCOM(0x0040, "40 MHz short GI");
+                       PBCOM(0x0080, "TX STBC");
+                       if (cap & 0x300)
+                               PCOM("RX STBC %d streams", (cap & 0x0300) >> 8);
+                       PBCOM(0x0400, "HT-delayed block-ack");
+                       PCOM("max A-MSDU len %d", 0xeff + ((cap & 0x0800) << 1));
+                       PBCOM(0x1000, "DSSS/CCK 40 MHz");
+                       PBCOM(0x2000, "PSMP support");
+                       PBCOM(0x4000, "40 MHz intolerant");
+                       PBCOM(0x8000, "L-SIG TXOP protection support");
+               }
+               if (tb_band[NL80211_BAND_ATTR_HT_AMPDU_FACTOR]) {
+                       unsigned char factor = nla_get_u8(tb_band[NL80211_BAND_ATTR_HT_AMPDU_FACTOR]);
+                       printf("\t\tHT A-MPDU factor: 0x%.4x (%d bytes)\n", factor, (1<<(13+factor))-1);
+               }
+               if (tb_band[NL80211_BAND_ATTR_HT_AMPDU_DENSITY]) {
+                       unsigned char dens = nla_get_u8(tb_band[NL80211_BAND_ATTR_HT_AMPDU_DENSITY]);
+                       printf("\t\tHT A-MPDU density: 0x%.4x (", dens);
+                       switch (dens) {
+                       case 0:
+                               printf("no restriction)\n");
+                               break;
+                       case 1:
+                               printf("1/4 usec)\n");
+                               break;
+                       case 2:
+                               printf("1/2 usec)\n");
+                               break;
+                       default:
+                               printf("%d usec)\n", 1<<(dens - 3));
+                       }
+               }
+               if (tb_band[NL80211_BAND_ATTR_HT_MCS_SET] &&
+                   nla_len(tb_band[NL80211_BAND_ATTR_HT_MCS_SET]) == 16) {
+                       unsigned char *mcs = nla_data(tb_band[NL80211_BAND_ATTR_HT_MCS_SET]);
+                       printf("\t\tHT MCS set: %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x\n",
+                               mcs[0], mcs[1], mcs[2], mcs[3], mcs[4], mcs[5], mcs[6], mcs[7],
+                               mcs[8], mcs[9], mcs[10], mcs[11], mcs[12], mcs[13], mcs[14], mcs[15]);
+               }
+#endif
+
                printf("\t\tFrequencies:\n");
 
                nla_for_each_nested(nl_freq, tb_band[NL80211_BAND_ATTR_FREQS], rem_freq) {
index 9bad65400fba76cad80e742b3784adbd4ca50637..1470e452075a2281cfd8fa5dbfbd41cbdb36a92f 100644 (file)
--- a/nl80211.h
+++ b/nl80211.h
  *     to the the specified ISO/IEC 3166-1 alpha2 country code. The core will
  *     store this as a valid request and then query userspace for it.
  *
+ * @NL80211_CMD_GET_SCAN: get scan results
+ * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
+ * @NL80211_CMD_NEW_SCAN: scan notification (as a reply to NL80211_CMD_GET_SCAN
+ *     and on the "scan" multicast group)
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -148,6 +153,10 @@ enum nl80211_commands {
        NL80211_CMD_SET_REG,
        NL80211_CMD_REQ_SET_REG,
 
+       NL80211_CMD_GET_SCAN,
+       NL80211_CMD_TRIGGER_SCAN,
+       NL80211_CMD_NEW_SCAN,
+
        /* add new commands above here */
 
        /* used to define NL80211_CMD_MAX below */
@@ -242,6 +251,13 @@ enum nl80211_commands {
  *     supported interface types, each a flag attribute with the number
  *     of the interface mode.
  *
+ * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
+ *     a single scan request, a wiphy attribute.
+ *
+ * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies
+ * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs
+ * @NL80211_ATTR_BSS: scan result BSS
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -296,6 +312,13 @@ enum nl80211_attrs {
        NL80211_ATTR_REG_ALPHA2,
        NL80211_ATTR_REG_RULES,
 
+       NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
+
+       NL80211_ATTR_SCAN_FREQUENCIES,
+       NL80211_ATTR_SCAN_SSIDS,
+       NL80211_ATTR_SCAN_GENERATION,
+       NL80211_ATTR_BSS,
+
        /* add attributes here, update the policy in nl80211.c */
 
        __NL80211_ATTR_AFTER_LAST,
@@ -452,17 +475,29 @@ enum nl80211_mpath_info {
  *     an array of nested frequency attributes
  * @NL80211_BAND_ATTR_RATES: supported bitrates in this band,
  *     an array of nested bitrate attributes
+ * @NL80211_BAND_ATTR_HT_MCS_SET: 16-byte attribute containing the MCS set as
+ *     defined in 802.11n
+ * @NL80211_BAND_ATTR_HT_CAPA: HT capabilities, as in the HT information IE
+ * @NL80211_BAND_ATTR_HT_AMPDU_FACTOR: A-MPDU factor, as in 11n
+ * @NL80211_BAND_ATTR_HT_AMPDU_DENSITY: A-MPDU density, as in 11n
  */
 enum nl80211_band_attr {
        __NL80211_BAND_ATTR_INVALID,
        NL80211_BAND_ATTR_FREQS,
        NL80211_BAND_ATTR_RATES,
 
+       NL80211_BAND_ATTR_HT_MCS_SET,
+       NL80211_BAND_ATTR_HT_CAPA,
+       NL80211_BAND_ATTR_HT_AMPDU_FACTOR,
+       NL80211_BAND_ATTR_HT_AMPDU_DENSITY,
+
        /* keep last */
        __NL80211_BAND_ATTR_AFTER_LAST,
        NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1
 };
 
+#define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA
+
 /**
  * enum nl80211_frequency_attr - frequency attributes
  * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
@@ -594,4 +629,18 @@ enum nl80211_mntr_flags {
        NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1
 };
 
+enum nl80211_bss {
+       __NL80211_BSS_INVALID,
+       NL80211_BSS_BSSID,
+       NL80211_BSS_FREQUENCY,
+       NL80211_BSS_TSF,
+       NL80211_BSS_BEACON_INTERVAL,
+       NL80211_BSS_CAPABILITY,
+       NL80211_BSS_INFORMATION_ELEMENTS,
+
+       /* keep last */
+       __NL80211_BSS_AFTER_LAST,
+       NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1
+};
+
 #endif /* __LINUX_NL80211_H */