cascardo/linux.git
10 years agoath10k: check otp.bin result
Kalle Valo [Tue, 11 Mar 2014 15:33:28 +0000 (17:33 +0200)]
ath10k: check otp.bin result

When we execute otp.bin in the target check that the result it returns doesn't
contain an error. This is to make sure that we don't accidentally use invalid
calibration data.

While at it, remove the useless label in the function and add few debug messages.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: separate result parameter in ath10k_bmi_execute()
Kalle Valo [Tue, 11 Mar 2014 15:33:19 +0000 (17:33 +0200)]
ath10k: separate result parameter in ath10k_bmi_execute()

It's just cleaner to have separate argument for the parameter and result. Also
fix returned error value if response length is invalid.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath6kl: update Kconfig descriptions
Kalle Valo [Tue, 11 Mar 2014 10:58:03 +0000 (12:58 +0200)]
ath6kl: update Kconfig descriptions

The help text were either out of date, too small or didn't exist at all. Also
move cfg80211 dependency to ath6kl_core module as it has all the calls to
cfg80211.

Fixes checkpatch warning:

WARNING: please write a paragraph that describes the config symbol fully

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath6kl: remove unnecessary line continuations
Kalle Valo [Tue, 11 Mar 2014 10:58:02 +0000 (12:58 +0200)]
ath6kl: remove unnecessary line continuations

Fixes checkpatch warning:

WARNING: Avoid unnecessary line continuations

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath6kl: remove spaces before semicolon
Kalle Valo [Tue, 11 Mar 2014 10:58:02 +0000 (12:58 +0200)]
ath6kl: remove spaces before semicolon

Fixes checkpatch warning:

CHECK: space prohibited before semicolon

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath6kl: use braces on both arms of if statement
Kalle Valo [Tue, 11 Mar 2014 10:58:01 +0000 (12:58 +0200)]
ath6kl: use braces on both arms of if statement

Fixes checkpatch warning:

CHECK: braces {} should be used on all arms of this statement

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath6kl: fix blank lines before and after braces
Kalle Valo [Tue, 11 Mar 2014 10:58:01 +0000 (12:58 +0200)]
ath6kl: fix blank lines before and after braces

Fixes checkpatch warnings:

CHECK: Blank lines aren't necessary after an open brace '{'
CHECK: Blank lines aren't necessary before a close brace '}'

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath6kl: fix struct hif_scatter_req list handling
Kalle Valo [Tue, 11 Mar 2014 10:58:00 +0000 (12:58 +0200)]
ath6kl: fix struct hif_scatter_req list handling

Jason noticed that with Yocto GCC 4.8.1 ath6kl crashes with this iperf command:

iperf -c $TARGET_IP -i 5 -t 50 -w 1M

The crash was:

Unable to handle kernel paging request at virtual address 1a480000
pgd = 80004000
[1a480000] *pgd=00000000
Internal error: Oops: 805 [#1] SMP ARM
Modules linked in: ath6kl_sdio ath6kl_core [last unloaded: ath6kl_core]
CPU: 0 PID: 1953 Comm: kworker/u4:0 Not tainted 3.10.9-1.0.0_alpha+dbf364b #1
Workqueue: ath6kl ath6kl_sdio_write_async_work [ath6kl_sdio]
task: dcc9a680 ti: dc9ae000 task.ti: dc9ae000
PC is at v7_dma_clean_range+0x20/0x38
LR is at dma_cache_maint_page+0x50/0x54
pc : [<8001a6f8>]    lr : [<800170fc>]    psr: 20000093
sp : dc9afcf8  ip : 8001a748  fp : 00000004
r10: 00000000  r9 : 00000001  r8 : 00000000
r7 : 00000001  r6 : 00000000  r5 : 80cb7000  r4 : 03f9a480
r3 : 0000001f  r2 : 00000020  r1 : 1a480000  r0 : 1a480000
Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c53c7d  Table: 6cc5004a  DAC: 00000015
Process kworker/u4:0 (pid: 1953, stack limit = 0xdc9ae238)
Stack: (0xdc9afcf8 to 0xdc9b0000)
fce0:                                                       80c9b29c 00000000
fd00: 00000000 80017134 8001a748 dc302ac0 00000000 00000000 dc454a00 80c12ed8
fd20: dc115410 80017238 00000000 dc454a10 00000001 80017588 00000001 00000000
fd40: 00000000 dc302ac0 dc9afe38 dc9afe68 00000004 80c12ed8 00000000 dc454a00
fd60: 00000004 80436f88 00000000 00000000 00000600 0000ffff 0000000c 80c113c4
fd80: 80c9b29c 00000001 00000004 dc115470 60000013 dc302ac0 dc46e000 dc302800
fda0: dc9afe10 dc302b78 60000013 dc302ac0 dc46e000 00000035 dc46e5b0 80438c90
fdc0: dc9afe10 dc302800 dc302800 dc9afe68 dc9afe38 80424cb4 00000005 dc9afe10
fde0: dc9afe20 80424de8 dc9afe10 dc302800 dc46e910 80424e90 dc473c00 dc454f00
fe00: 000001b5 7f619d64 dcc7c830 00000000 00000000 dc9afe38 dc9afe68 00000000
fe20: 00000000 00000000 dc9afe28 dc9afe28 80424d80 00000000 00000035 9cac0034
fe40: 00000000 00000000 00000000 00000000 000001b5 00000000 00000000 00000000
fe60: dc9afe68 dc9afe10 3b9aca00 00000000 00000080 00000034 00000000 00000100
fe80: 00000000 00000000 dc9afe10 00000004 dc454a00 00000000 dc46e010 dc46e96c
fea0: dc46e000 dc46e964 00200200 00100100 dc46e910 7f619ec0 00000600 80c0e770
fec0: dc15a900 dcc7c838 00000000 dc46e954 8042d434 dcc44680 dc46e954 dc004400
fee0: dc454500 00000000 00000000 dc9ae038 dc004400 8003c450 dcc44680 dc004414
ff00: dc46e954 dc454500 00000001 dcc44680 dc004414 dcc44698 dc9ae000 dc9ae030
ff20: 00000001 dc9ae000 dc004400 8003d158 8003d020 00000000 00000000 80c53941
ff40: dc9aff64 dcb71ea0 00000000 dcc44680 8003d020 00000000 00000000 00000000
ff60: 00000000 80042480 00000000 00000000 000000f8 dcc44680 00000000 00000000
ff80: dc9aff80 dc9aff80 00000000 00000000 dc9aff90 dc9aff90 dc9affac dcb71ea0
ffa0: 800423cc 00000000 00000000 8000e018 00000000 00000000 00000000 00000000
ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[<8001a6f8>] (v7_dma_clean_range+0x20/0x38) from [<800170fc>] (dma_cache_maint_page+0x50/0x54)
[<800170fc>] (dma_cache_maint_page+0x50/0x54) from [<80017134>] (__dma_page_cpu_to_dev+0x34/0x9c)
[<80017134>] (__dma_page_cpu_to_dev+0x34/0x9c) from [<80017238>] (arm_dma_map_page+0x64/0x68)
[<80017238>] (arm_dma_map_page+0x64/0x68) from [<80017588>] (arm_dma_map_sg+0x7c/0xf4)
[<80017588>] (arm_dma_map_sg+0x7c/0xf4) from [<80436f88>] (sdhci_send_command+0x894/0xe00)
[<80436f88>] (sdhci_send_command+0x894/0xe00) from [<80438c90>] (sdhci_request+0xc0/0x1ec)
[<80438c90>] (sdhci_request+0xc0/0x1ec) from [<80424cb4>] (mmc_start_request+0xb8/0xd4)
[<80424cb4>] (mmc_start_request+0xb8/0xd4) from [<80424de8>] (__mmc_start_req+0x60/0x84)
[<80424de8>] (__mmc_start_req+0x60/0x84) from [<80424e90>] (mmc_wait_for_req+0x10/0x20)
[<80424e90>] (mmc_wait_for_req+0x10/0x20) from [<7f619d64>] (ath6kl_sdio_scat_rw.isra.10+0x1dc/0x240 [ath6kl_sdio])
[<7f619d64>] (ath6kl_sdio_scat_rw.isra.10+0x1dc/0x240 [ath6kl_sdio]) from [<7f619ec0>] (ath6kl_sdio_write_async_work+0x5c/0x104 [ath6kl_sdio])
[<7f619ec0>] (ath6kl_sdio_write_async_work+0x5c/0x104 [ath6kl_sdio]) from [<8003c450>] (process_one_work+0x10c/0x370)
[<8003c450>] (process_one_work+0x10c/0x370) from [<8003d158>] (worker_thread+0x138/0x3fc)
[<8003d158>] (worker_thread+0x138/0x3fc) from [<80042480>] (kthread+0xb4/0xb8)
[<80042480>] (kthread+0xb4/0xb8) from [<8000e018>] (ret_from_fork+0x14/0x3c)
Code: e1a02312 e2423001 e1c00003 f57ff04f (ee070f3a)
---[ end trace 0c038f0b8e0b67a3 ]---
Kernel panic - not syncing: Fatal exception

Jason's analysis:

  "The GCC 4.8.1 compiler will not do the for-loop till scat_entries, instead,
   it only run one round loop. This may be caused by that the GCC 4.8.1 thought
   that the scat_list only have one item and then no need to do full iteration,
   but this is simply wrong by looking at the assebly code. This will cause the sg
   buffer not get set when scat_entries > 1 and thus lead to kernel panic.

   Note: This issue not observed with GCC 4.7.2, only found on the GCC 4.8.1)"

