[rt2x00-users] [PATCH] rt2x00: Antenna diversity does not work in 2.6.35

Helmut Schaa helmut.schaa at googlemail.com
Fri Sep 3 11:03:23 UTC 2010


Hi,

Am Thursday 02 September 2010 schrieb Ivo Van Doorn:
> Helmut, Gertjan, could you also check if below patch is correct?
> Software diversity has always been tricky, so an extra pair of eyes
> on any patches which touch this code would be nice. :)

I've looked through the whole patch but since I don't understand the
diversity code yet I cannot ack/nack on that but the patch description
sounds reasonable ...

Helmut

> 
> On Sun, Aug 15, 2010 at 12:13 PM, Ivo van Doorn <ivdoorn at gmail.com> wrote:
> > From: Lars Ericsson <lars_ericsson at telia.com>
> >
> > The test if antenna diversity is at all enabled uses a local variable
> > 'flags' to prepare the test condition, but uses 'ant->flags' when the test
> > is evaluated. The effect is that the diversity evaluation will never start.
> > I can see two solutions, use the 'flag' in the test condition or revert the
> > local flag change. My attached patch took alternative two.
> >
> > Then the evaluation start but it will still not switch antenna. The problem
> > is a code section in rt2x00lib_config_antenna (). The effect of that code
> > section is that any change the diversity function perform will be
> > effectively shorten and no antenna selection command issued. The attached
> > patch will filter out any ANTENNA_SW_DIVERSITY setting but forward all
> > other
> >
> > Signed-off-by: Lars Ericsson <lars_ericsson at telia.com>
> > Signed-off-by: Ivo van Doorn <IvDoorn at gmail.com>
> > ---
> > --- linux-2.6.35/drivers/net/wireless/rt2x00/rt2x00link.c       2010-08-13 07:40:16.000000000 +0200
> > +++ linux-2.6.35.new/drivers/net/wireless/rt2x00/rt2x00link.c   2010-08-13 07:43:06.000000000 +0200
> > @@ -212,7 +212,6 @@ static void rt2x00lib_antenna_diversity_
> >  static bool rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev)
> >  {
> >        struct link_ant *ant = &rt2x00dev->link.ant;
> > -       unsigned int flags = ant->flags;
> >
> >        /*
> >         * Determine if software diversity is enabled for
> > @@ -220,13 +219,13 @@ static bool rt2x00lib_antenna_diversity(
> >         * Always perform this check since within the link
> >         * tuner interval the configuration might have changed.
> >         */
> > -       flags &= ~ANTENNA_RX_DIVERSITY;
> > -       flags &= ~ANTENNA_TX_DIVERSITY;
> > +       ant->flags &= ~ANTENNA_RX_DIVERSITY;
> > +       ant->flags &= ~ANTENNA_TX_DIVERSITY;
> >
> >        if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
> > -               flags |= ANTENNA_RX_DIVERSITY;
> > +               ant->flags |= ANTENNA_RX_DIVERSITY;
> >        if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
> > -               flags |= ANTENNA_TX_DIVERSITY;
> > +               ant->flags |= ANTENNA_TX_DIVERSITY;
> >
> >        if (!(ant->flags & ANTENNA_RX_DIVERSITY) &&
> >            !(ant->flags & ANTENNA_TX_DIVERSITY)) {
> > @@ -234,9 +233,6 @@ static bool rt2x00lib_antenna_diversity(
> >                return true;
> >        }
> >
> > -       /* Update flags */
> > -       ant->flags = flags;
> > -
> >        /*
> >         * If we have only sampled the data over the last period
> >         * we should now harvest the data. Otherwise just evaluate
> > --- linux-2.6.35/drivers/net/wireless/rt2x00/rt2x00config.c     2010-08-13 09:22:05.000000000 +0200
> > +++ linux-2.6.35.new/drivers/net/wireless/rt2x00/rt2x00config.c 2010-08-13 09:20:24.000000000 +0200
> > @@ -132,12 +132,12 @@ void rt2x00lib_config_antenna(struct rt2
> >         */
> >        if (!(ant->flags & ANTENNA_RX_DIVERSITY))
> >                config.rx = rt2x00lib_config_antenna_check(config.rx, def->rx);
> > -       else
> > +       else if( config.rx == ANTENNA_SW_DIVERSITY )
> >                config.rx = active->rx;
> >
> >        if (!(ant->flags & ANTENNA_TX_DIVERSITY))
> >                config.tx = rt2x00lib_config_antenna_check(config.tx, def->tx);
> > -       else
> > +       else if( config.tx == ANTENNA_SW_DIVERSITY )
> >                config.tx = active->tx;
> >
> >        if (config.rx == active->rx && config.tx == active->tx)
> >
> 




More information about the users mailing list