profile/ivi/kernel-x86-ivi.git
11 years agomwifiex: use correct htcapinfo for HT20 ibss network
Amitkumar Karwar [Thu, 3 Jan 2013 00:56:00 +0000 (16:56 -0800)]
mwifiex: use correct htcapinfo for HT20 ibss network

It is observed that same htcapinfo ie is included in beacon for
HT20, HT40+ and HT40- ibss networks. This patch makes sure that
we will not advertise 40Mhz flags while creating/joining ibss
network in HT20 mode.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agowireless: mwifiex: remove unreachable paths
Sasha Levin [Thu, 3 Jan 2013 00:23:01 +0000 (16:23 -0800)]
wireless: mwifiex: remove unreachable paths

We know 'firmware' is non-NULL from the beginning of mwifiex_prog_fw_w_helper,
remove all !firmware paths from the rest of the function.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agop54pci: don't return zero on failure paths in p54p_probe()
Alexey Khoroshilov [Wed, 2 Jan 2013 20:06:47 +0000 (00:06 +0400)]
p54pci: don't return zero on failure paths in p54p_probe()

If pci_set_dma_mask() or pci_set_consistent_dma_mask() fails in p54p_probe(),
it breaks off initialization, deallocates all resources, but returns zero.
Similar issue is if check for returned value of pci_resource_len() fails.

The patch implements proper error code propagation.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: Update init code routines from interface up.
Hante Meuleman [Wed, 2 Jan 2013 14:22:51 +0000 (15:22 +0100)]
brcmfmac: Update init code routines from interface up.

On interface up dongle gets inialized. Move UP command to common
routine and update these common init routines using ifp.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: Removing obsolete variables and inline functions.
Hante Meuleman [Wed, 2 Jan 2013 14:22:50 +0000 (15:22 +0100)]
brcmfmac: Removing obsolete variables and inline functions.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: Return correct error on netdev xmit.
Hante Meuleman [Wed, 2 Jan 2013 14:22:49 +0000 (15:22 +0100)]
brcmfmac: Return correct error on netdev xmit.

Netdev xmit routine brcfm_netdev_start_xmit was defined
incorrectly and used wrong return codes. Always eat the
packet and return ok. Remove drvr_up check since it is not
relevant.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: Remove unused caching dongle error.
Hante Meuleman [Wed, 2 Jan 2013 14:22:48 +0000 (15:22 +0100)]
brcmfmac: Remove unused caching dongle error.

CDC errors are retained. However, it is never used so it can
be removed.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: remove unnecessary curly braces in dhd_attach()
Arend van Spriel [Wed, 2 Jan 2013 14:22:47 +0000 (15:22 +0100)]
brcmfmac: remove unnecessary curly braces in dhd_attach()

Stumbled into a curly braces used for if statement with only
one conditional statement. Removing them.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: cleanup netdev transmit callback
Arend van Spriel [Wed, 2 Jan 2013 14:22:46 +0000 (15:22 +0100)]
brcmfmac: cleanup netdev transmit callback

The header of the ethernet packet is processed conditionally, but
the check is wrong as it checks skb length is at least ETH_ALEN. It
should check it is at least sizeof struct ethhdr instead.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: remove unused event related definitions
Arend van Spriel [Wed, 2 Jan 2013 14:22:45 +0000 (15:22 +0100)]
brcmfmac: remove unused event related definitions

The driver had some global definitions in dhd.h to map event
identifiers to event names. With redesign of firmware event
processing this has all moved to fweh module so these definitions
can be removed.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: Use dedicated trace level for CDC.
Hante Meuleman [Wed, 2 Jan 2013 14:22:44 +0000 (15:22 +0100)]
brcmfmac: Use dedicated trace level for CDC.

CDC debug is partly done with TRACE and partly with CTL, however
CDC hardly ever needs debugging. Use dedicated level CDC and
replace TRACE and CTL in dhd_cdc with that.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: remove brcmf_proto_hdrpull() from bus interface
Arend van Spriel [Wed, 2 Jan 2013 14:22:43 +0000 (15:22 +0100)]
brcmfmac: remove brcmf_proto_hdrpull() from bus interface

The use of the function brcmf_proto_hdrpull() is moved to the
common part of the driver and consequently it can be removed
from the bus interface.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: remove rx helper function from bus interface
Arend van Spriel [Wed, 2 Jan 2013 14:22:42 +0000 (15:22 +0100)]
brcmfmac: remove rx helper function from bus interface

