Commit graph

468501 commits

Author SHA1 Message Date
John W. Linville 59e25676cf Merge branch 'for-linville' of git://github.com/kvalo/ath 2014-08-28 14:36:38 -04:00
Michal Kazior 0fdc14e42b ath10k: make target endianess more explicit
Some copy engine structures are target specific
and are uploaded to the device during
init/configuration.

This also cleans up a bit diag_mem_read/write
implicit byteswap mess leaving only
diag_access_read/write with an implicit endianess
byteswap.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-27 15:03:32 +03:00
Michal Kazior 7c6aa25db4 ath10k: dont duplicate service-pipe mapping
The mapping is already defined in a structure. It
makes little sense to duplicate information stored
in it within a function.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-27 15:03:23 +03:00
Michal Kazior d7bfb7aa54 ath10k: move pci init structures
It doesn't make much sense to have copy engine
configuration structures spread across the whole
source file.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-27 15:03:00 +03:00
Michal Kazior 1bbb119db0 ath10k: fix fw crash dumping
Recent crash dump patches introduced a regression.
If debugfs was disabled upon crash user could only
see the following:

 [  793.880000] ath10k: firmware crashed! (uuid n/a)
 [  793.890000] ath10k: qca988x hw2.0 (0x4100016c, 0x043202ff) fw 10.1.467.2-1 api 2 htt 2.1
 [  793.890000] ath10k: debug 0 debugfs 0 tracing 0 dfs 1

The report was missing register dump. Fix it by
printing registers regardless if crash_data is
present or not.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-26 19:09:03 +03:00
Michal Kazior 7aa7a72a23 ath10k: improve logging to include dev id
This makes it a lot easier to log and debug
messages if there's more than 1 ath10k device on a
system.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-26 19:04:48 +03:00
Himangi Saraogi 7bb75da171 orinoco_usb: use USB API functions rather than constants
This patch introduces the use of the functions
usb_endpoint_is_bulk_in(epd) and usb_endpoint_is_bulk_out(epd).

The semantic patch that makes these changes is as follows:

@@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\)) ==
- \(USB_ENDPOINT_XFER_BULK\|2\))
+ usb_endpoint_xfer_bulk(epd)

@@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bEndpointAddress & \(USB_ENDPOINT_DIR_MASK\|0x80\)) ==
-  \(USB_DIR_IN\|0x80\))
+ usb_endpoint_dir_in(epd)

@@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bEndpointAddress & \(USB_ENDPOINT_DIR_MASK\|0x80\)) ==
-  \(USB_DIR_OUT\|0\))
+ usb_endpoint_dir_out(epd)

@@ struct usb_endpoint_descriptor *epd; @@

- (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd))
+ usb_endpoint_is_bulk_in(epd)

@@ struct usb_endpoint_descriptor *epd; @@

- (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd))
+ usb_endpoint_is_bulk_out(epd)

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:42 -04:00
Himangi Saraogi b9395df96a atmel_cs: Remove typedef local_info_t
The Linux kernel coding style guidelines suggest not using typedefs
for structure types. This patch gets rid of the typedef for
local_info_t. Also, the name of the struct is changed to drop the _t,
to make the name look less typedef-like.

The following Coccinelle semantic patch detects the case:

@tn@
identifier i;
type td;
@@

-typedef
 struct i { ... }
-td
 ;

@@
type tn.td;
identifier tn.i;
@@

-td
+ struct i

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:41 -04:00
Tomasz Bursztyka a796dac9a6 wireless: core: Reorder wiphy_register() notifications relevantly
Currently it can send regulatory domain change notification before any
NEW_WIPHY notification. Moreover, if rfill_register() fails, calling
wiphy_unregister() will send a DEL_WIPHY though no NEW_WIPHY had been
sent previously.