Fix this by using the normal [0] style for defining unknown number of list
entries following the struct. This also fixes corruption with scat_q_depth, which
was mistankely added to the end of struct and overwritten if there were more
than item in the scat list.

Reported-by: Jason Liu <r64343@freescale.com>
Tested-by: Jason Liu <r64343@freescale.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: add recalc RTS/CTS protection method
Marek Kwaczynski [Tue, 11 Mar 2014 10:58:00 +0000 (12:58 +0200)]
ath10k: add recalc RTS/CTS protection method

Add recalculation of RTS/CTS protection when one or more legacy
stations are connected to ath10k. In this case enable RTS/CTS
protection and set sw retry profile are needed in the FW.
Without this change legacy station is starved and has very low
throughput.

Signed-off-by: Marek Kwaczynski <marek.kwaczynski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: allow the supported rate change by reassociate peer
Chun-Yeow Yeoh [Fri, 7 Mar 2014 08:19:30 +0000 (10:19 +0200)]
ath10k: allow the supported rate change by reassociate peer

IBSS mode requires the changing of supported rate. Do this
by reassociate the peer. The investigation shows that if move
from legacy to HT, the rate control won't work after changing
the supported rate. But once changing the supported rate to HT,
user can assign the TxRate in HT mode.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: do not overwrite max_antenna_gain
Marek Puzyniak [Wed, 5 Mar 2014 12:10:33 +0000 (13:10 +0100)]
ath10k: do not overwrite max_antenna_gain

Seems like we have an old bug, where we incidently overwrites
the max_antenna_gain we pass to firmware, with zero value.

End of all we are artifically reducing the output power.

This patch removes the excessive assignment on max_antenna_gain,
which is being provided by regulatory domain, and consequently
improves the tx power.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: support msdu chaining
Ben Greear [Mon, 3 Mar 2014 22:07:09 +0000 (14:07 -0800)]
ath10k: support msdu chaining

Consolidate the list of msdu skbs into the msdu-head skb, delete the
rest of the skbs, pass the msdu-head skb on up the stack as normal.

Tested with high-speed TCP and UDP traffic on modified firmware that
supports raw-rx.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: add vdev-id, return code to error codes
Ben Greear [Thu, 27 Feb 2014 16:50:00 +0000 (18:50 +0200)]
ath10k: add vdev-id, return code to error codes

When using multiple vdevs (stations, aps, etc), it is
nice to be able to associate log messages with specific
interfaces.  So, add vdev-id to most logging messages.
Add return code as well, where it was missing.

kvalo: unify some of the messages to follow the same style

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: minimize coherent dma accesses
Michal Kazior [Thu, 27 Feb 2014 16:50:05 +0000 (18:50 +0200)]
ath10k: minimize coherent dma accesses

It doesn't make much sense to calculate the ring
size fill count because it already is memoized in
a separate variable.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: remove pci completion list
Michal Kazior [Thu, 27 Feb 2014 16:50:05 +0000 (18:50 +0200)]
ath10k: remove pci completion list