The bus interface provided a wrapper function to pass a single
packet to the common driver part filling a skb queue with one
packet. For clarity the caller now sets up the skb queue and
call the rx bus interface function.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: define pr_fmt in one place
Arend van Spriel [Wed, 2 Jan 2013 20:20:10 +0000 (21:20 +0100)]
brcmfmac: define pr_fmt in one place

Several source files (but not all) define the pr_fmt() macro in exactly
the same way. Instead this commit defines it in a header file so driver
logging is consistent.

Cc: Joe Perches <joe@perches.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: assure USB dongle firmware is reset upon module unload
Arend van Spriel [Wed, 2 Jan 2013 14:22:40 +0000 (15:22 +0100)]
brcmfmac: assure USB dongle firmware is reset upon module unload

Upon unloading the brcmfmac module the USB firmware should be reset
as the device remains powered. The reset assures a known device
state when a new brcmfmac driver load is being done.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: removed deprecated set_bitrate_mask support
Hante Meuleman [Wed, 2 Jan 2013 14:22:39 +0000 (15:22 +0100)]
brcmfmac: removed deprecated set_bitrate_mask support

Set bitrate_mask is not desired anymore. The firmware will
determine the correct rates to be used.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: do not reconfigure refill rx on 0-length packet.
Hante Meuleman [Wed, 2 Jan 2013 14:22:38 +0000 (15:22 +0100)]
brcmfmac: do not reconfigure refill rx on 0-length packet.

When USB device gets removed rx complete comes with 0-length
packets. Do not refill those packets. In some rare cases it can
cause infinite loop.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmsmac: remove dead code
Piotr Haber [Wed, 2 Jan 2013 14:22:37 +0000 (15:22 +0100)]
brcmsmac: remove dead code

Dead code after AMPDU restructure.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmsmac: allow user-space setting of interface address
Arend van Spriel [Wed, 2 Jan 2013 14:22:36 +0000 (15:22 +0100)]
brcmsmac: allow user-space setting of interface address

The interface address of the wireless device is determined by
the permanent address stored in the device. This patch allows
it to be overridden from user-space.

Reported-by: Maximilian Engelhardt <maxi@daemonizer.de>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmsmac: use perimeter lock in add_interface() callback
Arend van Spriel [Wed, 2 Jan 2013 14:22:35 +0000 (15:22 +0100)]
brcmsmac: use perimeter lock in add_interface() callback

All callbacks that access driver functions should do that under
perimeter lock protection. The add_interface() callback was lacking
this lock.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmsmac: increase timer reference count for new timers only
Piotr Haber [Wed, 2 Jan 2013 14:22:34 +0000 (15:22 +0100)]
brcmsmac: increase timer reference count for new timers only

On hardware reintialization reference count of
already existing timers would be increased again.
This leads to problems on module unloading.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2x00: rt2800: convert read_eeprom functions to return an int value
Gabor Juhos [Sat, 29 Dec 2012 13:51:51 +0000 (14:51 +0100)]
rt2x00: rt2800: convert read_eeprom functions to return an int value

Both the rtt2x00usb_eeprom_read and the ioremap
functions are allowed to fail, however their
return values are not checked in the read_eeprom
functions in the rt2800{pci,usb} drivers.

The patch adds the missing checks, and converts
all read_eeprom functions to return an int value,
so the error values can be propagated up to the
'rt2800_validate_eeprom' function.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k_hw: Remove AR9485 1.0 macro
Sujith Manoharan [Wed, 26 Dec 2012 06:57:38 +0000 (12:27 +0530)]
ath9k_hw: Remove AR9485 1.0 macro

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmsmac: initialize morepending in brcms_b_recv()
Geert Uytterhoeven [Sat, 22 Dec 2012 21:07:14 +0000 (22:07 +0100)]
brcmsmac: initialize morepending in brcms_b_recv()

drivers/net/wireless/brcm80211/brcmsmac/main.c: In function ‘brcms_b_recv’:
drivers/net/wireless/brcm80211/brcmsmac/main.c:7636: warning: ‘morepending’ may be used uninitialized in this function

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoiwlegacy: allow to enable PS
Stanislaw Gruszka [Thu, 20 Dec 2012 13:31:53 +0000 (14:31 +0100)]
iwlegacy: allow to enable PS

Power save support was removed from iwlegacy due to possible firmware
crashes problems it cause. I use to plan first inspect code to find
reason of problems, fix them and then allow to enable PS. But
realistically - code inspection will not happen, so let's do it, and
wait for eventual bug reports.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoiwlegacy: add flush callback
Stanislaw Gruszka [Thu, 20 Dec 2012 13:31:51 +0000 (14:31 +0100)]
iwlegacy: add flush callback

