Skip to contentSkip to conversation

iw: print capability info for 60GHz band

PATCH Superseded Vladimir Kondratiev 2 participants 5 messages Dec 17, 2012 – Jan 4, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iw: print capability info for 60GHz band

Quoted 1 line

From cc320b6c4433b63f3b1641646a49c4540e8954d2 Mon Sep 17 00:00:00 2001

From: Vladimir Kondratiev <[email protected]>
Date: Mon, 17 Dec 2012 13:31:36 +0200
Subject: [PATCH] iw: print capability info for 60GHz band

On the 60GHz band, capability info defined different from .11n

Detect 11ad band by frequency; print accordingly

---
 scan.c |  105 ++++++++++++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 80 insertions(+), 25 deletions(-)
scan.c +80 -25
index 05bad0b..295a51c 100644
@@ -26,6 +26,21 @@
 #define WLAN_CAPABILITY_SHORT_SLOT_TIME	(1<<10)
 #define WLAN_CAPABILITY_APSD		(1<<11)
 #define WLAN_CAPABILITY_DSSS_OFDM	(1<<13)
+/* DMG (60gHz) 802.11ad */
+/* type - bits 0..1 */
+#define WLAN_CAPABILITY_DMG_TYPE_MASK		(3<<0)
+
+#define WLAN_CAPABILITY_DMG_TYPE_IBSS		(1<<0) /* Tx by: STA */
+#define WLAN_CAPABILITY_DMG_TYPE_PBSS		(2<<0) /* Tx by: PCP */
+#define WLAN_CAPABILITY_DMG_TYPE_AP		(3<<0) /* Tx by: AP */
+
+#define WLAN_CAPABILITY_DMG_CBAP_ONLY		(1<<2)
+#define WLAN_CAPABILITY_DMG_CBAP_SOURCE		(1<<3)
+#define WLAN_CAPABILITY_DMG_PRIVACY		(1<<4)
+#define WLAN_CAPABILITY_DMG_ECPAC		(1<<5)
+
+#define WLAN_CAPABILITY_DMG_SPECTRUM_MGMT	(1<<8)
+#define WLAN_CAPABILITY_DMG_RADIO_MEASURE	(1<<12)
 
 static unsigned char ms_oui[3]		= { 0x00, 0x50, 0xf2 };
 static unsigned char ieee80211_oui[3]	= { 0x00, 0x0f, 0xac };
@@ -1216,6 +1231,60 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
 	}
 }
 
+static void print_capa_11ad(__u16 capa)
+{
+	switch (capa & WLAN_CAPABILITY_DMG_TYPE_MASK) {
+	case WLAN_CAPABILITY_DMG_TYPE_AP:
+		printf(" DMG_ESS");
+		break;
+	case WLAN_CAPABILITY_DMG_TYPE_PBSS:
+		printf(" DMG_PCP");
+		break;
+	case WLAN_CAPABILITY_DMG_TYPE_IBSS:
+		printf(" DMG_IBSS");
+		break;
+	}
+
+	if (capa & WLAN_CAPABILITY_DMG_CBAP_ONLY)
+		printf(" CBAP_Only");
+	if (capa & WLAN_CAPABILITY_DMG_CBAP_SOURCE)
+		printf(" CBAP_Src");
+	if (capa & WLAN_CAPABILITY_DMG_PRIVACY)
+		printf(" Privacy");
+	if (capa & WLAN_CAPABILITY_DMG_ECPAC)
+		printf(" ECPAC");
+	if (capa & WLAN_CAPABILITY_DMG_SPECTRUM_MGMT)
+		printf(" SpectrumMgmt");
+	if (capa & WLAN_CAPABILITY_DMG_RADIO_MEASURE)
+		printf(" RadioMeasure");
+}
+
+static void print_capa_11n(__u16 capa)
+{
+	if (capa & WLAN_CAPABILITY_ESS)
+		printf(" ESS");
+	if (capa & WLAN_CAPABILITY_IBSS)
+		printf(" IBSS");
+	if (capa & WLAN_CAPABILITY_PRIVACY)
+		printf(" Privacy");
+	if (capa & WLAN_CAPABILITY_SHORT_PREAMBLE)
+		printf(" ShortPreamble");
+	if (capa & WLAN_CAPABILITY_PBCC)
+		printf(" PBCC");
+	if (capa & WLAN_CAPABILITY_CHANNEL_AGILITY)
+		printf(" ChannelAgility");
+	if (capa & WLAN_CAPABILITY_SPECTRUM_MGMT)
+		printf(" SpectrumMgmt");
+	if (capa & WLAN_CAPABILITY_QOS)
+		printf(" QoS");
+	if (capa & WLAN_CAPABILITY_SHORT_SLOT_TIME)
+		printf(" ShortSlotTime");
+	if (capa & WLAN_CAPABILITY_APSD)
+		printf(" APSD");
+	if (capa & WLAN_CAPABILITY_DSSS_OFDM)
+		printf(" DSSS-OFDM");
+}
+
 static int print_bss_handler(struct nl_msg *msg, void *arg)
 {
 	struct nlattr *tb[NL80211_ATTR_MAX + 1];
@@ -1237,6 +1306,7 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
 	};
 	struct scan_params *params = arg;
 	int show = params->show_both_ie_sets ? 2 : 1;
