Skip to contentSkip to conversation

iw: Sync nl80211.h with wireless-testing

PATCH In review Bruno Randolf 2 participants 9 messages Jul 27, 2010 – Jul 29, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 iw: Sync nl80211.h with wireless-testing

Adding antenna attributes.

---
 nl80211.h |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
nl80211.h +17 -0
index 2c87016..b9de53c 100644
@@ -731,6 +731,20 @@ enum nl80211_commands {
  *      This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING
  *      for non-automatic settings.
  *
+ * @NL80211_ATTR_WIPHY_ANTENNA_TX: Bitmap of allowed antennas for transmitting.
+ *	Each bit represents one antenna, starting with antenna 1 at the first
+ *	bit. If the bitmap is zero (0), the TX antenna follows RX diversity.
+ *	If multiple antennas are selected all selected antennas have to be used
+ *	for transmitting (801.11n multiple TX chains).
+ *	Drivers may reject configurations they cannot support.
+ *
+ * @NL80211_ATTR_WIPHY_ANTENNA_RX: Bitmap of allowed antennas for receiving.
+ *	Each bit represents one antenna, starting with antenna 1 at the first
+ *	bit. If multiple antennas are selected in the bitmap, 802.11n devices
+ *	should use multiple RX chains on these antennas, while non-802.11n
+ *	drivers should use antenna diversity between these antennas.
+ *	Drivers may reject configurations they cannot support.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -891,6 +905,9 @@ enum nl80211_attrs {
 	NL80211_ATTR_WIPHY_TX_POWER_SETTING,
 	NL80211_ATTR_WIPHY_TX_POWER_LEVEL,
 
+	NL80211_ATTR_WIPHY_ANTENNA_TX,
+	NL80211_ATTR_WIPHY_ANTENNA_RX,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
#1 lore raw

PATCH 2/2 iw: Add antenna configuration commands

Add command to set the antenna configuration (iw phyX set antenna ...) and include antenna setting in wiphy information (iw phyX info).

---
 info.c |    7 +++++++
 phy.c  |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 0 deletions(-)
info.c +7 -0
index 512e777..dc987c7 100644
@@ -167,6 +167,13 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
 		printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage);
 	}
 
+	if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
+	    tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
+		printf("\tAntenna: TX %d RX %d\n",
+		       nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX]),
+		       nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]));
+	}
+
 	if (!tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES])
 		goto commands;
 
phy.c +46 -0

49 lines not on this page · raw message

#2 lore raw

Re: [PATCH 2/2] iw: Add antenna configuration commands

info.c static int print_phy_handler(struct nl_msg *msg, void *arg) · line 174

Quoted 5 lines · Bruno Randolf
info.c +5 -0
+	if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
+	    tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
+		printf("\tAntenna: TX %d RX %d\n",
+		       nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX]),
+		       nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]));

That's like the worst possible way to show the info.

johannes

#3 lore raw

Re: [PATCH 2/2] iw: Add antenna configuration commands

Quoted 8 lines · On Tue July 27 2010 19:04:21 Johannes Berg wrote:

info.c static int print_phy_handler(struct nl_msg *msg, void *arg) · line 174

Quoted 5 lines · Bruno Randolf
info.c +5 -0
+	if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
+	    tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
+		printf("\tAntenna: TX %d RX %d\n",
+		       nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX]),
+		       nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]));

That's like the worst possible way to show the info.

which way would you prefer?

bruno

#4 lore raw

Re: [PATCH 2/2] iw: Add antenna configuration commands

Quoted 11 lines · Bruno Randolf
Quoted 8 lines · On Tue July 27 2010 19:04:21 Johannes Berg wrote:

info.c static int print_phy_handler(struct nl_msg *msg, void *arg) · line 174

Quoted 5 lines · Bruno Randolf
info.c +5 -0
+	if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
+	    tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
+		printf("\tAntenna: TX %d RX %d\n",
+		       nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX]),
+		       nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]));

That's like the worst possible way to show the info.

which way would you prefer?

It occurred to me later that with the normal numbers we have (1 through
7) it won't matter much ... but still, I'd prefer %#x.

johannes

#5 lore raw

Re: [PATCH 2/2] iw: Add antenna configuration commands

Quoted 11 lines · On Wed July 28 2010 15:50:48 Johannes Berg wrote:
Quoted 10 lines · Bruno Randolf
Quoted 8 lines · On Tue July 27 2010 19:04:21 Johannes Berg wrote:

info.c static int print_phy_handler(struct nl_msg *msg, void *arg) · line 174

Quoted 5 lines · Bruno Randolf
info.c +5 -0
+	if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
+	    tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
+		printf("\tAntenna: TX %d RX %d\n",
+		       nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX]),
+		       nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]));

That's like the worst possible way to show the info.

Quoted 4 lines
Quoted 1 line

which way would you prefer?

It occurred to me later that with the normal numbers we have (1 through
7) it won't matter much ... but still, I'd prefer %#x.

ok. changed that and the command line parsing to use "strtoul(argv[1], &end, 0)" so we can use hex, decimal or octal for the setting. i will resend the patches once a consensus is reached (or after an unspecified timeout ;)).

bruno

#6 lore raw

Re: [PATCH 2/2] iw: Add antenna configuration commands

Quoted 12 lines · On Wed July 28 2010 17:29:38 Bruno Randolf wrote:
Quoted 11 lines · On Wed July 28 2010 15:50:48 Johannes Berg wrote:
Quoted 10 lines · Bruno Randolf
Quoted 8 lines · On Tue July 27 2010 19:04:21 Johannes Berg wrote:

info.c static int print_phy_handler(struct nl_msg *msg, void *arg) · line 174

Quoted 5 lines · Bruno Randolf
info.c +5 -0
+	if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
+	    tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
+		printf("\tAntenna: TX %d RX %d\n",
+		       nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_TX]),
+		       nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_ANTENNA_RX]));

That's like the worst possible way to show the info.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

which way would you prefer?

It occurred to me later that with the normal numbers we have (1 through
7) it won't matter much ... but still, I'd prefer %#x.

ok. changed that...

actually - no. what sense does it make to use a hexadecimal notation and print 0x for values between 0 and 7?

bruno

#7 lore raw

Re: [PATCH 2/2] iw: Add antenna configuration commands

Quoted 2 lines · Bruno Randolf

actually - no. what sense does it make to use a hexadecimal notation and print 0x for values between 0 and 7?

Well ... 11n does define mimo 4x4.

johannes

#8 lore raw

Re: [PATCH 2/2] iw: Add antenna configuration commands

Quoted 5 lines · On Thu July 29 2010 16:49:05 Johannes Berg wrote:
Quoted 2 lines · Bruno Randolf

actually - no. what sense does it make to use a hexadecimal notation and print 0x for values between 0 and 7?

Well ... 11n does define mimo 4x4.

oh, yes, true: 0xf

bruno