One of the premises was to guarantee serialized
completion handling for upper layers
(HTC/WMI/HTT). Since quite some time now it is no
longer necessary.

The other premise was to batch up tx/rx
completions to take advantage of hot caches.
However frame tx/rx completion indications come in
on a single pipe already so they are already
batched up. More meaningful batching is done in
HTT itself.

This means PCI completion is no longer necessary
to keep around. It just wastes memory, cycles and
SLOC.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: reduce htt tx/rx spinlock overhead
Michal Kazior [Thu, 27 Feb 2014 16:50:05 +0000 (18:50 +0200)]
ath10k: reduce htt tx/rx spinlock overhead

It is inefficient to grab irqsave spinlocks for
skb lists for each queue/dequeue action.

Using rx_ring.lock and tx_lock allows to use less
heavy bh spinlock functions and moving locking
upwards allows to toggle spinlocks less often.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: batch htt tx/rx completions
Michal Kazior [Thu, 27 Feb 2014 16:50:04 +0000 (18:50 +0200)]
ath10k: batch htt tx/rx completions

HTT Rx endpoint processes both frame rx
indications and frame tx completion indications.

Those completions typically come in batches and
may be mixed so it makes sense to defer processing
hoping to get a bunch of them and take advantage
of hot caches.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: bypass htc for htt tx path
Michal Kazior [Thu, 27 Feb 2014 16:50:04 +0000 (18:50 +0200)]
ath10k: bypass htc for htt tx path

Going through full htc tx path for htt tx is a
waste of resources. By skipping it it's possible
to easily submit scatter-gather to the pci hif for
reduced host cpu load and improved performance.

The new approach uses dma pool to store the
following metadata for each tx request:
 * msdu fragment list
 * htc header
 * htt tx command

The htt tx command contains a msdu prefetch.
Instead of copying it original mapped msdu address
is used to submit a second scatter-gather item to
hif to make a complete htt tx command.

The htt tx command itself hands over dma mapped
pointers to msdus and completion of the command
itself doesn't mean the frame has been sent and
can be unmapped/freed. This is why htc tx
completion is skipped for htt tx as all tx related
resources are freed upon htt tx completion
indication event (which also implicitly means htt
tx command itself was completed).

Since now each htt tx request effectively consists
of 2 copy engine items CE_HTT_H2T_MSG_SRC_NENTRIES
is updated to allow maximum of
TARGET_10X_NUM_MSDU_DESC msdus being queued. This
keeps the tx path resource management simple.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: replace send_head() with tx_sg()
Michal Kazior [Thu, 27 Feb 2014 16:50:04 +0000 (18:50 +0200)]
ath10k: replace send_head() with tx_sg()

PCI is capable of handling scatter-gather lists.
This can be used to avoid copying memory.

Change the name of the callback while at to
reflect its purpose.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: remove is_aborted from skb_cb
Michal Kazior [Thu, 27 Feb 2014 16:50:04 +0000 (18:50 +0200)]
ath10k: remove is_aborted from skb_cb

The flag wasn't used anymore. No need to keep it.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: remove DMA mapping wrappers
Michal Kazior [Thu, 27 Feb 2014 16:50:03 +0000 (18:50 +0200)]
ath10k: remove DMA mapping wrappers

There's no real benefit from using them. DMA-API
already provides debugging. Some skbuffs are
already mapped directly with DMA-API since wrapper
arguments were insufficient and extending them
would be pointless.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: skip management frames in HTT path
Janusz Dziedzic [Tue, 25 Feb 2014 06:56:39 +0000 (07:56 +0100)]
ath10k: skip management frames in HTT path

After we pass frames with INV_PEER to upper layer in commit 716ae53c56cf
("ath10k: pass frames with invalid peer status to upper layer") we could pass
some management frames (in case INVALID_PEER and MGMT_CTRL) twice to upper
layer, once via WMI and once via HTT. Next we could handle assoc request twice.
This patch remove such regression.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: bitrate_mask add force_sgi support
Janusz Dziedzic [Fri, 17 Jan 2014 19:04:14 +0000 (20:04 +0100)]
ath10k: bitrate_mask add force_sgi support

Add force SGI support.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: enable spectrum management support
Janusz Dziedzic [Wed, 26 Feb 2014 16:42:09 +0000 (18:42 +0200)]
ath10k: enable spectrum management support

Indicate spectrum management support in hardware
flags, while we already handle power set
(IEEE80211_CONF_CHANGE_POWER) in the ath10k driver.
This enable 802.11h support for station mode.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: set the mactime of ieee80211_rx_status
Chun-Yeow Yeoh [Wed, 26 Feb 2014 16:42:05 +0000 (18:42 +0200)]
ath10k: set the mactime of ieee80211_rx_status

Retrieve the mactime of ieee80211_rx_status based on received
data frame. The value is obtained from the htt_rx_indication_ppdu
structure and only available in 32-bit.

kvalo: white space fixes

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: fix sta_rc_update for non-ap iftype
Michal Kazior [Tue, 25 Feb 2014 07:29:57 +0000 (09:29 +0200)]
ath10k: fix sta_rc_update for non-ap iftype

The arsta structure wasn't initialized for
non-ap interfaces. This should fix related
warnings/crashes.

Reported-By: Ben Greear <greearb@candelatech.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: fix 4addr rx
Michal Kazior [Tue, 25 Feb 2014 07:29:57 +0000 (09:29 +0200)]
ath10k: fix 4addr rx

The nwifi header is padded to 4 bytes. This wasn't
a problem until one tried to (at least) rx 4addr
frames.

This finally allows managed iface to be used in a
bridge.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: add more details to some debug messages
Ben Greear [Tue, 25 Feb 2014 07:29:57 +0000 (09:29 +0200)]
ath10k:  add more details to some debug messages

Makes it easier to determine why some failures
happened.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath10k: implement drv_get_tsf for ibss merging
Chun-Yeow Yeoh [Tue, 25 Feb 2014 07:29:54 +0000 (09:29 +0200)]
ath10k: implement drv_get_tsf for ibss merging

