cascardo/linux.git
11 years agoath6kl: Recover from fw crash
Vasanthakumar Thiagarajan [Wed, 29 Aug 2012 14:10:26 +0000 (19:40 +0530)]
ath6kl: Recover from fw crash

Re-initialize the target when fw crash is reported.
This would make the device functional again after
target crash. During the target re-initialization
it is made sure that target is not bugged with data/cmd
request, ar->state ATH6KL_STATE_RECOVERY is used
for this purpose.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: Refactor ath6kl_init_hw_start() and ath6kl_init_hw_stop()
Vasanthakumar Thiagarajan [Wed, 29 Aug 2012 14:10:25 +0000 (19:40 +0530)]
ath6kl: Refactor ath6kl_init_hw_start() and ath6kl_init_hw_stop()

So that these functions will be used to re-initialize the fw
upon detecting fw error. This refactoring moves ar->state
setting out of core stop/start functionality.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: fix link speed when using sgi
Dengke Qiu [Tue, 28 Aug 2012 07:33:42 +0000 (15:33 +0800)]
ath6kl: fix link speed when using sgi

The MSB of rate index from FW is used for sgi. But the ath6kl_wmi_get_rate
doesn't handle it. The access to wmi_rate_tbl array may be out of range
if sgi is 1. This may cause the return value of ath6kl_wmi_get_rate()
function is incorrect link rate. We add sgi adjustment to avoid such case.

kvalo: change patch title

Signed-off-by: Dengke Qiu <dqiu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: trivial cleanup on interface type selection
Mohammed Shafi Shajakhan [Fri, 24 Aug 2012 14:23:28 +0000 (19:53 +0530)]
ath6kl: trivial cleanup on interface type selection

a minor cleanup in assigning the driver specific network type
based on interface type.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: consolidate WoW pattern length
Thomas Pedersen [Mon, 20 Aug 2012 21:26:50 +0000 (14:26 -0700)]
ath6kl: consolidate WoW pattern length

Since WOW_MASK_SIZE and WOW_PATTERN_SIZE have the same value, are
logically equivalent, and part of the WMI API so therefore unlikely to
change, consolidate these into WOW_PATTERN_SIZE.

Reported-by Kalle Valo <kvalo@qualcomm.com>
Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: rework scheduled scan
Thomas Pedersen [Wed, 15 Aug 2012 23:51:24 +0000 (16:51 -0700)]
ath6kl: rework scheduled scan

This patch reflects changes in the firmware scheduled scan
implementation to behave better in cases with multiple concurrent vifs.
Major changes:

- scheduled scan filters and state are now programmed per-vif.
- decouple scheduled scan from host sleep.

To maintain graceful failure with old firmwares, a new firmware
capability bit is introduced: ATH6KL_FW_CAPABILITY_SCHED_SCAN_V2.
ath6kl simply won't advertise scheduled scan to cfg80211 if the
SCHED_SCAN_V2 is not supported.

Since firmwares from here on out won't support the previous implicit API
for scheduled scan (set WoW filters and host sleep), bump the firmware
API to protect old drivers.

Unfortunately, due to firmware RAM constraints ath6kl still cannot
expect a scan complete event at the end of a scheduled scan results
cycle, so the sched_scan_timer is retained.

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: check usb_register() return value
Marina Makienko [Tue, 14 Aug 2012 08:11:30 +0000 (12:11 +0400)]
ath6kl: check usb_register() return value

ath6kl_usb_init() does not check usb_register() return value.
As a result it may incorrectly report success of driver initialization.

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

kvalo: fix commit title and make cosmetic changes to the code to follow
more the style used in the driver

Signed-off-by: Marina Makienko <makienko@ispras.ru>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: Fix potential memory leak in ath6kl_tx_complete()
Vasanthakumar Thiagarajan [Tue, 14 Aug 2012 04:40:34 +0000 (10:10 +0530)]
ath6kl: Fix potential memory leak in ath6kl_tx_complete()

We bail out from ath6kl_tx_complete() if any of the sanity
checks on skb and ath6kl_cookie fails. By doing this we
potentially leak few remaining buffers in packet_queue.
Make sure to proceed processing the remaining buffers
as well. This issue is found during code review.

Reported-by: Wang yufeng <yufengw@qca.qualcomm.com>
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: Fix potential skb double free in ath6kl_wmi_sync_point()
Vasanthakumar Thiagarajan [Tue, 14 Aug 2012 04:40:33 +0000 (10:10 +0530)]
ath6kl: Fix potential skb double free in ath6kl_wmi_sync_point()

skb given to ath6kl_control_tx() is owned by ath6kl_control_tx().
Calling function should not free the skb for error cases.
This is found during code review.

kvalo: fix a checkpatch warning in ath6kl_wmi_cmd_send()

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: reconfigure RSN capabilities when restarting AP
Thomas Pedersen [Sat, 28 Jul 2012 01:13:27 +0000 (18:13 -0700)]
ath6kl: reconfigure RSN capabilities when restarting AP

If the firmware decides to initiate a channel switch on an AP vif
running an RSN BSS, reconfigure the saved RSN IE capabilities as well.

Fixes a bug where the beacon and 4-way handshake would have a capability
mismatch after a channel switch, since the firmware apparently clears
these on an AP disconnect.

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: restart concurrent vifs on failed connect
Thomas Pedersen [Fri, 27 Jul 2012 01:11:11 +0000 (18:11 -0700)]
ath6kl: restart concurrent vifs on failed connect

When an ath6kl STA vif is issued a connect command, the firmware will
disconnect all other beaconing vifs in preparation for a potential
channel switch. The case where the connect fails is currently unhandled,
so if a connection attempt on a STA vif fails and any vifs were waiting
for a new channel, simply restart the concurrent vifs on their previous
channel.