Thus reordering so it properly notifies NEW_WIPHY before any other.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:41 -04:00
Rickard Strandqvist f0bd88dfd7 net: wireless: ipw2x00: ipw2200.c: Cleaning up missing null-terminate in conjunction with strncpy
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:40 -04:00
Himangi Saraogi 372e3a8468 wireless: wlcore: Use devm_kzalloc
This patch introduces the use of devm_kzalloc and does away with the
kfrees in the probe and remove functions. Also, a couple of labels and
the initial assignment of the ret variable in the probe function are
removed.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:39 -04:00
Vladimir Kondratiev 560ce30872 wil6210: fix access after free in wil_pcie_remove()
'wil'  released in wil_if_free(); save iomapped address aside to
properly unmap it.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:38 -04:00
Vladimir Kondratiev 48e81a15fa wil6210: cfg80211_rx_mgmt to use GFP_ATOMIC
Internally, cfg80211_rx_mgmt() takes lock:
spin_lock_bh(&wdev->mgmt_registrations_lock);

and therefore one can't use it with GFP_KERNEL allocation flags.
When called with GFP_KERNEL, "sleep while atomic" warning triggered:

<3>[242645.446224] BUG: sleeping function called from invalid context at kernel/mm/slub.c:926
<3>[242645.455516] in_atomic(): 1, irqs_disabled(): 0, pid: 18881, name: kworker/u16:0
<6>[242645.462868] CPU: 0 PID: 18881 Comm: kworker/u16:0 Tainted: G           O 3.10.40-g619a884-00001-g357fa9c #2
<6>[242645.463044] Workqueue: wil6210_wmi wmi_event_worker [wil6210]
<6>[242645.463087] Call trace:
<6>[242645.463157] [<ffffffc000087390>] dump_backtrace+0x0/0x144
<6>[242645.463205] [<ffffffc0000874e4>] show_stack+0x10/0x1c
<6>[242645.463259] [<ffffffc0009abc04>] dump_stack+0x1c/0x28
<6>[242645.463313] [<ffffffc0000c10c0>] __might_sleep+0xe0/0xf0
<6>[242645.463365] [<ffffffc00015a514>] kmem_cache_alloc+0x48/0x1e4
<6>[242645.463414] [<ffffffc00080d468>] __alloc_skb+0x48/0x164
<6>[242645.463466] [<ffffffc00097f2c4>] nl80211_send_mgmt+0x4c/0x1dc
<6>[242645.463511] [<ffffffc000980268>] cfg80211_rx_mgmt+0x1bc/0x25c
<6>[242645.463647] [<ffffffbffc005d64>] wmi_evt_rx_mgmt+0x21c/0x23c [wil6210]
<6>[242645.463783] [<ffffffbffc0073b8>] wmi_event_worker+0x230/0x2f8 [wil6210]
<6>[242645.463838] [<ffffffc0000afffc>] process_one_work+0x258/0x3d0
<6>[242645.463887] [<ffffffc0000b0fe0>] worker_thread+0x1f0/0x310
<6>[242645.463946] [<ffffffc0000b642c>] kthread+0xac/0xb8

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:38 -04:00
Vladimir Kondratiev 8fcfdeac97 wil6210: fix free'd memory access in wil_if_free()
In the wil_priv_deinit(), wdev->netdev is accessed, so free_netdev()
should not be called before mentioned call.

Set wdev->netdev to NULL Make sure no more attempts to use it.
It is used for debug printk if not NULL.

This fix kernel panic on module unload and in case error on probe;
if memory allocation debugging enabled.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:37 -04:00
Dedy Lansky 1eb9d1e5c6 wil6210: Limit max number of associated stations
Add a module parameter to support setting the maximum
number of stations that can be associated to an AP.

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:36 -04:00
Vladimir Kondratiev a21420864a wil6210: fix false "scan timeout"
When sending scan request, if hardware is not ready, scan timer was started
and scan timeout mis-reported.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:36 -04:00
Vladimir Kondratiev 36345ac33c wil6210: fix beamforming data reporting
When reading 'bf' file on debugfs, query beam forming status from firmware.
Ignore CID's that return error or return all zeros.

