2009-01-27 03:08:45

by Larry Finger

[permalink] [raw]
Subject: [PATCH] rtl8187: Fix error in setting OFDM power settings for RTL8187L

After reports of poor performance, a review of the latest vendor driver
(rtl8187_linux_26.1025.0328.2007) for RTL8187L devices was undertaken.

A difference was found in the code used to index the OFDM power tables.=
When
the Linux driver was changed, my unit works at a much greater range tha=
n
before. I think this fixes Bugzilla #12380 and has been tested by at le=
ast
two other users.

Signed-off-by: Larry Finger <[email protected]>
Tested-by: Mart=C3=ADn Ernesto Barreyro <[email protected]>
Cc: Stable <[email protected]>
---

John,

This material should be included in 2.6.29. Although I have Cc'd stable=
, the
patch will need to be respun due to the file renaming.

Larry
---

Index: wireless-testing/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- wireless-testing.orig/drivers/net/wireless/rtl818x/rtl8187_rtl8225.=
c
+++ wireless-testing/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
@@ -285,6 +285,10 @@ static void rtl8225_rf_set_tx_power(stru
ofdm_power =3D priv->channels[channel - 1].hw_value >> 4;
=20
cck_power =3D min(cck_power, (u8)11);
+ if (ofdm_power > (u8)15)
+ ofdm_power =3D 25;
+ else
+ ofdm_power +=3D 10;
ofdm_power =3D min(ofdm_power, (u8)35);
=20
rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
@@ -536,7 +540,10 @@ static void rtl8225z2_rf_set_tx_power(st
cck_power +=3D priv->txpwr_base & 0xF;
cck_power =3D min(cck_power, (u8)35);
=20
- ofdm_power =3D min(ofdm_power, (u8)15);
+ if (ofdm_power > (u8)15)
+ ofdm_power =3D 25;
+ else
+ ofdm_power +=3D 10;
ofdm_power +=3D priv->txpwr_base >> 4;
ofdm_power =3D min(ofdm_power, (u8)35);
=20
---


2009-01-27 09:46:17

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH] rtl8187: Fix error in setting OFDM power settings for RTL8187L

Hin-Tak Leung wrote:
> --- On Tue, 27/1/09, Larry Finger <[email protected]> wrote:
>
>> After reports of poor performance, a review of the latest
>> vendor driver
>> (rtl8187_linux_26.1025.0328.2007) for RTL8187L devices was
>> undertaken.
>>
>> A difference was found in the code used to index the OFDM
>> power tables. When
>> the Linux driver was changed, my unit works at a much
>> greater range than
>> before. I think this fixes Bugzilla #12380 and has been
>> tested by at least
>> two other users.
>
> What exactly does this change do? it seems to just bias the value of ofdm into higher values:
>
> 0-15 -> 10-25
> 15- -> 25

The values of ofdm_power and cck_power are indexes into the tables
rtl8225_tx_power_cck or rtl8225z2_tx_power_cck. The change does bias
the value into larger numbers both for the index and the value in the
table. Whatever happens inside the device, the bottom line is that the
OFDM performance is greatly improved, at least for the units that use
the rtl8225z2_tx_power_cck table. I'm not sure that any of the other
type have been encountered.

After my experiences with the RTL8187B, I was careful to monitor the
device temperature. Although it is likely that this change increased
the power output of the radio, the device did not get any hotter.

> Also, the first "ofdm_power = min(ofdm_power, (u8)35);" after the change chunk has no effect, since the value from the changed code would clip at 25. You could remove that line...

Thank you for seeing that. I'll submit a revised patch.

Larry

2009-01-27 08:39:19

by Hin-Tak Leung

[permalink] [raw]
Subject: Re: [PATCH] rtl8187: Fix error in setting OFDM power settings for RTL8187L

--- On Tue, 27/1/09, Larry Finger <[email protected]> wrote:

> After reports of poor performance, a review of the latest
> vendor driver
> (rtl8187_linux_26.1025.0328.2007) for RTL8187L devices was
> undertaken.
>=20
> A difference was found in the code used to index the OFDM
> power tables. When
> the Linux driver was changed, my unit works at a much
> greater range than
> before. I think this fixes Bugzilla #12380 and has been
> tested by at least
> two other users.

What exactly does this change do? it seems to just bias the value of of=
dm into higher values:

0-15 -> 10-25
15- -> 25

Also, the first "ofdm_power =3D min(ofdm_power, (u8)35);" after the cha=
nge chunk has no effect, since the value from the changed code would cl=
ip at 25. You could remove that line...


>=20
> Signed-off-by: Larry Finger
> <[email protected]>
> Tested-by: Mart=EDn Ernesto Barreyro
> <[email protected]>
> Cc: Stable <[email protected]>

Acked-by: Hin-Tak Leung <[email protected]>


> ---
>=20
> John,
>=20
> This material should be included in 2.6.29. Although I have
> Cc'd stable, the
> patch will need to be respun due to the file renaming.
>=20
> Larry
> ---
>=20
> Index:
> wireless-testing/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> ---
> wireless-testing.orig/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
> +++
> wireless-testing/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
> @@ -285,6 +285,10 @@ static void
> rtl8225_rf_set_tx_power(stru
> ofdm_power =3D priv->channels[channel - 1].hw_value
> >> 4;
> =20
> cck_power =3D min(cck_power, (u8)11);
> + if (ofdm_power > (u8)15)
> + ofdm_power =3D 25;
> + else
> + ofdm_power +=3D 10;
> ofdm_power =3D min(ofdm_power, (u8)35);
> =20
> rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
> @@ -536,7 +540,10 @@ static void
> rtl8225z2_rf_set_tx_power(st
> cck_power +=3D priv->txpwr_base & 0xF;
> cck_power =3D min(cck_power, (u8)35);
> =20
> - ofdm_power =3D min(ofdm_power, (u8)15);
> + if (ofdm_power > (u8)15)
> + ofdm_power =3D 25;
> + else
> + ofdm_power +=3D 10;
> ofdm_power +=3D priv->txpwr_base >> 4;
> ofdm_power =3D min(ofdm_power, (u8)35);
> =20
> ---


=20