Skip to contentSkip to conversation

mac80211: give burst time in txop rather than 0.1msec units

PATCH In review Johannes Berg 5 participants 10 messages Feb 11, 2008 – Feb 13, 2008

Subsystems (2)
lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH v2 1/1 mac80211: give burst time in txop rather than 0.1msec units

This changes mac80211 to pass the burst time to conf_tx in txop units rather than 0.1msec units. 0.1msec units are only required by atheros hardware (according to current driver support), all other drivers do other calculations or require the txop value. Therefore, it results in fewer calculations and more precision if we just pass the txop value through to the driver.

---
Michael (Wu), the p54 driver has some values that differ from the 802.11 spec, is that intentional?

Changes since v1:
* Fix p54 +1 that was for integer division only, thanks goes to Tomas for pointing that out.
* CC linux-wireless

 drivers/net/wireless/iwlwifi/iwl3945-base.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl4965-base.c |    2 +-
 drivers/net/wireless/p54common.c            |   21 +++++++++++++--------
 include/net/mac80211.h                      |   12 ++++++------
 net/mac80211/ieee80211_sta.c                |   11 ++++++-----
 5 files changed, 27 insertions(+), 21 deletions(-)
include/net/mac80211.h +6 -6
@@ -89,19 +89,19 @@ struct ieee80211_ht_bss_info {
  * struct ieee80211_tx_queue_params - transmit queue configuration
  *
  * The information provided in this structure is required for QoS
- * transmit queue configuration.
+ * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
  *
  * @aifs: arbitration interface space [0..255, -1: use default]
  * @cw_min: minimum contention window [will be a value of the form
  *	2^n-1 in the range 1..1023; 0: use default]
  * @cw_max: maximum contention window [like @cw_min]
- * @burst_time: maximum burst time in units of 0.1ms, 0 meaning disabled
+ * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
  */
 struct ieee80211_tx_queue_params {
-	int aifs;
-	int cw_min;
-	int cw_max;
-	int burst_time;
+	s16 aifs;
+	u16 cw_min;
+	u16 cw_max;
+	u16 txop;
 };
 
 /**
net/mac80211/ieee80211_sta.c +6 -5
@@ -297,12 +297,13 @@ static void ieee80211_sta_wmm_params(str
 		params.aifs = pos[0] & 0x0f;
 		params.cw_max = ecw2cw((pos[1] & 0xf0) >> 4);
 		params.cw_min = ecw2cw(pos[1] & 0x0f);
-		/* TXOP is in units of 32 usec; burst_time in 0.1 ms */
-		params.burst_time = (pos[2] | (pos[3] << 8)) * 32 / 100;
+		params.txop = pos[2] | (pos[3] << 8);
+#ifdef CONFIG_MAC80211_DEBUG
 		printk(KERN_DEBUG "%s: WMM queue=%d aci=%d acm=%d aifs=%d "
-		       "cWmin=%d cWmax=%d burst=%d\n",
+		       "cWmin=%d cWmax=%d txop=%d\n",
 		       dev->name, queue, aci, acm, params.aifs, params.cw_min,
-		       params.cw_max, params.burst_time);
+		       params.cw_max, params.txop);
+#endif
 		/* TODO: handle ACM (block TX, fallback to next lowest allowed
 		 * AC for now) */
 		if (local->ops->conf_tx(local_to_hw(local), queue, &params)) {
@@ -3229,7 +3230,7 @@ int ieee80211_sta_set_ssid(struct net_de
 			qparam.cw_min = 15;
 
 		qparam.cw_max = 1023;
-		qparam.burst_time = 0;
+		qparam.txop = 0;
 
 		for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++)
 			local->ops->conf_tx(local_to_hw(local),
drivers/net/wireless/p54common.c +13 -8
@@ -759,13 +759,12 @@ static int p54_set_leds(struct ieee80211
 	return 0;
 }
 
-#define P54_SET_QUEUE(queue, ai_fs, cw_min, cw_max, burst)	\
+#define P54_SET_QUEUE(queue, ai_fs, cw_min, cw_max, _txop)	\
 do {	 							\
 	queue.aifs = cpu_to_le16(ai_fs);			\
 	queue.cwmin = cpu_to_le16(cw_min);			\
 	queue.cwmax = cpu_to_le16(cw_max);			\
-	queue.txop = (burst == 0) ? 				\
-		0 : cpu_to_le16((burst * 100) / 32 + 1);	\
+	queue.txop = cpu_to_le16(_txop);			\
 } while(0)
 
 static void p54_init_vdcf(struct ieee80211_hw *dev)
@@ -783,10 +782,16 @@ static void p54_init_vdcf(struct ieee802
 
 	vdcf = (struct p54_tx_control_vdcf *) hdr->data;
 
-	P54_SET_QUEUE(vdcf->queue[0], 0x0002, 0x0003, 0x0007, 0x000f);
-	P54_SET_QUEUE(vdcf->queue[1], 0x0002, 0x0007, 0x000f, 0x001e);
-	P54_SET_QUEUE(vdcf->queue[2], 0x0002, 0x000f, 0x03ff, 0x0014);
-	P54_SET_QUEUE(vdcf->queue[3], 0x0007, 0x000f, 0x03ff, 0x0000);
+	/*
+	 * FIXME: The default values in the spec (IEEE 802.11
+	 *	  7.3.2.19 Table 37) are 47, 94, 0, 0, why use
+	 *	  47, 94, 63, 0 here? Also, the default AIFS
+	 *	  values (second parameter) are 2, 2, 3, 7...
+	 */
+	P54_SET_QUEUE(vdcf->queue[0], 0x0002, 0x0003, 0x0007, 47);
+	P54_SET_QUEUE(vdcf->queue[1], 0x0002, 0x0007, 0x000f, 94);
+	P54_SET_QUEUE(vdcf->queue[2], 0x0002, 0x000f, 0x03ff, 63);
+	P54_SET_QUEUE(vdcf->queue[3], 0x0007, 0x000f, 0x03ff, 0);
 }
 
 static void p54_set_vdcf(struct ieee80211_hw *dev)
@@ -939,7 +944,7 @@ static int p54_conf_tx(struct ieee80211_
 
 	if ((params) && !((queue < 0) || (queue > 4))) {
 		P54_SET_QUEUE(vdcf->queue[queue], params->aifs,
-			params->cw_min, params->cw_max, params->burst_time);
+			params->cw_min, params->cw_max, params->txop);
 	} else
 		return -EINVAL;
 
drivers/net/wireless/iwlwifi/iwl3945-base.c +1 -1
@@ -7437,7 +7437,7 @@ static int iwl3945_mac_conf_tx(struct ie
 	priv->qos_data.def_qos_parm.ac[q].cw_max = cpu_to_le16(params->cw_max);
 	priv->qos_data.def_qos_parm.ac[q].aifsn = params->aifs;
 	priv->qos_data.def_qos_parm.ac[q].edca_txop =
-			cpu_to_le16((params->burst_time * 100));
+			cpu_to_le16((params->txop * 32));
 
 	priv->qos_data.def_qos_parm.ac[q].reserved1 = 0;
 	priv->qos_data.qos_active = 1;
drivers/net/wireless/iwlwifi/iwl4965-base.c +1 -1
@@ -7915,7 +7915,7 @@ static int iwl4965_mac_conf_tx(struct ie
 	priv->qos_data.def_qos_parm.ac[q].cw_max = cpu_to_le16(params->cw_max);
 	priv->qos_data.def_qos_parm.ac[q].aifsn = params->aifs;
 	priv->qos_data.def_qos_parm.ac[q].edca_txop =
-			cpu_to_le16((params->burst_time * 100));
+			cpu_to_le16((params->txop * 32));
 
 	priv->qos_data.def_qos_parm.ac[q].reserved1 = 0;
 	priv->qos_data.qos_active = 1;
Acked-by on v2 1/1
#1 lore raw

Review

Quoted 10 lines · On Sunday 10 February 2008 16:49:38 Johannes Berg wrote:

Michael (Wu), the p54 driver has some values that differ from the 802.11 spec, is that intentional?

(quoted diff) +6 -0
+	/*
+	 * FIXME: The default values in the spec (IEEE 802.11
+	 *	  7.3.2.19 Table 37) are 47, 94, 0, 0, why use
+	 *	  47, 94, 63, 0 here? Also, the default AIFS
+	 *	  values (second parameter) are 2, 2, 3, 7...
+	 */

Well, these values are the defaults of the original driver from conexant. As far as I know it has something to do with the "proprietary" frameburst feature (aka PRISM NITRO)...

So on-topic: IEEE 802.11 defaults are fine. Drop the "FIXME".

Review

Quoted 4 lines
(quoted diff) +4 -0
+	P54_SET_QUEUE(vdcf->queue[0], 0x0002, 0x0003, 0x0007, 47);
+	P54_SET_QUEUE(vdcf->queue[1], 0x0002, 0x0007, 0x000f, 94);
+	P54_SET_QUEUE(vdcf->queue[2], 0x0003, 0x000f, 0x03ff, 0);
+	P54_SET_QUEUE(vdcf->queue[3], 0x0007, 0x000f, 0x03ff, 0);

and off-topic: please merge another older patch. (see attachment)

Quoted 8 lines

Re: [PATCH split 4/8] fix 'and' typo's in wireless/p54common
Date: 26.10.2007 22:13
From: Roel Kluin <[email protected]>
To: [email protected]

      Fix priority mistakes similar to '!x & y' in wireless/p54common

drivers/net/wireless/p54common.c +1 -1
index 1437db0..8ee1453 100644
@@ -374,7 +374,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
 			if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0)
 				pad = entry_data->align[0];
 
-			if (!status.control.flags & IEEE80211_TXCTL_NO_ACK) {
+			if (!(status.control.flags & IEEE80211_TXCTL_NO_ACK)) {
 				if (!(payload->status & 0x01))
 					status.flags |= IEEE80211_TX_STATUS_ACK;
 				else
author maintainer
#2 lore raw
Quoted 11 lines

Review

Quoted 7 lines
(quoted diff) +6 -0
+	/*
+	 * FIXME: The default values in the spec (IEEE 802.11
+	 *	  7.3.2.19 Table 37) are 47, 94, 0, 0, why use
+	 *	  47, 94, 63, 0 here? Also, the default AIFS
+	 *	  values (second parameter) are 2, 2, 3, 7...
+	 */

Well, these values are the defaults of the original driver from conexant. As far as I know it has something to do with the "proprietary" frameburst feature (aka PRISM NITRO)...

Quoted 1 line

So on-topic: IEEE 802.11 defaults are fine. Drop the "FIXME".

Can you please submit a new patch to do this? This patch intends to not change behaviour in any way except where making values more accurate because fewer calculations are performed.

johannes

#3 lore raw

PATCH 1/1 p54: use IEEE 802.11e defaults for initialization

This trival one-liner changes the QoS initialization values to match IEEE 802.11e defaults.

---
Johannes:
Which tree do you want? I made two versions.
1. ...-2.6.24.2.diff will be fine for the mainline and the everything branch.
2. ...-txoppatch.diff is made for "[PATCH v2] mac80211: give burst time in txop rather than 0.1msec units" (with some offset?!)

drivers/net/wireless/p54common.c renamed from drivers/net/wireless/p54common.c.orig +1 -1
@@ -742,7 +742,7 @@ static void p54_init_vdcf(struct ieee802
 
 	P54_SET_QUEUE(vdcf->queue[0], 0x0002, 0x0003, 0x0007, 0x000f);
 	P54_SET_QUEUE(vdcf->queue[1], 0x0002, 0x0007, 0x000f, 0x001e);
-	P54_SET_QUEUE(vdcf->queue[2], 0x0002, 0x000f, 0x03ff, 0x0014);
+	P54_SET_QUEUE(vdcf->queue[2], 0x0003, 0x000f, 0x03ff, 0x0000);
 	P54_SET_QUEUE(vdcf->queue[3], 0x0007, 0x000f, 0x03ff, 0x0000);
 }
 
drivers/net/wireless/p54common.c renamed from drivers/net/wireless/p54common.c.orig +1 -7
@@ -740,15 +740,9 @@ static void p54_init_vdcf(struct ieee802
 
 	vdcf = (struct p54_tx_control_vdcf *) hdr->data;
 
-	/*
-	 * FIXME: The default values in the spec (IEEE 802.11
-	 *	  7.3.2.19 Table 37) are 47, 94, 0, 0, why use
-	 *	  47, 94, 63, 0 here? Also, the default AIFS
-	 *	  values (second parameter) are 2, 2, 3, 7...
-	 */
 	P54_SET_QUEUE(vdcf->queue[0], 0x0002, 0x0003, 0x0007, 47);
 	P54_SET_QUEUE(vdcf->queue[1], 0x0002, 0x0007, 0x000f, 94);
-	P54_SET_QUEUE(vdcf->queue[2], 0x0002, 0x000f, 0x03ff, 63);
+	P54_SET_QUEUE(vdcf->queue[2], 0x0003, 0x000f, 0x03ff, 0);
 	P54_SET_QUEUE(vdcf->queue[3], 0x0007, 0x000f, 0x03ff, 0);
 }
 
author maintainer Acked-by on v1 1/1
#4 lore raw

Re: [PATCH] p54: use IEEE 802.11e defaults for initialization

Quoted 4 lines · Christian Lamparter

This trival one-liner changes the QoS initialization values to match IEEE 802.11e defaults.

Quoted 4 lines

Which tree do you want? I made two versions.
1. ...-2.6.24.2.diff will be fine for the mainline and the everything branch.
2. ...-txoppatch.diff is made for "[PATCH v2] mac80211: give burst time in txop rather than 0.1msec units" (with some offset?!)

I'd prefer the second version since you made it already so I don't have to respin the other patch.

johannes

#5 lore raw
In reply to Johannes Berg
Quoted 3 lines · On Tuesday 12 February 2008 12:31:40 Johannes Berg wrote:
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+	/*
+	 * FIXME: The default values in the spec (IEEE 802.11
+	 *	  7.3.2.19 Table 37) are 47, 94, 0, 0, why use

Does somebody know the correct place where these values are in the specs? Section 7.3.2.19 is about "Supported channels IE".

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(quoted diff) +3 -0
+	 *	  47, 94, 63, 0 here? Also, the default AIFS
+	 *	  values (second parameter) are 2, 2, 3, 7...
+	 */
Signature · 1 line
Greetings Michael.
#6 lore raw
Quoted 14 lines · Michael Buesch
Quoted 3 lines · On Tuesday 12 February 2008 12:31:40 Johannes Berg wrote:
Quoted 3 lines

Review

Quoted 3 lines

+ /*

(quoted diff) +2 -0
+  * FIXME: The default values in the spec (IEEE 802.11
+  *        7.3.2.19 Table 37) are 47, 94, 0, 0, why use

Does somebody know the correct place where these values are in the specs? Section 7.3.2.19 is about "Supported channels IE".

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(quoted diff) +3 -0
+  *        47, 94, 63, 0 here? Also, the default AIFS
+  *        values (second parameter) are 2, 2, 3, 7...
+  */

7.3.2.29 EDCA Parameter Set element

Quoted 2 lines

Greetings Michael.

#7 lore raw
Quoted 10 lines · On Tuesday 12 February 2008 20:57:45 Tomas Winkler wrote:
Quoted 9 lines · Michael Buesch
Quoted 3 lines · On Tuesday 12 February 2008 12:31:40 Johannes Berg wrote:
Quoted 3 lines

Review

Quoted 3 lines

+ /*

(quoted diff) +2 -0
+  * FIXME: The default values in the spec (IEEE 802.11
+  *        7.3.2.19 Table 37) are 47, 94, 0, 0, why use

Does somebody know the correct place where these values are in the specs? Section 7.3.2.19 is about "Supported channels IE".

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+  *        47, 94, 63, 0 here? Also, the default AIFS
+  *        values (second parameter) are 2, 2, 3, 7...
+  */

7.3.2.29 EDCA Parameter Set element

Thanks, found it :)

Signature · 1 line
Greetings Michael.
author maintainer
#8 lore raw
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+  * FIXME: The default values in the spec (IEEE 802.11
+  *        7.3.2.19 Table 37) are 47, 94, 0, 0, why use

Does somebody know the correct place where these values are in the specs? Section 7.3.2.19 is about "Supported channels IE".

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+  *        47, 94, 63, 0 here? Also, the default AIFS
+  *        values (second parameter) are 2, 2, 3, 7...
+  */

7.3.2.29 EDCA Parameter Set element

Sorry, typo, I actually added the correct reference to the mac80211 header file :)

johannes

#9 lore raw
In reply to Christian Lamparter
Quoted 7 lines · Christian Lamparter

and off-topic: please merge another older patch. (see attachment)

Quoted 6 lines

Re: [PATCH split 4/8] fix 'and' typo's in wireless/p54common
Date: 26.10.2007 22:13
From: Roel Kluin <[email protected]>
To: [email protected]
=20
=A0 =A0 =A0 Fix priority mistakes similar to '!x & y' in wireless/p=

54common

drivers/net/wireless/=

Quoted 5 lines
Quoted 2 lines

=A0 =A0=20
=A0 =A0 =A0 Signed-off-by: Roel Kluin <[email protected]>

drivers/net/wireless/= renamed from drivers/net/wireless/p54common.c +0 -0

p54common.c

drivers/net/wireless/p54common.c static void p54_rx_frame_sent(struct ieee80211_hw=

Quoted 4 lines

index 1437db0..8ee1453 100644

drivers/net/wireless/p54common.c +0 -0
@@ -374,7 +374,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw=

*dev, struct sk_buff *skb)

Quoted 9 lines
drivers/net/wireless/p54common.c +0 -0
 			if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) !=3D 0)
 				pad =3D entry_data->align[0];

=20

drivers/net/wireless/p54common.c +1 -1
-			if (!status.control.flags & IEEE80211_TXCTL_NO_ACK) {
+			if (!(status.control.flags & IEEE80211_TXCTL_NO_ACK)) {
 				if (!(payload->status & 0x01))
 					status.flags |=3D IEEE80211_TX_STATUS_ACK;
 				else

=20

This is part of the commit here:

commit f59d9782751bf1a2c51e7e1e9f614ffec35fb52e

Author: Roel Kluin <[email protected]>
Date:   Fri Oct 26 21:51:26 2007 +0200

wireless: fix '!x & y' typo's

Fix priority mistakes similar to '!x & y'

Hth!

--=20
John W. Linville
[email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html