Remove obsolete code that used to maintain statistics on per-device basis,
as now it is reported be per-CID and current.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:35 -04:00
Vladimir Kondratiev b7cde47009 wil6210: convert debugfs to the table mode
Define tables for similar file entries, i.e.
- table for debugfs_create_file
- table for static parameters
- table for parameters that are members of "wil" structure
- table for blobs
- table for interrupt controllers

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:34 -04:00
Vladimir Kondratiev 6afd60055d wil6210: Workaround for Sparrow with bad device id
If firmware broken on the boot time, Sparrow card enumerates as
device 0x302 instead of 0x310. Allow using this ID

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:33 -04:00
Vladimir Kondratiev 520d68e7cf wil6210: wait longer for hardware reset completion
Typical time for hardware reset, as measured, is about 200..250 msec.
Adjust sleeping to use more relaxed msleep, increase sleep interval
and increase total sleep time to be about 1sec

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:33 -04:00
Vladimir Kondratiev bbb2adc7b4 wil6210: check error in wil_target_reset()
When resetting target in wil_target_reset(), error may occur.
Indicate error via error code. In case of error, don't attempt to further
interact with card, specifically don't attempt firmware download or
interrupts enabling.

Move wil_rx_fini() to be always executed to prevent memory leak.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:32 -04:00
Vladimir Kondratiev 02525a7925 wil6210: update copyright year 2014
Fix Copyright headers in all files changed in 2014, to mention 2014

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:31 -04:00
Vladimir Kondratiev cc9e4a2b66 wil6210: fix race in reset
It is important to halt USER CPU first, then MAC CPU
Otherwise, race happens in the firmware

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:30 -04:00
Vladimir Kondratiev 91b775edf7 wil6210: map MAC timer for packet lifetime into debugfs
expose reading RGF_MAC_MTRL_COUNTER_0 in debugfs

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:30 -04:00
Hans Wennborg e2261afd4c mwifiex: fix decimal printf format specifiers prefixed with 0x
The prefix suggests the number should be printed in hex, so use
the %x specifier to do that.

Found by using regex suggested by Joe Perches.

Signed-off-by: Hans Wennborg <hans@hanshq.net>
Acked-by: Avinash Patil <patila@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:17:29 -04:00
Himangi Saraogi 26c0604628 cw1200: Introduce the use of devm_kzalloc
This patch introduces the use of devm_kzalloc and does away with the
kfrees in the probe and remove functions.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:00:43 -04:00
Himangi Saraogi 6040aa70c3 net: wireless: wl1251: Remove unnecessary free_irq
This patch does away with free_irq in the remove function as the irq is
allocated with a devm_request_irq.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:00:43 -04:00
Rafał Miłecki 8615eb2870 b43: N-PHY: support setting custom TX power
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:00:43 -04:00
Rafał Miłecki ec76643b00 b43: implement PPR (Power Per Rate) management/API
Broadcom hardware supports auto-adjustment of TX power depending on the
currently used rate. So far all calculations were handled without any
helpers (API) using big arrays and magic offsets.
It seems Broadcom recently decided to clean this up by developing PPR.
Their wlc_ppr.h can be found in open parts of the SDK.
As we plan to implement support for rate-based TX power it makes sense
to also implement our version of PPR as well.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:00:43 -04:00
Rafał Miłecki a68c356bcf b43: N-PHY: add RF power tables for radio 0x2057 revs 9 & 14
Don't write them as we don't have gains configured correctly yet.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:00:43 -04:00
Rafał Miłecki 33df85f662 b43: N-PHY: update rev3+ gain control workarounds
This fixes workarounds on rev 6+ and cleans code slightly.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:00:42 -04:00
Rafał Miłecki 25c1556663 b43: flush some writes on Broadcom MIPS SoCs
Access to PHY and radio registers is indirect on Broadcom hardware and
it seems that addressing on some MIPS SoCs may require flushing. So far
this problem was noticed on 0x4716 SoC only (marketing names: BCM4717,
BCM4718).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:00:42 -04:00
Rafał Miłecki d342b95dd7 b43: don't duplicate common PHY read/write ops
Most of the PHYs use the same way of accessing registers, so move that
code to the shared place. An exception is G-PHY which sometimes access
A-PHY regs and requires special handling.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:00:42 -04:00
Rafał Miłecki 6247d2aa51 b43: update flushing many writes performed in a row
Flush radio writes as well and add some tiny optimizations (e.g.
masksetting PHY reg involves reading it, so reset the counter).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-08-25 16:00:42 -04:00
John W. Linville 07bc788424 Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next 2014-08-25 15:58:02 -04:00
Michal Kazior 61e9aab7a1 ath10k: flush hif buffers before recovery
Transport buffers weren't flushed and processed
before queueing hw recovery request to mac80211.