+	bool is_11ad = false;
 
 	nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
 		  genlmsg_attrlen(gnlh, 0), NULL);
@@ -1285,37 +1355,22 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
 			tsf, tsf/1000/1000/60/60/24, (tsf/1000/1000/60/60) % 24,
 			(tsf/1000/1000/60) % 60, (tsf/1000/1000) % 60);
 	}
-	if (bss[NL80211_BSS_FREQUENCY])
-		printf("\tfreq: %d\n",
-			nla_get_u32(bss[NL80211_BSS_FREQUENCY]));
+	if (bss[NL80211_BSS_FREQUENCY]) {
+		int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
+		printf("\tfreq: %d\n", freq);
+		if (freq > 45000)
+			is_11ad = true;
+	}
 	if (bss[NL80211_BSS_BEACON_INTERVAL])
 		printf("\tbeacon interval: %d\n",
 			nla_get_u16(bss[NL80211_BSS_BEACON_INTERVAL]));
 	if (bss[NL80211_BSS_CAPABILITY]) {
 		__u16 capa = nla_get_u16(bss[NL80211_BSS_CAPABILITY]);
 		printf("\tcapability:");
-		if (capa & WLAN_CAPABILITY_ESS)
-			printf(" ESS");
-		if (capa & WLAN_CAPABILITY_IBSS)
-			printf(" IBSS");
-		if (capa & WLAN_CAPABILITY_PRIVACY)
-			printf(" Privacy");
-		if (capa & WLAN_CAPABILITY_SHORT_PREAMBLE)
-			printf(" ShortPreamble");
-		if (capa & WLAN_CAPABILITY_PBCC)
-			printf(" PBCC");
-		if (capa & WLAN_CAPABILITY_CHANNEL_AGILITY)
-			printf(" ChannelAgility");
-		if (capa & WLAN_CAPABILITY_SPECTRUM_MGMT)
-			printf(" SpectrumMgmt");
-		if (capa & WLAN_CAPABILITY_QOS)
-			printf(" QoS");
-		if (capa & WLAN_CAPABILITY_SHORT_SLOT_TIME)
-			printf(" ShortSlotTime");
-		if (capa & WLAN_CAPABILITY_APSD)
-			printf(" APSD");
-		if (capa & WLAN_CAPABILITY_DSSS_OFDM)
-			printf(" DSSS-OFDM");
+		if (is_11ad)
+			print_capa_11ad(capa);
+		else
+			print_capa_11n(capa);
 		printf(" (0x%.4x)\n", capa);
 	}
 	if (bss[NL80211_BSS_SIGNAL_MBM]) {
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 iw: print all capability bits

To continue with capability: not all bits from .11n printed as well. Patch below adds missing bits.

I'll prepare patch for kernel with the #define's as well

Quoted 1 line

From 9f7b0078e7008e1735d980a4bb583efd2321d9ed Mon Sep 17 00:00:00 2001

From: Vladimir Kondratiev <[email protected]>
Date: Mon, 17 Dec 2012 15:26:47 +0200
Subject: [PATCH] iw: print all capability bits

Print all bits from capability info, as defined in the IEEE802.11-2012

---
 scan.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)
scan.c +13 -0
index 295a51c..a07f16a 100644
@@ -25,7 +25,10 @@
 #define WLAN_CAPABILITY_QOS		(1<<9)
 #define WLAN_CAPABILITY_SHORT_SLOT_TIME	(1<<10)
 #define WLAN_CAPABILITY_APSD		(1<<11)
+#define WLAN_CAPABILITY_RADIO_MEASURE	(1<<12)
 #define WLAN_CAPABILITY_DSSS_OFDM	(1<<13)