Dump implementation of flush, which just wait until all TX queues
become empty.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: fix column header comments for some initval arrays
Gabor Juhos [Mon, 17 Dec 2012 21:06:08 +0000 (22:06 +0100)]
ath9k: fix column header comments for some initval arrays

Some 3-column initval arrays have wrong comments. The
column of these arrays is indexed by the 'freqIndex'
variable in 'ar5008_hw_process_ini' which only depends
on the actual band.

The 'initvals' tool from 'qca-swiss-army-knife' prints
the correct comment lines for these arrays, since commit
'atheros-initvals: fix comments for non-fastclock 3-column tables'
however the comments were not refreshed in ath9k.

The patch contains no functional changes.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agocarl9170: refactor carl9170_update_beacon
Christian Lamparter [Sat, 22 Dec 2012 14:05:26 +0000 (15:05 +0100)]
carl9170: refactor carl9170_update_beacon

This patch moves parts of carl9170_update_beacon
into separate subroutines, so the parts become
more manageable.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agocarl9170: remove custom NUM_TID and friends
Christian Lamparter [Thu, 20 Dec 2012 01:44:29 +0000 (02:44 +0100)]
carl9170: remove custom NUM_TID and friends

The commit: "mac80211: introduce IEEE80211_NUM_TIDS and use it"
introduced a generic NUM_TID definitions for all everyone.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agocarl9170: disable hw crypto for p2p networks
Christian Lamparter [Mon, 17 Dec 2012 16:05:55 +0000 (17:05 +0100)]
carl9170: disable hw crypto for p2p networks

While the driver supports HW offload in a single
P2P client configuration, it doesn't support HW
offload in the concurrent P2P GO+CLIENT
configuration.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agocarl9170: don't enable hw crypto offload, if the fw doesn't support it
Christian Lamparter [Mon, 17 Dec 2012 15:30:05 +0000 (16:30 +0100)]
carl9170: don't enable hw crypto offload, if the fw doesn't support it

Previously, op_start would set disable_offload always
to false, even if it was set to true by the fw parser.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agocarl9170: Only specify interface combinations if more than one interface is possible
Christian Lamparter [Mon, 17 Dec 2012 13:54:19 +0000 (14:54 +0100)]
carl9170: Only specify interface combinations if more than one interface is possible

Otherwise carl9170 triggers a warning in cfg80211, from net/wireless/core.c

/* Combinations with just one interface aren't real */
if (WARN_ON(c->max_interfaces < 2))

Note: The number of supported interfaces is set by
the carl9170 firmware. The default number of
supported interfaces for all current firmwares is 2.
Therefore this warning can only be observed with
custom firmwares.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agocarl9170: allow P2P_GO interface creation after P2P_CLIENT
Christian Lamparter [Sun, 16 Dec 2012 00:41:37 +0000 (01:41 +0100)]
carl9170: allow P2P_GO interface creation after P2P_CLIENT

Janusz Dziedzic reported that after a change in wpa_supplicant
["nl80211: Automatically use concurrent P2P if possible"],
carl9170 was no longer able to host a P2P network.

This patch tackles the problem by allowing GO interfaces to be
registered, long after the P2P_CLIENT interface is brought up.

Reported-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agocarl9170: import 1.9.7 firmware headers
Christian Lamparter [Sat, 15 Dec 2012 22:21:32 +0000 (23:21 +0100)]
carl9170: import 1.9.7 firmware headers

Import new headers from my firmware branch:
<https://github.com/chunkeey/carl9170fw>

visit our wiki at:
<http://wireless.kernel.org/en/users/Drivers/carl9170.fw>

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agocarl9170: advertise support for TDLS
Christian Lamparter [Sat, 15 Dec 2012 22:18:06 +0000 (23:18 +0100)]
carl9170: advertise support for TDLS

Based on a quick test [ath9k and carl9170],
TDLS seemed to be working fine. And while
we are at it, let's move the wiphy feature
flag set from carl9170_alloc into a single
place in carl9170_fw.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k_hw: use the devres API for allocations
Felix Fietkau [Wed, 12 Dec 2012 12:14:23 +0000 (13:14 +0100)]
ath9k_hw: use the devres API for allocations

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: use the devres API for allocations/mappings
Felix Fietkau [Wed, 12 Dec 2012 12:14:22 +0000 (13:14 +0100)]
ath9k: use the devres API for allocations/mappings

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2800: refactor RFCSR initialization
Stanislaw Gruszka [Wed, 12 Dec 2012 05:30:55 +0000 (06:30 +0100)]
rt2800: refactor RFCSR initialization

