Skip to contentSkip to conversation

iwlagn: use cts-to-self protection on 5000 adapters series

PATCH In review Stanislaw Gruszka 4 participants 7 messages May 26, 2011 – Jun 6, 2011 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iwlagn: use cts-to-self protection on 5000 adapters series

This patch fixes 802.11n stability and performance regression we have since 2.6.35. It boost performance on my 5GHz N-only network from about 5MB/s to 8MB/s. Similar percentage boost can be observed on 2.4 GHz.

These are test results of 5x downloading of approximately 700MB iso image:

vanilla: 5.27 5.22 4.94 4.47 5.31 ; avr 5.0420 std 0.35110
patched: 8.07 7.95 8.06 7.99 7.96 ; avr 8.0060 std 0.055946

This was achieved with NetworkManager configured to do not perform periodical scans, by configuring constant BSSID. With periodical scans, after some time, performance downgrade to unpatched driver level, like in example below:

patched: 7.40 7.61 4.28 4.37 4.80 avr 5.6920 std 1.6683

However patch still make better here, since similar test on unpatched driver make link disconnects with below messages after some time:

wlan1: authenticate with 00:23:69:35:d1:3f (try 1)
wlan1: authenticate with 00:23:69:35:d1:3f (try 2)
wlan1: authenticate with 00:23:69:35:d1:3f (try 3)
wlan1: authentication with 00:23:69:35:d1:3f timed out

On 2.6.35 kernel patch helps against connection hangs with messages:

iwlagn 0000:20:00.0: queue 10 stuck 3 time. Fw reload. iwlagn 0000:20:00.0: On demand firmware reload
iwlagn 0000:20:00.0: Stopping AGG while state not ON or starting

---
v1 -> v2: s/unpached/unpatched/

 drivers/net/wireless/iwlwifi/iwl-5000.c     |    1 -
 drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c |   12 ++----------
 drivers/net/wireless/iwlwifi/iwl-agn-rxon.c |    8 ++++++++
 3 files changed, 10 insertions(+), 11 deletions(-)
drivers/net/wireless/iwlwifi/iwl-5000.c +0 -1
index a70b8cf..f96eb5b 100644
@@ -425,7 +425,6 @@ static struct iwl_base_params iwl5000_base_params = {
 };
 static struct iwl_ht_params iwl5000_ht_params = {
 	.ht_greenfield_support = true,
-	.use_rts_for_aggregation = true, /* use rts/cts protection */
 };
 
 #define IWL_DEVICE_5000						\
drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c +2 -10
index b12c72d..23fa93d 100644
@@ -163,17 +163,9 @@ static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
 				     __le16 fc, __le32 *tx_flags)
 {
 	if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
-	    info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
+	    info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT ||
+	    info->flags & IEEE80211_TX_CTL_AMPDU)
 		*tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
-		return;
-	}
-
-	if (priv->cfg->ht_params &&
-	    priv->cfg->ht_params->use_rts_for_aggregation &&
-	    info->flags & IEEE80211_TX_CTL_AMPDU) {
-		*tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
-		return;
-	}
 }
 
 /* Calc max signal level (dBm) among 3 possible receivers */
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c +8 -0
index a95ad84..0a1941d 100644
@@ -325,6 +325,14 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
 			return 0;
 	}
 
+	/*
+	 * force CTS-to-self frames protection if RTS-CTS is not preferred
+	 * one aggregation protection method
+	 */
+	if (!(priv->cfg->ht_params &&
+	      priv->cfg->ht_params->use_rts_for_aggregation))
+		ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
+
 	if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) ||
 	    !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK))
 		ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
Signature · 1 line
1.7.1
Acked-by on v2 1/1
#1 lore raw
Quoted 25 lines · Stanislaw Gruszka

This patch fixes 802.11n stability and performance regression we have since 2.6.35. It boost performance on my 5GHz N-only network from about 5MB/s to 8MB/s. Similar percentage boost can be observed on 2.4 GHz.

These are test results of 5x downloading of approximately 700MB iso image:

vanilla: 5.27 5.22 4.94 4.47 5.31 ; avr 5.0420 std 0.35110
patched: 8.07 7.95 8.06 7.99 7.96 ; avr 8.0060 std 0.055946

This was achieved with NetworkManager configured to do not perform periodical scans, by configuring constant BSSID. With periodical scans, after some time, performance downgrade to unpatched driver level, like in example below:

