linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: configure default wmm params correctly
@ 2008-03-18 12:48 Vladimir Koutny
  2008-03-18 13:21 ` Johannes Berg
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Koutny @ 2008-03-18 12:48 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, Michael Wu, Johannes Berg, Jiri Benc

Default WMM params have to be set according to beacon/probe response
information prior to authentication (or IBSS start/join). This does
not affect the use of 'real' WMM params as reported by AP.

Signed-off-by: Vladimir Koutny <vlado@ksp.sk>
---
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 8b991eb..a55b422 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -220,6 +220,58 @@ static int ecw2cw(int ecw)
 	return (1 << ecw) - 1;
 }

+
+static void ieee80211_sta_def_wmm_params(struct net_device *dev,
+				     struct ieee80211_sta_bss *bss)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct ieee80211_local *local = sdata->local;
+	int i, have_higher_than_11mbit = 0;
+
+
+	/* cf. IEEE 802.11 9.2.12 */
+	for (i = 0; i < bss->supp_rates_len; i++)
+		if ((bss->supp_rates[i] & 0x7f) * 5 > 110)
+			have_higher_than_11mbit = 1;
+		
+	if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
+    	have_higher_than_11mbit)
+		sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;
+	else
+		sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
+
+
+	if (local->ops->conf_tx) {
+		struct ieee80211_tx_queue_params qparam;
+		int i;
+
+		memset(&qparam, 0, sizeof(qparam));
+
+		qparam.aifs = 2;
+
+		if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
+		    !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE))
+			qparam.cw_min = 31;
+		else
+			qparam.cw_min = 15;
+
+		qparam.cw_max = 1023;
+		qparam.txop = 0;
+
+		for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++)
+			local->ops->conf_tx(local_to_hw(local),
+					   i + IEEE80211_TX_QUEUE_DATA0,
+					   &qparam);
+
+		/* IBSS uses different parameters for Beacon sending */
+		qparam.cw_min++;
+		qparam.cw_min *= 2;
+		qparam.cw_min--;
+		local->ops->conf_tx(local_to_hw(local),
+				   IEEE80211_TX_QUEUE_BEACON, &qparam);
+	}
+}
+
 static void ieee80211_sta_wmm_params(struct net_device *dev,
 				     struct ieee80211_if_sta *ifsta,
 				     u8 *wmm_param, size_t wmm_param_len)
@@ -2289,6 +2341,8 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
 					rates |= BIT(j);
 		}
 		ifsta->supp_rates_bits[local->hw.conf.channel->band] = rates;
+
+		ieee80211_sta_def_wmm_params(dev, bss);
 	} while (0);

 	if (skb) {
@@ -3274,6 +3328,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
 			ieee80211_sta_set_ssid(dev, selected->ssid,
 					       selected->ssid_len);
 		ieee80211_sta_set_bssid(dev, selected->bssid);
+		ieee80211_sta_def_wmm_params(dev, selected);
 		ieee80211_rx_bss_put(dev, selected);
 		ifsta->state = IEEE80211_AUTHENTICATE;
 		ieee80211_sta_reset_auth(dev, ifsta);
@@ -3453,38 +3508,6 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len)
 	if (len > IEEE80211_MAX_SSID_LEN)
 		return -EINVAL;

-	/* TODO: This should always be done for IBSS, even if IEEE80211_QOS is
-	 * not defined. */
-	if (local->ops->conf_tx) {
-		struct ieee80211_tx_queue_params qparam;
-		int i;
-
-		memset(&qparam, 0, sizeof(qparam));
-
-		qparam.aifs = 2;
-
-		if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
-		    !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE))
-			qparam.cw_min = 31;
-		else
-			qparam.cw_min = 15;
-
-		qparam.cw_max = 1023;
-		qparam.txop = 0;
-
-		for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++)
-			local->ops->conf_tx(local_to_hw(local),
-					   i + IEEE80211_TX_QUEUE_DATA0,
-					   &qparam);
-
-		/* IBSS uses different parameters for Beacon sending */
-		qparam.cw_min++;
-		qparam.cw_min *= 2;
-		qparam.cw_min--;
-		local->ops->conf_tx(local_to_hw(local),
-				   IEEE80211_TX_QUEUE_BEACON, &qparam);
-	}
-
 	ifsta = &sdata->u.sta;

 	if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0)

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] mac80211: configure default wmm params correctly
  2008-03-18 12:48 [PATCH] mac80211: configure default wmm params correctly Vladimir Koutny
@ 2008-03-18 13:21 ` Johannes Berg
  2008-03-18 13:45   ` Vladimir Koutny
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2008-03-18 13:21 UTC (permalink / raw)
  To: Vladimir Koutny; +Cc: John W. Linville, linux-wireless, Michael Wu, Jiri Benc

[-- Attachment #1: Type: text/plain, Size: 987 bytes --]


On Tue, 2008-03-18 at 13:48 +0100, Vladimir Koutny wrote:
> Default WMM params have to be set according to beacon/probe response
> information prior to authentication (or IBSS start/join). This does
> not affect the use of 'real' WMM params as reported by AP.
> 
> Signed-off-by: Vladimir Koutny <vlado@ksp.sk>

Looks ok, but

> +		

There is lots of trailing whitespace (use scripts/checkpatch.pl)

> +	if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
> +    	have_higher_than_11mbit)

and that really needs to be indented differently.

> +		/* IBSS uses different parameters for Beacon sending */
> +		qparam.cw_min++;
> +		qparam.cw_min *= 2;
> +		qparam.cw_min--;
> +		local->ops->conf_tx(local_to_hw(local),
> +				   IEEE80211_TX_QUEUE_BEACON, &qparam);

And shouldn't we do that only for IBSS? I'm in favour of removing it
completely, however, since the beacon queue is a way to construct
hardware, not do things in software...

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mac80211: configure default wmm params correctly
  2008-03-18 13:21 ` Johannes Berg