rt2800_init_rfcsr() is too big, split RF initialization into per chip
functions. Code will change, but we should setup the same values onto
RF registers and in the same order as before.

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi...
John W. Linville [Mon, 7 Jan 2013 19:57:43 +0000 (14:57 -0500)]
Merge branch 'for-john' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

11 years agoiwlwifi: always check that grab_nic_access succeeds
Emmanuel Grumbach [Mon, 31 Dec 2012 11:46:42 +0000 (13:46 +0200)]
iwlwifi: always check that grab_nic_access succeeds

This allows to let sparse check that the NIC access is
always released.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: fix spelling and value in LED registers.
Eytan Lifshitz [Thu, 27 Dec 2012 22:10:36 +0000 (00:10 +0200)]
iwlwifi: fix spelling and value in LED registers.

Fix typo in the macro name and the wrong value.

Signed-off-by: Eytan Lifshitz <eytan.lifshitz@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: move some PCIe calls to better places
Johannes Berg [Thu, 27 Dec 2012 21:58:21 +0000 (22:58 +0100)]
iwlwifi: move some PCIe calls to better places

Synchronizing the IRQ is pointless when we will
then enable the RF-Kill interrupt again, but is
needed before we free it and the data needed to
handle IRQs; move it to the free function.

Simiarly, cancelling the replenish work struct
can move to the function that frees the RX data
structures.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: request IRQ only once
Johannes Berg [Thu, 27 Dec 2012 22:08:06 +0000 (23:08 +0100)]
iwlwifi: request IRQ only once

There's no need to request the IRQ every time the
device is started, we can request it just once.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: don't treat a bool as an error code
Emmanuel Grumbach [Mon, 31 Dec 2012 11:15:36 +0000 (13:15 +0200)]
iwlwifi: don't treat a bool as an error code

iwl_trans_grab_nic_access returns a boolean. So ret should
explicitely set to an error code and not rely on the value
returned by iwl_trans_grab_nic_access.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: virtualize SRAM access
Emmanuel Grumbach [Mon, 24 Dec 2012 12:27:11 +0000 (14:27 +0200)]
iwlwifi: virtualize SRAM access

Different transports implement the access to the SRAM in
different ways. Virtualize it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: virtualize iwl_{grab,release}_nic_access
Emmanuel Grumbach [Mon, 24 Dec 2012 13:01:24 +0000 (15:01 +0200)]
iwlwifi: virtualize iwl_{grab,release}_nic_access

Since different transports have different ways to wake the
up the NIC, we need to virtualize it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: use __packed
Johannes Berg [Fri, 28 Dec 2012 11:27:43 +0000 (12:27 +0100)]
iwlwifi: use __packed

Use __packed instead of __attribute__((packed)).

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: let the op_mode run a FW while in RFKILL
Emmanuel Grumbach [Mon, 24 Dec 2012 09:10:43 +0000 (11:10 +0200)]
iwlwifi: let the op_mode run a FW while in RFKILL

In some cases, the fw should run even if the NIC is in
RFKILL. Make the API more flexible to allow that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: don't verify fw after download
Emmanuel Grumbach [Mon, 24 Dec 2012 14:51:22 +0000 (16:51 +0200)]
iwlwifi: don't verify fw after download

No need to verify that the fw has been written correctly.
In case it hasn't, we won't get ALIVE notification.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: clean up code in AGG
Emmanuel Grumbach [Tue, 18 Dec 2012 08:47:28 +0000 (10:47 +0200)]
iwlwifi: clean up code in AGG

If we take a pointer to the tid_data, then use it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: make the BC table layout configurable
Emmanuel Grumbach [Wed, 5 Dec 2012 13:07:54 +0000 (15:07 +0200)]
iwlwifi: make the BC table layout configurable

This is needed for newer NICs.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: disallow more station changes
Johannes Berg [Thu, 27 Dec 2012 16:32:09 +0000 (17:32 +0100)]
cfg80211: disallow more station changes

The following changes are invalid and should be
disallowed when a station already exists:
 * supported rates changes, except for TDLS peers
 * listen interval changes
 * HT capability changes

Disallow them and also update a mac80211 comment
explaining how they would be racy.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: unset peer's HT 40 MHz support if not usable
Johannes Berg [Fri, 28 Dec 2012 14:01:57 +0000 (15:01 +0100)]
mac80211: unset peer's HT 40 MHz support if not usable