patched: 7.40 7.61 4.28 4.37 4.80 avr 5.6920 std 1.6683

However patch still make better here, since similar test on unpatched driver make link disconnects with below messages after some time:

wlan1: authenticate with 00:23:69:35:d1:3f (try 1)
wlan1: authenticate with 00:23:69:35:d1:3f (try 2)
wlan1: authenticate with 00:23:69:35:d1:3f (try 3)
wlan1: authentication with 00:23:69:35:d1:3f timed out

Quoted 8 lines

On 2.6.35 kernel patch helps against connection hangs with messages:

iwlagn 0000:20:00.0: queue 10 stuck 3 time. Fw reload. iwlagn 0000:20:00.0: On demand firmware reload
iwlagn 0000:20:00.0: Stopping AGG while state not ON or starting

Quoted 63 lines

---
v1 -> v2: s/unpached/unpatched/

 drivers/net/wireless/iwlwifi/iwl-5000.c     |    1 -
 drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c |   12 ++----------
 drivers/net/wireless/iwlwifi/iwl-agn-rxon.c |    8 ++++++++
 3 files changed, 10 insertions(+), 11 deletions(-)
drivers/net/wireless/iwlwifi/iwl-5000.c +0 -1
index a70b8cf..f96eb5b 100644
@@ -425,7 +425,6 @@ static struct iwl_base_params iwl5000_base_params = {
 };
 static struct iwl_ht_params iwl5000_ht_params = {
 	.ht_greenfield_support = true,
-	.use_rts_for_aggregation = true, /* use rts/cts protection */
 };
 
 #define IWL_DEVICE_5000						\
drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c +2 -10
index b12c72d..23fa93d 100644
@@ -163,17 +163,9 @@ static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
 				     __le16 fc, __le32 *tx_flags)
 {
 	if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
-	    info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
+	    info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT ||
+	    info->flags & IEEE80211_TX_CTL_AMPDU)
 		*tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
-		return;
-	}
-
-	if (priv->cfg->ht_params &&
-	    priv->cfg->ht_params->use_rts_for_aggregation &&
-	    info->flags & IEEE80211_TX_CTL_AMPDU) {
-		*tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
-		return;
-	}
 }
 
 /* Calc max signal level (dBm) among 3 possible receivers */
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c +8 -0
index a95ad84..0a1941d 100644
@@ -325,6 +325,14 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
 			return 0;
 	}
 
+	/*
+	 * force CTS-to-self frames protection if RTS-CTS is not preferred
+	 * one aggregation protection method
+	 */
+	if (!(priv->cfg->ht_params &&
+	      priv->cfg->ht_params->use_rts_for_aggregation))
+		ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
+
 	if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) ||
 	    !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK))
 		ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
#2 lore raw
Quoted 15 lines · Wey-Yi
Quoted 14 lines · Stanislaw Gruszka
drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c +0 -0
index b12c72d..23fa93d 100644
@@ -163,17 +163,9 @@ static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
                                    __le16 fc, __le32 *tx_flags)
  {

      if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
-         info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
+         info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT ||
+         info->flags & IEEE80211_TX_CTL_AMPDU)
              *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
-             return;
-     }

Quoted 8 lines
Quoted 8 lines

-
-     if (priv->cfg->ht_params &&
-         priv->cfg->ht_params->use_rts_for_aggregation &&
-         info->flags & IEEE80211_TX_CTL_AMPDU) {
-             *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
-             return;
-     }
 }

Shouldn't there be a new "use_cts_for_aggregation" flag and one that dominates (looks like use_rts in your setup), rather than this? I'm still a bit confused as to why CTS-to-self should help (as opposed to masking some other bug).

Dan

#3 lore raw
Quoted 19 lines · Daniel Halperin
Quoted 18 lines · Wey-Yi
Quoted 17 lines · Stanislaw Gruszka
drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c +0 -0
index b12c72d..23fa93d 100644
@@ -163,17 +163,9 @@ static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
                                    __le16 fc, __le32 *tx_flags)
  {

      if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
-         info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
+         info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT ||
+         info->flags & IEEE80211_TX_CTL_AMPDU)
              *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
-             return;
-     }
-
-     if (priv->cfg->ht_params &&
-         priv->cfg->ht_params->use_rts_for_aggregation &&

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

-         info->flags & IEEE80211_TX_CTL_AMPDU) {
-             *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
-             return;
-     }
 }