This could in theory result in an unwanted htt/wmi
rx events being processed while mac80211 recovers
the device and possibly interfere or even crash
the system.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:32:28 +03:00
Michal Kazior 53b4e07354 ath10k: remove ar_pci->started
There are basically no more uses for
ar_pci->started. It is also perfectly safe to call
hif_stop without hif_start now.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:32:17 +03:00
Michal Kazior cf5dd36d96 ath10k: ignore ar_pci->started in pipe cleanup
Structures used by these functions are now
guaranteed to remain accessible until driver is
unregistered.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:32:09 +03:00
Michal Kazior 10d23db44a ath10k: update comment regarding warm reset
The old comment was a little out of date. HTT Rx
ring is a more relevant problem when stopping
transport layer.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:31:58 +03:00
Michal Kazior 728f95eef5 ath10k: rework posting pci rx buffers
It was possible on a host system running low on
memory to end up with no rx buffers on pci pipes.

This makes the driver more robust as it won't fail
to start if it can't allocate all rx buffers right
away. If it is fatal then upper layers will notice
trouble anyway.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:31:47 +03:00
Michal Kazior 5c771e7454 ath10k: remove early irq handling
It's not really necessary to have a dedicated irq
handler just for the sake of catching early fw
crashes anymore. It is now safe to use one handler
even during early stages of device boot up.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:29:49 +03:00
Michal Kazior ec5ba4d3b6 ath10k: make sure to really disable irqs
This fixes two corner cases.

One is a race between disabling copy engine
interrupts and unhandled pending interrupts on the
host. This could end up with a runaway tasklet and
consequently memory leak of a few copy engine
rx buffers.

The other one is an unexpected (and non-maskable
via device CSR) MSI fw indication interrupt during
teardown. This could trigger the same problem as
the first corner case.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:28:56 +03:00
Michal Kazior 145cc1214a ath10k: split ce irq/handler setup
It doesn't make much sense to overwrite send_cb
and recv_cb callbacks over and over again whenever
transport starts. Just make sure to unmask copy
engine interrupts when starting.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:28:42 +03:00
Michal Kazior 403d627be9 ath10k: setup irq method in probe
It doesn't make sense to re-init irqs completely
whenever transport is started/stopped. Do it just
once upon probing/removing.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:28:33 +03:00
Michal Kazior c947a9e1c7 ath10k: fix legacy irq workaround
Wrong register was being set up. This could
prevent firmware from booting in some rare cases
when using legacy interrupts.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:28:26 +03:00
Michal Kazior 8079de0dae ath10k: move fw init print
Firmware probing is done only once when driver is
registered and firmware version is guaranteed to
remain the same until driver is unregistered.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:28:13 +03:00
Kalle Valo 8a0c797edb ath10k: print more driver info when firmware crashes
Sometimes users forget to include important info like firmware version,
so better to print all the info.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:24:04 +03:00
Kalle Valo 0e9848c0ec ath10k: rename ath10k_pci_hif_dump_area() to ath10k_pci_fw_crashed_dump()
Better to have a clear name for the function. While at it, clear up the title
for the register dump.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:23:55 +03:00
Ben Greear 384914b2e5 ath10k: provide firmware crash info via debugfs
Store the firmware registers and other relevant data to a firmware crash dump
file and provide it to user-space via debugfs. Should help with figuring out
why the firmware crashed.

kvalo: remove dbglog support, rework and refactor the code to avoid ifdefs and
otherwise simplify it as well

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:23:24 +03:00
Kalle Valo 3d29a3e042 ath10k: add ath10k_pci_diag_* helpers
ath10k_pci_diag_read32() is for reading u32 from a device and ath10k_pci_diag_read_hi()
is a helper for reading data using "host interest" table.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2014-08-25 11:23:16 +03:00