@ 2008-03-18 13:45   ` Vladimir Koutny
  2008-03-18 14:16     ` Johannes Berg
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Koutny @ 2008-03-18 13:45 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John W. Linville, linux-wireless, Michael Wu, Jiri Benc

[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]

> 
> There is lots of trailing whitespace (use scripts/checkpatch.pl)
> 
>> +	if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
>> +    	have_higher_than_11mbit)
> 
> and that really needs to be indented differently.
> 
Oops, sorry for that :(

>> +		/* IBSS uses different parameters for Beacon sending */
>> +		qparam.cw_min++;
>> +		qparam.cw_min *= 2;
>> +		qparam.cw_min--;
>> +		local->ops->conf_tx(local_to_hw(local),
>> +				   IEEE80211_TX_QUEUE_BEACON, &qparam);
> 
> And shouldn't we do that only for IBSS? I'm in favour of removing it
> completely, however, since the beacon queue is a way to construct
> hardware, not do things in software...

Good question; I've just moved this part of code out of
ieee80211_sta_set_ssid as that is not the best place for it. I don't
object to removing that code completely; seems that noone uses
IEEE80211_TX_QUEUE_BEACON anyway. On the other hand, it can be a good
hint for those implementing beaconing on hw where it has to be set
explicitly..

Vlado


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] mac80211: configure default wmm params correctly
  2008-03-18 13:45   ` Vladimir Koutny
@ 2008-03-18 14:16     ` Johannes Berg
  2008-03-18 19:29       ` [PATCH v2] " Vladimir Koutny
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2008-03-18 14:16 UTC (permalink / raw)
  To: Vladimir Koutny; +Cc: John W. Linville, linux-wireless, Michael Wu, Jiri Benc

[-- Attachment #1: Type: text/plain, Size: 953 bytes --]


> >> +		/* IBSS uses different parameters for Beacon sending */
> >> +		qparam.cw_min++;
> >> +		qparam.cw_min *= 2;
> >> +		qparam.cw_min--;
> >> +		local->ops->conf_tx(local_to_hw(local),
> >> +				   IEEE80211_TX_QUEUE_BEACON, &qparam);
> > 
> > And shouldn't we do that only for IBSS? I'm in favour of removing it
> > completely, however, since the beacon queue is a way to construct
> > hardware, not do things in software...
> 
> Good question; I've just moved this part of code out of
> ieee80211_sta_set_ssid as that is not the best place for it. I don't
> object to removing that code completely; seems that noone uses
> IEEE80211_TX_QUEUE_BEACON anyway. On the other hand, it can be a good
> hint for those implementing beaconing on hw where it has to be set
> explicitly..

I disagree with the latter part, but let's just leave it for now, I
think my QoS patch (the one Ron is adopting) will kill it anyway.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] mac80211: configure default wmm params correctly
  2008-03-18 14:16     ` Johannes Berg
