Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jun 2013 18:34:30 +0800 (SGT)
From:      sandeep suresh <sandeep.suresh@yahoo.co.in>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        "freebsd-wireless@freebsd.org" <freebsd-wireless@freebsd.org>
Subject:   Re: [ath9k-devel] So long, and thanks for all the fish (kinda)
Message-ID:  <1370342070.43364.YahooMailNeo@web193503.mail.sg3.yahoo.com>
In-Reply-To: <CAJ-VmokgQ=3mXF86WUSs0K0%2BqPfqyrJRaH-shWsXUtxNFeaeiQ@mail.gmail.com>
References:  <CAJ-VmokgQ=3mXF86WUSs0K0%2BqPfqyrJRaH-shWsXUtxNFeaeiQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello Mr.Adrian,=0A=A0=A0=A0=A0Does that mean we will not get your guidance=
 moving further; I did not get the message?=0ARegards=0ASandeep.=0A=0A=0A__=
______________________________=0AFrom: Adrian Chadd <adrian@freebsd.org>=0A=
To: ath9k-devel <ath9k-devel@lists.ath9k.org>; linux-wireless@vger.kernel.o=
rg =0ACc: freebsd-wireless@freebsd.org =0ASent: Tuesday, 4 June 2013 12:47 =
AM=0ASubject: [ath9k-devel] So long, and thanks for all the fish (kinda)=0A=
=0A=0AHi all,=0A=0AThis Friday will be my last day at Qualcomm Atheros. I'v=
e enjoyed=0Aworking with the extremely bright and driven engineers and desi=
gners=0Athat make the wireless chips and SoCs that people everywhere=0Atake=
 for granted. I've achieved a bunch of goals both with their=0Ainternal pro=
duct development and open source. But now it's time to=0Amove onto differen=
t things.=0A=0AI'd especially like to thank Luis Rodriguez for introducing =
me to the=0AQCA folk and helping me get access to the Atheros open source p=
roject,=0Aas well as the follow-up discussions that led to me being hired.=
=0A=0AThe open source wireless community has been driving innovation in a=
=0Alot of areas for a number of years. I'd like to hope that I've had a=0As=
mall, positive effect on that. I wish you all the best of luck in=0Apushing=
 forward and continuing to innovate.=0A=0ANow, I'm still NDA-enabled and I =
quite like hacking on this wireless=0Astuff so I won't be quitting hacking =
on things. I will just have other=0Athings on my mind.=0A=0AGood luck to yo=
u all!=0A=0A=0AAdrian=0A_______________________________________________=0Aa=
th9k-devel mailing list=0Aath9k-devel@lists.ath9k.org=0Ahttps://lists.ath9k=
.org/mailman/listinfo/ath9k-devel
From owner-freebsd-wireless@FreeBSD.ORG  Wed Jun  5 22:50:25 2013
Return-Path: <owner-freebsd-wireless@FreeBSD.ORG>
Delivered-To: freebsd-wireless@freebsd.org
Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
 by hub.freebsd.org (Postfix) with ESMTP id 5AA8CF0D
 for <freebsd-wireless@freebsd.org>; Wed,  5 Jun 2013 22:50:25 +0000 (UTC)
 (envelope-from adrian.chadd@gmail.com)
Received: from mail-qa0-x22e.google.com (mail-qa0-x22e.google.com
 [IPv6:2607:f8b0:400d:c00::22e])
 by mx1.freebsd.org (Postfix) with ESMTP id 2598F186F
 for <freebsd-wireless@freebsd.org>; Wed,  5 Jun 2013 22:50:25 +0000 (UTC)
Received: by mail-qa0-f46.google.com with SMTP id ih17so816566qab.12
 for <freebsd-wireless@freebsd.org>; Wed, 05 Jun 2013 15:50:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:sender:date:x-google-sender-auth:message-id:subject
 :from:to:content-type;
 bh=gComhwI2bPN9fVevEjVqU6N7IZtsBJ3Cg7/kYFzglf0=;
 b=TyXB9Fk1m7RIWM94uW6vhx5WhDTt3F+tBYARding+4PPQ6NA+bTIN/B7HvVHZegvhn
 2694z6IhqmekO/KHWlOb0bF8DxtB+IBH4PdfEvrGCYdklEN+l7aZNrzxs+Kn27WrFA8o
 FZ+xYlph/mOh43sXAp+vIq6ANvpLpW1YREAZ/Lb0+JQ7ghcKlaVs2IYcr1oG+eqZ+cB9
 p0y38yc+P7wrtrbxFiNUsdOI1mdzu8LfaDDRhFil/Rz/meMy9ewLtv36qnhCR1NkxGSW
 h5pO0bL+SVRl/RE/FYakh/hKtyy0RtK7Z/qv9qk6bcz3ltY6jtz6kwMz0k3CkqB2Tkul
 L9SA==
MIME-Version: 1.0
X-Received: by 10.224.119.83 with SMTP id y19mr30513135qaq.7.1370472624204;
 Wed, 05 Jun 2013 15:50:24 -0700 (PDT)
