Larry Finger [Tue, 29 Oct 2013 22:06:41 +0000 (17:06 -0500)]
rtl8187: Increase RX queue depth
Under heavy load, the relatively small number of RX queue entries are
completely filled. With an increase from 16 to 32 entries, this condition
rarely happens.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
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.
Generated-by: Coccinelle SmPL Cc: Julia Lawall <julia.lawall@lip6.fr> Cc: Peter Senna Tschudin <peter.senna@gmail.com> Cc: Larry Finger <Larry.Finger@lwfinger.net> Reported-by: Mihir Shete <smihir@qti.qualcomm.com> Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com> Acked-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
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.
Generated-by: Coccinelle SmPL Cc: Julia Lawall <julia.lawall@lip6.fr> Cc: Peter Senna Tschudin <peter.senna@gmail.com> Cc: Seth Forshee <seth.forshee@canonical.com> Cc: Arend van Spriel <arend@broadcom.com> Reported-by: Mihir Shete <smihir@qti.qualcomm.com> Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com> Acked-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Solomon Peachy [Fri, 25 Oct 2013 22:15:43 +0000 (18:15 -0400)]
wireless: cw1200: Use consistent internal locking conventions
The cw1200_irq_handler() function expects the hwbus lock to be held when
it is called. On the SDIO platform, this lock is implemented in terms
of sdio_claim_host/sdio_release_host.
This trivial patch makes it explicit that we are performing the hwbus
lock rather than something SDIO-specific.
Signed-off-by: Solomon Peachy <pizza@shaftnet.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
We can mess logs if user space try to open device again and again if
RFKILL switch is on. Do not print message and return ERFKILL error
instead to indicate where the problem is.
Note that iwl4965 handle this problem differently, it allows to open
device when radio is disabled.
Reported-by: Dietmar Rudolph <dietmar@crlf.de> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
NeilBrown [Thu, 24 Oct 2013 07:33:33 +0000 (18:33 +1100)]
libertas/sdio: make sure card enters power-off when firmware is loaded.
Since firmware loading became async it is possible that if_sdio_finish_power_of
is called with only one remaining runtime_pm reference, so it isn't safe
to call pm_runtime_put_noidle. We must call pm_runtime_put().
Diagnosed-by: "Dr. H. Nikolaus Schaller" <hns@goldelico.com> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Amitkumar Karwar [Tue, 22 Oct 2013 22:24:47 +0000 (15:24 -0700)]
mwifiex: improvements in mwifiex_ret_tx_power_cfg()
1) Move common code out of switch case handling
2) Return from the function if number of bytes left in response buffer
are less than tlv size
3) Pass pg_tlv_hdr directly instead of txp_cfg to mwifiex_get_power_level()
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>
Arend van Spriel [Fri, 29 Nov 2013 11:25:23 +0000 (12:25 +0100)]
brcmfmac: move firmware event related defines to fweh.h
The dhd.h file contained a number of definitions that are
related to events received from the firmware. Those are
processed and dispatched in the driver by fweh. Hence the
definitions are moved to its include file.
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>
Hante Meuleman [Fri, 29 Nov 2013 11:25:21 +0000 (12:25 +0100)]
brcmfmac: Use consistent naming for BCDC.
The BCDC protocol layer is using a mix of naming of CDC, BDC and
BCDC. Use the name BCDC consistenly over all functions, defines
and variables. This patch does not change code functionality.
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>
Arend van Spriel [Fri, 29 Nov 2013 11:25:19 +0000 (12:25 +0100)]
brcmfmac: move firmware related structures to fwil_types.h
The firmware control interface is provided by fwil source file, but
a number of structures used to communicate with the firmware still
resided in dhd.h. The patch moves them to fwil_types.h.
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>
In bcmsdh.c the functions brcmf_sdio_probe() and brcmf_sdio_remove()
were exported, but that is not needed. The functions are linked into
the driver module, which is the only one needing to call these.
Reviewed-by: Franky Lin <frankyl@broadcom.com> Reviewed-by: Hante Meuleman <meuleman@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Arend van Spriel [Fri, 29 Nov 2013 11:25:17 +0000 (12:25 +0100)]
brcmfmac: provide firmware version in ethtool driver info
Knowing the firmware version is pretty useful information when
looking at issues. It is retrieved during initialization so
store it in driver data structure to fill the ethtool driver
info when requested.
Reviewed-by: Hante Meuleman <meuleman@brodcom.com> Reviewed-by: Franky Lin <frankyl@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>
Hante Meuleman [Fri, 29 Nov 2013 11:25:16 +0000 (12:25 +0100)]
brcmfmac: Dynamically register a protocol layer.
BCDC is the default protocol layer and being called directly. This
patch installs the functions for this layer dynamically. This allows
new protocols to be added and selected dynamically depending on the
hw capabilties. As currently only BCDC is supported this is always
the installed protocol.
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>
Arend van Spriel [Fri, 29 Nov 2013 11:25:15 +0000 (12:25 +0100)]
brcmfmac: remove redundant ioctl handlers
The ioctl() entry points were empty except for handling SIOC_ETHTOOL
but that has been obsoleted in favor of struct ethtool_ops. Cleaning
up removing the ioctl() handlers.
Reviewed-by: Hante Meuleman <meuleman@broadcom.com> Reviewed-by: Franky Lin <frankyl@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>
Arend van Spriel [Fri, 29 Nov 2013 11:25:14 +0000 (12:25 +0100)]
brcmfmac: use platform specific alignment in SDIO
The SDIO part of the brcmfmac driver uses a static define BRCMF_SDALIGN
to align buffers used for SDIO transfers. This patch replaces it by
using alignment derived from the platform specific data.
Reviewed-by: Franky Lin <frankyl@broadcom.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>
Hante Meuleman [Fri, 29 Nov 2013 11:46:29 +0000 (12:46 +0100)]
brcmfmac: rename dhd_cdc to bcdc
dhd_cdc is renamed to bcdc. This is a step in cleaning and
restructuring protocol layer. This is done so new protocols can
be added in the future. This step only renames the source files.
Reviewed-by: Arend Van Spriel <arend@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
[arend@broadcom.com: use 'git mv' to do the rename] Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Franky Lin [Fri, 29 Nov 2013 11:25:10 +0000 (12:25 +0100)]
brcmfmac: add host tx glomming support
New WiFi full dongle supports receiving chained packets in one command
through the SDIO bus. This patch adds the support on the host side to
send chained packets.
Reviewed-by: Hante Meuleman <meuleman@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Franky Lin [Fri, 29 Nov 2013 11:25:09 +0000 (12:25 +0100)]
brcmfmac: add firmware and nvram file name for bcm4339
Add firmware/nvram file name for bcm4339 so fmac can actually be functional with
the chip.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Arend van Spriel [Fri, 29 Nov 2013 11:25:08 +0000 (12:25 +0100)]
brcmfmac: fix driver build issue when CONFIG_BRCMDBG is not set
When CONFIG_BRCMDBG is not set we get the following build issue:
CC [M] drivers/net/wireless/brcm80211/brcmfmac/fwsignal.o
drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c:
In function ‘brcmf_fws_hdrpush’:
drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c:852:18:
error: ‘BRCMF_FWS_TYPE_SEQ_LEN’ undeclared
The define BRCMF_FWS_TYPE_SEQ_LEN was introduced by:
Arend van Spriel [Fri, 29 Nov 2013 11:25:07 +0000 (12:25 +0100)]
brcmfmac: determine sd host controller related variable earlier
The commit "eb9c174 brcmfmac: determine host controller related
variables during probe" was not implemented correctly as the
information is already needed in brcmf_sdbrcm_probe(). This patch
moves it to brcmf_sdioh_attach() instead.
Reviewed-by: Franky Lin <frankyl@broadcom.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>
Arend van Spriel [Fri, 29 Nov 2013 11:25:06 +0000 (12:25 +0100)]
brcmfmac: support hardware extension header in trace_brcmf_sdpcm_hdr()
The SDPCM header can be traced, but it used a fixed header size. With
txglom feature the SDPCM header will have additional 8 bytes of hardware
extension header so SDIO core can properly handle the txglom packet.
Reviewed-by: Franky Lin <frankyl@broadcom.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>
Arend van Spriel [Fri, 29 Nov 2013 10:48:19 +0000 (11:48 +0100)]
brcmsmac: select CONFIG_BCMA when possible
The brcmsmac relies BCMA functionality to access the device. This
patch selects CONFIG_BCMA when CONFIG_BCMA_POSSIBLE is set. This
way the user does not need to be select BCMA to make the brcmsmac
driver show up in his menuconfig.
Reported-by: Dan Carpenter <dan.carpenter@oracle.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>
The SleepCSR register is accessed to wakeup the device from the
host side. Depending on the state of the device this may take
multiple attempts. The failed attempt are not real failures so
reduce the log level specifically for this register. The calling
function will scream when the multiple attempts all failed.
Reviewed-by: Hante Meuleman <meuleman@broadcom.com> Reviewed-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Arend van Spriel [Fri, 29 Nov 2013 10:48:16 +0000 (11:48 +0100)]
brcmfmac: start netif queues only when setup is completed successful
Moving the call to netif_start_queue() after brcmf_cfg80211_up() is
completed successful. If not return -EIO instead of -1 as that results
in 'Operation not permitted' which can put user on wrong track.
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>
Arend van Spriel [Fri, 29 Nov 2013 10:48:15 +0000 (11:48 +0100)]
brcmfmac: replace dongle command list with .preinit() callback
The bus-specific interface allowed a list of dongle commands to be
provided to the common driver part. However, upcoming functionality
requires a more dynamic behaviour. Hence the list is replaced
by a new callback function so the bus-specific driver part can
implement this behaviour.
Reviewed-by: Franky Lin <frankyl@broadcom.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>
Arend van Spriel [Fri, 29 Nov 2013 10:48:14 +0000 (11:48 +0100)]
brcmfmac: add separate function for passing bus tx overhead
The common driver needs the packet overhead for the bus in order
to reserve headroom for sk_buffs. For the SDIO driver this depends
on firmware features so it is not possible to provide it in the
brcmf_attach() call.
Reviewed-by: Franky Lin <frankyl@broadcom.com> 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>
Hante Meuleman [Fri, 29 Nov 2013 10:48:13 +0000 (11:48 +0100)]
brcmfmac: Update fwsignal to fix out of order tx.
When using fwsignal it is possible that tx packets get delivered out
of order. This patch fixes that by reordering suppressed packets and
tracking generation bit and sequence number per packet.
Reviewed-by: Arend Van Spriel <arend@broadcom.com> Reviewed-by: Franky (Zhenhui) Lin <frankyl@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>
Felix Fietkau [Mon, 18 Nov 2013 19:14:44 +0000 (20:14 +0100)]
ath9k_hw: allow fast channel change when only CHANNEL_HT changes
The CHANNEL_HT flag is insignificant for fast channel change conditions,
since it does not affect any important part of the hardware reset /
channel setup.
Scanning usually runs with HT disabled, so this change will slightly
improve scan time on many chipsets.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Felix Fietkau [Mon, 18 Nov 2013 19:14:43 +0000 (20:14 +0100)]
ath9k_hw: fix TSF save/restore around chip reset
A cold reset can be triggered because of DMA stop issues, and this leads
to TSF being cleared on all chipsets. To properly deal with this, always
save the TSF.
Additionally, account for the time it takes to do the actual chip reset,
which can be quite significant. On AR9344 it takes around 4.5 ms.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Felix Fietkau [Mon, 11 Nov 2013 21:23:35 +0000 (22:23 +0100)]
ath9k: optimize ath9k_flush
Instead of checking the queues in a loop with hardcoded sleep times
inbetween, use a wait queue to trigger queue checks after the tx
processing tasklet has run.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Felix Fietkau [Mon, 11 Nov 2013 21:23:33 +0000 (22:23 +0100)]
ath9k: use a timer to put hardware into full sleep
When operating in client mode, the short period of time between scanning
and associating is often enough to put the hardware through several
FULL-SLEEP <-> AWAKE transitions, each wakeup requiring a reset to fully
recover the hardware.
This is completely unnecessary and can easily be avoided by deferring
the switch to full sleep.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Sujith Manoharan [Fri, 15 Nov 2013 07:35:18 +0000 (13:05 +0530)]
ath9k: Fix Carrier Leak calibration for SoC chips
CL calibration is applicable for all chips and the
enable/disable knob comes via the INI file. For PCOEM
chips, the calibration data is reused when Fast Channel Change
is used. Caldata reuse is not enabled for SoC chips, so remove
the CL post processing code.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Sujith Manoharan [Fri, 15 Nov 2013 05:16:21 +0000 (10:46 +0530)]
ath9k: Separate routines for PCOEM and SoC calibration
Though there is some overlap between the calibration mechanisms
of PC-OEM cards and SoC chip families, dumping both of them
into a single function makes things hard to understand.
ar9003_hw_init_cal() is unreadable with chip-specific segments
scattered around. To make the logic understandable, use
different functions for client cards and SoC chips. Some
code is duplicated, but in the long run, it makes the code
more maintanable.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Dan Carpenter [Thu, 14 Nov 2013 10:01:18 +0000 (15:31 +0530)]
ath9k: fix SC_OP_INVALID test in ath9k_tx99_init()
SC_OP_INVALID is zero so the test is always false. We're supposed to be
testing the lowest bit instead.
Fixes: 89f927af7f33 ('ath9k: add TX99 support') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
CUS227, which is an AR9340 based card used in Qualcomm's
Allplay platforms requires a custom TX gain array, based
on the index 7. Add suport for this.
Cc: Michael Larson <mlarson@qce.qualcomm.com> Cc: Stephen Collmeyer <scollmey@qce.qualcomm.com> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Sujith Manoharan [Mon, 28 Oct 2013 06:17:43 +0000 (11:47 +0530)]
ath9k: Fix wow.c compilation
The HW routines to set various WoW registers are present
in wow.c. For some reason, it has been compiled as part
of the main ath9k.ko module all this time, when it should
really be part of ath9k_hw.ko. This patch renames the file to
ar9003_wow.ko and adds it to ath9k_hw.ko.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Sujith Manoharan [Thu, 24 Oct 2013 06:34:39 +0000 (12:04 +0530)]
ath9k: Fix TX99 config option usage
Use CONFIG_ATH9K_TX99 to properly enclose the tx99 code
and make sure that it is not compiled as part of the driver
when it is not selected. Move the tx99 code to a new file tx99.c
and also add ATH9K_DEBUGFS as a dependency in Kconfig.
This reduces the module size on platforms like OpenWrt where
ATH9K_DEBUGFS is selected, but TX99 might be disabled.
Cc: Luis R. Rodriguez <mcgrof@do-not-panic.com> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Michal Kazior [Mon, 2 Dec 2013 10:54:07 +0000 (11:54 +0100)]
mac80211: fix rx_nss calculation for drivers with hw rc
Drivers with hardware rate control were given
sta->rx_nss set to 0. This was because rx_nss
calculation procedure was protected by hw/sw rate
control check.
Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Simon Wunderlich [Thu, 21 Nov 2013 17:19:52 +0000 (18:19 +0100)]
mac80211: don't cancel csa finalize work within stop_ap
The current channel switch code has a potential deadlock:
1) * cfg80211_stop_ap acquires wdev-lock
* ieee80211_stop_ap calls cancel_work_sync for the csa_finalize_work,
which acquires the associated worker-lock
2) * ieee80211_csa_finalize_work holds the worker-lock when run
* it calls cfg80211_ch_switch_notify which will claim the wdev-lock,
and also needs to claim the sdata-lock (which is the same as the
wdev-lock) to modify the beacons.
It is sufficient to just set the channel switch active to false. If the
worker is running later, it will find the channel switch to not be
active anymore and returns immediately without changing anything.
Canceling the worker is done anyway when the interface goes down
(ieee80211_do_stop).
Reported-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
The channel switch notification should be sent under the
wdev/sdata-lock, preferably in the same moment as the channel change
happens, to avoid races by other callers (e.g. start/stop_ap).
This also adds the previously missing sdata_lock protection in
csa_finalize_work.
Reported-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Simon Wunderlich [Thu, 21 Nov 2013 17:19:50 +0000 (18:19 +0100)]
mac80211: modify beacon using sdata/wdev-lock, not rtnl lock
The csa finalize worker needs to change the beacon information (for
different modes). These are normally protected under rtnl lock, but the
csa finalize worker is called by drivers and should not acquire the RTNL
lock. Therefore change access protection for beacons to sdata/wdev lock.
Reported-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
[fix sdata_dereference] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Simon Wunderlich [Thu, 21 Nov 2013 17:19:49 +0000 (18:19 +0100)]
cfg80211: protect beacon changing functions with wdev-lock
To avoid race conditions in functions which modify the beacon
information, lock these using the wdev lock. This is especially required
to avoid problems for csa handling functions which modify beacons but
can not be called under rtnl lock.
Reported-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Bob Copeland [Mon, 18 Nov 2013 22:25:28 +0000 (17:25 -0500)]
mac80211: mesh: only get tsf if we need it
The local TSF timer is used to compute the timing offset between
mesh peers on beacon reception. However, asking the device for
the TSF is not very accurate, so we prefer to use rx->mactime
if available. In the latter case, calling drv_get_tsf() just
adds more delay into the RX path, so skip it if we can.
Signed-off-by: Bob Copeland <bob@cozybit.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
cfg80211: aggregate mgmt_tx parameters into a struct
Change cfg80211 and mac80211 to use cfg80211_mgmt_tx_params
struct to aggregate parameters for mgmt_tx functions.
This makes the functions' signatures less clumsy and allows
less painful parameters extension.
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
[fix all other drivers] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Mon, 18 Nov 2013 17:06:47 +0000 (19:06 +0200)]
mac80211: remove sta_info_flush() from interface teardown
All interface types now properly clean up their stations
using some form of sta_info_flush() themselves, so there's
no need to try it again at teardown. Remove the call to
get rid of the extra delay from the synchronize_net() and
rcu_barrier() calls.
Reported-by: Moshe Benji <moshe.benji@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Matti Gottlieb [Mon, 18 Nov 2013 17:06:45 +0000 (19:06 +0200)]
mac80211: Tx frame latency statistics
Measure TX latency and jitter statistics per station per TID.
These Measurements are disabled by default and can be enabled
via debugfs.
Features included for each station's TID:
1. Keep count of the maximum and average latency of Tx frames.
2. Keep track of many frames arrived in a specific time range
(need to enable through debugfs and configure the bins ranges)
Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg [Mon, 18 Nov 2013 16:23:26 +0000 (17:23 +0100)]
mac80211_hwsim: use CLOCK_MONOTONIC_RAW
The beacon timers really shouldn't use any clock that is
subject to adjustments from userspace, particularly not
CLOCK_REALTIME. Use CLOCK_MONOTONIC_RAW instead.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Felix Fietkau [Sat, 9 Nov 2013 13:57:54 +0000 (14:57 +0100)]
cfg80211: fix reporting 5/10 MHz support to user space
nla_put_flag needs a real nl80211 attribute id, not a wiphy flag bit.
While at it, split 5 and 10 MHz capability flags in case we ever need
to support hardware that can only do one of the two.
Also move the flag settings to the split-only information so we don't
increase the space needed for old userspace.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
[change location of flag setting] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Karl Beldan [Mon, 11 Nov 2013 12:10:49 +0000 (13:10 +0100)]
mac80211: minstrel_ht: do not sample unsupported rates
ATM minstrel_ht does not check whether a sampling rate is supported.
Unsupported rates attempts can trigger when there are holes in bitfields
of supported MCSes belonging to the same group (e.g many devices are
MCS32 capable without MCS33->39 capable, also we systematically have a
hole for CCK rates).
Drop any attempts to sample unsupported rates, as suggested by Felix.
This is not a problem in minstrel which fills a per STA sample table
with only supported rates (though only at init).
Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Karl Beldan [Wed, 13 Nov 2013 09:54:19 +0000 (10:54 +0100)]
mac80211: minstrels: spare numerous useless calls to get_random_bytes
ATM, only the first array value returned by get_random_bytes is used.
This change moves the call to get_random_bytes from the nested loop it
is in to its parent.
While at it, replace get_random_bytes with prandom_bytes since PRNs are
way enough for the selection process.
After this, minstrel_ht reclaims 80 PR-bytes instead of 640 R-bytes.
minstrels use sample tables to probe different rates in a randomized
manner.
minstrel_ht inits one single sample table upon registration (during
subsys_initcalls) and minstrel uses one per STA addition in minstrel.
Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Karl Beldan [Mon, 11 Nov 2013 12:12:55 +0000 (13:12 +0100)]
mac80211: minstrel_ht: replace some occurences of MCS_GROUP_RATES
Consecutive MCSes in [8*(NSS-1)->8*NSS[ have the same number NSS of
streams (except for MCS32 which is mishandled ATM).
ATM minstrel_ht uses MCS_GROUP_RATES in place of this 8 modulus.
This change replaces such occurences and by doing so allows for different
values of MCS_GROUP_RATES (e.g to cope with VHT MCS8,9).
Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Eliad Peller [Mon, 11 Nov 2013 18:14:01 +0000 (20:14 +0200)]
mac80211: add min required channel definition field
Add a new field to ieee80211_chanctx_conf to indicate
the min required channel configuration.
Tuning to a narrower channel might help reducing
the noise level and saving some power.
The min required channel definition is the max of
all min required channel definitions of the interfaces
bound to this channel context.
In AP mode, use 20MHz when there are no connected station.
When a new station is added/removed, calculate the new max
bandwidth supported by any of the stations (e.g. 80MHz when
80MHz and 40MHz stations are connected).
In other cases, simply use bss_conf.chandef as the
min required chandef.
Notify drivers about changes to this field by calling
drv_change_chanctx with a new CHANGE_MIN_WIDTH notification.
Signed-off-by: Eliad Peller <eliad@wizery.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Eyal Shapira [Mon, 11 Nov 2013 18:14:00 +0000 (20:14 +0200)]
mac80211: enable easier manipulation of VHT beamforming caps
Introduce shift and mask defines for beamformee STS cap and number
of sounding dimensions cap as these can take any 3 bit value.
While at it also cleanup an unrequired parenthesis.
Signed-off-by: Eyal Shapira <eyal@wizery.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Luciano Coelho [Mon, 11 Nov 2013 18:34:54 +0000 (20:34 +0200)]
mac80211: move csa_chandef to sdata
There is no reason why we should have only one channel switch
announcement at a time for a single phy. When support for channel
switch with multiple contexts and multiple vifs per context is
implemented, we will need the chandef data for each vif. Move the
csa_chandef structure to sdata to prepare for this.
Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
[Fixed compilation with mesh] Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
cfg80211: add an option to disable processing country IEs
Certain vendors may want to disable the processing of
country IEs so that they can continue using the regulatory
domain the driver or user has set. Currently there is no
way to stop the core from processing country IEs, so add
support to the core to ignore country IE hints.
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> Signed-off-by: Johannes Berg <johannes.berg@intel.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>
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>