[go: nahoru, domu]

History log of /drivers/net/wireless/ath/regd.c
Revision Date Author Comments
94e05900770c0abe31200881df93e41d296fe8bd 22-Oct-2014 Felix Fietkau <nbd@openwrt.org> ath: use CTL region from cfg80211 if unset in EEPROM

Many AP devices do not have the proper regulatory domain programmed in
EEPROM. Instead they expect the software to set the appropriate region.
For these devices, the country code defaults to US, and the driver uses
the US CTL tables as well.
On devices bought in Europe this can lead to tx power being set too high
on the band edges, even if the cfg80211 regdomain is set correctly.
Fix this issue by taking into account the DFS region, but only when the
EEPROM regdomain is set to default.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ef8c00174a8738ea334197c0164143354644cb16 13-Feb-2014 Kalle Valo <kvalo@qca.qualcomm.com> ath: remove camel case from struct reg_dmn_pair_mapping

Fixes a checkpatch warning in ath10k:

drivers/net/wireless/ath/ath10k/mac.c:1636: WARNING: Avoid CamelCase: <regpair->regDmnEnum>

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
4f7b91404cd5da3657a82b00394f4f5dfbff13d6 14-Dec-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> cfg80211: make regulatory_hint() remove REGULATORY_CUSTOM_REG

The REGULATORY_CUSTOM_REG can be used during early init with
the goal of overriding the wiphy's default regulatory settings
in case the alpha2 of the device is not known. In the case that
the alpha2 becomes known lets avoid having drivers having to
clear the REGULATORY_CUSTOM_REG flag by doing it for them
when regulatory_hint() is used.

Cc: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
8fc685803a8d7b42a5f69dcad7f7cef6f8b60edf 14-Dec-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: fix warning on usage of REGULATORY_CUSTOM_REG

ath wants to first apply the custom regd and only later
will it revert to not using it if an alpha2 regulatory
domain is found. Since the wireless core now enforces
usage of the REGULATORY_CUSTOM_REG strictly when
wiphy_apply_custom_regulatory() is used this makes
ath adhere to the expected behaviour but also updates
the wiphy after its done with the custom usage.

This fixes this warning:

[ 5.488733] ath: phy0: ASPM enabled: 0x43
[ 5.488735] ath: EEPROM regdomain: 0x0
[ 5.488736] ath: EEPROM indicates default country code should be used
[ 5.488736] ath: doing EEPROM country->regdmn map search
[ 5.488737] ath: country maps to regdmn code: 0x3a
[ 5.488737] ath: Country alpha2 being used: US
[ 5.488738] ath: Regpair used: 0x3a
[ 5.488738] ------------[ cut here ]------------
[ 5.488745] WARNING: CPU: 0 PID: 161 at
/home/sujith/dev/wireless-testing/net/wireless/reg.c:1361
wiphy_apply_custom_regulatory+0x17a/0x1b0 [cfg80211]()
[ 5.488746] wiphy should have REGULATORY_CUSTOM_REG

The wireless core can *later* lift this flag for us for when
using the regulatory_hint() to make this fix more generic.

Reported-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
251c9ba19143caa5eb5b6ec52c77c70c9d7b3d8f 30-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: fix dynamic user regulatory domain support

As it stands dynamic user regulatory domain support is
only possible for a few programmed regulatory domains as
a few countries do not allow for this.

The existing code however only would take advantage of
the feature if a custom world regulatory domain is used
though as that's when we clear beconing flags. We need
to lift this restriction as otherwise this feature is
pointless.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ba94c049e555d1701d547025f7d547a582833d03 29-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: dynamic user allow check helper to the top

This will be used later.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a44ea6ffbbf716cca9c2abaa4a3a3a9a9ce7c75a 29-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: move dynamic_country_user_possible() to the top

This will be used later.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
62452a99d0b225a0f5d34d34b2aef63d7b44157b 29-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: fix usage of freq_reg_info()

freq_reg_info() expects KHz and not MHz, fix this. In
this case we'll now be getting the no-ir flags cleared
on channels for any channel when the country IE trusts
that channel.

@@
struct ieee80211_channel *ch;
struct wiphy *wiphy;
const struct ieee80211_reg_rule *rule;
@@

