diff mbox

[1/2] rt2x00: Hardcode TX ack timeout and consume time

Message ID 1254835429-9839-1-git-send-email-ike.pan@canonical.com
State Accepted
Headers show

Commit Message

Ike Panhc Oct. 6, 2009, 1:23 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/444377

Impact:
  With the original TX-Ack-Timeout register settings, the performance will hold
  at <3Mbps once we have some very weak signal (which signal level < -80dbm) in
  and out. If we override the register with the value in legacy driver, it will
  not.

Fix:
  Set the Tx-Ack-Timeout register to the same value in legacy driver.

Test:
  Test result shows the performance better when signal level is about -80dbm.

This patch is based on mainline kernel commit 4789666e13fb0b2d45feb1b4a5119a1b997ec84c
and its original author is Ivo van Doorn <ivdoorn@gmail.com>

Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
 .../drivers/net/wireless/rt2x00/rt2400pci.c        |    6 ++----
 .../drivers/net/wireless/rt2x00/rt2500pci.c        |    6 ++----
 .../drivers/net/wireless/rt2x00/rt2500usb.c        |    4 ----
 .../drivers/net/wireless/rt2x00/rt2x00.h           |    3 ---
 .../drivers/net/wireless/rt2x00/rt2x00config.c     |   16 ----------------
 .../drivers/net/wireless/rt2x00/rt61pci.c          |    2 +-
 .../drivers/net/wireless/rt2x00/rt73usb.c          |    2 +-
 7 files changed, 6 insertions(+), 33 deletions(-)

Comments

Stefan Bader Oct. 7, 2009, 1:47 p.m. UTC | #1
Just playing with patchworks. Just ignore.