Shouldn't there be a new "use_cts_for_aggregation" flag and one that dominates (looks like use_rts in your setup), rather than this?

Not sure if I understand. Rts-cts and cts-to-self are mutual exclusive at present, so if use_rts_for_aggregations = 0 mean that cts-to-self protection must be used. Perhaps we should introduce 4-way module option like: FORCE_RTS_CTS, FORCE_CTS_TO_SELF, FORCE_NO_PROTECTION, DEFAULT (HW depend) just for doing experiments.

Quoted 3 lines

I'm
still a bit confused as to why CTS-to-self should help (as opposed to masking some other bug).

I have no idea too, and indeed this could mask some (firmware?) bug. I think I can explain slight better performance on 6000 - when we use rts-cts two additional frames must be used when starting BA session, with cts-to-self only one frame.

Anyway 11n on iwlwifi still need some more investigation and fixing.

Stanislaw

#4 lore raw
In reply to Guy, Wey-Yi
Quoted 28 lines · Wey-Yi
Quoted 27 lines · Stanislaw Gruszka

This patch fixes 802.11n stability and performance regression we have since 2.6.35. It boost performance on my 5GHz N-only network from about 5MB/s to 8MB/s. Similar percentage boost can be observed on 2.4 GHz.

These are test results of 5x downloading of approximately 700MB iso image:

vanilla: 5.27 5.22 4.94 4.47 5.31 ; avr 5.0420 std 0.35110
patched: 8.07 7.95 8.06 7.99 7.96 ; avr 8.0060 std 0.055946

This was achieved with NetworkManager configured to do not perform periodical scans, by configuring constant BSSID. With periodical scans, after some time, performance downgrade to unpatched driver level, like in example below:

patched: 7.40 7.61 4.28 4.37 4.80 avr 5.6920 std 1.6683

However patch still make better here, since similar test on unpatched driver make link disconnects with below messages after some time:

wlan1: authenticate with 00:23:69:35:d1:3f (try 1)
wlan1: authenticate with 00:23:69:35:d1:3f (try 2)
wlan1: authenticate with 00:23:69:35:d1:3f (try 3)
wlan1: authentication with 00:23:69:35:d1:3f timed out

On 2.6.35 kernel patch helps against connection hangs with messages:

Quoted 7 lines
Quoted 6 lines

iwlagn 0000:20:00.0: queue 10 stuck 3 time. Fw reload. iwlagn 0000:20:00.0: On demand firmware reload
iwlagn 0000:20:00.0: Stopping AGG while state not ON or starting

John, can you apply that patch and push upstream? Or should I repost? I want backport it to Fedora 2.6.35 as it fixes random 11n connection hangs there (common F-14 bug).

Quoted 69 lines
Quoted 53 lines

---
v1 -> v2: s/unpached/unpatched/

 drivers/net/wireless/iwlwifi/iwl-5000.c     |    1 -
 drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c |   12 ++----------
 drivers/net/wireless/iwlwifi/iwl-agn-rxon.c |    8 ++++++++
 3 files changed, 10 insertions(+), 11 deletions(-)
drivers/net/wireless/iwlwifi/iwl-5000.c +0 -1
index a70b8cf..f96eb5b 100644
@@ -425,7 +425,6 @@ static struct iwl_base_params iwl5000_base_params = {
 };
 static struct iwl_ht_params iwl5000_ht_params = {
 	.ht_greenfield_support = true,
-	.use_rts_for_aggregation = true, /* use rts/cts protection */
 };
 
 #define IWL_DEVICE_5000						\
drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c +2 -10
index b12c72d..23fa93d 100644
@@ -163,17 +163,9 @@ static void iwlagn_tx_cmd_protection(struct iwl_priv *priv,
 				     __le16 fc, __le32 *tx_flags)
 {
 	if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS ||
-	    info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
+	    info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT ||
+	    info->flags & IEEE80211_TX_CTL_AMPDU)
 		*tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
-		return;
-	}
-
-	if (priv->cfg->ht_params &&
-	    priv->cfg->ht_params->use_rts_for_aggregation &&
-	    info->flags & IEEE80211_TX_CTL_AMPDU) {
-		*tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK;
-		return;
-	}
 }
 
 /* Calc max signal level (dBm) among 3 possible receivers */
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c +1 -0
index a95ad84..0a1941d 100644
@@ -325,6 +325,14 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
 			return 0;
 	}
 