Implement the get TSF by simply returning 0 so that IBSS
merging is happening. Otherwise, IBSS nodes that have similar
SSID naming won't merge. This is simply fooling the mac80211
that the TSF in the received beacon is higher than the local TSF.

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
10 years agoath5k: set SURVEY_INFO_IN_USE on get_survey
Felix Fietkau [Sat, 22 Feb 2014 13:55:57 +0000 (14:55 +0100)]
ath5k: set SURVEY_INFO_IN_USE on get_survey

Only one channel is returned - the one currently being used.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: make some hardware reset log messages debug-only
Felix Fietkau [Sat, 22 Feb 2014 13:52:49 +0000 (14:52 +0100)]
ath9k: make some hardware reset log messages debug-only

On some chips, baseband watchdog hangs are more common than others, and
the driver has support for handling them.
Interrupts even after a watchdog hang are also quite common, so there's
not much point in spamming the user's logfiles.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: do not set half/quarter channel flags in AR_PHY_MODE
Felix Fietkau [Sat, 22 Feb 2014 13:52:48 +0000 (14:52 +0100)]
ath9k: do not set half/quarter channel flags in AR_PHY_MODE

5/10 MHz channel bandwidth is configured via the PLL clock, instead of
the AR_PHY_MODE register. Using that register is AR93xx specific, and
makes the mode incompatible with earlier chipsets.

In some early versions, these flags were apparently applied at the wrong
point in time and thus did not cause connectivity issues, however now
they are causing problems, as pointed out in this OpenWrt ticket:

https://dev.openwrt.org/ticket/14916

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Use static const
Joe Perches [Fri, 21 Feb 2014 22:46:43 +0000 (14:46 -0800)]
ath9k: Use static const

Trivially reduces text size too.

$ size drivers/net/wireless/ath/ath9k/debug.o*
   text    data     bss     dec     hex filename
  34436    2528    5128   42092    a46c drivers/net/wireless/ath/ath9k/debug.o.new
  34464    2528    5128   42120    a488 drivers/net/wireless/ath/ath9k/debug.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: list more reset causes in debugfs
Felix Fietkau [Fri, 21 Feb 2014 10:45:36 +0000 (11:45 +0100)]
ath9k: list more reset causes in debugfs

Number of MAC hangs and stuck beacons were missing

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agowireless/rt2x00: don't use PREPARE_WORK in rt2800usb.c
Tejun Heo [Thu, 20 Feb 2014 20:44:23 +0000 (15:44 -0500)]
wireless/rt2x00: don't use PREPARE_WORK in rt2800usb.c

PREPARE_[DELAYED_]WORK() are being phased out.  They have few users
and a nasty surprise in terms of reentrancy guarantee as workqueue
considers work items to be different if they don't have the same work
function.

Update rt2800usb.c to use INIT_WORK() instead of PREPARE_WORK().  As
the work item isn't in active use during rt2800usb_probe_hw(), this
doesn't cause any behavior difference.

It would probably be best to route this with other related updates
through the workqueue tree.

Only compile tested.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ivo van Doorn <IvDoorn@gmail.com>
Cc: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: Helmut Schaa <helmut.schaa@googlemail.com>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoiwlegacy: properly enable power saving
Stanislaw Gruszka [Wed, 19 Feb 2014 08:15:11 +0000 (09:15 +0100)]
iwlegacy: properly enable power saving

Even if we mark PS on, device still worked in normal mode. Patch
corrects that and now we send proper powertable command to device,
which put it in sleep mode when PS is on.

Reported-and-tested-by: Tino Keitel <tino.keitel@tikei.de>
Tested-by: Pedro Francisco <pedrogfrancisco@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoiwlegacy: merge reclaim check
Stanislaw Gruszka [Wed, 19 Feb 2014 08:15:10 +0000 (09:15 +0100)]
iwlegacy: merge reclaim check

Merge reclaim check for 3945 & 4965. This add some more checks for
3945, most importantly N_RX notify.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoiwl3945: fix wakeup interrupt
Stanislaw Gruszka [Wed, 19 Feb 2014 08:15:09 +0000 (09:15 +0100)]
iwl3945: fix wakeup interrupt

We have only 5 tx queues on 3945, updating il->txq[5] results in
writing random value to HBUS_TARG_WRPTR register.

Additionally use spin lock to protect txq->write_ptr and
txq->need_update fields also modified in TX path.

Tested-by: Pedro Francisco <pedrogfrancisco@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: enable obss scan offload feature flag
Amitkumar Karwar [Tue, 18 Feb 2014 23:47:57 +0000 (15:47 -0800)]
mwifiex: enable obss scan offload feature flag

We don't perform OBSS scan internally. As we intend to use
corresponding feature in application, we will enable this flag.

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>
10 years agomwifiex: remove redundant del_timer
Avinash Patil [Tue, 18 Feb 2014 23:47:56 +0000 (15:47 -0800)]
mwifiex: remove redundant del_timer

While modifying timer, we need not delete timer.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: use del_timer_sync instead of del_timer
Avinash Patil [Tue, 18 Feb 2014 23:47:55 +0000 (15:47 -0800)]
mwifiex: use del_timer_sync instead of del_timer

Use SMP safe del_timer_sync instead of del_timer for cancelling
timers.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoath9k: Enable U-APSD AP mode support
Jouni Malinen [Tue, 18 Feb 2014 18:41:08 +0000 (20:41 +0200)]
ath9k: Enable U-APSD AP mode support

mac80211 handles the actual operations, so ath9k can just indicate
support for this. Based on initial tests, this combination seems to
work fine.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agodrivers:net:wireless:airo.c:checkpatch.pl cleanup
Avinash kumar [Tue, 18 Feb 2014 11:34:10 +0000 (17:04 +0530)]
drivers:net:wireless:airo.c:checkpatch.pl cleanup

removed following warnings-
drivers/net/wireless/airo.c:39: WARNING: Use #include <linux/io.h> instead of <asm/io.h>
drivers/net/wireless/airo.c:48: WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>

Signed-off-by: Avinash Kumar <avi.kp.137@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agohostap: add Netgear MA401 card
Cédric Le Goater [Tue, 18 Feb 2014 09:07:52 +0000 (10:07 +0100)]
hostap: add Netgear MA401 card

This is a relatively old Prism2 card which is correctly supported
by the hostap driver.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agonet: wireless: wl3501_cs: Remove duplicate include
Sachin Kamat [Mon, 17 Feb 2014 09:55:01 +0000 (15:25 +0530)]
net: wireless: wl3501_cs: Remove duplicate include