-rule = freq_reg_info(wiphy, ch->center_freq);
+rule = freq_reg_info(wiphy, MHZ_TO_KHZ(ch->center_freq));

Generated-by: Coccinelle SmPL
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Peter Senna Tschudin <peter.senna@gmail.com>
Reported-by: Mihir Shete <smihir@qti.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
07782d94d90b9ab94a97b1a1841575251484e5bb 21-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: move the channel for ath_reg_apply_beaconing_flags() into helper

While at it convert this into a switch statement, this
makes it easier and manage.

Cc: smihir@qti.qualcomm.com
Cc: tushnimb@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
6c3af5888eb1df139c81bf74024f5d63ab336b04 21-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: simplify ath_reg_apply_beaconing_flags()

Simplify ath_reg_apply_beaconing_flags() by making use of
thew new no-ir helper.

Cc: smihir@qti.qualcomm.com
Cc: tushnimb@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
f33cbc4f4350003a0cfb12be07750f3a95965867 21-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: rename ath_reg_apply_active_scan_flags() to ath_reg_apply_ir_flags()

This also applies the no-ibss flag to the channels or clears it.
The idea here is to clarify no initiated radiation should be
allowed on these channels.

Cc: smihir@qti.qualcomm.com
Cc: tushnimb@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
bc0aa0691806dc30cf1a69fe50ae90cf8f752977 21-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: clean up ath_reg_apply_active_scan_flags()

The routine ath_reg_apply_active_scan_flags() can be a bit
hard to read, this cleans it up by adding helpers for the
two cases of clearing IR flags or adding them. This approach
also makes no assumptions on the index of channels 12 and 13
so it should be portable accross different drivers.

Cc: smihir@qti.qualcomm.com
Cc: tushnimb@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d44040de6a991999b466adefc7588e479680b98d 21-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: fix logic on ath_reg_apply_active_scan_flags()

The existing logic removes the passive scan flag from
channels 12 and 13 when a regulatory hint coming from
something other than a country IE has been passed. This
is incorrect, the original intention was to ensure we
always have passive scan enabled for these two channels
for a specific set of custom world regulatory domains.

Cc: smihir@qti.qualcomm.com
Cc: tushnimb@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a09a85a013523a8b572dc5732b5c30e0785195f3 11-Nov-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> cfg80211: add flags to define country IE processing rules

802.11 cards may have different country IE parsing behavioural
preferences and vendors may want to support these. These preferences
were managed by the REGULATORY_CUSTOM_REG and the REGULATORY_STRICT_REG
flags and their combination. Instead of using this existing notation,
split out the country IE behavioural preferences as a new flag. This
will allow us to add more customizations easily and make the code more
maintainable.

Cc: Mihir Shete <smihir@qti.qualcomm.com>
Cc: Henri Bahini <hbahini@qca.qualcomm.com>
Cc: Tushnim Bhattacharyya <tushnimb@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
[fix up conflicts]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
a2f73b6c5db3c272d87eaebb5bed355d75a0f25f 11-Nov-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> cfg80211: move regulatory flags to their own variable

We'll expand this later, this will make it easier to
classify and review what things are related to regulatory
or not.

Coccinelle only missed 4 hits, which I had to do manually,
supplying the SmPL in case of merge conflicts.

@@
struct wiphy *wiphy;
@@
-wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY
+wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG
@@
expression e;
@@
-e->flags |= WIPHY_FLAG_CUSTOM_REGULATORY
+e->regulatory_flags |= REGULATORY_CUSTOM_REG
@@
struct wiphy *wiphy;
@@
-wiphy->flags &= ~WIPHY_FLAG_CUSTOM_REGULATORY
+wiphy->regulatory_flags &= ~REGULATORY_CUSTOM_REG
@@
struct wiphy *wiphy;
@@
-wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY
+wiphy->regulatory_flags & REGULATORY_CUSTOM_REG

@@
struct wiphy *wiphy;
@@
-wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY
+wiphy->regulatory_flags |= REGULATORY_STRICT_REG
@@
expression e;
@@
-e->flags |= WIPHY_FLAG_STRICT_REGULATORY
+e->regulatory_flags |= REGULATORY_STRICT_REG
@@
struct wiphy *wiphy;
@@
-wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY
+wiphy->regulatory_flags &= ~REGULATORY_STRICT_REG
@@
struct wiphy *wiphy;
@@
-wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY
+wiphy->regulatory_flags & REGULATORY_STRICT_REG