When an interface is configured to a 20 MHz channel
and the device as well as the peer are 40 MHz capable
the HT capabilities of the peer are not restricted to
20 MHz, even though they're supposed to be restricted
to the currently possible capabilities.

Unset the 40 MHz HT capability bits in this case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agowireless: use __aligned
Johannes Berg [Fri, 28 Dec 2012 11:22:02 +0000 (12:22 +0100)]
wireless: use __aligned

Use __aligned(...) instead of __attribute__((aligned(...)))
in mac80211 and cfg80211.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: support HT notify channel width action
Johannes Berg [Fri, 28 Dec 2012 11:12:10 +0000 (12:12 +0100)]
mac80211: support HT notify channel width action

Support the HT notify channel width action frame
to update the rate scaling about the bandwidth
the peer can receive in.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agowireless: use __packed in ieee80211.h
Johannes Berg [Fri, 28 Dec 2012 11:00:40 +0000 (12:00 +0100)]
wireless: use __packed in ieee80211.h

Use __packed instead of __attribute__((packed)).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: split TX aggregation stop action
Johannes Berg [Wed, 18 Jul 2012 11:51:25 +0000 (13:51 +0200)]
mac80211: split TX aggregation stop action

When TX aggregation is stopped, there are a few
different cases:
 - connection with the peer was dropped
 - session stop was requested locally
 - session stop was requested by the peer
 - connection was dropped while a session is stopping

The behaviour in these cases should be different, if
the connection is dropped then the driver should drop
all frames, otherwise the frames may continue to be
transmitted, aggregated in the case of a locally
requested session stop or unaggregated in the case of
the peer requesting session stop.

Split these different cases so that the driver can
act accordingly; however, treat local and remote stop
the same way and ask the driver to not send frames as
aggregated packets any more.

In the case of connection drop, the stop callback the
driver is otherwise supposed to call is no longer
required.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: move ieee80211_remove_tid_tx function
Johannes Berg [Fri, 28 Dec 2012 08:43:03 +0000 (09:43 +0100)]
mac80211: move ieee80211_remove_tid_tx function

To call it from ___ieee80211_stop_tx_ba_session,
move the function and dependencies up.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: split out aggregation TX removal
Johannes Berg [Wed, 18 Jul 2012 12:12:44 +0000 (14:12 +0200)]
mac80211: split out aggregation TX removal

Create the function ieee80211_remove_tid_tx to call
it from ___ieee80211_stop_tx_ba_session later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: split aggregation stop by reason
Johannes Berg [Wed, 18 Jul 2012 11:31:31 +0000 (13:31 +0200)]
mac80211: split aggregation stop by reason

The initiator/tx doesn't really identify why an
aggregation session is stopped, give a reason
for stopping that more clearly identifies what's
going on. This will help tell the driver clearly
what is expected of it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agonl80211/mac80211: support full station state in AP mode
Johannes Berg [Fri, 26 Oct 2012 15:53:44 +0000 (17:53 +0200)]
nl80211/mac80211: support full station state in AP mode

Today, stations are added already associated. That is
inefficient if, for example, the driver has no room
for stations any more because then the station will
go through the entire auth/assoc handshake, only to
be kicked out afterwards.

To address this a bit better, at least with drivers
using the new station state callback, allow hostapd
to add stations in unauthenticated mode, just after
receiving the AUTH frame, before even replying. Thus
if there's no more space at that point, it can send
a negative auth frame back. It still needs to handle
later state transition errors though, of course.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: move some AP code to right file
Johannes Berg [Thu, 20 Dec 2012 17:23:01 +0000 (18:23 +0100)]
cfg80211: move some AP code to right file

Some AP code ended up in mlme.c as ap.c didn't
exist when it was written, move it now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: restrict assoc request VHT capabilities
Johannes Berg [Fri, 7 Dec 2012 12:06:48 +0000 (13:06 +0100)]
mac80211: restrict assoc request VHT capabilities

In interoperability testing some APs showed bad behaviour
if some of the VHT capabilities of the station are better
than their own. Restrict the assoc request parameters
 - beamformee capabable,
 - RX STBC and
 - RX MCS set
to the subset that the AP can support.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: move world roaming check for beacon hints
Luis R. Rodriguez [Wed, 19 Dec 2012 18:53:04 +0000 (10:53 -0800)]
cfg80211: move world roaming check for beacon hints

