* RT61 antenna diversity in 2.6.30
@ 2009-07-13 20:24 Lars Ericsson
2009-07-14 19:44 ` Ivo van Doorn
0 siblings, 1 reply; 2+ messages in thread
From: Lars Ericsson @ 2009-07-13 20:24 UTC (permalink / raw)
To: 'Ivo van Doorn'; +Cc: linux-wireless, users
Hi Ivo,
I recently moved from 2.6.26 to 2.6.30 with a HW that do
SW antenna diversity with .26 but not with .30
I have found two problems:
1) The rt2x00mac_config() calls rt2x00lib_config_antenna() and reset the
rt2x00dev->default_ant.
2) The rt2x00lib_antenna_diversity_sample() does not update the sampled
antenna rssi.
I have applied the following patches to correct the problems:
1)
--- a/drivers/net/wireless/rt2x00/rt2x00link.c 2009-07-13
21:48:45.000000000 +0200
+++ b/drivers/net/wireless/rt2x00/rt2x00link.c 2009-07-13
21:52:42.000000000 +0200
@@ -146,8 +151,13 @@ static void rt2x00lib_antenna_diversity_
{
struct link_ant *ant = &rt2x00dev->link.ant;
struct antenna_setup new_ant;
- int sample_a = rt2x00link_antenna_get_rssi_history(rt2x00dev,
ANTENNA_A);
- int sample_b = rt2x00link_antenna_get_rssi_history(rt2x00dev,
ANTENNA_B);
+ int rssi_curr, sample_a, sample_b;
+
+ rssi_curr = rt2x00link_antenna_get_link_rssi(rt2x00dev);
+ rt2x00link_antenna_update_rssi_rx_history(rt2x00dev, rssi_curr);
+
+ sample_a = rt2x00link_antenna_get_rssi_history(rt2x00dev,
ANTENNA_A);
+ sample_b = rt2x00link_antenna_get_rssi_history(rt2x00dev,
ANTENNA_B);
memcpy(&new_ant, &ant->active, sizeof(new_ant));
---
2)
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c 2009-07-13
21:51:26.000000000 +0200
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c 2009-07-13
21:54:28.000000000 +0200
@@ -375,10 +375,12 @@ int rt2x00mac_config(struct ieee80211_hw
* diversity. But for non-diversity configurations, we need
* to have configured the correct state now.
*/
- if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED)
+ if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) {
+ rt2x00dev->link.ant.active = rt2x00dev->default_ant;
rt2x00lib_config_antenna(rt2x00dev,
- &rt2x00dev->default_ant);
-
+
&rt2x00dev->link.ant.active);
+ }
+
/* Turn RX back on */
rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
} else {
Regards
Lars
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: RT61 antenna diversity in 2.6.30
2009-07-13 20:24 RT61 antenna diversity in 2.6.30 Lars Ericsson
@ 2009-07-14 19:44 ` Ivo van Doorn
0 siblings, 0 replies; 2+ messages in thread
From: Ivo van Doorn @ 2009-07-14 19:44 UTC (permalink / raw)
To: Lars Ericsson; +Cc: linux-wireless, users
On Monday 13 July 2009, Lars Ericsson wrote:
> Hi Ivo,
>
> I recently moved from 2.6.26 to 2.6.30 with a HW that do
> SW antenna diversity with .26 but not with .30
>
> I have found two problems:
> 1) The rt2x00mac_config() calls rt2x00lib_config_antenna() and reset the
> rt2x00dev->default_ant.
Where is this reset of default_ant occuring?
There is only 1 write action in that function and that is altering the
rt2x00dev->link.ant.active field.
> 2) The rt2x00lib_antenna_diversity_sample() does not update the sampled
> antenna rssi.
And why should that be done?
> I have applied the following patches to correct the problems:
>
> 1)
> --- a/drivers/net/wireless/rt2x00/rt2x00link.c 2009-07-13
> 21:48:45.000000000 +0200
> +++ b/drivers/net/wireless/rt2x00/rt2x00link.c 2009-07-13
> 21:52:42.000000000 +0200
> @@ -146,8 +151,13 @@ static void rt2x00lib_antenna_diversity_
> {
> struct link_ant *ant = &rt2x00dev->link.ant;
> struct antenna_setup new_ant;
> - int sample_a = rt2x00link_antenna_get_rssi_history(rt2x00dev,
> ANTENNA_A);
> - int sample_b = rt2x00link_antenna_get_rssi_history(rt2x00dev,
> ANTENNA_B);
> + int rssi_curr, sample_a, sample_b;
> +
> + rssi_curr = rt2x00link_antenna_get_link_rssi(rt2x00dev);
> + rt2x00link_antenna_update_rssi_rx_history(rt2x00dev, rssi_curr);
> +
> + sample_a = rt2x00link_antenna_get_rssi_history(rt2x00dev,
> ANTENNA_A);
> + sample_b = rt2x00link_antenna_get_rssi_history(rt2x00dev,
> ANTENNA_B);
>
> memcpy(&new_ant, &ant->active, sizeof(new_ant));
> ---
>
> 2)
> --- a/drivers/net/wireless/rt2x00/rt2x00mac.c 2009-07-13
> 21:51:26.000000000 +0200
> +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c 2009-07-13
> 21:54:28.000000000 +0200
> @@ -375,10 +375,12 @@ int rt2x00mac_config(struct ieee80211_hw
> * diversity. But for non-diversity configurations, we need
> * to have configured the correct state now.
> */
> - if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED)
> + if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) {
> + rt2x00dev->link.ant.active = rt2x00dev->default_ant;
This is done in rt2x00lib_config_antenna where it should.
> rt2x00lib_config_antenna(rt2x00dev,
> - &rt2x00dev->default_ant);
> +
> &rt2x00dev->link.ant.active);
This is very bad, since calling rt2x00lib_config_antenna() to set it to
the active configuration should always result in nothing being done.
Your hack by reseting the active field will cause it to do something,
but it looks extremely hackish.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-14 19:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-13 20:24 RT61 antenna diversity in 2.6.30 Lars Ericsson
2009-07-14 19:44 ` Ivo van Doorn
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).