+#define WLAN_CAPABILITY_DEL_BACK	(1<<14)
+#define WLAN_CAPABILITY_IMM_BACK	(1<<15)
 /* DMG (60gHz) 802.11ad */
 /* type - bits 0..1 */
 #define WLAN_CAPABILITY_DMG_TYPE_MASK		(3<<0)
@@ -1265,6 +1268,10 @@ static void print_capa_11n(__u16 capa)
 		printf(" ESS");
 	if (capa & WLAN_CAPABILITY_IBSS)
 		printf(" IBSS");
+	if (capa & WLAN_CAPABILITY_CF_POLLABLE)
+		printf(" CfPollable");
+	if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
+		printf(" CfPollReq");
 	if (capa & WLAN_CAPABILITY_PRIVACY)
 		printf(" Privacy");
 	if (capa & WLAN_CAPABILITY_SHORT_PREAMBLE)
@@ -1281,8 +1288,14 @@ static void print_capa_11n(__u16 capa)
 		printf(" ShortSlotTime");
 	if (capa & WLAN_CAPABILITY_APSD)
 		printf(" APSD");
+	if (capa & WLAN_CAPABILITY_RADIO_MEASURE)
+		printf(" RadioMeasure");
 	if (capa & WLAN_CAPABILITY_DSSS_OFDM)
 		printf(" DSSS-OFDM");
+	if (capa & WLAN_CAPABILITY_DEL_BACK)
+		printf(" DelayedBACK");
+	if (capa & WLAN_CAPABILITY_IMM_BACK)
+		printf(" ImmediateBACK");
 }
 
 static int print_bss_handler(struct nl_msg *msg, void *arg)
Signature · 1 line
1.7.10.4
#2 lore raw
In reply to Vladimir Kondratiev
Quoted 6 lines · Vladimir Kondratiev

From cc320b6c4433b63f3b1641646a49c4540e8954d2 Mon Sep 17 00:00:00 2001
From: Vladimir Kondratiev <[email protected]>
Date: Mon, 17 Dec 2012 13:31:36 +0200
Subject: [PATCH] iw: print capability info for 60GHz band

On the 60GHz band, capability info defined different from .11n

I would prefer you didn't use "11ad" or "11n", in particular not "11n", it hasn't existed for quite a while now.

Also, the 2.4/5ghz capability bits really have nothing to do with 11n anyway.

johannes

#3 lore raw

PATCH v2 1/1 iw: print capability info for DMG (60GHz band)

Quoted 8 lines · Johannes Berg
Quoted 6 lines · Vladimir Kondratiev

From cc320b6c4433b63f3b1641646a49c4540e8954d2 Mon Sep 17 00:00:00 2001
From: Vladimir Kondratiev <[email protected]>
Date: Mon, 17 Dec 2012 13:31:36 +0200
Subject: [PATCH] iw: print capability info for 60GHz band

On the 60GHz band, capability info defined different from .11n

Quoted 7 lines

I would prefer you didn't use "11ad" or "11n", in particular not "11n", it hasn't existed for quite a while now.

Also, the 2.4/5ghz capability bits really have nothing to do with 11n anyway.

johannes

Well, agree, I rephrased. Also, squash these 2:

[PATCH] iw: print capability info for 60GHz band
[PATCH] iw: print all capability bits

Combined patch follows

Quoted 1 line

From e79a5515929c6d4cab691e96e51f2616d7602240 Mon Sep 17 00:00:00 2001

From: Vladimir Kondratiev <[email protected]>
Date: Mon, 17 Dec 2012 13:31:36 +0200
Subject: [PATCH v2] iw: print capability info for DMG (60GHz band)

On the DMG (Directed Multi-Gigabit) aka 60GHz band, capability info defined by the 802.11ad spec differently from non-DMG one

Detect DMG band by frequency, spec says DMG if above 45 GHz; parse and print accordingly

For the non-DMG capability info, add more bits as defined in the IEEE802.11-2012

---
 scan.c |  118 ++++++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 93 insertions(+), 25 deletions(-)
scan.c +93 -25
index 05bad0b..2188166 100644
@@ -25,7 +25,25 @@
 #define WLAN_CAPABILITY_QOS		(1<<9)
 #define WLAN_CAPABILITY_SHORT_SLOT_TIME	(1<<10)
 #define WLAN_CAPABILITY_APSD		(1<<11)
+#define WLAN_CAPABILITY_RADIO_MEASURE	(1<<12)
 #define WLAN_CAPABILITY_DSSS_OFDM	(1<<13)