@@
struct wiphy *wiphy;
@@
-wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS
+wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS
@@
expression e;
@@
-e->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS
+e->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS
@@
struct wiphy *wiphy;
@@
-wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS
+wiphy->regulatory_flags &= ~REGULATORY_DISABLE_BEACON_HINTS
@@
struct wiphy *wiphy;
@@
-wiphy->flags & WIPHY_FLAG_DISABLE_BEACON_HINTS
+wiphy->regulatory_flags & REGULATORY_DISABLE_BEACON_HINTS

Generated-by: Coccinelle SmPL
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Peter Senna Tschudin <peter.senna@gmail.com>
Cc: Mihir Shete <smihir@qti.qualcomm.com>
Cc: Henri Bahini <hbahini@qca.qualcomm.com>
Cc: Tushnim Bhattacharyya <tushnimb@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
[fix up whitespace damage, overly long lines]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8fe02e167efa8ed4a4503a5eedc0f49fcb7e3eb9 21-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> cfg80211: consolidate passive-scan and no-ibss flags

These two flags are used for the same purpose, just
combine them into a no-ir flag to annotate no initiating
radiation is allowed.

Old userspace sending either flag will have it treated as
the no-ir flag. To be considerate to older userspace we
also send both the no-ir flag and the old no-ibss flags.
Newer userspace will have to be aware of older kernels.

Update all places in the tree using these flags with the
following semantic patch:

@@
@@
-NL80211_RRF_PASSIVE_SCAN
+NL80211_RRF_NO_IR
@@
@@
-NL80211_RRF_NO_IBSS
+NL80211_RRF_NO_IR
@@
@@
-IEEE80211_CHAN_PASSIVE_SCAN
+IEEE80211_CHAN_NO_IR
@@
@@
-IEEE80211_CHAN_NO_IBSS
+IEEE80211_CHAN_NO_IR
@@
@@
-NL80211_RRF_NO_IR | NL80211_RRF_NO_IR
+NL80211_RRF_NO_IR
@@
@@
-IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_NO_IR
+IEEE80211_CHAN_NO_IR
@@
@@
-(NL80211_RRF_NO_IR)
+NL80211_RRF_NO_IR
@@
@@
-(IEEE80211_CHAN_NO_IR)
+IEEE80211_CHAN_NO_IR

Along with some hand-optimisations in documentation, to
remove duplicates and to fix some indentation.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
[do all the driver updates in one go]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3e850edd58800e7b9b29a8dc2c950ebdf489a3e3 12-Nov-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: fix dynamic user regulatory settings

A world regulatory domain check was in place that
prevents user dynamic regulatory hints from being
processed. This was there for historical reasons
as this was only possible previously for world
roaming cards and dynamic regulatory settings was
only possible for country IEs. Fix this by enforcing
the world regulatory domain check only for when the
initiator is a country IE. Support for dynamic user
regulatory support is already checked.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
94e7876daa4396d7a997d57dfcceaab6851bd017 15-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: add support for proper dynamic regulatory hints

This enables support for dynamic user regulatory hints.
This is enabled only when CFG80211_CERTIFICATION_ONUS
is selected. For US and JP this is explicitly disabled
unless the systems are being used for strict controlled
testing.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
4da225bbc366a4efd6458636c155b34ac9784d4b 15-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: split user and driver reguluatory hint parsing

On the regulatory notifier split up the parsing of the
hints coming from drivers or user. We'll treat these
separately.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
8a3b6c800a993bbc7559bcfa77a34e4fc633cf0e 15-Oct-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: move common dynamic regulatory domain setting to a helper

This moves the dynamic regulatory domain selection code into
a helper.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d619c62f161a43db1f40e5039ff1285dd29b8658 06-Jun-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> ath: add VHT80 support for regulatory domains

This adds VHT80 support for the QCA world regulatory
domains.

Cc: kvalo@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
0c0280bd0ba410326eecdaeb1b936696eda6381d 11-Jan-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com> wireless: make the reg_notifier() void