@ 2008-03-18 19:29       ` Vladimir Koutny
  2008-03-18 19:38         ` Johannes Berg
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Koutny @ 2008-03-18 19:29 UTC (permalink / raw)
  To: Johannes Berg, John W. Linville; +Cc: linux-wireless, Michael Wu, Jiri Benc

Default WMM params have to be set according to beacon/probe response
information prior to authentication (or IBSS start/join); beacon queue
is configured only in IBSS. This does not affect the use of 'real' WMM
params as reported by AP.

Signed-off-by: Vladimir Koutny <vlado@ksp.sk>
---
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 8b991eb..14d80e0 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -220,6 +220,61 @@ static int ecw2cw(int ecw)
 	return (1 << ecw) - 1;
 }

+
+static void ieee80211_sta_def_wmm_params(struct net_device *dev,
+					 struct ieee80211_sta_bss *bss,
+					 int ibss)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct ieee80211_local *local = sdata->local;
+	int i, have_higher_than_11mbit = 0;
+
+
+	/* cf. IEEE 802.11 9.2.12 */
+	for (i = 0; i < bss->supp_rates_len; i++)
+		if ((bss->supp_rates[i] & 0x7f) * 5 > 110)
+			have_higher_than_11mbit = 1;
+
+	if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
+		have_higher_than_11mbit)
+		sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;
+	else
+		sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
+
+
+	if (local->ops->conf_tx) {
+		struct ieee80211_tx_queue_params qparam;
+		int i;
+
+		memset(&qparam, 0, sizeof(qparam));
+
+		qparam.aifs = 2;
+
+		if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
+		    !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE))
+			qparam.cw_min = 31;
+		else
+			qparam.cw_min = 15;
+
+		qparam.cw_max = 1023;
+		qparam.txop = 0;
+
+		for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++)
+			local->ops->conf_tx(local_to_hw(local),
+					   i + IEEE80211_TX_QUEUE_DATA0,
+					   &qparam);
+
+		if (ibss) {
+			/* IBSS uses different parameters for Beacon sending */
+			qparam.cw_min++;
+			qparam.cw_min *= 2;
+			qparam.cw_min--;
+			local->ops->conf_tx(local_to_hw(local),
+					   IEEE80211_TX_QUEUE_BEACON, &qparam);
+		}
+	}
+}
+
 static void ieee80211_sta_wmm_params(struct net_device *dev,
 				     struct ieee80211_if_sta *ifsta,
 				     u8 *wmm_param, size_t wmm_param_len)
@@ -2289,6 +2344,8 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
 					rates |= BIT(j);
 		}
 		ifsta->supp_rates_bits[local->hw.conf.channel->band] = rates;
+
+		ieee80211_sta_def_wmm_params(dev, bss, 1);
 	} while (0);

 	if (skb) {
@@ -3274,6 +3331,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
 			ieee80211_sta_set_ssid(dev, selected->ssid,
 					       selected->ssid_len);
 		ieee80211_sta_set_bssid(dev, selected->bssid);
+		ieee80211_sta_def_wmm_params(dev, selected, 0);
 		ieee80211_rx_bss_put(dev, selected);
 		ifsta->state = IEEE80211_AUTHENTICATE;
 		ieee80211_sta_reset_auth(dev, ifsta);
@@ -3448,43 +3506,10 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len)
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 	struct ieee80211_if_sta *ifsta;
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);

 	if (len > IEEE80211_MAX_SSID_LEN)
 		return -EINVAL;