Sender: adrian.chadd@gmail.com
Received: by 10.224.5.65 with HTTP; Wed, 5 Jun 2013 15:50:24 -0700 (PDT)
Date: Wed, 5 Jun 2013 15:50:24 -0700
X-Google-Sender-Auth: P4xVm7euBuQYgEdHQvA1J8FV10M
Message-ID: <CAJ-Vmo=FmADSCNwyp_vfiWsidsBFfrqrxHvYERYZjVb4Az3Fxg@mail.gmail.com>
Subject: AR9285 antenna diversity - a journey
From: Adrian Chadd <adrian@freebsd.org>
To: freebsd-wireless@freebsd.org
Content-Type: text/plain; charset=ISO-8859-1
X-BeenThere: freebsd-wireless@freebsd.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Discussions of 802.11 stack,
 tools device driver development." <freebsd-wireless.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-wireless>, 
 <mailto:freebsd-wireless-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-wireless>;
List-Post: <mailto:freebsd-wireless@freebsd.org>
List-Help: <mailto:freebsd-wireless-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-wireless>, 
 <mailto:freebsd-wireless-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 05 Jun 2013 22:50:25 -0000

Hi all,

I made the mistake of whacking an AR9285 into an EEEPC I have here. It
has one antenna. So, I thought, I'll just whack it onto the primary
antenna as I know the AR9285 only transmits on the main antenna (the
second antenna connector is only for receive.)

And it didn't work.

Thus started the journey of "what the hell kind of weird crap is going on here."

The TL;DR version - if you use an AR9285 or AR2427, please update to
the latest -HEAD.

The short version:

It's a 1x1 chip. But it has two receive inputs - LNA1 and LNA2. LNA1
shares with TX and it's 3dB less sensitive than LNA2. So ideally you
want to configure things so you receive on LNA2. There's also a
receive antenna switch table and switch bit that can connect to an
external antenna switch. If you don't have an AR9285 + bluetooth
combo, you very likely don't have an antenna switch.

So _normally_, this is what you have:

* Antenna 1 / Main : connects to LNA1, is used for TX
* Antenna 2 / Alt : connects to LNA2, is used for RX.

Now if you're using a single-antenna device, that can only connect to LNA1.

Next, there's how it's configured up.

There's this thing called "LNA combining." Where the BB mixes the LNA
signals in different ways. The four configurations are:

* LNA1 only
* LNA2 only
* LNA1-LNA2
* LNA1+LNA2

Then there's two profiles - "main" and "alt." You configure "main" as
the receive profile that the BB tries first. If it has time, it'll try
the "alt" config and if that's better than main, it'll flip over to
using this to receive the frame.

These get programmed in by some settings in the EEPROM.

Now - what happened:

I naively thought that the driver code "just worked." It turns out
that yes, the driver code just worked, except for setting
AR_DEF_ANTENNA to 1 instead of the default (0). This meant the MAC
would tell the PHY that it should just do receive on the alternate
config. If you have a single antenna connected to LNA1 _and_ your NIC
EEPROM settings default to "main = LNA1, alt=LNA2", it'll always
receive on LNA2. This obviously would result in badness - you always
receive on a non-connected antenna.

So, I fixed that. It worked. But I wanted some better
diagnostic/debugging tools.

The first thing I did was to hack the receive path to log the LNA
configuration used in the RX antenna field, rather than having it
default to something useless. So now, athstats shows this:


Antenna profile:
[0] tx     6232 rx    17364
[1] tx        0 rx    64685
[2] tx        0 rx     9615

These map as following:

rx0 = LNA1-LNA2
rx1 = LNA2
rx2 = LNA1
rx3 = LNA1+LNA2

rx4->rx7 is the same as rx0->rx3, but with the "external" RX antenna
diversity switch set to '1'.

So now, you can watch this live:


adrian@lucy:~/work/freebsd/ath/head/src/sys/dev/ath]> athstats -o
input,output,rxstbc,rx0,rx1,rx2,rx3,rx4,rx5,rx6,rx7,rssi 1
   input   output rxstbc ant0(rx) ant1(rx) ant2(rx) ant3(rx) ant4(rx)
ant5(rx) ant6(rx) ant7(rx) rssi
   95610     7740   8242    17364    68075    10171        0        0
      0        0        0   26
      59        2      0        0       53        6        0        0
      0        0        0   35
      50        2      0        0       46        4        0        0
      0        0        0   35
      66        2      0        0       60        6        0        0
      0        0        0   38
      60        0      0        0       56        4        0        0
      0        0        0   33

.. Next, I wanted to log what the default settings were. That way if
people come to me and say that their AR9285 behaves crappy, I at least
have the information needed.

Behold, from the attach code:


[ath] AR9285 Main LNA config: LNA2
[ath] AR9285 Alt LNA config: LNA1
[ath] LNA diversity enabled, Diversity enabled
[ath] Enabling diversity for Kite

It will now tell you what the main/alternate configuration is
specified in the EEPROM and whether diversity is enabled or disabled.

After much discussion and research, I've discovered why - for laptops
with one antenna, the only real guaranteed way to do this without
hacking the driver is to default the EEPROM settings to _not_ enable
diversity. Even if the NIC has two antenna connectors and you do hook
up a separate antenna.

So now this is all done and sorted out, I'm going to document how it
all holds together, add some run time configuration twiddles for
controlling the AR9285 antenna diversity parameters, and see about
writing a tool to log/track the receive antenna configurations so
people can tinker with things and figure out why things are performing
badly or not.

So what's this mean for you?

If you have two antennas hooked up, good.

If you have one antenna hooked up to the AR9285, the above _must_ say
the main configuration is LNA1 if diversity is disabled. or it just
won't work. If it says MAIN=LNA2 and diversity is disabled, it will
_only_ receive on the second (alt) antenna, and thus you'll have
crappy (no) receive performance.


Phew!



Adrian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1370342070.43364.YahooMailNeo>