ral, rum and bi-antenna
sam at freebsd.org
Tue Aug 5 18:28:31 UTC 2008
David Naylor wrote:
> On Tuesday 05 August 2008 18:05:14 Sam Leffler wrote:
>> David Naylor wrote:
>>> I happen to have the good fortune of owning a RT2661S (ral driver) and a
>>> RT2601USB (rum driver) [manufactured by Canyon]. Both chipsets have the
>>> ability to handle two antenna.
>>> Now the good fortune, both chipsets default to the wrong antenna. When I
>>> should be getting a stable connection at about -70dBm instead I am
>>> getting very poor connection (less than 50% connectivity, reported from
>>> ping) and about -90dBm.
>>> After looking at the FreeBSD driver code (and the [Open/Net]BSD) the
>>> antenna selection is marked as *TBD*. Does anyone know how to add
>>> antenna selection (the ralink linux drivers are a wild maze). I
>>> considered trying to do it myself but I do not know the first thing about
>>> kernel hacking (let alone chipset drivers) and have no idea where to
>>> I was thinking a stop-gap solution will be to have the antenna selectable
>>> using tunables/sysctl?
>>> Needless to say I am very willing to try any patches (and even attempt to
>>> create one myself if someone could point me in the right direction...).
>> So far as I know the hardware provides no help in this area; e.g. like
>> switching antenna ports on retry attempts or reporting which antenna was
>> used to tx/rx a frame. I don't even know if the h/w does rx diversity.
>> I believe the ralink drivers for these chips do some form of s/w
>> diversity or antenna switching.
>> Otherwise you can certainly hookup a sysctl to fix the antenna; ath has
>> code to do this you can crib. At some point we'll get around to hooking
>> up ifconfig (I've delayed as MIMO makes this api slightly more involved
>> then pick one of auto, 0, 1).
> I have been reading through the rt2560 driver code and they do in-fact use
> sysctl although it is undocumented. It appears to me that a lot of the code
> is copied and could be refactored (with a bit of abstraction?) [where
> templates from C++ will be handy?]. An idea for a project, should someone
> want some extra work :->
Don't know who "they" are. Adding a sysctl is easy; feel free to send a
ral is a sandwich of drivers instead of a common code base w/ a hardware
abstraction layer. Understand also that 2860 support is waiting commit
so it bloats the driver even more. I'm not a fan of this kind of
architecture but it's often a toss up which way to go.
>> But the bigger question is why you're seeing such a difference when
>> locking tx to one port or another; it sounds like the antenna design on
>> your card is highly directional. This is not unexpected for USB devices
>> where every penny is scrimped in design+manufacture but cardbus cards
>> typically are better. Cardbus cards often have U.FL connectors under
>> the sheath so if you're willing to canibalize your card you can remove
>> the sheath and attach good antennae to see if you get better behaviour.
> The card only has one slot available to connect an 'external' antenna and I
> think it defaults to the internal one. I think in this case the external
> antenna does make a big difference. (I even have homemade parabolic
> reflectors attached to the aerials, which does give some boost).
In 2.4G there's really not a lot to gain from multiple antenna's,
especially if the hardware doesn't do diversity. I'm sure I've said
this before but vendors really cut corners on the antenna when building
low cost products like those ralink parts typically appear in.
> I assume there will be no problem if I copied from the linux drivers provided
> by ralink (it looks like a BSD license to me)
Depends on how much you copy and what the license is. You cannot copy
from the GPL linux drivers w/o talking to the author(s). If the code
you're looking at has a BSD license then obviously you're free to crib.
More information about the freebsd-current