-	/* TODO: This should always be done for IBSS, even if IEEE80211_QOS is
-	 * not defined. */
-	if (local->ops->conf_tx) {
-		struct ieee80211_tx_queue_params qparam;
-		int i;
-
-		memset(&qparam, 0, sizeof(qparam));
-
-		qparam.aifs = 2;
-
-		if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
-		    !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE))
-			qparam.cw_min = 31;
-		else
-			qparam.cw_min = 15;
-
-		qparam.cw_max = 1023;
-		qparam.txop = 0;
-
-		for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++)
-			local->ops->conf_tx(local_to_hw(local),
-					   i + IEEE80211_TX_QUEUE_DATA0,
-					   &qparam);
-
-		/* IBSS uses different parameters for Beacon sending */
-		qparam.cw_min++;
-		qparam.cw_min *= 2;
-		qparam.cw_min--;
-		local->ops->conf_tx(local_to_hw(local),
-				   IEEE80211_TX_QUEUE_BEACON, &qparam);
-	}
-
 	ifsta = &sdata->u.sta;

 	if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0)


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] mac80211: configure default wmm params correctly
  2008-03-18 19:29       ` [PATCH v2] " Vladimir Koutny
@ 2008-03-18 19:38         ` Johannes Berg
  2008-03-18 20:14           ` Vladimir Koutny
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2008-03-18 19:38 UTC (permalink / raw)
  To: Vladimir Koutny; +Cc: John W. Linville, linux-wireless, Michael Wu, Jiri Benc

[-- Attachment #1: Type: text/plain, Size: 417 bytes --]


> +	if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
> +		have_higher_than_11mbit)
> +		sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;

I don't know what CodingStyle says, but I very much prefer

if (local->hw..... &&
    have_higher_than_11mbit)
	sdata->flags |= ...

since that visually puts the continuation of the condition together with
the start of it. Mind changing that?

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] mac80211: configure default wmm params correctly
  2008-03-18 19:38         ` Johannes Berg
@ 2008-03-18 20:14           ` Vladimir Koutny
  2008-03-18 20:15             ` Johannes Berg
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Koutny @ 2008-03-18 20:14 UTC (permalink / raw)
  To: Johannes Berg; +Cc: John W. Linville, linux-wireless, Michael Wu, Jiri Benc

> I don't know what CodingStyle says, but I very much prefer
> 
> if (local->hw..... &&
>     have_higher_than_11mbit)
> 	sdata->flags |= ...
> 
> since that visually puts the continuation of the condition together with
> the start of it. Mind changing that?
No problem (and better don't ask what CodingStyle thinks about spaces..)
Here we go:

---
Default WMM params have to be set according to beacon/probe response
information prior to authentication (or IBSS start/join); beacon queue
is configured only in IBSS. This does not affect the use of 'real' WMM
params as reported by AP.

Signed-off-by: Vladimir Koutny <vlado@ksp.sk>
---
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 8b991eb..14d80e0 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -220,6 +220,61 @@ static int ecw2cw(int ecw)
 	return (1 << ecw) - 1;
 }

+
+static void ieee80211_sta_def_wmm_params(struct net_device *dev,
+					 struct ieee80211_sta_bss *bss,
+					 int ibss)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct ieee80211_local *local = sdata->local;
+	int i, have_higher_than_11mbit = 0;
+
+
+	/* cf. IEEE 802.11 9.2.12 */
+	for (i = 0; i < bss->supp_rates_len; i++)
+		if ((bss->supp_rates[i] & 0x7f) * 5 > 110)
+			have_higher_than_11mbit = 1;
+
+	if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
+	    have_higher_than_11mbit)
+		sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;
+	else
+		sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
+
+
+	if (local->ops->conf_tx) {
+		struct ieee80211_tx_queue_params qparam;
+		int i;
+
+		memset(&qparam, 0, sizeof(qparam));
+
+		qparam.aifs = 2;
+
+		if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
+		    !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE))
+			qparam.cw_min = 31;
+		else
+			qparam.cw_min = 15;
+
+		qparam.cw_max = 1023;
+		qparam.txop = 0;
+
+		for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++)
+			local->ops->conf_tx(local_to_hw(local),
+					   i + IEEE80211_TX_QUEUE_DATA0,
+					   &qparam);
+
+		if (ibss) {
+			/* IBSS uses different parameters for Beacon sending */
+			qparam.cw_min++;
+			qparam.cw_min *= 2;
+			qparam.cw_min--;
+			local->ops->conf_tx(local_to_hw(local),
+					   IEEE80211_TX_QUEUE_BEACON, &qparam);
+		}
+	}
+}
+
 static void ieee80211_sta_wmm_params(struct net_device *dev,
 				     struct ieee80211_if_sta *ifsta,
 				     u8 *wmm_param, size_t wmm_param_len)