We should not add new beacon hints even if the wiphy
is not world roaming. Without this we were always adding
a beacon hint if not world roaming for every non world
roaming wiphy interface.

Tested-by: Ben Greear <greearb@candelatech.com>
Reported-by: Ben Greear <greearb@candelatech.com>
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
[fix locking]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: move reg_is_world_roaming()
Luis R. Rodriguez [Wed, 19 Dec 2012 18:53:03 +0000 (10:53 -0800)]
cfg80211: move reg_is_world_roaming()

This will be used later by other code. This has no
functional change.

Tested-by: Ben Greear <greearb@candelatech.com>
Reported-by: Ben Greear <greearb@candelatech.com>
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: do not process beacon hints if one is already queued
Luis R. Rodriguez [Wed, 19 Dec 2012 18:53:02 +0000 (10:53 -0800)]
cfg80211: do not process beacon hints if one is already queued

Regulatory beacon hints are used to help with world roaming
and as it is right now we learn from a beacon hint processed
on one wiphy to all other wiphys. The processing of beacon
hints however is scheduled and if we have a lot of interfaces
we may hit the case that we'll queue a the same beacon hint
many times until its processed.

To avoid this do a lookup on the queued up beacon hints prior
to adding a new beacon hint. If the beacon hint is removed
from the pending reg beacon hint list then it would be processed
and we'd ensure all wiphys would have learned from it, if its
on the pending reg beacon list we'd now find it prior to it
being processed.

Tested-by: Ben Greear <greearb@candelatech.com>
Reported-by: Ben Greear <greearb@candelatech.com>
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: assign bss_conf.bssid only once
Johannes Berg [Fri, 14 Dec 2012 13:34:25 +0000 (14:34 +0100)]
mac80211: assign bss_conf.bssid only once

Instead of checking every time bss_info_changed is called,
assign the pointer once depending on the interface type
and then leave it untouched until the interface type is
changed. This makes the ieee80211_bss_info_change_notify()
now a simple wrapper to call the driver only.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: further simplify ieee80211_bss_info_change_notify
Johannes Berg [Fri, 14 Dec 2012 13:22:10 +0000 (14:22 +0100)]
mac80211: further simplify ieee80211_bss_info_change_notify

The special case in the function isn't really needed,
instead make the suspend code a bit better and also
easier to understand and move the warning into the
driver op wrapper inline.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: reconfig bss_info_changed only if beaconing
Johannes Berg [Fri, 14 Dec 2012 13:17:26 +0000 (14:17 +0100)]
mac80211: reconfig bss_info_changed only if beaconing

For AP/IBSS/mesh interfaces, call the driver to reconfigure
bss_info_changed only if the interface was beaconing before
suspend, otherwise we call the driver and it might interpret
the change as going from enabled to disabled.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: track enable_beacon explicitly
Johannes Berg [Fri, 14 Dec 2012 13:06:28 +0000 (14:06 +0100)]
mac80211: track enable_beacon explicitly

Instead of calculating in ieee80211_bss_info_change_notify()
whether beaconing should be enabled or not, set it in the
correct places in the callers. This simplifies the logic in
this function at the expense of offchannel, but is also more
robust.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix channel context iteration
Johannes Berg [Thu, 13 Dec 2012 16:42:30 +0000 (17:42 +0100)]
mac80211: fix channel context iteration

During suspend/resume channel contexts might be
iterated even if they haven't been re-added to
the driver, keep track of this and skip them in
iteration. Also use the new status for sanity
checks.