The reg_notifier()'s return value need not be checked
as it is only supposed to do post regulatory work and
that should never fail. Any behaviour to regulatory
that needs to be considered before cfg80211 does work
to a driver should be specified by using the already
existing flags, the reg_notifier() just does post
processing should it find it needs to.

Also make lbs_reg_notifier static.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
[move lbs_reg_notifier to not break compile]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
361c9c8b0eeeec7d881e018d5143bf883558c566 06-Dec-2012 Johannes Berg <johannes.berg@intel.com> regulatory: use IS_ERR macro family for freq_reg_info

Instead of returning an error and filling a pointer
return the pointer and an ERR_PTR value in error cases.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
fe7ef5e9ba0c60bab01390493a4c6790f7b093af 04-Dec-2012 Johannes Berg <johannes.berg@intel.com> regulatory: remove handling of channel bandwidth

The channel bandwidth handling isn't really quite right,
it assumes that a 40 MHz channel is really two 20 MHz
channels, which isn't strictly true. This is the way the
regulatory database handling is defined right now though
so remove the logic to handle other channel widths.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
516304b0f45614fb8967dc86ff681499204cdbb1 19-Mar-2012 Joe Perches <joe@perches.com> ath: Add and use pr_fmt, convert printks to pr_<level>

Use a more current logging style.
Make sure all output is prefixed appropriately.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
de1c732b1891a25f3f2f52ef7211a3d567bbd588 08-Dec-2011 Luis R. Rodriguez <rodrigue@qca.qualcomm.com> ath: optimize processing of CTLs for country IEs for world roaming cards

When we receive a country IE hint and we have a world roaming card
we can optimize output power further by ensuring that we use the
calibrated data for the country by using that country's own CTL data.
That is -- when world roaming and when we process a country IE we
no longer need to use the lowest output power of all CTLs instead
we use an optimized CTL output power for that specific country.

We accomplish this by copying the regulatory data prior on init
and restoring it when cfg80211 tells us it gets a core hint. Core
hints are only sent on init and when it wants to restore reguulatory
settings. We take advantage of this fact and apply the cached
regulatory data when we get a core hint. When we get a country IE
hint though we process the regulatory data as if programmed for
a specific country.

Tested-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
43fcb430a4cfb7bd7c82600edeb3ca65f202a5f3 08-Dec-2011 Luis R. Rodriguez <rodrigue@qca.qualcomm.com> ath: add a helper for processing reg data on init

This has no functional change. The helper can be used later
for other things like country IE changes and following the CTL
for different countries.

Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a59be0811c322f80aaa886b144239393efece42d 08-Nov-2011 Helmut Schaa <helmut.schaa@googlemail.com> ath: Fix NULL ptr dereference in ath_reg_apply_world_flags

This happens with devices using a regulatory domain 0x68 that are only
5Ghz capable because ath_reg_apply_active_scan_flags assumes that we
always have a 2,4Ghz band.