+#define WLAN_CAPABILITY_DEL_BACK	(1<<14)
+#define WLAN_CAPABILITY_IMM_BACK	(1<<15)
+/* DMG (60gHz) 802.11ad */
+/* type - bits 0..1 */
+#define WLAN_CAPABILITY_DMG_TYPE_MASK		(3<<0)
+
+#define WLAN_CAPABILITY_DMG_TYPE_IBSS		(1<<0) /* Tx by: STA */
+#define WLAN_CAPABILITY_DMG_TYPE_PBSS		(2<<0) /* Tx by: PCP */
+#define WLAN_CAPABILITY_DMG_TYPE_AP		(3<<0) /* Tx by: AP */
+
+#define WLAN_CAPABILITY_DMG_CBAP_ONLY		(1<<2)
+#define WLAN_CAPABILITY_DMG_CBAP_SOURCE		(1<<3)
+#define WLAN_CAPABILITY_DMG_PRIVACY		(1<<4)
+#define WLAN_CAPABILITY_DMG_ECPAC		(1<<5)
+
+#define WLAN_CAPABILITY_DMG_SPECTRUM_MGMT	(1<<8)
+#define WLAN_CAPABILITY_DMG_RADIO_MEASURE	(1<<12)
 
 static unsigned char ms_oui[3]		= { 0x00, 0x50, 0xf2 };
 static unsigned char ieee80211_oui[3]	= { 0x00, 0x0f, 0xac };
@@ -1216,6 +1234,70 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
 	}
 }
 
+static void print_capa_dmg(__u16 capa)
+{
+	switch (capa & WLAN_CAPABILITY_DMG_TYPE_MASK) {
+	case WLAN_CAPABILITY_DMG_TYPE_AP:
+		printf(" DMG_ESS");
+		break;
+	case WLAN_CAPABILITY_DMG_TYPE_PBSS:
+		printf(" DMG_PCP");
+		break;
+	case WLAN_CAPABILITY_DMG_TYPE_IBSS:
+		printf(" DMG_IBSS");
+		break;
+	}
+
+	if (capa & WLAN_CAPABILITY_DMG_CBAP_ONLY)
+		printf(" CBAP_Only");
+	if (capa & WLAN_CAPABILITY_DMG_CBAP_SOURCE)
+		printf(" CBAP_Src");
+	if (capa & WLAN_CAPABILITY_DMG_PRIVACY)
+		printf(" Privacy");
+	if (capa & WLAN_CAPABILITY_DMG_ECPAC)
+		printf(" ECPAC");
+	if (capa & WLAN_CAPABILITY_DMG_SPECTRUM_MGMT)
+		printf(" SpectrumMgmt");
+	if (capa & WLAN_CAPABILITY_DMG_RADIO_MEASURE)
+		printf(" RadioMeasure");
+}
+
+static void print_capa_non_dmg(__u16 capa)
+{
+	if (capa & WLAN_CAPABILITY_ESS)
+		printf(" ESS");
+	if (capa & WLAN_CAPABILITY_IBSS)
+		printf(" IBSS");
+	if (capa & WLAN_CAPABILITY_CF_POLLABLE)
+		printf(" CfPollable");
+	if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
+		printf(" CfPollReq");
+	if (capa & WLAN_CAPABILITY_PRIVACY)
+		printf(" Privacy");
+	if (capa & WLAN_CAPABILITY_SHORT_PREAMBLE)
+		printf(" ShortPreamble");
+	if (capa & WLAN_CAPABILITY_PBCC)
+		printf(" PBCC");
+	if (capa & WLAN_CAPABILITY_CHANNEL_AGILITY)
+		printf(" ChannelAgility");
+	if (capa & WLAN_CAPABILITY_SPECTRUM_MGMT)
+		printf(" SpectrumMgmt");
+	if (capa & WLAN_CAPABILITY_QOS)
+		printf(" QoS");
+	if (capa & WLAN_CAPABILITY_SHORT_SLOT_TIME)
+		printf(" ShortSlotTime");
+	if (capa & WLAN_CAPABILITY_APSD)
+		printf(" APSD");
+	if (capa & WLAN_CAPABILITY_RADIO_MEASURE)
+		printf(" RadioMeasure");
+	if (capa & WLAN_CAPABILITY_DSSS_OFDM)
+		printf(" DSSS-OFDM");
+	if (capa & WLAN_CAPABILITY_DEL_BACK)
+		printf(" DelayedBACK");
+	if (capa & WLAN_CAPABILITY_IMM_BACK)
+		printf(" ImmediateBACK");
+}
+
 static int print_bss_handler(struct nl_msg *msg, void *arg)
 {
 	struct nlattr *tb[NL80211_ATTR_MAX + 1];
@@ -1237,6 +1319,7 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
 	};
 	struct scan_params *params = arg;
 	int show = params->show_both_ie_sets ? 2 : 1;