Requires that we start tracking the last issued channel in ar->last_ch,
which is valid since ath6kl only supports 1 channel at a time.

Also clear the beaconing vif's want_ch_switch bit regardless of whether
channel switch succeeds, to stop recommitting the same failed profile.

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: configure wow filters per-vif
Thomas Pedersen [Fri, 10 Aug 2012 00:32:33 +0000 (17:32 -0700)]
ath6kl: configure wow filters per-vif

Only WoW filters for the first vif were being set, causing failures to
wake up on any concurrent connected vifs. Handle all per-vif suspend
and resume tasks.

Since cfg80211 issues user wow filters on a per-wiphy basis, set any
custom filters on all connected vifs.

Starting WoW in firmware and setting host sleep mode is still handled on
a global per-phy level. The first vif is always used for bookkeeping
regardless of whether it is connected or not.

WoW is cancelled if no connected vifs are found.

No firmware capability bits or API bump is needed for this patch, as
setting filters for vifs with index > 0 will simply overwrite the index
0 filters in the current implementation. While not correct, this is
identical to the existing behavior.

kvalo: fix a checkpatch warning in ath6kl_wow_resume()

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: fix incorrect use of IEEE80211_NUM_BANDS
Kalle Valo [Thu, 12 Jul 2012 09:13:12 +0000 (12:13 +0300)]
ath6kl: fix incorrect use of IEEE80211_NUM_BANDS

ath6kl was incorrectly assuming that IEEE80211_NUM_BANDS will always be 2
and used that also in the firmware WMI interface definitions. But after
the support for 60 GHz was added to cfg80211 IEEE80211_NUM_BANDS changed to 3
and this can cause all sort of problems, possibly even memory corruption.
I only found this during code review and didn't notice any bugs, but I'm
sure there are a few lurking somewhere.

To fix this rename unused A_NUM_BANDS to ATH6KL_NUM_BANDS, which is
always defined to be 2, and use that in WMI.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: add support for changing contry code
Kalle Valo [Thu, 19 Jul 2012 13:00:56 +0000 (16:00 +0300)]
ath6kl: add support for changing contry code

To make it possible to change the country code from user space via nl80211
add handler for reg_notifier. The feature is only enabled when built
time option CONFIG_ATH6KL_REGDOMAIN is enabled, which again depends on
CFG80211_CERTIFICATION_ONUS for certication purposes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: refactor wmi scan command
Kalle Valo [Thu, 19 Jul 2012 13:00:48 +0000 (16:00 +0300)]
ath6kl: refactor wmi scan command

ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX was checked in cfg80211.c which is
a bit awkward when adding more callsites to the scan functions. Refactor
the code to wmi.c so that it's transparent to the callers.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: move ath6kl_wmi_startscan_cmd()
Kalle Valo [Thu, 19 Jul 2012 13:00:40 +0000 (16:00 +0300)]
ath6kl: move ath6kl_wmi_startscan_cmd()

To make it easier to refactor the scan commands move
ath6kl_wmi_startscan_cmd() before the beginscan function. No functional
changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: support TX error rate notification
Thomas Pedersen [Wed, 18 Jul 2012 02:39:55 +0000 (19:39 -0700)]
ath6kl: support TX error rate notification

The ath6kl firmware can monitor a connection and report when a certain
TX failure threshold is crossed. Support this configuration and event
reporting on compatible firmwares.

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: Add support for AR6004 hardware version 1.3
Bala Shanmugam [Tue, 17 Jul 2012 06:31:55 +0000 (12:01 +0530)]
ath6kl: Add support for AR6004 hardware version 1.3

Add support for AR6004 hardware with version 1.3 and has
id 0x31c8088a.

Signed-off-by: Bala Shanmugam <bkamatch@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: Make use of return value from ath6kl_diag_read()
Pandiyarajan Pitchaimuthu [Wed, 11 Jul 2012 07:21:43 +0000 (12:51 +0530)]
ath6kl: Make use of return value from ath6kl_diag_read()

In ath6kl_read_fwlogs(), return value from ath6kl_diag_read()is not
used to bail out in case of any errors in reading fw log. No real issue
is observed because of this, reported by source code analyzer.

kvalo: fix a long line warning

Signed-off-by: Pandiyarajan Pitchaimuthu <c_ppitch@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: use custom MAC address for newly created interfaces
Aarthi Thiruvengadam [Tue, 10 Jul 2012 20:20:40 +0000 (13:20 -0700)]
ath6kl: use custom MAC address for newly created interfaces

Firmware and driver generate MAC addresses for the second and third interfaces.
In addition to the existing algorithm, flip bit 7 of 5th octet. Since both
firmware and driver individually generate the MAC addresses, introduce a new
firmware capability bit to keep them compatible.

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoath6kl: support rssi threshold for sched scan
Thomas Pedersen [Thu, 21 Jun 2012 19:50:08 +0000 (12:50 -0700)]
ath6kl: support rssi threshold for sched scan

