linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.12 1/3] mac80211: fix honouring rate flags in low-rate transmit
@ 2013-10-15 13:17 Johannes Berg
  2013-10-15 13:17 ` [PATCH 3.12 2/3] mac80211: respect rate mask in TX Johannes Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Johannes Berg @ 2013-10-15 13:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: Andrei Otcheretianski

From: Andrei Otcheretianski <andrei.otcheretianski@intel.com>

Transmissions with the IEEE80211_TX_CTL_NO_CCK_RATE flag set
(which can come from userspace) were no longer guaranteed to
be transmitted with allowed rates since commit 2103dec14792b
("mac80211: select and adjust bitrates according to channel
mode") due to a missing rate_flags check in that commit. The
commit also introduced the need to check the 5/10 MHz flags
but accidentally didn't. Fix it by adding the missing check.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/rate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index e126605..7f7ce11 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -247,6 +247,9 @@ static void __rate_control_send_low(struct ieee80211_hw *hw,
 
 	info->control.rates[0].idx = 0;
 	for (i = 0; i < sband->n_bitrates; i++) {
+		if ((rate_flags & sband->bitrates[i].flags) != rate_flags)
+			continue;
+
 		if (!rate_supported(sta, sband->band, i))
 			continue;
 
-- 
1.8.4.rc3


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

* [PATCH 3.12 2/3] mac80211: respect rate mask in TX
  2013-10-15 13:17 [PATCH 3.12 1/3] mac80211: fix honouring rate flags in low-rate transmit Johannes Berg
@ 2013-10-15 13:17 ` Johannes Berg
  2013-10-15 13:17 ` [PATCH 3.12 3/3] mac80211: sanity check WMM/QoS parameters Johannes Berg
  2013-10-17 11:35 ` [PATCH 3.12 1/3] mac80211: fix honouring rate flags in low-rate transmit Johannes Berg
  2 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2013-10-15 13:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: Andrei Otcheretianski

From: Andrei Otcheretianski <andrei.otcheretianski@intel.com>