CPU 0 Unable to handle kernel paging request at virtual address 00000000, epc == 82cd838c, ra == 82cd8384
Oops[#1]:
Cpu 0
$ 0 : 00000000 00000061 00000003 00000024
$ 4 : 00000003 000016c1 82f900ac 00000024
$ 8 : 00000000 82cda304 0058bad8 00000005
$12 : 005908f8 001e8481 00000003 1dcd6500
$16 : 00000002 00000000 82c700c0 82c700c0
$20 : 82d415e4 82c70d64 82c70200 82c715bc
$24 : 00000000 11e1a300
$28 : 82ce2000 82ce3c70 82c715a8 82cd8384
Hi : 00000000
Lo : 0000001e
epc : 82cd838c ath_reg_apply_world_flags+0x78/0x17c [ath]
Not tainted
ra : 82cd8384 ath_reg_apply_world_flags+0x70/0x17c [ath]
Status: 1000d403 KERNEL EXL IE
Cause : 80800008
BadVA : 00000000
PrId : 00019374 (MIPS 24Kc)
Modules linked in: ath9k(+) ath9k_common ath9k_hw ath mac80211 cfg80211
compat_firmware_class compat arc4 aes_generic deflate ecb cbc
leds_gpio button_hotplug gpio_buttons input_polldev ie
Process insmod (pid: 464, threadinfo=82ce2000, task=838b31d8, tls=00000000)
Stack : 00000000 00000002 82f900ac 82c700c0 82d415e4 82c70d64 00000000 00000068
82f900ac 82cd88f4 82c700c0 82cda304 00000001 000020f0 82f90000 82c70d40
00000002 82f90000 82f900ac 82d4207c 82d518a0 00000002 7fee6118 8017c0d8
00000008 8397ba00 82c70d40 00000000 82c70200 83813000 83813058 b0010000
82d518a0 00000002 7fee6118 82d4b8c8 83445cc0 80120dc0 83804000 800eeda0
...
Call Trace:
[<82cd838c>] ath_reg_apply_world_flags+0x78/0x17c [ath]
[<82cd88f4>] ath_regd_init+0x464/0x488 [ath]
[<82d4207c>] ath9k_init_device+0x6a4/0x6b4 [ath9k]
[<82d4b8c8>] ath_pci_probe+0x27c/0x358 [ath9k]
[<80181de0>] pci_device_probe+0x64/0xa4
[<8019e874>] driver_probe_device+0xb8/0x190
[<8019e9b8>] __driver_attach+0x6c/0xa4
[<8019dfc0>] bus_for_each_dev+0x60/0xb0
[<8019d744>] bus_add_driver+0xc4/0x25c
[<8019ed6c>] driver_register+0xe0/0x198
[<8018206c>] __pci_register_driver+0x50/0xe0
[<82dd0010>] ath9k_init+0x10/0x54 [ath9k]
[<8006b4a0>] do_one_initcall+0x68/0x1ec
[<800a901c>] sys_init_module+0xec/0x23c
[<80062544>] stack_done+0x20/0x3c

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
ee40fa0656a730491765545ff7550f3c1ceb0fbc 27-May-2011 Paul Gortmaker <paul.gortmaker@windriver.com> drivers/net: Add export.h to files using EXPORT_SYMBOL/THIS_MODULE

These were getting the macros from an implicit module.h
include via device.h, but we are planning to clean that up.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

drivers/net: Add export.h to wireless/brcm80211/brcmfmac/bcmsdh.c

This relatively recently added file uses EXPORT_SYMBOL and hence
needs export.h included so that it is compatible with the module.h
split up work.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2290a9c35df271cc33601b69e7836fa288e2fc7d 14-Apr-2011 Luis R. Rodriguez <lrodriguez@atheros.com> ath: fix 0x6C for beaconing/passive scan flags based on country IE

The 0x6C regulatory domain is just like the 0x6A regulatory
domain but differs in that 0x6C will allow adhoc and active
scan on its channels only if we are associated to an AP
with a country IE that allows those channels. The
ath_reg_apply_beaconing_flags() does just this -- we respect
the manufacturer's intent on only enabling beaconing modes
of operation if and only if blessed by the country IE.

Cc: David Quan <david.quan@atheros.com>
Cc: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
34a0a2025c8bddc6505b56a58ef2e7333a4e4165 14-Apr-2011 Senthil Balasubramanian <senthilkumar@atheros.com> ath: Add a missing world regulatory domain 0x6C

Some customers use 0x6C world regulatory domain and this patch
adds the support.

Cc: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
5719efdde1d0ae8670b96eb8748d1a0dc6a37be2 25-Jan-2011 Bruno Randolf <br1@einfach.org> ath: Add function to check if 4.9GHz channels are allowed

This adds a helper function to ath/regd.c which can be asked if 4.9GHz channels
are allowed for a given regulatory domain code. This keeps the knowledge of
regdomains and defines like MKK9_MKKC in one place. I'm passing the regdomain
code instead of the ath_regulatory structure because this needs to be called
quite early in the driver inititalization where ath_regulatory is not available
yet in ath5k.

I'm using MKK9_MKKC only because this is the regdomain in the 802.11j enabled
sample cards we got from our vendor. I found some hints in HAL code that this
is used by Atheros to indicate 4.9GHz channels support and that there might be
other domain codes as well, but as I don't have any documentation I'm just
putting in what I need right now. It can be extended later.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
931299cf87701962ea1811dc216f48f3f7a4ebc8 16-Dec-2010 Luis R. Rodriguez <lrodriguez@atheros.com> ath: fix NULL pointer dereference on reg_notifier()

The reg_notifier() was recently updated as being capable of
having the request passed as NULL, fix ath to follow this API
change. Without this we end up oopsing:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
IP: [<ffffffffa02fb8cb>] ath_reg_notifier_apply+0x5b/0xa0 [ath]
PGD b4c4c067 PUD b4c4d067 PMD 0
Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
last sysfs file: /sys/devices/pci0000:00/0000:00:1b.0/uevent
CPU 1
Modules linked in: <etc>
Pid: 436, comm: modprobe Not tainted 2.6.37-rc5-wl+ #36 6460DWU/6460DWU
RIP: 0010:[<ffffffffa02fb8cb>] [<ffffffffa02fb8cb>] ath_reg_notifier_apply+0x5b/0xa0 [ath]
RSP: 0018:ffff8800b6f6baa8 EFLAGS: 00010246
RAX: ffff8800b527b254 RBX: ffff8800b532c180 RCX: 0000000000000018
RDX: ffff8800b530c108 RSI: 0000000000000000 RDI: ffff8800b532c180
RBP: ffff8800b6f6baa8 R08: ffff8800b532f268 R09: 0000000000000235
R10: 00000000000016ad R11: 0000000000000018 R12: 0000000000000000
R13: 0000000000000016 R14: ffff8800b532f268 R15: 0000000000000011
FS: 00007f0c53104700(0000) GS:ffff8800bed00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000004 CR3: 00000000b6531000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process modprobe (pid: 436, threadinfo ffff8800b6f6a000, task ffff8800b404dc40)
Stack:
ffff8800b6f6bac8 ffffffffa03ea651 ffff8800b532c180 ffff8800b527b254
ffff8800b6f6bb38 ffffffffa01835ca ffffffffa019ed00 00000000a019ed80
0000000000000002 ffff880000000002 ffffffffa0366140 0000000010aee572
Call Trace:
[<ffffffffa03ea651>] ath9k_reg_notifier+0x41/0x50 [ath9k]
[<ffffffffa01835ca>] wiphy_update_regulatory+0x4ba/0x5a0 [cfg80211]
[<ffffffffa0366140>] ? ieee80211_register_hw+0xa0/0x5b0 [mac80211]
[<ffffffffa0366140>] ? ieee80211_register_hw+0xa0/0x5b0 [mac80211]
[<ffffffffa017f994>] wiphy_register+0x1d4/0x360 [cfg80211]
[<ffffffff8114b918>] ? __kmalloc+0x108/0x1c0
[<ffffffffa0366223>] ieee80211_register_hw+0x183/0x5b0 [mac80211]
[<ffffffffa03eb49b>] ath9k_init_device+0x66b/0x850 [ath9k]
[<ffffffffa03f9dd6>] ath_pci_probe+0x2f6/0x3c0 [ath9k]
[<ffffffff81037529>] ? default_spin_lock_flags+0x9/0x10
[<ffffffff812e19cf>] local_pci_probe+0x5f/0xd0
[<ffffffff812e2bf1>] pci_device_probe+0x101/0x120
[<ffffffff81390aca>] ? driver_sysfs_add+0x7a/0xb0
[<ffffffff81390c26>] driver_probe_device+0x96/0x1c0
[<ffffffff81390deb>] __driver_attach+0x9b/0xa0
[<ffffffff81390d50>] ? __driver_attach+0x0/0xa0
[<ffffffff81390008>] bus_for_each_dev+0x68/0x90
[<ffffffff81390a4e>] driver_attach+0x1e/0x20
[<ffffffff81390309>] bus_add_driver+0xe9/0x290
[<ffffffffa0407000>] ? ath9k_init+0x0/0x4d [ath9k]
[<ffffffff81391130>] driver_register+0x80/0x150
[<ffffffffa0407000>] ? ath9k_init+0x0/0x4d [ath9k]
[<ffffffffa0407000>] ? ath9k_init+0x0/0x4d [ath9k]
[<ffffffff812e2e76>] __pci_register_driver+0x56/0xd0
[<ffffffffa03f9ec3>] ath_pci_init+0x23/0x30 [ath9k]
[<ffffffffa040702b>] ath9k_init+0x2b/0x4d [ath9k]
[<ffffffff81002053>] do_one_initcall+0x43/0x190
[<ffffffff8109fb5b>] sys_init_module+0xbb/0x200
[<ffffffff8100c042>] system_call_fastpath+0x16/0x1b
Code: <who even reads this anyway? haha, ok you do>
RIP [<ffffffffa02fb8cb>] ath_reg_notifier_apply+0x5b/0xa0 [ath]
RSP <ffff8800b6f6baa8>
CR2: 0000000000000004
---[ end trace 6d03d3c7eda9f06b ]---

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
a4b770972b8f819e408d7cc3ae9637e15bff62f6 14-May-2010 Joe Perches <joe@perches.com> drivers/net: Remove unnecessary returns from void function()s

This patch removes from drivers/net/ all the unnecessary
return; statements that precede the last closing brace of
void functions.

It does not remove the returns that are immediately
preceded by a label as gcc doesn't like that.

It also does not remove null void functions with return.

Done via:
$ grep -rP --include=*.[ch] -l "return;\n}" net/ | \
xargs perl -i -e 'local $/ ; while (<>) { s/\n[ \t\n]+return;\n}/\n}/g; print; }'

with some cleanups by hand.

Compile tested x86 allmodconfig only.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
cfcfe4469cc39625cb8257355c00dd8f35f900aa 30-Mar-2010 Luis de Bethencourt <luisbg@ubuntu.com> ath: fix code readability in regd.c

This is a patch to the ath/regd.c file that fixes two code
readability issues. A space between to separate two defines
and the indentation inside the ath_redg_is_eeprom_valid
function.

Signed-off-by: Luis de Bethencourt <luisbg@ubuntu.com>
Acked-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
641eabb0a3717020d1a93d3f91493ab0d826c910 07-Feb-2010 Christian Lamparter <chunkeey@googlemail.com> ath: fix WARN_ON with Polish (Poland) Contry code

This patch fixes a WARN_ON which is triggered
by Poland's country code.

ath: EEPROM regdomain: 0x8268
ath: EEPROM indicates we should expect a country code
ath: doing EEPROM country->regdmn map search
ath: country maps to regdmn code: 0x37
ath: Country alpha2 being used: PL
ath: Regpair used: 0x37
-----------[ cut here ]------------
WARNING: at drivers/net/wireless/ath/regd.c:155 ath_regd_init+0x30b
Pid: 12661, comm: firmware/carl91 2.6.33-rc5-wl #18
Call Trace:
[<>] ? warn_slowpath_common+0x76/0x8c
[<>] ? ar9170_reg_notifier+0x0/0x2d [carl9170usb]
[<>] ? ath_regd_init+0x30b/0x377 [ath]
[<>] ? ar9170_register+0x3b3/0x3ca [carl9170usb]
[...]
---[ end trace ]---

Note: Poland is just an example. But it is very likely
that more country codes are affected.

Cc: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
5be83de54c16944dea9c16c6a5a53c1fa75ed304 19-Nov-2009 Johannes Berg <johannes@sipsolutions.net> cfg80211: convert bools into flags

We've accumulated a number of options for wiphys
which make more sense as flags as we keep adding
more. Convert the existing ones.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
5d2214ac5e7f72c9ae70b2444649e8d1d3e1086d 20-Jul-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath: add support for special 0x8000 regulatory domain

Two users of ar9170 devices have now reported their cards
have been programmed with a regulatory domain of 0x8000.
This is not a valid regulatory domain as such these users were
unable to use these devices. Since this doesn't seem to be
a device EEPROM corruption we must treat it specially. It
may have been possible the manufacturer intended to use 0x0
as the regulatory domain and that would ultimately yield
to US but since we cannot get confirmationf or this we
default this special case to one of our world regulatory
domains, specifically 0x64.

Reported-by: DavidFreeman on #linux-wireless
Reported-by: Joerg Albert <jal2@gmx.de>
Cc: Christian Lamparter <chunkeey@web.de>,
Cc: Stephen Chen <stephen.chen@atheros.com>
Cc: David Quan <david.quan@atheros.com>
Cc: Tony Yang <tony.yang@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
88f6bfe1829d67bea37b060d53131b2b96ebc8ac 04-Jul-2009 Bob Copeland <me@bobcopeland.com> ath: remove unnecessary return in ath_regd_get_band_ctl

'default' case already returns NO_CTL

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e03e5ffd8d3327d23d76be5d63cfbbb537b1af59 02-Jun-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath: make regulatory parsing more verbose on debug

This should help when reviewing issues regarding regulatory
domain on ath5k/ath9k/ar9170.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
038659e7c6b385065cb223872771ac437ef70b62 02-May-2009 Luis R. Rodriguez <lrodriguez@atheros.com> cfg80211: Process regulatory max bandwidth checks for HT40

We are not correctly listening to the regulatory max bandwidth
settings. To actually make use of it we need to redesign things
a bit. This patch does the work for that. We do this to so we
can obey to regulatory rules accordingly for use of HT40.

We end up dealing with HT40 by having two passes for each channel.

The first check will see if a 20 MHz channel fits into the channel's
center freq on a given frequency range. We check for a 20 MHz
banwidth channel as that is the maximum an individual channel
will use, at least for now. The first pass will go ahead and
check if the regulatory rule for that given center of frequency
allows 40 MHz bandwidths and we use this to determine whether
or not the channel supports HT40 or not. So to support HT40 you'll
need at a regulatory rule that allows you to use 40 MHz channels
but you're channel must also be enabled and support 20 MHz by itself.

The second pass is done after we do the regulatory checks over
an device's supported channel list. On each channel we'll check
if the control channel and the extension both:

o exist
o are enabled
o regulatory allows 40 MHz bandwidth on its frequency range

This work allows allows us to idependently check for HT40- and
HT40+.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d323655372590c533c275b1d798f9d1221efb5c6 20-Apr-2009 Johannes Berg <johannes@sipsolutions.net> cfg80211: clean up includes

Trying to separate header files into net/wireless.h and
net/cfg80211.h has been a source of confusion. Remove
net/wireless.h (because there also is the linux/wireless.h)
and subsume everything into net/cfg80211.h -- except the
definitions for regulatory structures which get moved to
a new header net/regulatory.h.

The "new" net/cfg80211.h is now divided into sections.

There are no real changes in this patch but code shuffling
and some very minor documentation fixes.

I have also, to make things reflect reality, put in a
copyright line for Luis to net/regulatory.h since that
is probably exclusively written by him but was formerly
in a file that only had my copyright line.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
85efc86eb7c6cbb1c8ce8d99b10b948be033fbb9 14-Apr-2009 Luis R. Rodriguez <lrodriguez@atheros.com> atheros: fix propagation of bad EEPROM on regulatory init

When the EEPROM is not in good condition we cannot continue so
we currently bail out but only ath5k is bailing out properly.
Both ath9k and ar9170 were proceeding and if a user were to run
into this they'd see an obscure panic. Lets propagate the error
as intended and make sure we inform the user by lifting the
error message from debug to a kernel error.

Stable note: You can find a port of this page here:

http://bombadil.infradead.org/~mcgrof/patches/ath9k/ath9k-fix-eeprom.patch.txt

Cc: stable@kernel.org
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
6b2b2ffbef7750e51bfa74e92229ecee10b59307 31-Mar-2009 Luis R. Rodriguez <lrodriguez@atheros.com> ath: space cleanup

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
e3bb249be89dd387e78ca382d08fad31745edac9 31-Mar-2009 Bob Copeland <me@bobcopeland.com> ath: move more setup code into ath_regd_init

Setup the wiphy regulatory parameters when first initializing the
Atheros regulatory module. We can remove five exported symbols this
way and simplify the driver code for both ath5k and ath9k.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
3a702e49c03ba959e3f5bb2b74ec9921a81c8c98 31-Mar-2009 Bob Copeland <me@bobcopeland.com> atheros: introduce ath module containing common ath5k/ath9k/ar9170 code

This change creates a new module, ath.ko, which includes code that can
be shared between ath5k, ath9k and ar9170. For now, extract most of the ath9k
regulatory code so it can also be used in ath5k.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>