The ath6kl firmware can filter scan results based on rssi. This is
useful to limit hosts wakeups on scheduled scans.

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
11 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
John W. Linville [Tue, 23 Oct 2012 15:41:46 +0000 (11:41 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless

Conflicts:
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
net/mac80211/mlme.c

11 years agobrcm80211: remove some truely barftastic code
Alan Cox [Thu, 11 Oct 2012 16:25:14 +0000 (17:25 +0100)]
brcm80211: remove some truely barftastic code

It's not used or called but please make it go away before someone copies or
uses it

Signed-off-by: Alan "minus lunch" Cox <alan@linux.intel.com>
Acked-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: remove 'always false' condition from brcmf_c_mkiovar_bsscfg
Arend van Spriel [Wed, 10 Oct 2012 18:13:11 +0000 (11:13 -0700)]
brcmfmac: remove 'always false' condition from brcmf_c_mkiovar_bsscfg

The parameter buflen is unsigned so the condition buflen < 0 is
always false. The patch fixes the if statement checking the buffer
length.

Reported-by: Dan Carpenter <dan.carpenter@oracle.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: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: fix sparse warnings
Franky Lin [Wed, 10 Oct 2012 18:13:08 +0000 (11:13 -0700)]
brcmfmac: fix sparse warnings

Following sparse warning is fixed:
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c:2518:21: warning: symbol 'brcmf_find_wpaie' was not declared. Should it be static?
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c:3768:1: warning: symbol 'brcmf_set_management_ie' was not declared. Should it be static?

Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobrcmfmac: Using zero instead of NULL
Dan Carpenter [Wed, 10 Oct 2012 18:13:07 +0000 (11:13 -0700)]
brcmfmac: Using zero instead of NULL

Sparse complains that we use zero instead of NULL here.  In fact, the
initialization is wrong and should be removed.  Doing these kinds of
bogus initializations means that GCC can't detect unitialized variables
and leads to bugs.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: perform ANI cycle in idle state
Rajkumar Manoharan [Wed, 10 Oct 2012 17:33:02 +0000 (23:03 +0530)]
ath9k: perform ANI cycle in idle state

As of now the ANI cycle is executed only when the chip is awake.
On idle state case, the station wakes up from network sleep for
beacon reception. Since most of the time, ANI cycle is not syncing
with beacon wakeup, ANI cycle is ignored. Approx 5 mins once, the
calibration is performed. This could affect the connection stability
when the station is idle for long. Even though the OFDM and CCK phy
error rates are too high, ANI is unable to tune its immunity level
as quick enough due to rare execution.

Here the experiment shows that OFDM and CCK levels are at default
even on higher phy error rate.

listenTime=44 OFDM:3 errs=121977/s CCK:2 errs=440818/s ofdm_turn=1

This change ensures that ANI calibration will be exectued atleast
once for every 10 seconds. The below result shows improvements and
immunity levels are adopted quick enough.

listenTime=557 OFDM:4 errs=752/s CCK:4 errs=125/s ofdm_turn=0

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agocarl9170: handle traps from firmware loader
Christian Lamparter [Sat, 6 Oct 2012 18:42:54 +0000 (20:42 +0200)]
carl9170: handle traps from firmware loader

This patch changes the way the driver deals with
command responses and traps which are sent through
the special interrupt input endpoint 3.

While the carl9170 firmware does not use this
endpoint for command responses or traps, the
firmware loader on the device does. It uses it
to notify the host about 'watchdog triggered'
in case the firmware/hardware has crashed.

Note:
Even without this patch, the driver is still
able to detect the mishap and reset the device.
But previously it did that because the trap
event caused an out-of-order message sequence
number error, which also triggered a reset.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: Using %*phD instead of print_hex_dump_bytes
Andrei Emeltchenko [Fri, 5 Oct 2012 20:57:49 +0000 (13:57 -0700)]
mwifiex: Using %*phD instead of print_hex_dump_bytes

Make output more readable and remove unneeded function call.

...
mwifiex_sdio mmc0:0001:1: last_cmd_index = 3
last_cmd_id: 00000000: 16 00 cd 00 83 00 df 00 28 00 ........(.
...

would be changed to:

...
mwifiex_sdio mmc0:0001:1: last_cmd_index = 3
mwifiex_sdio mmc1:0001:1: last_cmd_id: 16 00 cd 00 83 00 df 00 28 00
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agomwifiex: use sizeof(array) to print_hex_dump_bytes
Bing Zhao [Fri, 5 Oct 2012 20:57:48 +0000 (13:57 -0700)]
mwifiex: use sizeof(array) to print_hex_dump_bytes

DBG_CMD_NUM is the number of commands, not the actual bytes of
data for printing.

Also remove the duplicated DBG_CMD_NUM definition.

Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2800: comment tx power settings
Stanislaw Gruszka [Fri, 5 Oct 2012 11:44:15 +0000 (13:44 +0200)]
rt2800: comment tx power settings

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2800: allow to reduce tx power on devices not exporting power limit
Stanislaw Gruszka [Fri, 5 Oct 2012 11:44:14 +0000 (13:44 +0200)]
rt2800: allow to reduce tx power on devices not exporting power limit

Some rt2800 devices don't have their calibrated max eirp tx power in
their calibration data. For those devices reduce tx power according to
difference between regulatory max channel power and requested tx power.

This patch is based on Helmut Schaa work.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2800: pass channel pointer to rt2800_config_txpower
Stanislaw Gruszka [Fri, 5 Oct 2012 11:44:13 +0000 (13:44 +0200)]
rt2800: pass channel pointer to rt2800_config_txpower

Preparation for use regulatory max channel power in TX power delta
calculations.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2800: use eeprom OFDM 6M TX power as criterion
Stanislaw Gruszka [Fri, 5 Oct 2012 11:44:12 +0000 (13:44 +0200)]
rt2800: use eeprom OFDM 6M TX power as criterion

Don use TX_PWR_CFG_0 register value of OFDM 6M tx power as criterion
since it can be changed. The same do vendor driver (see
AsicAdjustSingleSkuTxPower and AsicGetTxPowerOffset functions from
2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO).

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2800: compensate tx power also for non 11b rates on 2GHz
Stanislaw Gruszka [Fri, 5 Oct 2012 11:44:11 +0000 (13:44 +0200)]
rt2800: compensate tx power also for non 11b rates on 2GHz

We skip compensate calculation for non 11b rates on 2.4GHz band. I do
not see that on vendor driver
(2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO).

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2800: limit TX_PWR_CFG_ values to 0xc
Stanislaw Gruszka [Fri, 5 Oct 2012 11:44:10 +0000 (13:44 +0200)]
rt2800: limit TX_PWR_CFG_ values to 0xc

Based on AsicAdjustTxPower function from vendor driver
(2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO)
limit per rate TX power values we program into TX_PWR_CFG_ registers.

Note that on some configurations (devices/rates) is allowed to use
bigger values than 0xc, but we use safe maximum value for now. Further
work need to be done to allow use bigger values than 0xc.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agort2800: use BBP_R1 for setting tx power
Stanislaw Gruszka [Fri, 5 Oct 2012 11:44:09 +0000 (13:44 +0200)]
rt2800: use BBP_R1 for setting tx power

TX power delta can be negative. TX_PWR_CFG_ registers allow to set delta
only in range between 0 dBm and 15 dBm (4 bits for each rate). Se we
need to use BBP_R1 to configure negative deltas.

Not utilize +6 dBm increasing BBP_R1 option for safety reason. For now,
this can be used for devices, which export maximum allowed TX power
value.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Helmut Schaa <helmut.schaa@googlemail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath_hw: Use common REG_WRITE parameter order
Sven Eckelmann [Thu, 4 Oct 2012 17:43:15 +0000 (19:43 +0200)]
ath_hw: Use common REG_WRITE parameter order

All defines for REG_WRITE in Atheros wireless drivers use the order "ah",
"register" and "value". hw.c is the only file using the order "ah", "value" and
"register".

drivers/net/wireless/ath/ath9k/hw.h:#define REG_WRITE(_ah, _reg, _val) \
drivers/net/wireless/ath/key.c:#define REG_WRITE(_ah, _reg, _val) (common->ops->write)(_ah, _val, _reg)

This inconsistent definition can easily lead to implementation errors. The
modification doesn't change the behavior of the driver or the generated code.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agortlwifi: rtl8192ce: rtl8192cu: use %*phC to dump small buffers
Andy Shevchenko [Tue, 2 Oct 2012 14:19:44 +0000 (17:19 +0300)]
rtlwifi: rtl8192ce: rtl8192cu: use %*phC to dump small buffers

The patch changes a bit trace output format in the rtl_cam_program_entry() to
print prefix and the actual data on the same line. Moreover the %*phC outputs
each byte as 2 hex digits, which is slightly different to the original %x.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
ACKed-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoorinoco_usb: clean up some signedness issues
Dan Carpenter [Tue, 2 Oct 2012 08:32:34 +0000 (11:32 +0300)]
orinoco_usb: clean up some signedness issues

In ezusb_read_ltv() we had a comparison "(bufsize < 0)" which was never
true because bufsize was unsigned.  I looked at the implications of
that.  If we passed a negative number to ezusb_access_ltv() then it
would be used as the size parameter of the memcpy() because that
function uses min_t(int, exp_len, ans_size).

But fortunately when I looked at the callers, bufsize is not controlled
by the user and it's never negative.  So these signedness mistakes have
no impact.

I removed the always false check from ezusb_read_ltv() and I changed the
types in ezusb_access_ltv() and made the variables unsigned.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: do not initialize deactivated PCIe cores
Hauke Mehrtens [Sun, 30 Sep 2012 22:12:54 +0000 (00:12 +0200)]
bcma: do not initialize deactivated PCIe cores

Before it was tried to initialize the deactivated PCIe core in client
mode, but this causes the SoC to hang. Just do not initialize it at all
and ignore the core it is not working and nothing is connected to it
when the specific bit is set in the boardflags.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath/ath9k/ar9003_eeprom.c: Remove semicolon after if
Peter Senna Tschudin [Wed, 10 Oct 2012 16:38:17 +0000 (18:38 +0200)]
ath/ath9k/ar9003_eeprom.c: Remove semicolon after if

This patch remove a semicolon after if(...) that is preventing the
error check to work correctly. Removing this semicolon will change the
code behavior, but this is intended.

The semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r1@
position p;
@@
if (...);@p

@script:python@
p0 << r1.p;
@@
// Emacs org-mode output
cocci.print_main("", p0)
cocci.print_secs("", p0)
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Fix BT_OP_SCAN usage
Sujith Manoharan [Sun, 30 Sep 2012 03:33:37 +0000 (09:03 +0530)]
ath9k: Fix BT_OP_SCAN usage

BT_OP_SCAN is applicable only for pre-MCI WLAN/BT combo chips
and using it for MCI-based cards is incorrect. Fix this by
cleaning up its usage.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agoath9k: Use a helper routine for MCI/FTP tuning
Sujith Manoharan [Sun, 30 Sep 2012 03:33:20 +0000 (09:03 +0530)]
ath9k: Use a helper routine for MCI/FTP tuning

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: add an extra pcie core struct
Hauke Mehrtens [Sat, 29 Sep 2012 18:40:18 +0000 (20:40 +0200)]
bcma: add an extra pcie core struct

The BCM4706 has two PCIe host controller on the bcma bus. For PCIe
client mode it is assumed that there is only one PCIe controller so the
PCIe driver, like b43 and brcmsmac are accessing the first PCIe
controller when they want to issue a operation on the host controller.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: use fallback sprom if sprom on card was not valid
Hauke Mehrtens [Sat, 29 Sep 2012 18:38:11 +0000 (20:38 +0200)]
bcma: use fallback sprom if sprom on card was not valid

Sometimes the PCIe card indicates that it has a sprom somewhere and we
are able to read the memory region, but it is empty and not valid. In
these cases we should try to use the fallback sprom as a last chance.

This is the case for the PCIe cards in my ASUS RT-N66U (BCM4706 + 2
times BCM4331) and I have heard of someone having the same problem with
an other PCIe card connected to an other Broadcom SoC.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agossb: add attribute to indicate a parallel flash is available
Hauke Mehrtens [Sat, 29 Sep 2012 18:36:18 +0000 (20:36 +0200)]
ssb: add attribute to indicate a parallel flash is available

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agossb: move parallel flash config into an own struct
Hauke Mehrtens [Sat, 29 Sep 2012 18:36:17 +0000 (20:36 +0200)]
ssb: move parallel flash config into an own struct

This is a preparing step for adding serial flash support.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: add some more flash chips for serial flash
Hauke Mehrtens [Sat, 29 Sep 2012 18:33:53 +0000 (20:33 +0200)]
bcma: add some more flash chips for serial flash

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: extract drv_cc in bcma_core_mips_flash_detect()
Hauke Mehrtens [Sat, 29 Sep 2012 18:33:52 +0000 (20:33 +0200)]
bcma: extract drv_cc in bcma_core_mips_flash_detect()

This makes the code more readable

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: mark nflash if it is the boot flash
Hauke Mehrtens [Sat, 29 Sep 2012 18:33:51 +0000 (20:33 +0200)]
bcma: mark nflash if it is the boot flash

There are some devices which are able to boot from nand flash and other
are using a serial flash for booting. Add a bool to indicate that the
device is booted from that flash chip and not from some other chip also
connected to the SoC. This is needed to find the nvram, as it is stored
on the flash the devices booted from.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: add and use constants for the flash windows
Hauke Mehrtens [Sat, 29 Sep 2012 18:33:50 +0000 (20:33 +0200)]
bcma: add and use constants for the flash windows

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: mark pflash as present when available
Hauke Mehrtens [Sat, 29 Sep 2012 18:33:49 +0000 (20:33 +0200)]
bcma: mark pflash as present when available

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: init sprom struct earlier
Hauke Mehrtens [Sat, 29 Sep 2012 18:29:50 +0000 (20:29 +0200)]
bcma: init sprom struct earlier

The PCIe host driver and the chip common initialisation accesses the
sprom struct, but it is not initialized when these functions are run.
Move the sprom parsing up in to do it earlier.
As we need the chip common core rev and some other attributes from the
chip common core, the early initialization is done before accessing the
sprom.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
11 years agobcma: just do the necessary things in early register on SoCs
Hauke Mehrtens [Sat, 29 Sep 2012 18:29:49 +0000 (20:29 +0200)]
bcma: just do the necessary things in early register on SoCs

Some parts of the initialization for chip common and the pcie core are
accessing the sprom struct, but it is not initialized at that stage.
Just do the necessary thing in the early register on SoCs and not the
complete initialization to read out the nvram from the flash chip.
After it is possible to read out the nvram, the sprom should be parsed
from it and the full initialization of the cores should be run.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
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 [Fri, 19 Oct 2012 19:48:17 +0000 (15:48 -0400)]
Merge branch 'for-john' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

11 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac802...
John W. Linville [Fri, 19 Oct 2012 19:36:53 +0000 (15:36 -0400)]
Merge branch 'for-john' of git://git./linux/kernel/git/jberg/mac80211-next

11 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth...
John W. Linville [Fri, 19 Oct 2012 19:22:27 +0000 (15:22 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/bluetooth/bluetooth-next

11 years agomac80211: make client powersave independent of interface type
Marco Porsch [Wed, 10 Oct 2012 19:39:50 +0000 (12:39 -0700)]
mac80211: make client powersave independent of interface type

This patch prepares mac80211 for a later implementation of mesh or
ad-hoc powersave clients.
The structures related to powersave (buffer, TIM map, counters) are
moved from the AP-specific interface structure to a generic structure
that can be embedded into any interface type.
The functions related to powersave are prepared to allow easy
extension with different interface types. For example with:

+ } else if (sta->sdata->vif.type == NL80211_IFTYPE_MESH_POINT) {
+         ps = &sdata->u.mesh.ps;

Some references to the AP's beacon structure are removed where they
were obviously not used.

The patch compiles without warning and has been briefly tested as AP
interface with one client in PS mode.

Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agonl/cfg80211: force scan using an AP vif if requested
Antonio Quartulli [Tue, 16 Oct 2012 06:39:22 +0000 (08:39 +0200)]
nl/cfg80211: force scan using an AP vif if requested

If the user wants to scan using a vif configured as AP,
cfg80211 must give him a chance to do it, even if this
will disrupt the stations performance due to off-channel
scanning. To do so, this patch adds a 'force' flag to the
SCAN_TRIGGER command which tells cfg80211 to perform the
scanning operation even if the vif is an AP and the
beaconing has already started.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoBluetooth: AMP: Get amp_mgr reference in HS hci_conn
Andrei Emeltchenko [Thu, 18 Oct 2012 10:16:19 +0000 (13:16 +0300)]
Bluetooth: AMP: Get amp_mgr reference in HS hci_conn

When assigning amp_mgr in hci_conn (type AMP_LINK) get also reference.
In hci_conn_del those references would be put for both conn types
AMP_LINK and ACL_LINK associated with amp_mgr.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
11 years agocfg80211: add cfg80211 exported function tracing
Beni Lev [Mon, 27 Aug 2012 09:49:39 +0000 (12:49 +0300)]
cfg80211: add cfg80211 exported function tracing

Also add tracing to the API functions that drivers
(and mac80211) can call in cfg80211.

Signed-off-by: Beni Lev <beni.lev@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: add tracing to rdev-ops
Beni Lev [Tue, 31 Jul 2012 15:48:27 +0000 (18:48 +0300)]
cfg80211: add tracing to rdev-ops

Add tracing to make debugging cfg80211/mac80211
(or full-mac driver) interaction easier.

Signed-off-by: Beni Lev <beni.lev@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Hila Gonen <hila.gonen@intel.com>
Tested-by: Hila Gonen <hila.gonen@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
[add a cast to int to sizeof() to avoid warning]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: add wrappers for registered_device_ops
Hila Gonen [Wed, 27 Jun 2012 14:19:42 +0000 (17:19 +0300)]
cfg80211: add wrappers for registered_device_ops

This will allow adding central tracing like in mac80211.

Signed-off-by: Hila Gonen <hila.gonen@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: Disallow HT/WEP in IBSS mode
Sujith Manoharan [Thu, 18 Oct 2012 04:49:28 +0000 (10:19 +0530)]
cfg80211: Disallow HT/WEP in IBSS mode

Currently, a user is allowed to choose a HT operating channel
with WEP when creating an IBSS network. WEP is not allowed
in HT configuration - this patch ensures that such requests
are denied.

Signed-off-by: Sujith Manoharan <c_manoha@qti.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: fix copy-paste typo in Kconfig
Marco Porsch [Thu, 18 Oct 2012 03:21:30 +0000 (20:21 -0700)]
mac80211: fix copy-paste typo in Kconfig

Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: use __printf attribute in debugfs
Johannes Berg [Sun, 30 Sep 2012 15:12:45 +0000 (17:12 +0200)]
mac80211: use __printf attribute in debugfs

The internal function mac80211_format_buffer() has a
printf-style argument list, so add the attribute to
have gcc verify that list.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove some unused code
Johannes Berg [Sun, 30 Sep 2012 15:08:35 +0000 (17:08 +0200)]
mac80211: remove some unused code

There are a number of unused variables that gcc
pointed out (when building with W=1) as well as
some conditions that can never be true due to
the datatypes used: unsigned values can't be
less than zero. Remove this code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: remove unimplemented mesh vendor sync
Johannes Berg [Sun, 30 Sep 2012 15:07:19 +0000 (17:07 +0200)]
mac80211: remove unimplemented mesh vendor sync

There's no vendor-specific mesh sync implemented
and there don't need to be dummy handlers that
only print messages, so remove that code. While
at it, also constify the mesh sync ops.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agowireless: remove duplicate enum ieee80211_eid definitions
Arend van Spriel [Fri, 12 Oct 2012 10:28:16 +0000 (12:28 +0200)]
wireless: remove duplicate enum ieee80211_eid definitions

WLAN_EID_WPA and WLAN_EID_GENERIC mapped to the same value
as WLAN_EID_VENDOR_SPECIFIC. The last one being more in line
with the standard specification. Removing WLAN_EID_WPA and
WLAN_EID_GENERIC as there are no longer drivers using these.

Cc: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agowireless: gelic: make use of WLAN_EID_VENDOR_SPECIFIC
Arend van Spriel [Fri, 12 Oct 2012 10:28:15 +0000 (12:28 +0200)]
wireless: gelic: make use of WLAN_EID_VENDOR_SPECIFIC

The include file linux/ieee80211.h contains three definitions for
the same thing in enum ieee80211_eid due to historic changes:

    /* Information Element IDs */
    enum ieee80211_eid {
        :
        WLAN_EID_WPA = 221,
        WLAN_EID_GENERIC = 221,
        WLAN_EID_VENDOR_SPECIFIC = 221,
        :
    };

The standard refers to this as "vendor specific" element so the
other two definitions are better not used. This patch changes the
wireless drivers to use one definition, ie. WLAN_EID_VENDOR_SPECIFIC.

Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agowireless: drivers: make use of WLAN_EID_VENDOR_SPECIFIC
Arend van Spriel [Fri, 12 Oct 2012 10:28:14 +0000 (12:28 +0200)]
wireless: drivers: make use of WLAN_EID_VENDOR_SPECIFIC

The include file linux/ieee80211.h contains three definitions for
the same thing in enum ieee80211_eid due to historic changes:

/* Information Element IDs */
enum ieee80211_eid {
    :
    WLAN_EID_WPA = 221,
    WLAN_EID_GENERIC = 221,
    WLAN_EID_VENDOR_SPECIFIC = 221,
    :
};

The standard refers to this as "vendor specific" element so the
other two definitions are better not used. This patch changes the
wireless drivers to use one definition, ie. WLAN_EID_VENDOR_SPECIFIC.

Cc: Jouni Malinen <j@w1.fi>
Cc: Dan Williams <dcbw@redhat.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Acked-by: Kalle Valo <kvalo@qca.qualcomm.com> [ath6kl]
Acked-by: Bing Zhao <bzhao@marvell.com> [mwifiex]
Acked-by: Stanislav Yakovlev <stas.yakovlev@gmail.com> [ipw2x00]
Signed-off-by: Arend van Spriel <arend@broadcom.com>
[change libipw as well]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: Notify new IBSS network creation
Sujith Manoharan [Fri, 12 Oct 2012 12:05:45 +0000 (17:35 +0530)]
mac80211: Notify new IBSS network creation

Initialization of beacon transmission in IBSS mode depends
on whether a new BSS is being created or joined. When joining
an existing IBSS network, beaconing has to start only after
a TSF-sync has happened - this is explained in 11.1.4.

Introduce a new parameter in the BSS information structure to
indicate creator/joiner mode.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: add support for tx to abort low priority scan requests
Sam Leffler [Fri, 12 Oct 2012 04:03:35 +0000 (21:03 -0700)]
mac80211: add support for tx to abort low priority scan requests

Use NL80211_SCAN_FLAG_LOW_PRIORITY flag in mac80211's scan state
machine to prematurely terminate scan operations if outbound
traffic collides. This is useful for marking background scans so
they don't affect throughput.

Signed-off-by: Sam Leffler <sleffler@chromium.org>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
[set feature flag only if software scan is used]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: add support for flushing old scan results
Sam Leffler [Fri, 12 Oct 2012 04:03:34 +0000 (21:03 -0700)]
cfg80211: add support for flushing old scan results

Add an NL80211_SCAN_FLAG_FLUSH flag that causes old bss cache
entries to be flushed on scan completion. This is useful for
collecting guaranteed fresh scan/survey result (e.g. on resume).

For normal scan, flushing only happens on successful completion
of a scan; i.e. it does not happen if the scan is aborted.
For scheduled scan, previous scan results are flushed everytime
when we get new scan results.

This feature is enabled by default. Drivers can disable it by
unsetting the NL80211_FEATURE_SCAN_FLUSH flag.

Signed-off-by: Sam Leffler <sleffler@chromium.org>
Tested-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
[invert polarity of feature flag to account for old kernels]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agowireless: use OR operation to set wiphy features
Johannes Berg [Fri, 12 Oct 2012 08:55:53 +0000 (10:55 +0200)]
wireless: use OR operation to set wiphy features

The next patch will introduce a flag that is set
by default in cfg80211 so drivers and mac80211
need to use |= to set features they have so that
they don't clear the already-set feature.

We could set the flag in wiphy_register() instead
of wiphy_new() to avoid this patch, but then the
drivers couldn't *unset* flags they don't want to
use even though the implementation is generic.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: add scan flag to indicate its priority
Sam Leffler [Fri, 12 Oct 2012 04:03:32 +0000 (21:03 -0700)]
cfg80211: add scan flag to indicate its priority

Add NL80211_SCAN_FLAG_LOW_PRIORITY flag support. It tells drivers
that this is a low priority scan request, so that they can take
necessary action.
Drivers need to advertise low priority scan capability during
registration.

Signed-off-by: Sam Leffler <sleffler@chromium.org>
Tested-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: code rearrangement to avoid forward declarations
Amitkumar Karwar [Fri, 12 Oct 2012 04:03:33 +0000 (21:03 -0700)]
cfg80211: code rearrangement to avoid forward declarations

bss_release() and __cfg80211_unlink_bss() function definitions
are moved at the begining of the file. They are used in next
patch in this series.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years ago{nl,cfg}80211: add a flags word to scan requests
Sam Leffler [Fri, 12 Oct 2012 04:03:31 +0000 (21:03 -0700)]
{nl,cfg}80211: add a flags word to scan requests

Add a flags word to direct and scheduled scan requests; it will
be used for control of optional behaviours such as flushing the
bss cache prior to doing a scan.

Signed-off-by: Sam Leffler <sleffler@chromium.org>
Tested-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211
John W. Linville [Wed, 17 Oct 2012 20:23:33 +0000 (16:23 -0400)]
Merge branch 'for-john' of git://git./linux/kernel/git/jberg/mac80211

11 years agomac80211: connect with HT20 if HT40 is not permitted
Johannes Berg [Mon, 1 Oct 2012 13:52:00 +0000 (15:52 +0200)]
mac80211: connect with HT20 if HT40 is not permitted

Some changes to fix issues with HT40 APs in Korea
and follow-up changes to allow using HT40 even if
the local regulatory database disallows it caused
issues with iwlwifi (and could cause issues with
other devices); iwlwifi firmware would assert if
you tried to connect to an AP that has an invalid
configuration (e.g. using HT40- on channel 140.)

Fix this, while avoiding the "Korean AP" issue by
disabling HT40 and advertising HT20 to the AP
when connecting.

Cc: stable@vger.kernel.org [3.6]
Reported-by: Florian Reitmeir <florian@reitmeir.org>
Tested-by: Florian Reitmeir <florian@reitmeir.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years ago{nl,cfg}80211: Peer STA VHT caps
Mahesh Palivela [Thu, 11 Oct 2012 08:04:52 +0000 (08:04 +0000)]
{nl,cfg}80211: Peer STA VHT caps

To save STAs VHT caps in AP mode

Signed-off-by: Mahesh Palivela <maheshp@posedge.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: VHT peer STA caps
Mahesh Palivela [Wed, 10 Oct 2012 11:33:04 +0000 (11:33 +0000)]
mac80211: VHT peer STA caps

Save the AP's VHT capabilities (in managed
mode) and make them available to the driver
in the station information.

Unlike HT capabilities, they aren't restricted
to the common capabilities, so drivers must be
aware of their own capabilities.

Signed-off-by: Mahesh Palivela <maheshp@posedge.com>
[fix endian conversion bug ...]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoieee80211: Rename VHT cap struct
Mahesh Palivela [Wed, 10 Oct 2012 11:25:40 +0000 (11:25 +0000)]
ieee80211: Rename VHT cap struct

Rename struct ieee80211_vht_capabilities to ieee80211_vht_cap
and renamed its member vht_capabilities_info to vht_cap_info.

Signed-off-by: Mahesh Palivela <maheshp@posedge.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: move out the non-statistics variable estab_plinks from mesh_stat
Ashok Nagarajan [Tue, 9 Oct 2012 20:27:47 +0000 (13:27 -0700)]
mac80211: move out the non-statistics variable estab_plinks from mesh_stat

estab_plinks is not a statistics member. Hence move estab_plinks from
struct mesh_stat to struct ieee80211_if_mesh

Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: Use appropriate debug wrapper
Mohammed Shafi Shajakhan [Mon, 8 Oct 2012 16:03:47 +0000 (21:33 +0530)]
mac80211: Use appropriate debug wrapper

ieee80211_sta_expire will be called by both IBSS and mesh
interfaces to account for inactive stations, so it would be more
appropriate to use sta_dbg instead of ibss_dbg.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: Allow station mode SAE to be implemented in user space
Jouni Malinen [Sun, 30 Sep 2012 16:29:40 +0000 (19:29 +0300)]
mac80211: Allow station mode SAE to be implemented in user space

SAE uses two rounds of Authentication frames and both rounds require
considerable calculation to be done. This commit extends the existing
station mode authentication request to allow more control for user
space programs to build the SAE fields and to run the authentication
step ones. Only the second round with authentication transaction
sequence 2 will result in moving to authenticated state.

Signed-off-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agocfg80211: Allow user space to specify non-IEs to SAE Authentication
Jouni Malinen [Sun, 30 Sep 2012 16:29:39 +0000 (19:29 +0300)]
cfg80211: Allow user space to specify non-IEs to SAE Authentication

SAE extends Authentication frames with fields that are not information
elements. NL80211_ATTR_IE is not suitable for these, so introduce a new
attribute that can be used to specify the fields needed for SAE in
station mode.

Signed-off-by: Jouni Malinen <j@w1.fi>
[change to verify that SAE is only used with authenticate command]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: Add debug print on unexpect authentication state
Jouni Malinen [Sun, 30 Sep 2012 16:29:38 +0000 (19:29 +0300)]
mac80211: Add debug print on unexpect authentication state

This is useful when debugging authentication process issues.

Signed-off-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: Take status code as parameter to ieee80211_send_auth
Jouni Malinen [Sun, 30 Sep 2012 16:29:37 +0000 (19:29 +0300)]
mac80211: Take status code as parameter to ieee80211_send_auth

Non-zero status code may be needed for Authentication frames, e.g.,
when using SAE.

Signed-off-by: Jouni Malinen <j@w1.fi>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: add channel context iterator
Johannes Berg [Tue, 11 Sep 2012 15:57:42 +0000 (17:57 +0200)]
mac80211: add channel context iterator

Drivers may need to iterate the active channel
contexts, export an iterator function to allow
that. To make it possible, use RCU-safe list
functions.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: track needed RX chains for channel contexts
Johannes Berg [Tue, 11 Sep 2012 12:34:12 +0000 (14:34 +0200)]
mac80211: track needed RX chains for channel contexts

On each channel that the device is operating on, it
may need to listen using one or more chains depending
on the SMPS settings of the interfaces using it. The
previous channel context changes completely removed
this ability (before, it was available as the SMPS
mode).

Add per-context tracking of the required static and
dynamic RX chains and notify the driver on changes.
To achieve this, track the chains and SMPS mode used
on each virtual interface and update the channel
context whenever this changes.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: use channel contexts
Johannes Berg [Thu, 26 Jul 2012 15:24:39 +0000 (17:24 +0200)]
mac80211: use channel contexts

Instead of operating on a single channel only,
use the new channel context infrastructure in
all mac80211 code.

This enables drivers that want to use the new
channel context infrastructure to use multiple
channels, while nothing should change for all
the other drivers that don't support it.

Right now this disables both TX power settings
and spatial multiplexing powersave. Both need
to be re-enabled on a channel context basis.

Additionally, when channel contexts are used
drop the connection when channel switch is
received rather than trying to handle it. This
will have to be improved later.

[With fixes from Eliad and Emmanuel incorporated]
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: track whether to use channel contexts
Johannes Berg [Thu, 26 Jul 2012 12:55:08 +0000 (14:55 +0200)]
mac80211: track whether to use channel contexts

Depending on the driver, channel contexts may be used or
not. If they are used, the driver must have support for
hardware scan and remain-on-channel; otherwise the driver
must not advertise support for multiple channels.

Also prohibit WDS type interfaces when channel contexts
are to be used as there's no clear definition of which
channel they use.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: check channel context methods
Johannes Berg [Thu, 26 Jul 2012 12:46:32 +0000 (14:46 +0200)]
mac80211: check channel context methods

Verify that the channel context methods are
all assigned by the driver or not used.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: reuse channels for channel contexts
Michal Kazior [Tue, 26 Jun 2012 12:37:22 +0000 (14:37 +0200)]
mac80211: reuse channels for channel contexts

Reuse channels with compatible channel types. Some
channel types are compatible and can be used
concurrently.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: use channel context notifications
Michal Kazior [Tue, 26 Jun 2012 12:37:20 +0000 (14:37 +0200)]
mac80211: use channel context notifications

Channel context pointer will be accessible on
both assign and unassign events.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: introduce new ieee80211_ops
Michal Kazior [Tue, 26 Jun 2012 12:37:17 +0000 (14:37 +0200)]
mac80211: introduce new ieee80211_ops

Introduce channel context driver methods. The channel
on a context channel is immutable, but the channel type
and other properties can change.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agomac80211: introduce channel context skeleton code
Michal Kazior [Tue, 26 Jun 2012 12:37:16 +0000 (14:37 +0200)]
mac80211: introduce channel context skeleton code

Channel context are the foundation for multi-channel
operation. They are are immutable and are re-created
(or re-used if other interfaces are bound to a certain
channel and a compatible channel type) on channel
switching.

This is an initial implementation and more features
will come in separate patches.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
[some changes including RCU protection]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 years agoiwlwifi: don't WARN when a non empty queue is disabled
Emmanuel Grumbach [Mon, 15 Oct 2012 15:57:36 +0000 (17:57 +0200)]
iwlwifi: don't WARN when a non empty queue is disabled

This can happen when we shut down suddenly an interface.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>