+	/*

drivers/net/wireless/iwlwifi/iwl-agn-rxon.c int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) · line 338

Quoted 10 lines
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c +7 -0
+	 * force CTS-to-self frames protection if RTS-CTS is not preferred
+	 * one aggregation protection method
+	 */
+	if (!(priv->cfg->ht_params &&
+	      priv->cfg->ht_params->use_rts_for_aggregation))
+		ctx->staging.flags |= RXON_FLG_SELF_CTS_EN;
+
 	if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) ||
 	    !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK))
 		ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;

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

#5 lore raw
Quoted 33 lines · Stanislaw Gruszka
Quoted 32 lines · Wey-Yi
Quoted 31 lines · Stanislaw Gruszka

This patch fixes 802.11n stability and performance regression we have since 2.6.35. It boost performance on my 5GHz N-only network from about 5MB/s to 8MB/s. Similar percentage boost can be observed on 2.4 GHz.

These are test results of 5x downloading of approximately 700MB iso image:

vanilla: 5.27 5.22 4.94 4.47 5.31 ; avr 5.0420 std 0.35110
patched: 8.07 7.95 8.06 7.99 7.96 ; avr 8.0060 std 0.055946

This was achieved with NetworkManager configured to do not perform periodical scans, by configuring constant BSSID. With periodical scans, after some time, performance downgrade to unpatched driver level, like in example below:

patched: 7.40 7.61 4.28 4.37 4.80 avr 5.6920 std 1.6683

However patch still make better here, since similar test on unpatched driver make link disconnects with below messages after some time:

wlan1: authenticate with 00:23:69:35:d1:3f (try 1)
wlan1: authenticate with 00:23:69:35:d1:3f (try 2)
wlan1: authenticate with 00:23:69:35:d1:3f (try 3)
wlan1: authentication with 00:23:69:35:d1:3f timed out

On 2.6.35 kernel patch helps against connection hangs with messages:

iwlagn 0000:20:00.0: queue 10 stuck 3 time. Fw reload. iwlagn 0000:20:00.0: On demand firmware reload
iwlagn 0000:20:00.0: Stopping AGG while state not ON or starting

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

John, can you apply that patch and push upstream? Or should I repost? I want backport it to Fedora 2.6.35 as it fixes random 11n connection hangs there (common F-14 bug).

Sorry, I was waiting to see if Daniel was going to reply further...

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#6 lore raw
Quoted 36 lines · John W. Linville
Quoted 35 lines · Stanislaw Gruszka
Quoted 34 lines · Wey-Yi
Quoted 33 lines · Stanislaw Gruszka

This patch fixes 802.11n stability and performance regression we have since 2.6.35. It boost performance on my 5GHz N-only network from about 5MB/s to 8MB/s. Similar percentage boost can be observed on 2.4 GHz.

These are test results of 5x downloading of approximately 700MB iso image:

vanilla: 5.27 5.22 4.94 4.47 5.31 ; avr 5.0420 std 0.35110
patched: 8.07 7.95 8.06 7.99 7.96 ; avr 8.0060 std 0.055946

This was achieved with NetworkManager configured to do not perform periodical scans, by configuring constant BSSID. With periodical scans, after some time, performance downgrade to unpatched driver level, like in example below:

patched: 7.40 7.61 4.28 4.37 4.80 avr 5.6920 std 1.6683

However patch still make better here, since similar test on unpatched driver make link disconnects with below messages after some time:

wlan1: authenticate with 00:23:69:35:d1:3f (try 1)
wlan1: authenticate with 00:23:69:35:d1:3f (try 2)
wlan1: authenticate with 00:23:69:35:d1:3f (try 3)
wlan1: authentication with 00:23:69:35:d1:3f timed out

On 2.6.35 kernel patch helps against connection hangs with messages:

iwlagn 0000:20:00.0: queue 10 stuck 3 time. Fw reload. iwlagn 0000:20:00.0: On demand firmware reload
iwlagn 0000:20:00.0: Stopping AGG while state not ON or starting

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

John, can you apply that patch and push upstream? Or should I repost? I want backport it to Fedora 2.6.35 as it fixes random 11n connection hangs there (common F-14 bug).

Sorry, I was waiting to see if Daniel was going to reply further...

Gotcha -- I doubt it harms much, and Stanislaw is right that changing RTS/CTS to CTS-self is more efficient. This patch is likely a good thing to have, though I still think there's something else going on ;)

Dan