Ike Panhc wrote:
> BugLink: https://bugs.launchpad.net/bugs/444377
> 
> Impact:
>   With the original TX-Ack-Timeout register settings, the performance will hold
>   at <3Mbps once we have some very weak signal (which signal level < -80dbm) in
>   and out. If we override the register with the value in legacy driver, it will
>   not.
> 
> Fix:
>   Set the Tx-Ack-Timeout register to the same value in legacy driver.
> 
> Test:
>   Test result shows the performance better when signal level is about -80dbm.
> 
> This patch is based on mainline kernel commit 4789666e13fb0b2d45feb1b4a5119a1b997ec84c
> and its original author is Ivo van Doorn <ivdoorn@gmail.com>
> 
> Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  .../drivers/net/wireless/rt2x00/rt2400pci.c        |    6 ++----
>  .../drivers/net/wireless/rt2x00/rt2500pci.c        |    6 ++----
>  .../drivers/net/wireless/rt2x00/rt2500usb.c        |    4 ----
>  .../drivers/net/wireless/rt2x00/rt2x00.h           |    3 ---
>  .../drivers/net/wireless/rt2x00/rt2x00config.c     |   16 ----------------
>  .../drivers/net/wireless/rt2x00/rt61pci.c          |    2 +-
>  .../drivers/net/wireless/rt2x00/rt73usb.c          |    2 +-
>  7 files changed, 6 insertions(+), 33 deletions(-)
> 
> diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2400pci.c b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2400pci.c
> index 4c0538d..2d49e68 100644
> --- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2400pci.c
> +++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2400pci.c
> @@ -367,10 +367,8 @@ static void rt2400pci_config_erp(struct rt2x00_dev *rt2x00dev,
>  	preamble_mask = erp->short_preamble << 3;
>  
>  	rt2x00pci_register_read(rt2x00dev, TXCSR1, &reg);
> -	rt2x00_set_field32(&reg, TXCSR1_ACK_TIMEOUT,
> -			   erp->ack_timeout);
> -	rt2x00_set_field32(&reg, TXCSR1_ACK_CONSUME_TIME,
> -			   erp->ack_consume_time);
> +	rt2x00_set_field32(&reg, TXCSR1_ACK_TIMEOUT, 0x1ff);
> +	rt2x00_set_field32(&reg, TXCSR1_ACK_CONSUME_TIME, 0x13a);
>  	rt2x00pci_register_write(rt2x00dev, TXCSR1, reg);
>  
>  	rt2x00pci_register_read(rt2x00dev, ARCSR2, &reg);
> diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500pci.c b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500pci.c
> index aa6dfb8..0dd6387 100644
> --- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500pci.c
> +++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500pci.c
> @@ -373,10 +373,8 @@ static void rt2500pci_config_erp(struct rt2x00_dev *rt2x00dev,
>  	preamble_mask = erp->short_preamble << 3;
>  
>  	rt2x00pci_register_read(rt2x00dev, TXCSR1, &reg);
> -	rt2x00_set_field32(&reg, TXCSR1_ACK_TIMEOUT,
> -			   erp->ack_timeout);
> -	rt2x00_set_field32(&reg, TXCSR1_ACK_CONSUME_TIME,
> -			   erp->ack_consume_time);
> +	rt2x00_set_field32(&reg, TXCSR1_ACK_TIMEOUT, 0x162);
> +	rt2x00_set_field32(&reg, TXCSR1_ACK_CONSUME_TIME, 0xa2);
>  	rt2x00pci_register_write(rt2x00dev, TXCSR1, reg);
>  
>  	rt2x00pci_register_read(rt2x00dev, ARCSR2, &reg);
> diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500usb.c b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500usb.c
> index 2547467..8c23b21 100644
> --- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500usb.c
> +++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500usb.c
> @@ -415,10 +415,6 @@ static void rt2500usb_config_erp(struct rt2x00_dev *rt2x00dev,
>  {
>  	u16 reg;
>  
> -	rt2500usb_register_read(rt2x00dev, TXRX_CSR1, &reg);
> -	rt2x00_set_field16(&reg, TXRX_CSR1_ACK_TIMEOUT, erp->ack_timeout);
> -	rt2500usb_register_write(rt2x00dev, TXRX_CSR1, reg);
> -
>  	rt2500usb_register_read(rt2x00dev, TXRX_CSR10, &reg);
>  	rt2x00_set_field16(&reg, TXRX_CSR10_AUTORESPOND_PREAMBLE,
>  			   !!erp->short_preamble);
> diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00.h b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00.h
> index 345b7d1..427d01e 100644
> --- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00.h
> +++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00.h
> @@ -437,9 +437,6 @@ struct rt2x00lib_conf {
>  struct rt2x00lib_erp {
>  	int short_preamble;
>  	int cts_protection;
> -
> -	int ack_timeout;
> -	int ack_consume_time;
>  };
>  
>  /*
> diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00config.c b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00config.c
> index e7ce8c4..36a0345 100644
> --- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00config.c
> +++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00config.c
> @@ -86,22 +86,6 @@ void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
>  	erp.short_preamble = bss_conf->use_short_preamble;
>  	erp.cts_protection = bss_conf->use_cts_prot;
>  
> -	erp.ack_timeout = PLCP + get_duration(ACK_SIZE, 10);
> -	erp.ack_consume_time = SIFS + PLCP + get_duration(ACK_SIZE, 10);
> -
> -	if (rt2x00dev->hw->conf.flags & IEEE80211_CONF_SHORT_SLOT_TIME)
> -		erp.ack_timeout += SHORT_DIFS;
> -	else
> -		erp.ack_timeout += DIFS;
> -
> -	if (bss_conf->use_short_preamble) {
> -		erp.ack_timeout += SHORT_PREAMBLE;
> -		erp.ack_consume_time += SHORT_PREAMBLE;
> -	} else {
> -		erp.ack_timeout += PREAMBLE;
> -		erp.ack_consume_time += PREAMBLE;
> -	}
> -
>  	rt2x00dev->ops->lib->config_erp(rt2x00dev, &erp);
>  }
>  
> diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt61pci.c b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt61pci.c
> index 70ef7bf..63ed430 100644
> --- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt61pci.c
> +++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt61pci.c
> @@ -431,7 +431,7 @@ static void rt61pci_config_erp(struct rt2x00_dev *rt2x00dev,
>  	u32 reg;
>  
>  	rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, &reg);
> -	rt2x00_set_field32(&reg, TXRX_CSR0_RX_ACK_TIMEOUT, erp->ack_timeout);
> +	rt2x00_set_field32(&reg, TXRX_CSR0_RX_ACK_TIMEOUT, 0x32);
>  	rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg);
>  
>  	rt2x00pci_register_read(rt2x00dev, TXRX_CSR4, &reg);
> diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.c b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.c
> index a797405..2521a08 100644
> --- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.c
> +++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.c
> @@ -453,7 +453,7 @@ static void rt73usb_config_erp(struct rt2x00_dev *rt2x00dev,
>  	u32 reg;
>  
>  	rt73usb_register_read(rt2x00dev, TXRX_CSR0, &reg);
> -	rt2x00_set_field32(&reg, TXRX_CSR0_RX_ACK_TIMEOUT, erp->ack_timeout);
> +	rt2x00_set_field32(&reg, TXRX_CSR0_RX_ACK_TIMEOUT, 0x32);
>  	rt73usb_register_write(rt2x00dev, TXRX_CSR0, reg);
>  
>  	rt73usb_register_read(rt2x00dev, TXRX_CSR4, &reg);
diff mbox

Patch

diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2400pci.c b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2400pci.c
index 4c0538d..2d49e68 100644
--- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -367,10 +367,8 @@  static void rt2400pci_config_erp(struct rt2x00_dev *rt2x00dev,
 	preamble_mask = erp->short_preamble << 3;
 
 	rt2x00pci_register_read(rt2x00dev, TXCSR1, &reg);
-	rt2x00_set_field32(&reg, TXCSR1_ACK_TIMEOUT,
-			   erp->ack_timeout);
-	rt2x00_set_field32(&reg, TXCSR1_ACK_CONSUME_TIME,
-			   erp->ack_consume_time);
+	rt2x00_set_field32(&reg, TXCSR1_ACK_TIMEOUT, 0x1ff);
+	rt2x00_set_field32(&reg, TXCSR1_ACK_CONSUME_TIME, 0x13a);
 	rt2x00pci_register_write(rt2x00dev, TXCSR1, reg);
 
 	rt2x00pci_register_read(rt2x00dev, ARCSR2, &reg);
diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500pci.c b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500pci.c
index aa6dfb8..0dd6387 100644
--- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -373,10 +373,8 @@  static void rt2500pci_config_erp(struct rt2x00_dev *rt2x00dev,
 	preamble_mask = erp->short_preamble << 3;
 
 	rt2x00pci_register_read(rt2x00dev, TXCSR1, &reg);
-	rt2x00_set_field32(&reg, TXCSR1_ACK_TIMEOUT,
-			   erp->ack_timeout);
-	rt2x00_set_field32(&reg, TXCSR1_ACK_CONSUME_TIME,
-			   erp->ack_consume_time);
+	rt2x00_set_field32(&reg, TXCSR1_ACK_TIMEOUT, 0x162);
+	rt2x00_set_field32(&reg, TXCSR1_ACK_CONSUME_TIME, 0xa2);
 	rt2x00pci_register_write(rt2x00dev, TXCSR1, reg);
 
 	rt2x00pci_register_read(rt2x00dev, ARCSR2, &reg);
diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500usb.c b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500usb.c
index 2547467..8c23b21 100644
--- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -415,10 +415,6 @@  static void rt2500usb_config_erp(struct rt2x00_dev *rt2x00dev,
 {
 	u16 reg;
 
-	rt2500usb_register_read(rt2x00dev, TXRX_CSR1, &reg);
-	rt2x00_set_field16(&reg, TXRX_CSR1_ACK_TIMEOUT, erp->ack_timeout);
-	rt2500usb_register_write(rt2x00dev, TXRX_CSR1, reg);
-
 	rt2500usb_register_read(rt2x00dev, TXRX_CSR10, &reg);
 	rt2x00_set_field16(&reg, TXRX_CSR10_AUTORESPOND_PREAMBLE,
 			   !!erp->short_preamble);
diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00.h b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00.h
index 345b7d1..427d01e 100644
--- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00.h
@@ -437,9 +437,6 @@  struct rt2x00lib_conf {
 struct rt2x00lib_erp {
 	int short_preamble;
 	int cts_protection;
-
-	int ack_timeout;
-	int ack_consume_time;
 };
 
 /*
diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00config.c b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00config.c
index e7ce8c4..36a0345 100644
--- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -86,22 +86,6 @@  void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
 	erp.short_preamble = bss_conf->use_short_preamble;
 	erp.cts_protection = bss_conf->use_cts_prot;
 
-	erp.ack_timeout = PLCP + get_duration(ACK_SIZE, 10);
-	erp.ack_consume_time = SIFS + PLCP + get_duration(ACK_SIZE, 10);
-
-	if (rt2x00dev->hw->conf.flags & IEEE80211_CONF_SHORT_SLOT_TIME)
-		erp.ack_timeout += SHORT_DIFS;
-	else
-		erp.ack_timeout += DIFS;
-
-	if (bss_conf->use_short_preamble) {
-		erp.ack_timeout += SHORT_PREAMBLE;
-		erp.ack_consume_time += SHORT_PREAMBLE;
-	} else {
-		erp.ack_timeout += PREAMBLE;
-		erp.ack_consume_time += PREAMBLE;
-	}
-
 	rt2x00dev->ops->lib->config_erp(rt2x00dev, &erp);
 }
 
diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt61pci.c b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt61pci.c
index 70ef7bf..63ed430 100644
--- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt61pci.c
@@ -431,7 +431,7 @@  static void rt61pci_config_erp(struct rt2x00_dev *rt2x00dev,
 	u32 reg;
 
 	rt2x00pci_register_read(rt2x00dev, TXRX_CSR0, &reg);
-	rt2x00_set_field32(&reg, TXRX_CSR0_RX_ACK_TIMEOUT, erp->ack_timeout);
+	rt2x00_set_field32(&reg, TXRX_CSR0_RX_ACK_TIMEOUT, 0x32);
 	rt2x00pci_register_write(rt2x00dev, TXRX_CSR0, reg);
 
 	rt2x00pci_register_read(rt2x00dev, TXRX_CSR4, &reg);
diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.c b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.c
index a797405..2521a08 100644
--- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.c
@@ -453,7 +453,7 @@  static void rt73usb_config_erp(struct rt2x00_dev *rt2x00dev,
 	u32 reg;
 
 	rt73usb_register_read(rt2x00dev, TXRX_CSR0, &reg);
-	rt2x00_set_field32(&reg, TXRX_CSR0_RX_ACK_TIMEOUT, erp->ack_timeout);
+	rt2x00_set_field32(&reg, TXRX_CSR0_RX_ACK_TIMEOUT, 0x32);
 	rt73usb_register_write(rt2x00dev, TXRX_CSR0, reg);
 
 	rt73usb_register_read(rt2x00dev, TXRX_CSR4, &reg);