Patchwork [1/1] UBUNTU: rt2x00: re-adjust wifi signal strength range

login
register
mail settings
Submitter Colin King
Date April 9, 2010, 9:14 a.m.
Message ID <1270804497-16001-2-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/49792/
State Accepted
Delegated to: Stefan Bader
Headers show

Comments

Colin King - April 9, 2010, 9:14 a.m.
From: Colin Ian King <colin.king@canonical.com>

BugLink: https://bugs.launchpad.net/bugs/557239

The range of signal strength reported by rt2x00 is very narrow and
the base offset is too low.  The original algorithm was based on a
mix of 20% from the RSSI, 40% from RX quality and 40% from TX
quality metrics.

For the rt73usb driver, the TX failure metric is a piece of fiction
and always returns success (unless there is a USB URB failure) so
this skews the TX quality metrics and hence skews the signal
strength result.

The original calculation is only really useful for a network
that you're already connected to.  The reliance on RX and TX
quality metrics when not connected to a network skews the final
signal strength since the only valid metric (RSSI) is a minor
contributor to the final calculation.

A survey of most wifi drivers show that using just the RSSI is
a common method of producing a signal strength metric, so this
fix adjusts the wifi strength to be calculated just on RSSI.

This fix also adjusts the range of the DEFAULT_RSSI_OFFSET to
correctly reflect the absolute maximum range of the RSSI.  The
original code was a little overzealous in providing enough
headroom.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 .../drivers/net/wireless/rt2x00/rt2x00.h           |    6 +++---
 .../drivers/net/wireless/rt2x00/rt73usb.h          |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