@@ -2289,6 +2344,8 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
 					rates |= BIT(j);
 		}
 		ifsta->supp_rates_bits[local->hw.conf.channel->band] = rates;
+
+		ieee80211_sta_def_wmm_params(dev, bss, 1);
 	} while (0);

 	if (skb) {
@@ -3274,6 +3331,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
 			ieee80211_sta_set_ssid(dev, selected->ssid,
 					       selected->ssid_len);
 		ieee80211_sta_set_bssid(dev, selected->bssid);
+		ieee80211_sta_def_wmm_params(dev, selected, 0);
 		ieee80211_rx_bss_put(dev, selected);
 		ifsta->state = IEEE80211_AUTHENTICATE;
 		ieee80211_sta_reset_auth(dev, ifsta);
@@ -3448,43 +3506,10 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len)
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 	struct ieee80211_if_sta *ifsta;
-	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);

 	if (len > IEEE80211_MAX_SSID_LEN)
 		return -EINVAL;

-	/* TODO: This should always be done for IBSS, even if IEEE80211_QOS is
-	 * not defined. */
-	if (local->ops->conf_tx) {
-		struct ieee80211_tx_queue_params qparam;
-		int i;
-
-		memset(&qparam, 0, sizeof(qparam));
-
-		qparam.aifs = 2;
-
-		if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
-		    !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE))
-			qparam.cw_min = 31;
-		else
-			qparam.cw_min = 15;
-
-		qparam.cw_max = 1023;
-		qparam.txop = 0;
-
-		for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++)
-			local->ops->conf_tx(local_to_hw(local),
-					   i + IEEE80211_TX_QUEUE_DATA0,
-					   &qparam);
-
-		/* IBSS uses different parameters for Beacon sending */
-		qparam.cw_min++;
-		qparam.cw_min *= 2;
-		qparam.cw_min--;
-		local->ops->conf_tx(local_to_hw(local),
-				   IEEE80211_TX_QUEUE_BEACON, &qparam);
-	}
-
 	ifsta = &sdata->u.sta;

 	if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0)

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] mac80211: configure default wmm params correctly
  2008-03-18 20:14           ` Vladimir Koutny
@ 2008-03-18 20:15             ` Johannes Berg
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Berg @ 2008-03-18 20:15 UTC (permalink / raw)
  To: Vladimir Koutny; +Cc: John W. Linville, linux-wireless, Michael Wu, Jiri Benc