+	bool is_dmg = false;
 
 	nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
 		  genlmsg_attrlen(gnlh, 0), NULL);
@@ -1285,37 +1368,22 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
 			tsf, tsf/1000/1000/60/60/24, (tsf/1000/1000/60/60) % 24,
 			(tsf/1000/1000/60) % 60, (tsf/1000/1000) % 60);
 	}
-	if (bss[NL80211_BSS_FREQUENCY])
-		printf("\tfreq: %d\n",
-			nla_get_u32(bss[NL80211_BSS_FREQUENCY]));
+	if (bss[NL80211_BSS_FREQUENCY]) {
+		int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
+		printf("\tfreq: %d\n", freq);
+		if (freq > 45000)
+			is_dmg = true;
+	}
 	if (bss[NL80211_BSS_BEACON_INTERVAL])
 		printf("\tbeacon interval: %d\n",
 			nla_get_u16(bss[NL80211_BSS_BEACON_INTERVAL]));
 	if (bss[NL80211_BSS_CAPABILITY]) {
 		__u16 capa = nla_get_u16(bss[NL80211_BSS_CAPABILITY]);
 		printf("\tcapability:");
-		if (capa & WLAN_CAPABILITY_ESS)
-			printf(" ESS");
-		if (capa & WLAN_CAPABILITY_IBSS)
-			printf(" IBSS");
-		if (capa & WLAN_CAPABILITY_PRIVACY)
-			printf(" Privacy");
-		if (capa & WLAN_CAPABILITY_SHORT_PREAMBLE)
-			printf(" ShortPreamble");
-		if (capa & WLAN_CAPABILITY_PBCC)
-			printf(" PBCC");
-		if (capa & WLAN_CAPABILITY_CHANNEL_AGILITY)
-			printf(" ChannelAgility");
-		if (capa & WLAN_CAPABILITY_SPECTRUM_MGMT)
-			printf(" SpectrumMgmt");
-		if (capa & WLAN_CAPABILITY_QOS)
-			printf(" QoS");
-		if (capa & WLAN_CAPABILITY_SHORT_SLOT_TIME)
-			printf(" ShortSlotTime");
-		if (capa & WLAN_CAPABILITY_APSD)
-			printf(" APSD");
-		if (capa & WLAN_CAPABILITY_DSSS_OFDM)
-			printf(" DSSS-OFDM");
+		if (is_dmg)
+			print_capa_dmg(capa);
+		else
+			print_capa_non_dmg(capa);
 		printf(" (0x%.4x)\n", capa);
 	}
 	if (bss[NL80211_BSS_SIGNAL_MBM]) {
Signature · 1 line
1.7.10.4
#4 lore raw

Re: [PATCH v2] iw: print capability info for DMG (60GHz band)

Quoted 29 lines · Vladimir Kondratiev
Quoted 8 lines · Johannes Berg
Quoted 6 lines · Vladimir Kondratiev

From cc320b6c4433b63f3b1641646a49c4540e8954d2 Mon Sep 17 00:00:00 2001
From: Vladimir Kondratiev <[email protected]>
Date: Mon, 17 Dec 2012 13:31:36 +0200
Subject: [PATCH] iw: print capability info for 60GHz band

On the 60GHz band, capability info defined different from .11n

Quoted 7 lines

I would prefer you didn't use "11ad" or "11n", in particular not "11n", it hasn't existed for quite a while now.

Also, the 2.4/5ghz capability bits really have nothing to do with 11n anyway.

johannes

Well, agree, I rephrased. Also, squash these 2:

[PATCH] iw: print capability info for 60GHz band
[PATCH] iw: print all capability bits

Combined patch follows

From e79a5515929c6d4cab691e96e51f2616d7602240 Mon Sep 17 00:00:00 2001
From: Vladimir Kondratiev <[email protected]>
Date: Mon, 17 Dec 2012 13:31:36 +0200
Subject: [PATCH v2] iw: print capability info for DMG (60GHz band)

Quoted 8 lines

On the DMG (Directed Multi-Gigabit) aka 60GHz band, capability info defined by the 802.11ad spec differently from non-DMG one

Detect DMG band by frequency, spec says DMG if above 45 GHz; parse and print accordingly

For the non-DMG capability info, add more bits as defined in the IEEE802.11-2012

Applied, thanks.

johannes