Also clarify the fact that during HW restart all
contexts are iterated over (thanks Eliad.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: clean up association better in suspend
Johannes Berg [Thu, 13 Dec 2012 16:16:45 +0000 (17:16 +0100)]
mac80211: clean up association better in suspend

When suspending, bss_info_changed() is called to
disable beacons, but managed mode interfaces are
simply removed (bss_info_changed() is called with
"no change" only). This can lead to problems.

To fix this and copy the BSS configuration, clear
it during suspend and restore it on resume.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: clean up ieee80211_quiesce
Johannes Berg [Thu, 13 Dec 2012 15:47:42 +0000 (16:47 +0100)]
mac80211: clean up ieee80211_quiesce

It's a bit odd that there's a return value that only
depends on the iftype, move that logic out of the
function into the only caller that needs it.

Also, since the quiescing could stop timers that
trigger the sdata work, move the sdata work cancel
into the function and after the actual quiesce.

Finally, there's no need to call it on interfaces
that are down, so don't.

Change-Id: I1632d46d21ba3558ea713d035184f1939905f2f1
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac82011: use frame control to differentiate probe resp/beacon
Emmanuel Grumbach [Mon, 10 Dec 2012 14:19:13 +0000 (16:19 +0200)]
mac82011: use frame control to differentiate probe resp/beacon

The probe response/beacon management frame RX code passes a
bool parameter to differentiate beacons and probe responses.
This is useless since we have the frame and can thus use its
frame control field. Moreover it is buggy since there is one
call to ieee80211_rx_bss_info with a beacon frame that is
indicated as a probe response, which is also fixed by using
the frame control field, so do that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix ieee80211_ie_build_vht_cap indentation
Johannes Berg [Fri, 7 Dec 2012 11:45:06 +0000 (12:45 +0100)]
mac80211: fix ieee80211_ie_build_vht_cap indentation

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: adjacent 80+80 MHz channel segments are invalid
Johannes Berg [Thu, 13 Dec 2012 23:19:08 +0000 (00:19 +0100)]
cfg80211: adjacent 80+80 MHz channel segments are invalid

In that case, it's really a 160 MHz channel, so disallow
this configuration.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: optimise AP stop RCU handling
Johannes Berg [Fri, 14 Dec 2012 13:56:03 +0000 (14:56 +0100)]
mac80211: optimise AP stop RCU handling

If there are VLANs, stopping an AP is inefficient as it
calls rcu_barrier() once for each interface (the VLANs
and the AP itself). Optimise this by moving rcu_barrier()
out of the station cleanups and calling it only once for
all interfaces combined.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: use IS_ERR macro family for freq_reg_info
Johannes Berg [Thu, 6 Dec 2012 14:57:14 +0000 (15:57 +0100)]
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>
11 years agoregulatory: use RCU to protect last_request
Johannes Berg [Thu, 6 Dec 2012 15:29:25 +0000 (16:29 +0100)]
regulatory: use RCU to protect last_request

This will allow making freq_reg_info() lock-free.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: use RCU to protect global and wiphy regdomains
Johannes Berg [Thu, 6 Dec 2012 14:47:38 +0000 (15:47 +0100)]
regulatory: use RCU to protect global and wiphy regdomains

To simplify the locking and not require cfg80211_mutex
(which nl80211 uses to access the global regdomain) and
also to make it possible for drivers to access their
wiphy->regd safely, use RCU to protect these pointers.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: pass new regdomain to reset function
Johannes Berg [Thu, 6 Dec 2012 14:44:07 +0000 (15:44 +0100)]
regulatory: pass new regdomain to reset function

Instead of assigning after calling the function do
it inside the function. This will later avoid a
period of time where the pointer is NULL.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: remove handling of channel bandwidth
Johannes Berg [Tue, 4 Dec 2012 14:07:34 +0000 (15:07 +0100)]
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>
11 years agoregulatory: fix reg_is_valid_request handling
Johannes Berg [Mon, 3 Dec 2012 23:48:59 +0000 (00:48 +0100)]
regulatory: fix reg_is_valid_request handling

There's a bug with the world regulatory domain, it
can be updated any time which is different from all
other regdomains that can only be updated once after
a request for them. Fix this by adding a check for
"processed" to the reg_is_valid_request() function
and clear that when doing a request.

While looking at this I also found another locking
bug, last_request is protected by the reg_mutex not
the cfg80211_mutex so the code in nl80211 is racy.
Remove that code as it only tries to prevent an
allocation in an error case, which isn't necessary.
Then the function can also become static and locking
in nl80211 can have a smaller scope.

Also change __set_regdom() to do the checks earlier
and not different for world/other regdomains.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: remove locking from wiphy_apply_custom_regulatory
Johannes Berg [Mon, 3 Dec 2012 23:19:24 +0000 (00:19 +0100)]
regulatory: remove locking from wiphy_apply_custom_regulatory

wiphy_apply_custom_regulatory() doesn't have to hold
the regulatory mutex as it only modifies the given
wiphy with the given regulatory domain, it doesn't
access any global regulatory data.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: clarify locking rules and assertions
Johannes Berg [Mon, 3 Dec 2012 22:00:08 +0000 (23:00 +0100)]
regulatory: clarify locking rules and assertions

Many places that currently check that cfg80211_mutex
is held don't actually use any data protected by it.
The functions that need to hold the cfg80211_mutex
are the ones using the cfg80211_regdomain variable,
so add the lock assertion to those and clarify this
in the comments.

The reason for this is that nl80211 uses the regdom
without being able to hold reg_mutex.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: simplify freq_reg_info_regd
Johannes Berg [Mon, 3 Dec 2012 23:14:17 +0000 (00:14 +0100)]
regulatory: simplify freq_reg_info_regd

The function itself has dual-purpose: it can
retrieve from a given regdomain or from the
globally installed one. Change it to have a
single purpose only: to look up from a given
regdomain. Pass the correct regdomain in the
freq_reg_info() function instead.

This also changes the locking rules for it,
no locking is required any more.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: remove useless warning
Johannes Berg [Mon, 3 Dec 2012 18:12:02 +0000 (19:12 +0100)]
regulatory: remove useless warning

Even if it never happens and is hidden behind the
debug config option, it's completely useless: the
calltrace will only show module loading.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: remove redundant isalpha() check
Johannes Berg [Mon, 3 Dec 2012 17:59:58 +0000 (18:59 +0100)]
regulatory: remove redundant isalpha() check

toupper() only modifies lower-case letters, so
the isalpha() check is redundant; remove it.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: simplify restore_regulatory_settings
Johannes Berg [Mon, 3 Dec 2012 17:56:41 +0000 (18:56 +0100)]
regulatory: simplify restore_regulatory_settings

Use list_splice_tail_init() and also simplify the locking.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: remove BUG_ON
Johannes Berg [Mon, 3 Dec 2012 17:36:09 +0000 (18:36 +0100)]
regulatory: remove BUG_ON

This code is a bit too BUG_ON happy, remove all
instances and while doing so make some code a bit
smarter by passing the right pointer instead of
indices into arrays.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: remove wiphy_idx_valid
Johannes Berg [Mon, 3 Dec 2012 17:23:37 +0000 (18:23 +0100)]
cfg80211: remove wiphy_idx_valid

This is pretty much useless since get_wiphy_idx()
always returns true since it's always called with
a valid wiphy pointer.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: use proper enum for return values
Johannes Berg [Mon, 3 Dec 2012 16:54:55 +0000 (17:54 +0100)]
regulatory: use proper enum for return values

Instead of treating special error codes specially,
like -EALREADY, introduce a real enum for all the
needed possibilities and use it.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: remove useless locking on exit
Johannes Berg [Mon, 3 Dec 2012 16:59:24 +0000 (17:59 +0100)]
regulatory: remove useless locking on exit

It would be a major problem if anything were to run
concurrently while the module is being unloaded so
remove the locking that doesn't help anything.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: code cleanup
Johannes Berg [Mon, 3 Dec 2012 16:21:11 +0000 (17:21 +0100)]
regulatory: code cleanup

Clean up various things like indentation, extra
parentheses, too many/few line breaks, etc.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: simplify regulatory_hint_11d
Johannes Berg [Mon, 3 Dec 2012 16:21:26 +0000 (17:21 +0100)]
regulatory: simplify regulatory_hint_11d

There's no need to unlock before calling
queue_regulatory_request(), so simplify
the function.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: don't test list before iterating
Johannes Berg [Mon, 3 Dec 2012 16:32:01 +0000 (17:32 +0100)]
regulatory: don't test list before iterating

There's no need to test whether a list is
empty or not before iterating.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: clean up reg_copy_regd()
Johannes Berg [Mon, 3 Dec 2012 15:59:46 +0000 (16:59 +0100)]
regulatory: clean up reg_copy_regd()

Use ERR_PTR/IS_ERR to return the result or errors,
also do some code cleanups.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: clean up regdom_intersect
Johannes Berg [Thu, 6 Dec 2012 16:26:17 +0000 (17:26 +0100)]
regulatory: clean up regdom_intersect

As the dummy_rule (also renamed from irule) is only
used for output by the reg_rules_intersect() function
there's no need to clear it at all, remove that.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: don't allocate too much memory
Johannes Berg [Tue, 4 Dec 2012 11:49:16 +0000 (12:49 +0100)]
regulatory: don't allocate too much memory

There's no need to allocate one reg rule more
than will be used, reduce the allocations. The
allocation in nl80211 already doesn't allocate
too much space.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoregulatory: don't write past array when intersecting rules
Johannes Berg [Thu, 6 Dec 2012 16:03:17 +0000 (17:03 +0100)]
regulatory: don't write past array when intersecting rules

When intersecting rules, we count first to know how many
rules need to be allocated, and then do the intersection
into the allocated array. However, the code doing this
writes past the end of the array because it attempts to
do all intersections. Make it stop when the right number
of rules has been reached.

Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>