[-- Attachment #1: Type: text/plain, Size: 4963 bytes --]


On Tue, 2008-03-18 at 21:14 +0100, Vladimir Koutny wrote:
> > I don't know what CodingStyle says, but I very much prefer
> > 
> > if (local->hw..... &&
> >     have_higher_than_11mbit)
> > 	sdata->flags |= ...
> > 
> > since that visually puts the continuation of the condition together with
> > the start of it. Mind changing that?
> No problem (and better don't ask what CodingStyle thinks about spaces..)
> Here we go:

Thanks.

> ---
> Default WMM params have to be set according to beacon/probe response
> information prior to authentication (or IBSS start/join); beacon queue
> is configured only in IBSS. This does not affect the use of 'real' WMM
> params as reported by AP.
> 
> Signed-off-by: Vladimir Koutny <vlado@ksp.sk>

Acked-by: Johannes Berg <johannes@sipsolutions.net>

> ---
> diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
> index 8b991eb..14d80e0 100644
> --- a/net/mac80211/ieee80211_sta.c
> +++ b/net/mac80211/ieee80211_sta.c
> @@ -220,6 +220,61 @@ static int ecw2cw(int ecw)
>  	return (1 << ecw) - 1;
>  }
> 
> +
> +static void ieee80211_sta_def_wmm_params(struct net_device *dev,
> +					 struct ieee80211_sta_bss *bss,
> +					 int ibss)
> +{
> +	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
> +	struct ieee80211_local *local = sdata->local;
> +	int i, have_higher_than_11mbit = 0;
> +
> +
> +	/* cf. IEEE 802.11 9.2.12 */
> +	for (i = 0; i < bss->supp_rates_len; i++)
> +		if ((bss->supp_rates[i] & 0x7f) * 5 > 110)
> +			have_higher_than_11mbit = 1;
> +
> +	if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
> +	    have_higher_than_11mbit)
> +		sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE;
> +	else
> +		sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE;
> +
> +
> +	if (local->ops->conf_tx) {
> +		struct ieee80211_tx_queue_params qparam;
> +		int i;
> +
> +		memset(&qparam, 0, sizeof(qparam));
> +
> +		qparam.aifs = 2;
> +
> +		if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
> +		    !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE))
> +			qparam.cw_min = 31;
> +		else
> +			qparam.cw_min = 15;
> +
> +		qparam.cw_max = 1023;
> +		qparam.txop = 0;
> +
> +		for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++)
> +			local->ops->conf_tx(local_to_hw(local),
> +					   i + IEEE80211_TX_QUEUE_DATA0,
> +					   &qparam);
> +
> +		if (ibss) {
> +			/* IBSS uses different parameters for Beacon sending */
> +			qparam.cw_min++;
> +			qparam.cw_min *= 2;
> +			qparam.cw_min--;
> +			local->ops->conf_tx(local_to_hw(local),
> +					   IEEE80211_TX_QUEUE_BEACON, &qparam);
> +		}
> +	}
> +}
> +
>  static void ieee80211_sta_wmm_params(struct net_device *dev,
>  				     struct ieee80211_if_sta *ifsta,
>  				     u8 *wmm_param, size_t wmm_param_len)
> @@ -2289,6 +2344,8 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
>  					rates |= BIT(j);
>  		}
>  		ifsta->supp_rates_bits[local->hw.conf.channel->band] = rates;
> +
> +		ieee80211_sta_def_wmm_params(dev, bss, 1);
>  	} while (0);
> 
>  	if (skb) {
> @@ -3274,6 +3331,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
>  			ieee80211_sta_set_ssid(dev, selected->ssid,
>  					       selected->ssid_len);
>  		ieee80211_sta_set_bssid(dev, selected->bssid);
> +		ieee80211_sta_def_wmm_params(dev, selected, 0);
>  		ieee80211_rx_bss_put(dev, selected);
>  		ifsta->state = IEEE80211_AUTHENTICATE;
>  		ieee80211_sta_reset_auth(dev, ifsta);
> @@ -3448,43 +3506,10 @@ int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len)
>  {
>  	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
>  	struct ieee80211_if_sta *ifsta;
> -	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
> 
>  	if (len > IEEE80211_MAX_SSID_LEN)
>  		return -EINVAL;
> 
> -	/* TODO: This should always be done for IBSS, even if IEEE80211_QOS is
> -	 * not defined. */
> -	if (local->ops->conf_tx) {
> -		struct ieee80211_tx_queue_params qparam;
> -		int i;
> -
> -		memset(&qparam, 0, sizeof(qparam));
> -
> -		qparam.aifs = 2;
> -
> -		if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
> -		    !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE))
> -			qparam.cw_min = 31;
> -		else
> -			qparam.cw_min = 15;
> -
> -		qparam.cw_max = 1023;
> -		qparam.txop = 0;
> -
> -		for (i = IEEE80211_TX_QUEUE_DATA0; i < NUM_TX_DATA_QUEUES; i++)
> -			local->ops->conf_tx(local_to_hw(local),
> -					   i + IEEE80211_TX_QUEUE_DATA0,
> -					   &qparam);
> -
> -		/* IBSS uses different parameters for Beacon sending */
> -		qparam.cw_min++;
> -		qparam.cw_min *= 2;
> -		qparam.cw_min--;
> -		local->ops->conf_tx(local_to_hw(local),
> -				   IEEE80211_TX_QUEUE_BEACON, &qparam);
> -	}
> -
>  	ifsta = &sdata->u.sta;
> 
>  	if (ifsta->ssid_len != len || memcmp(ifsta->ssid, ssid, len) != 0)
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-03-20  1:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-18 12:48 [PATCH] mac80211: configure default wmm params correctly Vladimir Koutny
2008-03-18 13:21 ` Johannes Berg
2008-03-18 13:45   ` Vladimir Koutny
2008-03-18 14:16     ` Johannes Berg
2008-03-18 19:29       ` [PATCH v2] " Vladimir Koutny
2008-03-18 19:38         ` Johannes Berg
2008-03-18 20:14           ` Vladimir Koutny
2008-03-18 20:15             ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).