All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: Holger Schurig <holgerschurig@googlemail.com>
Cc: Jeffrey Baker <jwbaker@gmail.com>, linux-wireless@vger.kernel.org
Subject: Re: Getting random regulatory domains on boot-up with ath9k
Date: Fri, 6 Nov 2009 07:53:52 -0800	[thread overview]
Message-ID: <43e72e890911060753s3c55c660x2a9cc0ab5210e231@mail.gmail.com> (raw)
In-Reply-To: <m3hbt7kgdb.wl%holgerschurig@gmail.com>

On Fri, Nov 6, 2009 at 4:05 AM, Holger Schurig
<holgerschurig@googlemail.com> wrote:
> Hmm, maybe it's not a bug after all.

Right.

> The card's eeprom just have a region, 0x37 is ETSI World. Now the
> kernel looks for the first country with this region and uses this for
> crda.

The atheros driver does this, that is right. This is just one way in
which the EEPROM can be programmed on Atheros cards, a way which I
hope will disappear as this obviously can confuse users.

> There have been changes to drivers/net/wireless/ath/regd_common.h
> recently, so maybe on one kernel-version "DK" is the first ETSI World,
> on the next "AW" is the first and on some other again some different
> country.

Right, this is exactly what happens.

So the search is for any alpha2 for 0x37 (ETSI1_WORLD) on the Atheros
regulatory table allCountries[]. There are a few and recently the
first alpha2 was made 'AW' as noted. Reason for searching for the
first one is all of the alpha2s that match ETSI1_WORLD all have the
same regulatory domain so the way to think about these is more of a
region code and that region code maps to a certain number of alpha2s
which all happen to have the same exact regulatory domain definitions.
This obviously can change over time but for Windows driver this
behavior is static as the driver remains static unless a change is
requested by an ODM. For Linux this is different -- we get all the
updates, and IMHO this is good but this also means this one way of
programming the EEPROM should be avoided and eventually dropped. That
will take time but I had already started poking internally for a
change.

In the meantime I've tried to document the regulatory details on the
wiki so interested users / developers can understand what is going on.

So for ETSI1_WORLD we have these mappings, in this order now on
wireless-testing (bleeding edge):

mcgrof@tux ~/wireless-testing (git::my-stuff)$ grep ETSI1_WORLD
drivers/net/wireless/ath/regd_common.h
        ETSI1_WORLD = 0x37,
        {ETSI1_WORLD, CTL_ETSI, CTL_ETSI},
        {CTRY_ARUBA, ETSI1_WORLD, "AW"},
        {CTRY_AUSTRIA, ETSI1_WORLD, "AT"},
        {CTRY_BELARUS, ETSI1_WORLD, "BY"},
        {CTRY_BELGIUM, ETSI1_WORLD, "BE"},
        {CTRY_BOSNIA_HERZ, ETSI1_WORLD, "BA"},
        {CTRY_CAMBODIA, ETSI1_WORLD, "KH"},
        {CTRY_CROATIA, ETSI1_WORLD, "HR"},
        {CTRY_CYPRUS, ETSI1_WORLD, "CY"},
        {CTRY_DENMARK, ETSI1_WORLD, "DK"},
        {CTRY_ESTONIA, ETSI1_WORLD, "EE"},
        {CTRY_FINLAND, ETSI1_WORLD, "FI"},
        {CTRY_FRANCE, ETSI1_WORLD, "FR"},
        {CTRY_GERMANY, ETSI1_WORLD, "DE"},
        {CTRY_GREECE, ETSI1_WORLD, "GR"},
        {CTRY_GREENLAND, ETSI1_WORLD, "GL"},
        {CTRY_HAITI, ETSI1_WORLD, "HT"},
        {CTRY_HUNGARY, ETSI1_WORLD, "HU"},
        {CTRY_ICELAND, ETSI1_WORLD, "IS"},
        {CTRY_IRELAND, ETSI1_WORLD, "IE"},
        {CTRY_ITALY, ETSI1_WORLD, "IT"},
        {CTRY_LATVIA, ETSI1_WORLD, "LV"},
        {CTRY_LIECHTENSTEIN, ETSI1_WORLD, "LI"},
        {CTRY_LITHUANIA, ETSI1_WORLD, "LT"},
        {CTRY_LUXEMBOURG, ETSI1_WORLD, "LU"},
        {CTRY_MALTA, ETSI1_WORLD, "MT"},
        {CTRY_NETHERLANDS, ETSI1_WORLD, "NL"},
        {CTRY_NETHERLANDS_ANTILLES, ETSI1_WORLD, "AN"},
        {CTRY_NORWAY, ETSI1_WORLD, "NO"},
        {CTRY_POLAND, ETSI1_WORLD, "PL"},
        {CTRY_PORTUGAL, ETSI1_WORLD, "PT"},
        {CTRY_SERBIA_MONTENEGRO, ETSI1_WORLD, "CS"},
        {CTRY_SLOVAKIA, ETSI1_WORLD, "SK"},
        {CTRY_SLOVENIA, ETSI1_WORLD, "SI"},
        {CTRY_SPAIN, ETSI1_WORLD, "ES"},
        {CTRY_SWEDEN, ETSI1_WORLD, "SE"},
        {CTRY_SWITZERLAND, ETSI1_WORLD, "CH"},
        {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"},

The assumption of whether or not all of these alpha2s have the same
regulatory definition on db.txt from wireless-regdb may be wrong
already, not sure, but they all should be pretty close. The design of
programming an Atheros card with 0x37 would end up being to use the
same exact regulatory domain for any of these alpha2s as all of these
alpha2s would be mapped internally in the driver to static regulatory
domain definition. In that case the regulatory domain would never
change, the user would not be informed of the alpha2 at all and its
just used. For Linux the alpha2 regulatory database has been moved to
userspace and although countries (alpah2s) can have the same exact
regulatory domain they do not -- they are just split up.

> So it's just misleading, e.g.
>
>    using first country with regdm 0x37: DK
>
> would probably a better dmesg output.

Agreed, maybe better:

ath: region code found 0x37, fist country in region: DK

That or print all the alpha2s in the region. But as I also had
suggested before we could also check the currently set alpha2 on
cfg80211 by the user and if it happens to match an alpha2 in the
region ask CRDA for that alpha2's regulatory domain.

  Luis

  reply	other threads:[~2009-11-06 15:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-06  8:04 Getting random regulatory domains on boot-up with ath9k Jeffrey Baker
2009-11-06  9:50 ` Holger Schurig
2009-11-06 11:17   ` Davide Pesavento
2009-11-10 10:03     ` Sebastian Kemper
2009-11-10 14:41       ` Luis R. Rodriguez
2009-11-06 12:05   ` Holger Schurig
2009-11-06 15:53     ` Luis R. Rodriguez [this message]
2009-11-06 16:21 ` Luis R. Rodriguez
2009-11-06 16:30   ` Luis R. Rodriguez
2009-11-06 16:44     ` Luis R. Rodriguez
2009-11-07 19:02   ` Jeffrey Baker
2009-11-07 19:42     ` Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43e72e890911060753s3c55c660x2a9cc0ab5210e231@mail.gmail.com \
    --to=lrodriguez@atheros.com \
    --cc=holgerschurig@googlemail.com \
    --cc=jwbaker@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.