Bitrate mask were not respected in transmissions, causing (for
example) P2P GO/client to use CCK rates for auth and assoc frames.
Fix it by considering the rate mask in __rate_control_send_low().

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/rate.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 7f7ce11..22b223f 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -235,7 +235,8 @@ static void rc_send_low_basicrate(s8 *idx, u32 basic_rates,
 static void __rate_control_send_low(struct ieee80211_hw *hw,
 				    struct ieee80211_supported_band *sband,
 				    struct ieee80211_sta *sta,
-				    struct ieee80211_tx_info *info)
+				    struct ieee80211_tx_info *info,
+				    u32 rate_mask)
 {
 	int i;
 	u32 rate_flags =
@@ -247,6 +248,9 @@ static void __rate_control_send_low(struct ieee80211_hw *hw,
 
 	info->control.rates[0].idx = 0;
 	for (i = 0; i < sband->n_bitrates; i++) {
+		if (!(rate_mask & BIT(i)))
+			continue;
+
 		if ((rate_flags & sband->bitrates[i].flags) != rate_flags)
 			continue;
 
@@ -277,7 +281,8 @@ bool rate_control_send_low(struct ieee80211_sta *pubsta,
 	bool use_basicrate = false;
 
 	if (!pubsta || !priv_sta || rc_no_data_or_no_ack_use_min(txrc)) {
-		__rate_control_send_low(txrc->hw, sband, pubsta, info);
+		__rate_control_send_low(txrc->hw, sband, pubsta, info,
+					txrc->rate_idx_mask);
 
 		if (!pubsta && txrc->bss) {
 			mcast_rate = txrc->bss_conf->mcast_rate[sband->band];
@@ -659,7 +664,8 @@ void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
 		rate_control_apply_mask(sdata, sta, sband, info, dest, max_rates);
 
 	if (dest[0].idx < 0)
-		__rate_control_send_low(&sdata->local->hw, sband, sta, info);
+		__rate_control_send_low(&sdata->local->hw, sband, sta, info,
+					sdata->rc_rateidx_mask[info->band]);
 
 	if (sta)
 		rate_fixup_ratelist(vif, sband, info, dest, max_rates);
-- 
1.8.4.rc3


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

* [PATCH 3.12 3/3] mac80211: sanity check WMM/QoS parameters
  2013-10-15 13:17 [PATCH 3.12 1/3] mac80211: fix honouring rate flags in low-rate transmit Johannes Berg
  2013-10-15 13:17 ` [PATCH 3.12 2/3] mac80211: respect rate mask in TX Johannes Berg
@ 2013-10-15 13:17 ` Johannes Berg
  2013-10-17  7:46   ` Johannes Berg
  2013-10-17 11:35 ` [PATCH 3.12 1/3] mac80211: fix honouring rate flags in low-rate transmit Johannes Berg
  2 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2013-10-15 13:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

Check for invalid WMM parameters (AIFSN < 2 or CWmax < CWmin)
and try to set them to usable values in this case.

Notably the Sitecom WL-153 v1 with firmware 1.45 is sending
AIFSN, ECWmin and ECWmax as all zero.

Reported-and-tested-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/mlme.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 86e4ad5..058ae1c 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1598,6 +1598,7 @@ static bool ieee80211_sta_wmm_params(struct ieee80211_local *local,
 	int count;
 	const u8 *pos;
 	u8 uapsd_queues = 0;
+	static const u8 default_aifs[] = { 2, 2, 3, 7 };
 
 	if (!local->ops->conf_tx)
 		return false;
@@ -1664,8 +1665,12 @@ static bool ieee80211_sta_wmm_params(struct ieee80211_local *local,
 		}
 
 		params.aifs = pos[0] & 0x0f;
+		if (params.aifs < 2)
+			params.aifs = default_aifs[queue];
 		params.cw_max = ecw2cw((pos[1] & 0xf0) >> 4);
 		params.cw_min = ecw2cw(pos[1] & 0x0f);
+		if (params.cw_max < params.cw_min)
+			params.cw_max = params.cw_min;
 		params.txop = get_unaligned_le16(pos + 2);
 		params.acm = acm;
 		params.uapsd = uapsd;
-- 
1.8.4.rc3


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

* Re: [PATCH 3.12 3/3] mac80211: sanity check WMM/QoS parameters
  2013-10-15 13:17 ` [PATCH 3.12 3/3] mac80211: sanity check WMM/QoS parameters Johannes Berg
@ 2013-10-17  7:46   ` Johannes Berg
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2013-10-17  7:46 UTC (permalink / raw)
  To: linux-wireless

On Tue, 2013-10-15 at 15:17 +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> Check for invalid WMM parameters (AIFSN < 2 or CWmax < CWmin)
> and try to set them to usable values in this case.
> 
> Notably the Sitecom WL-153 v1 with firmware 1.45 is sending
> AIFSN, ECWmin and ECWmax as all zero.

We reviewed this and decided that it would be more robust to connect as
a non-WMM station, since we can't know what other parameters are wrong.
I've just posted a replacement patch to that effect.

johannes


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

* Re: [PATCH 3.12 1/3] mac80211: fix honouring rate flags in low-rate transmit
  2013-10-15 13:17 [PATCH 3.12 1/3] mac80211: fix honouring rate flags in low-rate transmit Johannes Berg
  2013-10-15 13:17 ` [PATCH 3.12 2/3] mac80211: respect rate mask in TX Johannes Berg
  2013-10-15 13:17 ` [PATCH 3.12 3/3] mac80211: sanity check WMM/QoS parameters Johannes Berg
@ 2013-10-17 11:35 ` Johannes Berg
  2 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2013-10-17 11:35 UTC (permalink / raw)
  To: linux-wireless; +Cc: Andrei Otcheretianski

On Tue, 2013-10-15 at 15:17 +0200, Johannes Berg wrote:
> From: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
> 
> Transmissions with the IEEE80211_TX_CTL_NO_CCK_RATE flag set
> (which can come from userspace) were no longer guaranteed to
> be transmitted with allowed rates since commit 2103dec14792b
> ("mac80211: select and adjust bitrates according to channel
> mode") due to a missing rate_flags check in that commit. The
> commit also introduced the need to check the 5/10 MHz flags
> but accidentally didn't. Fix it by adding the missing check.

Applied 1 and 2.

johannes


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

end of thread, other threads:[~2013-10-17 11:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-15 13:17 [PATCH 3.12 1/3] mac80211: fix honouring rate flags in low-rate transmit Johannes Berg
2013-10-15 13:17 ` [PATCH 3.12 2/3] mac80211: respect rate mask in TX Johannes Berg
2013-10-15 13:17 ` [PATCH 3.12 3/3] mac80211: sanity check WMM/QoS parameters Johannes Berg
2013-10-17  7:46   ` Johannes Berg
2013-10-17 11:35 ` [PATCH 3.12 1/3] mac80211: fix honouring rate flags in low-rate transmit 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).