Andy Whitcroft - April 9, 2010, 2:14 p.m.
On Fri, Apr 09, 2010 at 10:14:57AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/557239
> 
> The range of signal strength reported by rt2x00 is very narrow and
> the base offset is too low.  The original algorithm was based on a
> mix of 20% from the RSSI, 40% from RX quality and 40% from TX
> quality metrics.
> 
> For the rt73usb driver, the TX failure metric is a piece of fiction
> and always returns success (unless there is a USB URB failure) so
> this skews the TX quality metrics and hence skews the signal
> strength result.
> 
> The original calculation is only really useful for a network
> that you're already connected to.  The reliance on RX and TX
> quality metrics when not connected to a network skews the final
> signal strength since the only valid metric (RSSI) is a minor
> contributor to the final calculation.
> 
> A survey of most wifi drivers show that using just the RSSI is
> a common method of producing a signal strength metric, so this
> fix adjusts the wifi strength to be calculated just on RSSI.
> 
> This fix also adjusts the range of the DEFAULT_RSSI_OFFSET to
> correctly reflect the absolute maximum range of the RSSI.  The
> original code was a little overzealous in providing enough
> headroom.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  .../drivers/net/wireless/rt2x00/rt2x00.h           |    6 +++---
>  .../drivers/net/wireless/rt2x00/rt73usb.h          |    2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> 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 311b8d0..97812c8 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
> @@ -196,9 +196,9 @@ struct link_qual {
>  	int tx_percentage;
>  	int tx_success;
>  	int tx_failed;
> -#define WEIGHT_RSSI	20
> -#define WEIGHT_RX	40
> -#define WEIGHT_TX	40
> +#define WEIGHT_RSSI	100
> +#define WEIGHT_RX	0
> +#define WEIGHT_TX	0
>  };
>  
>  /*
> diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h
> index 60f98be..97f9503 100644
> --- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h
> +++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h
> @@ -39,7 +39,7 @@
>   * Signal information.
>   * Defaul offset is required for RSSI <-> dBm conversion.
>   */
> -#define DEFAULT_RSSI_OFFSET		120
> +#define DEFAULT_RSSI_OFFSET		104
>  
>  /*
>   * Register layout information.

Looks to do what you claim.  I am assuming you are measureing against
other cards in the same environ and with these patches have a similar 
metrics.  So:

Acked-by: Andy Whitcroft <apw@canonical.com>

-apw
Colin King - April 9, 2010, 3:15 p.m.
On Fri, 2010-04-09 at 15:14 +0100, Andy Whitcroft wrote:
> On Fri, Apr 09, 2010 at 10:14:57AM +0100, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> > 
> > BugLink: https://bugs.launchpad.net/bugs/557239
> > 
> > The range of signal strength reported by rt2x00 is very narrow and
> > the base offset is too low.  The original algorithm was based on a
> > mix of 20% from the RSSI, 40% from RX quality and 40% from TX
> > quality metrics.
> > 
> > For the rt73usb driver, the TX failure metric is a piece of fiction
> > and always returns success (unless there is a USB URB failure) so
> > this skews the TX quality metrics and hence skews the signal
> > strength result.
> > 
> > The original calculation is only really useful for a network
> > that you're already connected to.  The reliance on RX and TX
> > quality metrics when not connected to a network skews the final
> > signal strength since the only valid metric (RSSI) is a minor
> > contributor to the final calculation.
> > 
> > A survey of most wifi drivers show that using just the RSSI is
> > a common method of producing a signal strength metric, so this
> > fix adjusts the wifi strength to be calculated just on RSSI.
> > 
> > This fix also adjusts the range of the DEFAULT_RSSI_OFFSET to
> > correctly reflect the absolute maximum range of the RSSI.  The
> > original code was a little overzealous in providing enough
> > headroom.
> > 
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  .../drivers/net/wireless/rt2x00/rt2x00.h           |    6 +++---
> >  .../drivers/net/wireless/rt2x00/rt73usb.h          |    2 +-
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > 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 311b8d0..97812c8 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
> > @@ -196,9 +196,9 @@ struct link_qual {
> >  	int tx_percentage;
> >  	int tx_success;
> >  	int tx_failed;
> > -#define WEIGHT_RSSI	20
> > -#define WEIGHT_RX	40
> > -#define WEIGHT_TX	40
> > +#define WEIGHT_RSSI	100
> > +#define WEIGHT_RX	0
> > +#define WEIGHT_TX	0
> >  };
> >  
> >  /*
> > diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h
> > index 60f98be..97f9503 100644
> > --- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h
> > +++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h
> > @@ -39,7 +39,7 @@
> >   * Signal information.
> >   * Defaul offset is required for RSSI <-> dBm conversion.
> >   */
> > -#define DEFAULT_RSSI_OFFSET		120
> > +#define DEFAULT_RSSI_OFFSET		104
> >  
> >  /*
> >   * Register layout information.
> 
> Looks to do what you claim.  I am assuming you are measureing against
> other cards in the same environ and with these patches have a similar 
> metrics. 

Indeed. It's a rather subjective to say the least. I surveyed a bunch of
drivers and summarised my findings here:
http://smackerelofopinion.blogspot.com/2010/02/examining-wifi-signal-quality.html


>  So:
> 
> Acked-by: Andy Whitcroft <apw@canonical.com>
> 
> -apw
Stefan Bader - April 12, 2010, 3:17 p.m.
It sounds like you tested well. HAve you sent it upstream as well or is it not
applicable there? In general it seems to be doing what you claim...


Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/557239
> 
> The range of signal strength reported by rt2x00 is very narrow and
> the base offset is too low.  The original algorithm was based on a
> mix of 20% from the RSSI, 40% from RX quality and 40% from TX
> quality metrics.
> 
> For the rt73usb driver, the TX failure metric is a piece of fiction
> and always returns success (unless there is a USB URB failure) so
> this skews the TX quality metrics and hence skews the signal
> strength result.
> 
> The original calculation is only really useful for a network
> that you're already connected to.  The reliance on RX and TX
> quality metrics when not connected to a network skews the final
> signal strength since the only valid metric (RSSI) is a minor
> contributor to the final calculation.
> 
> A survey of most wifi drivers show that using just the RSSI is
> a common method of producing a signal strength metric, so this
> fix adjusts the wifi strength to be calculated just on RSSI.
> 
> This fix also adjusts the range of the DEFAULT_RSSI_OFFSET to
> correctly reflect the absolute maximum range of the RSSI.  The
> original code was a little overzealous in providing enough
> headroom.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  .../drivers/net/wireless/rt2x00/rt2x00.h           |    6 +++---
>  .../drivers/net/wireless/rt2x00/rt73usb.h          |    2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> 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 311b8d0..97812c8 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
> @@ -196,9 +196,9 @@ struct link_qual {
>  	int tx_percentage;
>  	int tx_success;
>  	int tx_failed;
> -#define WEIGHT_RSSI	20
> -#define WEIGHT_RX	40
> -#define WEIGHT_TX	40
> +#define WEIGHT_RSSI	100
> +#define WEIGHT_RX	0
> +#define WEIGHT_TX	0
>  };
>  
>  /*
> diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h
> index 60f98be..97f9503 100644
> --- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h
> +++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h
> @@ -39,7 +39,7 @@
>   * Signal information.
>   * Defaul offset is required for RSSI <-> dBm conversion.
>   */
> -#define DEFAULT_RSSI_OFFSET		120
> +#define DEFAULT_RSSI_OFFSET		104
>  
>  /*
>   * Register layout information.

Patch

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 311b8d0..97812c8 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
@@ -196,9 +196,9 @@  struct link_qual {
 	int tx_percentage;
 	int tx_success;
 	int tx_failed;
-#define WEIGHT_RSSI	20
-#define WEIGHT_RX	40
-#define WEIGHT_TX	40
+#define WEIGHT_RSSI	100
+#define WEIGHT_RX	0
+#define WEIGHT_TX	0
 };
 
 /*
diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h
index 60f98be..97f9503 100644
--- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h
+++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h
@@ -39,7 +39,7 @@ 
  * Signal information.
  * Defaul offset is required for RSSI <-> dBm conversion.
  */
-#define DEFAULT_RSSI_OFFSET		120
+#define DEFAULT_RSSI_OFFSET		104
 
 /*
  * Register layout information.