linux/etherdevice.h was included twice.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: return true / false instead of numbers in functions which return bool value
Zhao, Gang [Sun, 16 Feb 2014 14:31:38 +0000 (22:31 +0800)]
b43: return true / false instead of numbers in functions which return bool value

Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agob43: Kconfig: let config B43_BCMA_PIO depends on B43
Zhao, Gang [Sun, 16 Feb 2014 14:31:37 +0000 (22:31 +0800)]
b43: Kconfig: let config B43_BCMA_PIO depends on B43

Logically, config B43_BCMA_PIO should depend on B43. This also solves
the problem that sub options of b43 driver didn't indent correctly in
make menuconfig's ncurses window.

Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agortlwifi: properly apply filter flags
Peter Wu [Fri, 14 Feb 2014 18:03:45 +0000 (19:03 +0100)]
rtlwifi: properly apply filter flags

commit 0baa0fd76f3f5a134461d6cf30294f6bb1bb824c
("rtlwifi: Convert core routines for addition of rtl8192se and
rtl8192de") removed setting HW_VAR_RCR, HW_VAR_MGT_FILTER and
HW_VAR_CTRL_FILTER. The last two are probably done because some hardware
does not support them. The first is probably a mistake. This patch adds
the missing set_hw_reg call.

For PCI support, rx_conf is not touched directly. Instead, get_hw_reg is
used to abstract between receive_config (for PCI) and rx_conf (for USB).

This was tested on a 10ec:8176 Realtek RTL8188CE (according to the
label on the mini-PCIe card). Before this patch, `iw wlan0 set monitor
otherbss` did not capture frames from other BSS's. After this patch, it
does print packets.

Tested-by: Peter Wu <lekensteyn@gmail.com>
Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agortlwifi: avoid accessing RCR directly
Peter Wu [Fri, 14 Feb 2014 18:03:44 +0000 (19:03 +0100)]
rtlwifi: avoid accessing RCR directly

The rtl*_set_check_bssid functions are mostly the same, but access the
RCR register in different ways. Use the get_hw_reg abstraction layer
(which reads rtlpci->receive_config for PCI devices and mac->rx_conf for
USB).

There is no functional change for cases where receive_config was
accessed directly. For rtl8192ce, there is still no change because
nothing modifies REG_RCR or receive_config. For rtl8192cu, it now also
applies changes to rx_conf from configure_filter, but that can be
considered a bug which is fixed later.

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agomwifiex: memory corruption in mwifiex_tdls_add_vht_capab()
Dan Carpenter [Fri, 14 Feb 2014 09:03:13 +0000 (12:03 +0300)]
mwifiex: memory corruption in mwifiex_tdls_add_vht_capab()

There is a typo here because the names are confusingly similar.  The
intent was sizeof(struct ieee80211_vht_cap) (size 12) but sizeof(struct
ieee80211_ht_cap) (size 32) was used.

Anway, it's cleaner to just specify the variable instead of the type.

Fixes: 5f6d5983394f ('mwifiex: add VHT support for TDLS')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi...
John W. Linville [Mon, 24 Feb 2014 20:05:42 +0000 (15:05 -0500)]
Merge branch 'for-john' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

10 years agoMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetoot...
John W. Linville [Mon, 24 Feb 2014 20:04:35 +0000 (15:04 -0500)]
Merge branch 'for-upstream' of git://git./linux/kernel/git/bluetooth/bluetooth-next

10 years agoMerge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac802...
John W. Linville [Mon, 24 Feb 2014 20:03:32 +0000 (15:03 -0500)]
Merge branch 'for-john' of git://git./linux/kernel/git/jberg/mac80211-next

10 years agoMerge branch 'for-linville' of git://github.com/kvalo/ath
John W. Linville [Mon, 24 Feb 2014 20:02:36 +0000 (15:02 -0500)]
Merge branch 'for-linville' of git://github.com/kvalo/ath

10 years agoRevert "Staging: rtl8812ae: remove modules field of rate_control_ops"
John W. Linville [Mon, 24 Feb 2014 19:35:46 +0000 (14:35 -0500)]
Revert "Staging: rtl8812ae: remove modules field of rate_control_ops"

This reverts commit 35582ad9d342025653aaf28ed321bf5352488d7f.

This should not have been merged through this tree...

Signed-off-by: John W. Linville <linville@tuxdriver.com>
10 years agoiwlwifi: mvm: fix a few wd_disable comments
Eliad Peller [Tue, 11 Feb 2014 14:54:42 +0000 (16:54 +0200)]
iwlwifi: mvm: fix a few wd_disable comments

Few minor comments.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
10 years agoiwlwifi: mvm: prepare infrastructure for more TLV flags
Eran Harary [Thu, 20 Feb 2014 09:00:01 +0000 (11:00 +0200)]
iwlwifi: mvm: prepare infrastructure for more TLV flags

We use the TLV flags as a handshake between the firmware
and the driver. These flags allow the firmware to advertise
its capabilities and API version.
Since we are running short of bits, we add a new
infrastructure which is more scalable, yet backward
compatible.

We make now the difference between API changes and the
capabilities. Both can have an index which allows to scale
at will.

Signed-off-by: Eran Harary <eran.harary@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
10 years agoiwlwifi: mvm: remove redundant define in fw.c
Inbal Hacohen [Sun, 23 Feb 2014 08:34:11 +0000 (10:34 +0200)]
iwlwifi: mvm: remove redundant define in fw.c

This define is a leftover from dvm (in mvm, it
was replaced by MVM_UCODE_ALIVE_TIMEOUT).

Signed-off-by: Inbal Hacohen <Inbal.Hacohen@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
10 years agoiwlwifi: nvm: remove reading valid antennas from NVM
Johannes Berg [Wed, 12 Feb 2014 21:02:38 +0000 (22:02 +0100)]
iwlwifi: nvm: remove reading valid antennas from NVM

These values aren't used as the firmware values should be used,
so reading them is pointless and hides potential errors when
somebody uses these values. Leave them zero to make it clearer
that they can't be used. We can't remove the struct members as
the DVM driver does read the values from EEPROM/OTP and the
structure is shared between drivers.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
10 years agoBluetooth: Fix iterating wrong list in hci_remove_irk()
Johan Hedberg [Fri, 21 Feb 2014 14:03:31 +0000 (16:03 +0200)]
Bluetooth: Fix iterating wrong list in hci_remove_irk()

We should be iterating hdev->identity_resolving_keys in the
hci_remove_irk() function instead of hdev->long_term_keys. This patch
fixes the issue.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
10 years agomac80211: ibss: handle cfg80211_chandef_dfs_required() error codes
Luciano Coelho [Thu, 20 Feb 2014 14:36:23 +0000 (16:36 +0200)]
mac80211: ibss: handle cfg80211_chandef_dfs_required() error codes

Error codes returned by cfg80211_chandef_dfs_required() are ignored
when trying to join an IBSS.  Fix this by printing an error and
returning.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 years agocfg80211: remove radar requirements check from cfg80211_can_use_iftype_chan()
Luciano Coelho [Thu, 20 Feb 2014 14:36:21 +0000 (16:36 +0200)]
cfg80211: remove radar requirements check from cfg80211_can_use_iftype_chan()

We don't have to double check whether the parameters passed to
cfg80211_can_use_iftype_chan() are correct.  We should just make sure
they *are* when we call this function.

Remove the radar_detect argument check in
cfg80211_can_use_iftype_chan() to simplify the code.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
[keep braces around a long comment + single statement]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 years agonl80211: make sure we check for DFS with mesh channel switch
Luciano Coelho [Thu, 20 Feb 2014 14:36:20 +0000 (16:36 +0200)]
nl80211: make sure we check for DFS with mesh channel switch

Since mesh support for DFS channels was added, we also need to check
for DFS channels when performing a channel switch with
NL80211_IFTYPE_MESHPOINT.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
[use switch statement, slight code cleanup]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 years agomac80211: allow drivers to request SMPS off
Luciano Coelho [Thu, 20 Feb 2014 14:41:51 +0000 (16:41 +0200)]
mac80211: allow drivers to request SMPS off

Previously we were warning and using automatic when a driver sent an
update request with SMPS off.  This patch makes it possible for
drivers to disable SMPS at runtime, for whatever reason.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 years agocfg80211: docbook: add interface combinations documentation
Luciano Coelho [Thu, 20 Feb 2014 14:45:34 +0000 (16:45 +0200)]
cfg80211: docbook: add interface combinations documentation

Add the ieee80211_iface_limit and the ieee80211_iface_combination
structures to docbook.  Reformat the examples of combinations
slightly, so it looks a bit better on docbook.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 years agocfg80211: docbook: fix small formatting error
Luciano Coelho [Thu, 20 Feb 2014 14:45:33 +0000 (16:45 +0200)]
cfg80211: docbook: fix small formatting error

docbook (or one of its friends) gets confused with semi-colons in the
argument descriptions, causing it to think that the semi-colon is
marking a new section in the description of addr_mask in wiphy struct.

Prevent this by using hyphens instead of semi-colons in the mask
example.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 years agocfg80211: regulatory: introduce NL80211_RRF_AUTO_BW rule flag
Janusz Dziedzic [Thu, 20 Feb 2014 12:52:16 +0000 (13:52 +0100)]
cfg80211: regulatory: introduce NL80211_RRF_AUTO_BW rule flag

Introduce NL80211_RRF_AUTO_BW rule flag. If this flag set
maximum available bandwidth should be calculated base on
contiguous rules and wider channels will be allowed to cross
multiple contiguous/overlapping frequency ranges.

In case of old kernels maximum bandwidth from regulatory
rule will be used, while there is no NL80211_RRF_AUTO_BW flag.

This fixes the previous commit 9752482083066af7ac18a5ca376f
("cfg80211: regulatory introduce maximum bandwidth calculation")
which was found to be a problem for userspace API compatibility.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
[edit commit log, use sizeof()]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 years agoBluetooth: Increase minor version of core module
Marcel Holtmann [Thu, 20 Feb 2014 20:44:20 +0000 (12:44 -0800)]
Bluetooth: Increase minor version of core module

With the addition of Resolvable Private Address (RPA) resolution
support for Bluetooth Low Energy connections, it makes sense to
increase the minor version of the Bluetooth core module.

The module version is not used anywhere, but it gives a nice extra
hint for debugging purposes.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Provide option for changing LE advertising channel map
Marcel Holtmann [Thu, 20 Feb 2014 19:55:56 +0000 (11:55 -0800)]
Bluetooth: Provide option for changing LE advertising channel map

For testing purposes it is useful to provide an option to change the
advertising channel map. So add a debugfs option to allow this.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Fix channel check when binding RFCOMM sock
Andrzej Kaczmarek [Thu, 20 Feb 2014 15:42:01 +0000 (16:42 +0100)]
Bluetooth: Fix channel check when binding RFCOMM sock

When binding RFCOMM socket with non-zero channel we're checking if
there is already any other socket which has the same channel number
assigned and then fail. This check does not consider situation where
we have another socket connected to remote device on given channel
number in which case we still should be able to bind local socket.

This patch changes __rfcomm_get_sock_by_addr() to return only sockets
in either BT_BOUND or BT_LISTEN states, also name is updated to better
describe what this function does now.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoiwlwifi: mvm: add Rx frames statistics via debugfs
Eyal Shapira [Mon, 27 Jan 2014 23:35:32 +0000 (01:35 +0200)]
iwlwifi: mvm: add Rx frames statistics via debugfs

Collect statistics regarding rates and aggregations in Rx
frames and export the data via debugfs.

Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
10 years agoiwlwifi: mvm: set immediate apply time bit in time events
Emmanuel Grumbach [Sun, 16 Feb 2014 13:36:00 +0000 (15:36 +0200)]
iwlwifi: mvm: set immediate apply time bit in time events

Newer firmware support a new bit in the policy  that allows
to request to apply the time event immediately. Add this bit
without removing the workarounds we used until now to support
older firmares.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
10 years agoiwlwifi: pcie: stop the firmware when we restart it
Emmanuel Grumbach [Wed, 12 Feb 2014 06:51:54 +0000 (08:51 +0200)]
iwlwifi: pcie: stop the firmware when we restart it

In case the firmware didn't assert but we want to restart
it, e.g. we didn't get the reply for a host command, or the
Tx queues are stuck, we should stop the firmware by
provoking an interrupt. This allows to better debug the
firmware in these bad scenarios.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
10 years agoiwlwifi: mvm: fix possible memory leak
Eytan Lifshitz [Tue, 18 Feb 2014 13:02:29 +0000 (15:02 +0200)]
iwlwifi: mvm: fix possible memory leak

iwl_parse_nvm_data() doesn't free allocated memory if it is
fed with invalid parameter. Fix this.

Signed-off-by: Eytan Lifshitz <eytan.lifshitz@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
10 years agomac80211: allow driver to return error from sched_scan_stop
Johannes Berg [Mon, 17 Feb 2014 09:48:17 +0000 (10:48 +0100)]
mac80211: allow driver to return error from sched_scan_stop

In order to solve races with sched_scan_stop, it is necessary
for the driver to be able to return an error to propagate that
to cfg80211 so it doesn't send an event.

Reviewed-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 years agocfg80211: document sched_scan_stop synchronous behaviour
Johannes Berg [Thu, 13 Feb 2014 16:16:10 +0000 (17:16 +0100)]
cfg80211: document sched_scan_stop synchronous behaviour

Due to userspace assumptions, the sched_scan_stop operation must
be synchronous, i.e. once it returns a new scheduled scan must be
able to start immediately. Document this in the API.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 years agocfg80211: Pass TDLS peer capability information in tdls_mgmt
Sunil Dutt Undekari [Thu, 20 Feb 2014 10:52:09 +0000 (16:22 +0530)]
cfg80211: Pass TDLS peer capability information in tdls_mgmt

While framing the TDLS Setup Confirmation frame, the driver needs to
know if the TDLS peer is VHT/HT/WMM capable and thus shall construct
the VHT/HT operation / WMM parameter elements accordingly. Supplicant
determines if the TDLS peer is VHT/HT/WMM capable based on the
presence of the respective IEs in the received TDLS Setup Response frame.

The host driver should not need to parse the received TDLS Response
frame and thus, should be able to rely on the supplicant to indicate
the capability of the peer through additional flags while transmitting
the TDLS Setup Confirmation frame through tdls_mgmt operations.

Signed-off-by: Sunil Dutt Undekari <usdutt@qti.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 years agoMerge remote-tracking branch 'wireless-next/master' into mac80211-next
Johannes Berg [Thu, 20 Feb 2014 10:55:12 +0000 (11:55 +0100)]
Merge remote-tracking branch 'wireless-next/master' into mac80211-next

10 years agoBluetooth: Track the current configured random address
Marcel Holtmann [Thu, 20 Feb 2014 03:52:13 +0000 (19:52 -0800)]
Bluetooth: Track the current configured random address

For Bluetooth controllers with LE support, track the value of the
currently configured random address. It is important to know what
the current random address is to avoid unneeded attempts to set
a new address. This will become important when introducing the
LE privacy support in the future.

In addition expose the current configured random address via
debugfs for debugging purposes.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Replace own_address_type with force_static_address debugfs
Marcel Holtmann [Thu, 20 Feb 2014 03:31:26 +0000 (19:31 -0800)]
Bluetooth: Replace own_address_type with force_static_address debugfs

The own_address_type debugfs option does not providing enough
flexibity for interacting with the upcoming LE privacy support.

What really is needed is an option to force using the static address
compared to the public address. The new force_static_address debugfs
option does exactly that. In addition it is also only available when
the controller does actually have a public address. For single mode
LE only controllers this option will not be available.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Add comment explainging store hint for long term keys
Marcel Holtmann [Thu, 20 Feb 2014 01:11:58 +0000 (17:11 -0800)]
Bluetooth: Add comment explainging store hint for long term keys

The code itself is not descriptive on what store hint is used for
long term keys and why. So add some extensive comment here. Similar
to what has already been done for identity resolving key store hint.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Don't send store hint for devices using identity addresses
Marcel Holtmann [Wed, 19 Feb 2014 19:51:54 +0000 (11:51 -0800)]
Bluetooth: Don't send store hint for devices using identity addresses

The identity resolving keys should only be stored for devices using
resolvable random addresses. If the device is already using an
identity address, inform it about the new identity resolving key,
but tell userspace that this key is not persistent.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Add support for sending New IRK event
Johan Hedberg [Wed, 19 Feb 2014 13:18:31 +0000 (15:18 +0200)]
Bluetooth: Add support for sending New IRK event

This patch adds the necessary helper function to send the New IRK mgmt
event and makes sure that the function is called at when SMP key
distribution has completed. The event is sent before the New LTK event
so user space knows which remote device to associate with the keys.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Move SMP LTK notification after key distribution
Johan Hedberg [Wed, 19 Feb 2014 12:57:47 +0000 (14:57 +0200)]
Bluetooth: Move SMP LTK notification after key distribution

This patch moves the SMP Long Term Key notification over mgmt from the
hci_add_ltk function to smp.c when both sides have completed their key
distribution. This way we are also able to update the identity address
into the mgmt_new_ltk event.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Track SMP keys in the SMP context
Johan Hedberg [Wed, 19 Feb 2014 12:57:46 +0000 (14:57 +0200)]
Bluetooth: Track SMP keys in the SMP context

As preparation to do mgmt notification in a single place at the end of
the key distribution, store the keys that need to be notified within the
SMP context.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Move New LTK store hint evaluation into mgmt_new_ltk
Johan Hedberg [Wed, 19 Feb 2014 12:57:45 +0000 (14:57 +0200)]
Bluetooth: Move New LTK store hint evaluation into mgmt_new_ltk

It's simpler (one less if-statement) to just evaluate the appropriate
value for store_hint in the mgmt_new_ltk function than to pass a boolean
parameter to the function. Furthermore, this simplifies moving the mgmt
event emission out from hci_add_ltk in subsequent patches.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Return added key when adding LTKs and IRKs
Johan Hedberg [Wed, 19 Feb 2014 12:57:44 +0000 (14:57 +0200)]
Bluetooth: Return added key when adding LTKs and IRKs

The SMP code will need to postpone the mgmt event emission for the IRK
and LTKs. To avoid extra lookups at the end of the key distribution
simply return the added value from the add_ltk and add_irk functions.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Avoid using GFP_ATOMIC where not necessary
Johan Hedberg [Wed, 19 Feb 2014 12:57:43 +0000 (14:57 +0200)]
Bluetooth: Avoid using GFP_ATOMIC where not necessary

The various pieces of data cached in the hci_dev structure do not need
to be allocated using GFP_ATOMIC since they are never added from
interrupt context. This patch updates these allocations to use
GFP_KERNEL instead.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Use same LE min/max connection event length during update
Marcel Holtmann [Wed, 19 Feb 2014 06:27:14 +0000 (22:27 -0800)]
Bluetooth: Use same LE min/max connection event length during update

During LE connection establishment the value 0x0000 is used for min/max
connection event length. So use the same value when the peripheral is
requesting an update of the the connection paramters.

For some reason the value 0x0001 got used in the connection update and
0x0000 in the connection creation. Using the same value for both just
makes sense.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Expose current list of identity resolving keys via debugfs
Marcel Holtmann [Wed, 19 Feb 2014 05:54:49 +0000 (21:54 -0800)]
Bluetooth: Expose current list of identity resolving keys via debugfs

For debugging purposes expose the current list of identity resolving
keys via debugfs. This file is read-only and limited to root access.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Fix wrong identity address during connection failures
Marcel Holtmann [Tue, 18 Feb 2014 23:13:43 +0000 (15:13 -0800)]
Bluetooth: Fix wrong identity address during connection failures

When the connection attempt fails, the address information are not
provided in the HCI_LE_Connection_Complete event. So use the original
information from the connection to reconstruct the identity address.

This is important when a connection attempt has been made using the
identity address, but the cached resolvable random address has changed
in the meantime. The failure event needs to use the identity address
and not the resolvable random address.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Use connection address for reporting connection failures
Marcel Holtmann [Tue, 18 Feb 2014 22:22:20 +0000 (14:22 -0800)]
Bluetooth: Use connection address for reporting connection failures

When reporting connect failed events to userspace, use the address
of the connection and not the address from the HCI event.

This change is strictly speaking not needed since BR/EDR does not
have the concept of resolvable random addresses. It is more for
making the code consistent.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Report identity address when remote device connects
Marcel Holtmann [Tue, 18 Feb 2014 22:22:19 +0000 (14:22 -0800)]
Bluetooth: Report identity address when remote device connects

When the remote device has been successfully connected, report the
identity address (public address or static random address).

Currently the address from the HCI_LE_Connection_Complete event is
used. This was no problem so far, but since now known resolvable
random addresses are converted into identities, it is important to
use the identity of the connection and not the address report by
HCI event.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
10 years agoBluetooth: Print error when dropping L2CAP data
Szymon Janc [Tue, 18 Feb 2014 19:48:34 +0000 (20:48 +0100)]
Bluetooth: Print error when dropping L2CAP data

Silently dropping L2CAP data (i.e. due to remote device not obeying
negotiated MTU) is confusing and makes debugging harder.

Signed-off-by: Szymon Janc <szymon.janc@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Use Identity Address in Device Found event
Johan Hedberg [Tue, 18 Feb 2014 19:41:37 +0000 (21:41 +0200)]
Bluetooth: Use Identity Address in Device Found event

Whenever a device uses an RPA we want to have user space identify it by
its Identity Address if we've got an IRK available for it. This patch
updates the Device Found mgmt event to contain the Identity Address if
an IRK is available for the device in question.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Look up RPA for connection requests with Identity Address
Johan Hedberg [Tue, 18 Feb 2014 19:41:36 +0000 (21:41 +0200)]
Bluetooth: Look up RPA for connection requests with Identity Address

We need to check whether there's a matching IRK and RPA when we're
requested to connect to a remote LE device based on its Identity
Address. This patch updates the hci_connect_le function to do an extra
call to hci_find_irk_by_addr and uses the RPA if it's cached. This is
particularly important once we start exposing the Identity Address to
user space instead of the RPA in events such as Device Connected and
Device Found.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Don't try to look up private addresses as Identity Address
Johan Hedberg [Tue, 18 Feb 2014 19:41:35 +0000 (21:41 +0200)]
Bluetooth: Don't try to look up private addresses as Identity Address

Identity Addresses are either public or static random. When looking up
addresses based on the Identity Address it doesn't make sense to go
through the IRK list if we're given a private random address. This patch
fixes (or rather improves) the hci_find_irk_by_addr function to bail out
early if given a private random address.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Wait for SMP key distribution completion when pairing
Johan Hedberg [Tue, 18 Feb 2014 19:41:34 +0000 (21:41 +0200)]
Bluetooth: Wait for SMP key distribution completion when pairing

When we initiate pairing through mgmt_pair_device the code has so far
been waiting for a successful HCI Encrypt Change event in order to
respond to the mgmt command. However, putting privacy into the play we
actually want the key distribution to be complete before replying so
that we can include the Identity Address in the mgmt response.

This patch updates the various hci_conn callbacks for LE in mgmt.c to
only respond in the case of failure, and adds a new mgmt_smp_complete
function that the SMP code will call once key distribution has been
completed.

Since the smp_chan_destroy function that's used to indicate completion
and clean up the SMP context can be called from various places,
including outside of smp.c, the easiest way to track failure vs success
is a new flag that we set once key distribution has been successfully
completed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Fix updating Identity Address in L2CAP channels
Johan Hedberg [Tue, 18 Feb 2014 19:41:33 +0000 (21:41 +0200)]
Bluetooth: Fix updating Identity Address in L2CAP channels

When we receive a remote identity address during SMP key distribution we
should ensure that any associated L2CAP channel instances get their
address information correspondingly updated (so that e.g. doing
getpeername on associated sockets returns the correct address).

This patch adds a new L2CAP core function l2cap_conn_update_id_addr()
which is used to iterate through all L2CAP channels associated with a
connection and update their address information.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
10 years agoBluetooth: Track the LE Identity Address in struct hci_conn
Johan Hedberg [Tue, 18 Feb 2014 19:41:32 +0000 (21:41 +0200)]
Bluetooth: Track the LE Identity Address in struct hci_conn

Since we want user space to see and use the LE Identity Address whenever
interfacing with the kernel it makes sense to track that instead of the
real address (the two will only be different in the case of an RPA).
This patch adds the necessary updates to when an LE connection gets
established and when receiving the Identity Address from a remote
device.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>