openwrt/staging/blogic.git
9 years agoath10k: change the fw stats access mask
Yanbo Li [Wed, 1 Apr 2015 19:53:21 +0000 (22:53 +0300)]
ath10k: change the fw stats access mask

This fix the regerssion introduced after "ath10k_wmi_requests_stats()
call to use more stat bits", both the 10.2.X FW and community FW 10.1.X
will return time out when access the fw_stats with the STAT_VDEV and
STAT_PDEV. Add the condition to use different fw_stats mask for different
FW versions.

Fixes: 7777d8c7ef6f ("ath10k: implement fw stats for wmi-tlv")
Signed-off-by: Yanbo Li <yanbol@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix static wep with more than 1 key in client mode
Michal Kazior [Wed, 1 Apr 2015 19:53:20 +0000 (22:53 +0300)]
ath10k: fix static wep with more than 1 key in client mode

The default keyidx callback may be called after
more than 1 key is installed. This led to only 1
WEP key being reinstalled only. This caused Rxed
traffic encrypted with other WEP keys to be
dropped in client mode.

Tested-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix arvif->wep_keys clearing
Michal Kazior [Wed, 1 Apr 2015 19:53:19 +0000 (22:53 +0300)]
ath10k: fix arvif->wep_keys clearing

The variable should be cleared regardless of
whether there's a peer associated with the key or
not.

This fixes case when user first associates with 2
WEP keys and then disconnects and connects with 1
WEP key. This resulted in WEP key count being 2 in
the driver leading to default keyidx fixup
failure.

Tested-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: replenish htc tx credits always
Michal Kazior [Wed, 1 Apr 2015 19:53:19 +0000 (22:53 +0300)]
ath10k: replenish htc tx credits always

There's always at most 2 credits and it makes
little sense to set the
ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE flag
conditionally.

This seems to fix some random issues with tx
credit starvation on WLAN.RM.2.0-00073 I've been
seeing. Note: this isn't related to wmi mgmt tx.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix insufficient tracing buffer size
Michal Kazior [Wed, 1 Apr 2015 19:53:19 +0000 (22:53 +0300)]
ath10k: fix insufficient tracing buffer size

Some trace messages were truncated and a kernel
splat could be seen in the log:

  WARNING: CPU: 3 PID: 0 at /devel/src/linux/drivers/net/wireless/ath/ath10k/./trace.h:114 ftrace_raw_event_ath10k_log_dbg+0x20e/0x220 [ath10k_core]()
  Modules linked in: ath10k_pci(O) ath10k_core(O) ath iwldvm iwlwifi [last unloaded: iwlwifi]
  CPU: 3 PID: 0 Comm: swapper/3 Tainted: G        W  O    4.0.0-rc3-wl-ath+ #703
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
   ffffffffa01d4cb0 ffff88001fd83998 ffffffff8191b86c ffffffff81e3b718
   0000000000000000 ffff88001fd839d8 ffffffff8105573a ffff88001c0a5528
   ffff88001bea9ae0 ffff88001c3dd940 00000000000d0018 ffff88001fd83a80
  Call Trace:
   <IRQ>  [<ffffffff8191b86c>] dump_stack+0x45/0x57
   [<ffffffff8105573a>] warn_slowpath_common+0x8a/0xc0
   [<ffffffff8105582a>] warn_slowpath_null+0x1a/0x20
   [<ffffffffa01c61fe>] ftrace_raw_event_ath10k_log_dbg+0x20e/0x220 [ath10k_core]
   [<ffffffffa01aaa6b>] ath10k_dbg+0xbb/0xd0 [ath10k_core]
   [<ffffffff810eed89>] ? trace_clock_local+0x9/0x10
   [<ffffffffa01bd069>] ath10k_wmi_event_service_ready+0x479/0x520 [ath10k_core]
   [<ffffffff810fdf90>] ? trace_buffer_unlock_commit+0x50/0x60
   [<ffffffffa01c2113>] ath10k_wmi_tlv_op_rx+0x6b3/0x8b0 [ath10k_core]

This could be reproduced with:

  trace-cmd record -e ath10k
  ifconfig wlan0 down
  ifconfig wlan0 up

Fixes: 5c01aa3de918 ("ath10k: deduplicate wmi service ready logic")
Fixes: ca996ec56608 ("ath10k: implement wmi-tlv backend")
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: disable burst mode
Janusz Dziedzic [Wed, 1 Apr 2015 19:53:18 +0000 (22:53 +0300)]
ath10k: disable burst mode

Firmwares that indicate BURST_SERVICE as enabled
could overwrite some wmm parameters (eg. txop).
This could lead IOT and balancing issues.
Hence disable this by default.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix IBSS scanning on wmi-tlv and qca6174
Michal Kazior [Tue, 24 Mar 2015 13:14:03 +0000 (13:14 +0000)]
ath10k: fix IBSS scanning on wmi-tlv and qca6174

WLAN.RM.2.0-00073 firmware requires self-peer to
be created prior to issuing scan command. Without
this wmi-tlv with qca6174 firmware crashes after
submitting a scan request.

Creating the peer as soon as add_interface()
shouldn't be a problem.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: clean up set_bitrate_mask handling
Michal Kazior [Tue, 31 Mar 2015 10:49:20 +0000 (10:49 +0000)]
ath10k: clean up set_bitrate_mask handling

The code was a bit convoluted. Clean it up and
prepare for future changes.

While at it this fixes incorrect verification of
'single nss' case when ss2 rates were missing
while ss1 and ss3 were requested resulting in
nss=3 being set:

  iw wlan1 set bitrates legacy-5 ht-mcs-5 0 1 2 3 4 5 6 7 16 17 18 19 20 21 22 23 vht-mcs-5 1:0-9 3:0-9

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: allocate fw resources for iface combinations
Michal Kazior [Tue, 31 Mar 2015 10:26:26 +0000 (10:26 +0000)]
ath10k: allocate fw resources for iface combinations

The number of 3 vdevs wasn't enough to handle the
worst case for interface combinations in practice.

wpa_supplicant may need up to 4 vifs to have 2
vifs actually connected, i.e. p2pdev + client + 2x
p2p (either p2p client or p2p go).

This fixes worst case warning:

  Free vdev map is empty, no more interfaces allowed.

This keeps the ability to associate 32 stations in
AP mode at the cost of not being able to guarantee
that under all circumstances, i.e. some
combinations may consume additional fw peer
entries for internal purposes leaving less
resource for stations in AP mode.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: enable multi-channel on supported devices
Michal Kazior [Tue, 31 Mar 2015 10:26:25 +0000 (10:26 +0000)]
ath10k: enable multi-channel on supported devices

This effectively enables multi-channel operation
on qca6174 WLAN.RM.2.0-00073 (and possibly any
newer firmware release for qca6174).

This adds appopriate interface combinations and
initializes firmware channel scheduler.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: implement tx pause wmi event
Michal Kazior [Tue, 31 Mar 2015 10:26:24 +0000 (10:26 +0000)]
ath10k: implement tx pause wmi event

qca6174 wmi-tlv firmware defines a new wmi event
for host tx pausing (i.e. stop/wake tx queues).

Map these events to ath10k/mac80211 tx queue
control.

This is important for multi-channel throughput
performance.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: rework tx queue locking
Michal Kazior [Tue, 31 Mar 2015 10:26:23 +0000 (10:26 +0000)]
ath10k: rework tx queue locking

Tx queue locking was very simple until now.
Multi-channel support will require a more flexible
and fine grained control.

This introduces a per-hw and per-vif (each with a
bitmask of reasons) tx queue locking.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: implement adaptive qcs command
Michal Kazior [Tue, 31 Mar 2015 10:26:22 +0000 (10:26 +0000)]
ath10k: implement adaptive qcs command

This command will be used to configure
multi-channel scheduler in firmware.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: implement chanctx API
Michal Kazior [Tue, 31 Mar 2015 10:26:21 +0000 (10:26 +0000)]
ath10k: implement chanctx API

The chanctx API will allow ath10k to support
multi-channel operation.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: allow empty ssid vdev config
Michal Kazior [Tue, 31 Mar 2015 10:26:20 +0000 (10:26 +0000)]
ath10k: allow empty ssid vdev config

It doesn't make much sense to reject a valid
firmware configuration combination.

Since SSID isn't known early on it might make
sense to allow driver to start vdev without SSID
and restart it later.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: don't call quiet mode if it's not implemented
Michal Kazior [Tue, 24 Mar 2015 12:40:17 +0000 (12:40 +0000)]
ath10k: don't call quiet mode if it's not implemented

qca6174 and wmi-tlv doesn't have quiet mode
implemented. Don't even attempt to call it. This
fixes a warning when bringing first interface up:

  failed to set quiet mode period 100 duarion 0 enabled 0 ret -95

Fixes: 8515b5c79a54 ("ath10k: configure thermal throttle while powering up")
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix survey reporting
Michal Kazior [Tue, 24 Mar 2015 12:38:11 +0000 (12:38 +0000)]
ath10k: fix survey reporting

Number of channels is stored in a separate macro
in a header file and channel list is constructed
independently. The macro is used to define survey
array.

This fixes a recent regression introduced after
adding support for 144 channel. The regression
would lead to a warning and incomplete survey data
on channel 165:

  chan info: invalid frequency 5825 (idx 38 out of bounds)

Also make sure to enforce the sizes and avoid this
kind of problem in the future.

Fixes: 4a7898fed5f3 ("ath10k: enable channel 144 on 5GHz band")
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: harmonize error case handling in ath10k_core_start
Nicholas Mc Guire [Mon, 30 Mar 2015 12:39:21 +0000 (15:39 +0300)]
ath10k: harmonize error case handling in ath10k_core_start

All of the bringup/init functions called in ath10k_core_start return 0
on success and != 0 on failure. ath10k_wmi_wait_for_service_ready(),
ath10k_wmi_wait_for_unified_ready() and their call sites were adjusted
to fit this model.
The return type of wait_for_completion_timeout is unsigned long not int so
ath10k_wmi_wait_for_service_ready() and ath10k_wmi_wait_for_unified_ready()
were fixed up accordingly.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: core: match wait_for_completion_timeout return type
Nicholas Mc Guire [Mon, 30 Mar 2015 12:39:21 +0000 (15:39 +0300)]
ath10k: core: match wait_for_completion_timeout return type

Return type of wait_for_completion_timeout is unsigned long not int.
An appropriately named unsigned long is added and the assignments fixed up.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: thermal: match wait_for_completion_timeout return type
Nicholas Mc Guire [Mon, 30 Mar 2015 12:39:20 +0000 (15:39 +0300)]
ath10k: thermal: match wait_for_completion_timeout return type

Return type of wait_for_completion_timeout is unsigned long not int.
An appropriately named unsigned long is added and the assignments fixed up.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: debug: match wait_for_completion_timeout return type
Nicholas Mc Guire [Mon, 30 Mar 2015 12:39:20 +0000 (15:39 +0300)]
ath10k: debug: match wait_for_completion_timeout return type

Return type of wait_for_completion_timeout is unsigned long not int.
An appropriately named unsigned long is added and the assignments fixed up.
Missing spaces 1*HZ -> 1 * HZ were also added along the way.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: htc: match wait_for_completion_timeout return type
Nicholas Mc Guire [Mon, 30 Mar 2015 12:39:20 +0000 (15:39 +0300)]
ath10k: htc: match wait_for_completion_timeout return type

Return type of wait_for_completion_timeout is unsigned long not int.
An appropriately named unsigned long is added and the assignments fixed up.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: mac: match wait_for_completion_timeout return type
Nicholas Mc Guire [Mon, 30 Mar 2015 12:39:19 +0000 (15:39 +0300)]
ath10k: mac: match wait_for_completion_timeout return type

Return type of wait_for_completion_timeout is unsigned long not int.
An appropriately named unsigned long is added, respectively 'ret'
renamed, and the assignments fixed up.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix aid setup in station mode
Michal Kazior [Mon, 30 Mar 2015 06:51:57 +0000 (09:51 +0300)]
ath10k: fix aid setup in station mode

While debugging something else I noticed AID was
set to 0. This could lead to powersave issues in
station mode. Maybe this isn't really necessary
but set it properly just to be sure.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: document ofdm/5ghz rate offset with a macro
Michal Kazior [Mon, 30 Mar 2015 06:51:57 +0000 (09:51 +0300)]
ath10k: document ofdm/5ghz rate offset with a macro

Don't use literal values for offsets. While at it
rename a function so it is more clear what it
checks for.

This finally takes care of the last magic
5GHz/OFDM offset.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: deduplicate bitrate to rate idx conversion
Michal Kazior [Mon, 30 Mar 2015 06:51:56 +0000 (09:51 +0300)]
ath10k: deduplicate bitrate to rate idx conversion

It's possible to derive rate index from bitrate
without any additional mapping structures/logic.

This should have little to none impact on
performance since this is only done for management
frames and the previous approach wasn't
particularly optimized.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: rework legacy rx rate decoding
Michal Kazior [Mon, 30 Mar 2015 06:51:56 +0000 (09:51 +0300)]
ath10k: rework legacy rx rate decoding

Instead of using a hacky table and magic values
use supported band information advertised to
mac80211.

This may impact performance a little when dealing
with legacy rx rates depending on system
architecture. It's probably negligible.

This also fixes a highly theoretical corner case
when HT/VHT rates weren't reported correctly if
channel frequency wasn't known.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: simplify fixed rate selection
Michal Kazior [Mon, 30 Mar 2015 06:51:56 +0000 (09:51 +0300)]
ath10k: simplify fixed rate selection

Use the existing ieee80211_rate array instead of
definining separate one. This gets rid of the ugly
4-index offset when dealing with 5GHz band.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: use hw rate definitions for fixed rate
Michal Kazior [Mon, 30 Mar 2015 06:51:55 +0000 (09:51 +0300)]
ath10k: use hw rate definitions for fixed rate

Using raw values is discouraged. Having
defines/enums is preferred.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: add hw rate definitions
Michal Kazior [Mon, 30 Mar 2015 06:51:55 +0000 (09:51 +0300)]
ath10k: add hw rate definitions

Prepare defines for future use.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: drop RATETAB_ENT macro
Michal Kazior [Mon, 30 Mar 2015 06:51:54 +0000 (09:51 +0300)]
ath10k: drop RATETAB_ENT macro

It was superfluous and confusing. It's better to
define the structure explicitly.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: derive rate from bitrate
Michal Kazior [Mon, 30 Mar 2015 06:51:54 +0000 (09:51 +0300)]
ath10k: derive rate from bitrate

There's no need to store rate values in hw_value.
This frees up the hw_value for better future use.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: move rate definitions to file start
Michal Kazior [Mon, 30 Mar 2015 06:51:54 +0000 (09:51 +0300)]
ath10k: move rate definitions to file start

Prepare the code for future changes so that new
code can refer to rate-related stuff without
forward declarations.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: introduce basic tdls functionality
Marek Puzyniak [Mon, 30 Mar 2015 06:51:53 +0000 (09:51 +0300)]
ath10k: introduce basic tdls functionality

This patch introduces tdls without tdls peer uapsd and tdls channel switching.
Transmitting tdls data frames works only for ethernet type frames, that's why
data addressed to tdls sta is in ethernet format.

This patch depends on commit c23e31cf7b55 ("mac80211: initialize rate control
earlier for tdls station").

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Marek Kwaczynski <marek.kwaczynski@tieto.com>
Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: add wmi support for tdls
Marek Puzyniak [Mon, 30 Mar 2015 06:51:53 +0000 (09:51 +0300)]
ath10k: add wmi support for tdls

As a part of tdls implementation introduce
tdls related wmi data structures, constant
values and functions.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: update station counting
Marek Puzyniak [Mon, 30 Mar 2015 06:51:52 +0000 (09:51 +0300)]
ath10k: update station counting

Currently station counting functions
(inc_num_stations/dec_num_stations) does not handle
tdls type of stations. Tdls station should be counted
because it consumes peer in firmware. Only not tdls
stations are excluded from this counting.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: store max tdls vdevs that fw can handle
Marek Puzyniak [Mon, 30 Mar 2015 06:51:52 +0000 (09:51 +0300)]
ath10k: store max tdls vdevs that fw can handle

Currently number of tdls vdevs supported by firmware
is hardcoded. For future usage it is stored in ath10k
structure based on defined value.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: make peer type configurable
Marek Puzyniak [Mon, 30 Mar 2015 06:51:52 +0000 (09:51 +0300)]
ath10k: make peer type configurable

Peer type was hardcoded to default value.
For future implementation it is required
to make is configurable.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Marek Kwaczynski <marek.kwaczynski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: unify tx mode and dispatch
Michal Kazior [Mon, 30 Mar 2015 06:51:51 +0000 (09:51 +0300)]
ath10k: unify tx mode and dispatch

There are a few different tx paths depending on
firmware and frame itself.

Creating a uniform decision will make it possible
to switch between different txmode easier, both
for testing and for future features as well.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: clear htt.freq
Michal Kazior [Mon, 30 Mar 2015 06:51:51 +0000 (09:51 +0300)]
ath10k: clear htt.freq

If htt.freq isn't cleared and contains garbage fw
may discard tx packets. Prevent this from
happening by clearing htt.freq properly.

Possible manifestation of the problem could be not
being able to send auth request/response frames on
firmware with HTT >= 3.4 (when freq param was
introduced), e.g. on qca6174.

Fixes: 8d6d36243610 ("ath10k: fix offchan reliability")
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix HTT op backwards compatibility for QCA6174
Kalle Valo [Mon, 30 Mar 2015 11:14:28 +0000 (14:14 +0300)]
ath10k: fix HTT op backwards compatibility for QCA6174

Commit 8348db298496 ("ath10k: add ATH10K_FW_IE_HTT_OP_VERSION") broke QCA6174
receive side as the HTT ids from ATH10K_FW_HTT_OP_VERSION_MAIN don't have
HTT_TLV_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND set. Fix this by adding a backwards
compatibility code which sets HTT op version if it's not set by the firmware
image.

Fixes: 8348db298496 ("ath10k: add ATH10K_FW_IE_HTT_OP_VERSION")
Reported-by: Michal Kazior <michal.kazior@tieto.com>
Tested-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoMerge mac80211-next into ath-next
Kalle Valo [Mon, 30 Mar 2015 07:07:12 +0000 (10:07 +0300)]
Merge mac80211-next into ath-next

Patch "ath10k: introduce basic tdls functionality" depends on this mac80211
patch:

c23e31cf7b55 mac80211: initialize rate control earlier for tdls station

9 years agoath10k: bump up FW API to 5
Kalle Valo [Wed, 25 Mar 2015 11:12:42 +0000 (13:12 +0200)]
ath10k: bump up FW API to 5

Firmware 10.2.4.48-3 now supports management frames over HTT feature and has
ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX. But as 10.2.4 branch has conflicting HTT ids
patch "ath10k: add ATH10K_FW_IE_HTT_OP_VERSION" is needed to fix the issue.
Older ath10k versions don't have support that support and to maintain backwards
compatibility we need bump up the FW API to 5 not break older versions.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: add ATH10K_FW_IE_HTT_OP_VERSION
Rajkumar Manoharan [Wed, 25 Mar 2015 11:12:27 +0000 (13:12 +0200)]
ath10k: add ATH10K_FW_IE_HTT_OP_VERSION

Target to host HTT messages are conflicting between 10.x and other
firmware revisions. By maintaining separate HTT T2H tables for each
firmware revisions (main, 10x and tlv) similar to WMI abstraction,
solves the conflicts. Add ATH10K_FW_IE_HTT_OP_VERSION so that the firmware can
advertise the HTT interface to ath10k.

This fix is needed to get management frames over HTT (ie.
ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX disabled) working with 10.2.4.48-2 firmware.
Otherwise there will be unknown htt events and nothing works:

[30087.438343] ath10k_pci 0000:02:00.0: htt event (19) not handled
[30087.448691] ath10k_pci 0000:02:00.0: htt event (19) not handled
[30149.032974] ath10k_pci 0000:02:00.0: htt event (19) not handled

If the firmware does not have ATH10K_FW_IE_HTT_OP_VERSION use the main HTT
interface. That way old firmware images will still work.

Cc: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: add WOW patterns support
Janusz Dziedzic [Mon, 23 Mar 2015 15:32:54 +0000 (17:32 +0200)]
ath10k: add WOW patterns support

Add patterns support for WOW.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: add WMI support for WOW patterns
Janusz Dziedzic [Mon, 23 Mar 2015 15:32:54 +0000 (17:32 +0200)]
ath10k: add WMI support for WOW patterns

Add WMI support for WOW patterns.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: add WOW disconnect/magic-packet support
Janusz Dziedzic [Mon, 23 Mar 2015 15:32:53 +0000 (17:32 +0200)]
ath10k: add WOW disconnect/magic-packet support

Add support for WOW disconnect and magic-packet.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: add WMI support for WOW
Janusz Dziedzic [Mon, 23 Mar 2015 15:32:53 +0000 (17:32 +0200)]
ath10k: add WMI support for WOW

Add WMI support for WOW like enable,
wakeup events and host wakeup indication.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: allow user to toggle ani_enable via debugfs
Ashok Raj Nagarajan [Thu, 19 Mar 2015 11:08:00 +0000 (16:38 +0530)]
ath10k: allow user to toggle ani_enable via debugfs

Now that ANI is enabled by default, allow user to disable or enable ANI feature
from debugfs

echo 0|1 > /sys/kernel/debug/ieee80211/phyX/ath10k/ani_enable

Signed-off-by: Ashok Raj Nagarajan <arnagara@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: enable Adaptive Noise Immunity (ANI) by default
Ashok Raj Nagarajan [Thu, 19 Mar 2015 11:07:59 +0000 (16:37 +0530)]
ath10k: enable Adaptive Noise Immunity (ANI) by default

ANI helps to improve connectvity and performance in a noisy environment.
Enabling this feature would help the user experience a better and stable
wireless connection in a noisy environmnet. This feature is currently not
enabled for ath10k. Enable this feature by default.

Signed-off-by: Ashok Raj Nagarajan <arnagara@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: enable channel 144 on 5GHz band
Peter Oh [Wed, 18 Mar 2015 18:39:18 +0000 (11:39 -0700)]
ath10k: enable channel 144 on 5GHz band

Enable channel 144 on 5GHz band since 802.11ac introduced it.

Signed-off-by: Peter Oh <poh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: move driver state check before setting throttle
Rajkumar Manoharan [Sun, 15 Mar 2015 15:06:25 +0000 (20:36 +0530)]
ath10k: move driver state check before setting throttle

Since thermal daemon is unaware of the device state, it might
try to adjust the throttle state when the device is powered down.
So the driver caches the value and will configure it while
powering up the target. The cached value will be programed later
once the device is brought up. In such case, returning error
status is confusing and misleading the user application. Hence
moving the driver state check before sending wmi command to target.

Reported-by: Matthias Kaehlcke <mka@google.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: cache throttle state when device is down
Rajkumar Manoharan [Sun, 15 Mar 2015 15:06:24 +0000 (20:36 +0530)]
ath10k: cache throttle state when device is down

Allow driver to cache the throttle state when the devie is not
yet started. Configure the cached throttle state while powering
up the device. Since thermal daemon is unaware of the up/down cycle,
it assumes that device is throttled.

Reported-by: Matthias Kaehlcke <mka@google.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: do not restrict thermal throttling to ap mode
Rajkumar Manoharan [Sun, 15 Mar 2015 15:06:23 +0000 (20:36 +0530)]
ath10k: do not restrict thermal throttling to ap mode

Recently thermal mitigation is validated in station mode as well.
Hence allowing thermal throttling for all interfaces. This enables
user to validate thermal mitigation with different modes.

Reported-by: Matthias Kaehlcke <mka@google.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: configure thermal throttle while powering up
Rajkumar Manoharan [Sun, 15 Mar 2015 15:06:22 +0000 (20:36 +0530)]
ath10k: configure thermal throttle while powering up

Thermal throttling is not handled in software restart and device
bootup. Also it needs to be configured whenever quiet period got
updated. Fix that.

Reported-by: Matthias Kaehlcke <mka@google.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix interpretation of cooling device state
Rajkumar Manoharan [Sun, 15 Mar 2015 15:06:21 +0000 (20:36 +0530)]
ath10k: fix interpretation of cooling device state

Setting the sysfs attribute ends up configuring the duty cycle,
but the interface through which the attribute is exposed
(cooling_device) is for setting the throttle/cooling state. This
is confusing the user. Hence renaming the cooling device interfaces
for better readability.

Cc: Matthias Kaehlcke <mka@google.com>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: add debugfs entry to configure quiet period
Rajkumar Manoharan [Sun, 15 Mar 2015 15:06:20 +0000 (20:36 +0530)]
ath10k: add debugfs entry to configure quiet period

Add support to configure quiet period (in milliseconds) via debugfs.
This is useful to experiment different quiet period values along with
different throttle ratio.

echo 100 > /sys/kernel/debug/ieee80211/phyX/ath10k/quiet_period

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: increase station kickout threshold
Rajkumar Manoharan [Thu, 19 Mar 2015 14:03:29 +0000 (16:03 +0200)]
ath10k: increase station kickout threshold

Since the station kickout threshold is also counting software
reries (Default sw count in firmware is 16), increasing the threshold
to try with atleast 20 data frames before kicking out the station.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix rts profile for second rate series
Rajkumar Manoharan [Thu, 19 Mar 2015 14:03:29 +0000 (16:03 +0200)]
ath10k: fix rts profile for second rate series

By default rts protection is enabled in firmware for the second
rateset. Currently ath10k selects RTS profile (only for software
retries), when legacy stations are associated or asked by mac80211.
On congested environment, when AP is running in HT/VHT mode and
there are no legacy clients associated, this will impact the
robustness. Also enabling RTS protection only for second rateset will
not impact performance on clear environment. Fix that.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agocfg80211: add vlan to station add/change tracing
Johannes Berg [Fri, 20 Mar 2015 18:56:41 +0000 (19:56 +0100)]
cfg80211: add vlan to station add/change tracing

This helps debug issues with VLAN modifications that are otherwise
not really visible in any tracing/debugging.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agomac80211: avoid duplicate TX path station lookup
Johannes Berg [Fri, 20 Mar 2015 13:18:27 +0000 (14:18 +0100)]
mac80211: avoid duplicate TX path station lookup

Instead of looking up the destination station twice in the TX path
(first to build the header, and then for control processing), save
it when building the header and use it later in the TX path.

To avoid having to look up the station in the many callers, allow
those to pass %NULL which keeps the existing lookup.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agomac80211: mesh: avoid pointless station lookup
Johannes Berg [Fri, 20 Mar 2015 15:01:52 +0000 (16:01 +0100)]
mac80211: mesh: avoid pointless station lookup

In ieee80211_build_hdr(), the station is looked up to build the
header correctly (QoS field) and to check for authorization. For
mesh, authorization isn't checked here, and QoS capability is
mandatory, so the station lookup can be avoided.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agomac80211: drop 4-addr VLAN frames earlier if not connected
Johannes Berg [Fri, 20 Mar 2015 13:05:02 +0000 (14:05 +0100)]
mac80211: drop 4-addr VLAN frames earlier if not connected

If there's no station on the 4-addr VLAN interface, then frames
cannot be transmitted. Drop such frames earlier, before setting
up all the information for them.

We should keep the old check though since that code might be used
for other internally-generated frames.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agomac80211: don't look up destination station twice
Johannes Berg [Fri, 20 Mar 2015 12:29:29 +0000 (13:29 +0100)]
mac80211: don't look up destination station twice

There's no need to look up the destination station twice while
building the 802.11 header for a given frame if the frame will
actually be transmitted to the station we initially looked up.

This happens for 4-addr VLAN interfaces and TDLS connections, which
both directly send the frame to the station they looked up, though
in the case of TDLS some station conditions need to be checked.

To avoid that, add a variable indicating that we've looked up the
station that the frame is going to be transmitted to, and avoid the
lookup/flag checking if it already has been done.

In the TDLS case, also move the authorized/wme_sta flag assignment
to the correct place, i.e. only when that station is really used.
Before this change, the new lookup should always have succeeded so
that the potentially erroneous data would be overwritten.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agomac80211: remove drop_unencrypted code
Johannes Berg [Fri, 20 Mar 2015 10:37:36 +0000 (11:37 +0100)]
mac80211: remove drop_unencrypted code

This mechanism was historic, and only ever used by IBSS, which
also doesn't need to have it as it properly manages station's
802.1X PAE state (or, with WEP, always has a key.)

Remove the mechanism to clean up the code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agoath10k: setup maximum number of supported stations
Janusz.Dziedzic@tieto.com [Thu, 12 Mar 2015 12:11:41 +0000 (13:11 +0100)]
ath10k: setup maximum number of supported stations

Setup maximum number of associated stations supported in
AP/P2P_GO mode.

This allow hostapd/wpa_supplicant to play with that limit
and set more information (eg. P2P group limit bit for P2P_GO).

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: protect driver from unsolicited htc ep0 events
Michal Kazior [Wed, 11 Mar 2015 13:37:11 +0000 (14:37 +0100)]
ath10k: protect driver from unsolicited htc ep0 events

Some firmware revisions (tested with qca6174
rm2.0-00088) deliver unsolicited unknown (kind of
garbled) HTC ep0 event to host in some cases.

This issue was mainly observed with both qca988x
and qca6174 being installed on a single host
system. During driver probing if qca6174 booting
sequences were somehow deferred (e.g. by qca988x
implicitly making some resources busy presumably)
the unsolicited event would came around 1s after
ATH10K_HTC_MSG_READY_ID was delivered to host for
qca6174.

The unsolicited event would confuse driver and
cause HTT initialization (and subsequently
driver probing) to fail.

Make the ep0 event processing more robust. The
event will still be caught but instead will
only generate a warning now.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix wrong symlink name on error path
Rajkumar Manoharan [Thu, 12 Mar 2015 17:32:00 +0000 (19:32 +0200)]
ath10k: fix wrong symlink name on error path

Wrong symlink name is used on error path of thermal registration
and also correcting the error message.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: strip qos data bit always
Michal Kazior [Wed, 11 Mar 2015 13:25:26 +0000 (14:25 +0100)]
ath10k: strip qos data bit always

NativeWifi tx mode expects QoS Data frames to be
delivered as Data frames with QoS part (e.g. tid)
being delievered out-of-band in fw tx command.

The QoS bit wasn't stripped before submitting to
firmware.

Stripping fixes two known problems:

 * qca6174 IOT with some APs, e.g.
   Cisco AIR-AP 1252 (which would crash after
   ath10k association). Some ath9k APs would
   crash as well.

 * sniffing own tx frames via radiotap because,
   e.g. wireshark was seeing QoS bit set but
   since QoS Control was stripped in ath10k it
   would parse beginning of LLC/SNAP

>From debugability point of view this removes the
ability to distinguish QoS from non-QoS frames
when sniffing own tx via radiotap. On the other
hand frames can be now parsed correctly without
special software modification.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agomac80211: Get IV len from key conf and not cipher scheme
Cedric Izoard [Tue, 17 Mar 2015 10:47:33 +0000 (10:47 +0000)]
mac80211: Get IV len from key conf and not cipher scheme

When a key is installed using a cipher scheme, set a new
internal key flag (KEY_FLAG_CIPHER_SCHEME) on it, to allow
distinguishing such keys more easily.

In particular, use this flag on the TX path instead of
testing the sta->cipher_scheme pointer, as the station is
NULL for broad-/multicast message, and use the key's iv_len
instead of the cipher scheme information.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
[add missing documentation, rewrite commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agomac80211: IBSS: refactor ieee80211_rx_bss_info
Janusz.Dziedzic@tieto.com [Mon, 9 Mar 2015 06:58:15 +0000 (07:58 +0100)]
mac80211: IBSS: refactor ieee80211_rx_bss_info

Put station specific code in ieee80211_update_sta_info
function.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agomac80211: minstrel_ht: fix rounding issue in MCS duration calculation
Felix Fietkau [Fri, 13 Mar 2015 09:54:44 +0000 (10:54 +0100)]
mac80211: minstrel_ht: fix rounding issue in MCS duration calculation

On very high MCS bitrates, the calculated duration of rates that are
next to each other can be very imprecise, due to the small packet size
used as reference (1200 bytes).
This is most visible in VHT80 nss=2 MCS8/9, for which minstrel shows the
same throughput when the probability is also the same. This leads to a
bad rate selection for such rates.

Fix this issue by introducing an average A-MPDU size factor into the
calculation.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agocfg80211: Process all pending regulatory requests/hints
Ben [Thu, 12 Mar 2015 13:37:34 +0000 (09:37 -0400)]
cfg80211: Process all pending regulatory requests/hints

It is possible that there are several regulatory requests
pending, but the processing of the last one does not call
CRDA, and thus the other requests are not handled.

Fix this by rescheduling the work until all requests have
been processed.

Signed-off-by: Ben Rosenfeld <ben.rosenfeld@intel.com>
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agomac80211: initialize rate control earlier for tdls station
Marek Puzyniak [Sun, 8 Mar 2015 16:04:22 +0000 (18:04 +0200)]
mac80211: initialize rate control earlier for tdls station

Currently when TDLS station in driver goes from authenticated
to associated state it can not use rate control parameters
because rate control is not initialized yet. Some drivers
require parameters already initialized by rate control when
entering associated state. It can be done by initializing
rate control after station transition to associated state but
before notifying driver about that.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
[fix comment to say 'associated' instead of 'authorized']
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agomac80211: refactor drop connection/unlock in CSA processing
Johannes Berg [Thu, 12 Mar 2015 06:53:25 +0000 (08:53 +0200)]
mac80211: refactor drop connection/unlock in CSA processing

The schedule_work()/mutex unlocking code is duplicated many times,
refactor that to a common place in the function.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agomac80211: allow to get wireless_dev structure from ieee80211_vif
Emmanuel Grumbach [Thu, 12 Mar 2015 06:53:24 +0000 (08:53 +0200)]
mac80211: allow to get wireless_dev structure from ieee80211_vif

This will allow mac80211 drivers to call cfg80211 APIs with
the right handle.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agomac80211: add comment for rx_path_lock
Johannes Berg [Mon, 16 Mar 2015 08:08:20 +0000 (09:08 +0100)]
mac80211: add comment for rx_path_lock

Add a comment explaining how the RX path lock is used.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agomac80211: move netdev stats to common function
Johannes Berg [Mon, 16 Mar 2015 08:05:23 +0000 (09:05 +0100)]
mac80211: move netdev stats to common function

Move the netdev stats accounting into the common function
ieee80211_deliver_skb() that is called in both places.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agoath10k: fix PMF by using AES-CMAC/IGTK software crypto
Bartosz Markowski [Tue, 10 Mar 2015 13:32:19 +0000 (14:32 +0100)]
ath10k: fix PMF by using AES-CMAC/IGTK software crypto

While testing with older supplicant, .drv_set_key() was failing due to
higher than ath10k firmware could handle key_index (WMI_MAX_KEY_INDEX == 3).

--
wpa_driver_nl80211_set_key: ifindex=15 alg=4 addr=0x7f02b129fbe3 key_idx=4 set_tx=0 seq_len=6 key_len=16
    broadcast key
nl80211: set_key failed; err=-22 Invalid argument)
wlan0: WPA: Failed to configure IGTK to the driver
wlan0: RSN: Failed to configure IGTK
--

In order to fix this case (PMF: AES-CMAC/IGTK) force the AES_CMAC cipher to
be handled by software.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: add hw connection monitor support
Michal Kazior [Tue, 10 Mar 2015 14:22:01 +0000 (16:22 +0200)]
ath10k: add hw connection monitor support

Some firmware revisions (e.g. qca6174 with fw73)
don't deliver beacons to host reliably. This
causes random disconnects even in perfect
conditions. This is most visible with
multi-channel operation.

All available firmware revisions seem to support
beacon miss offloading so there shouldn't be any
problems.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: implement wmi roam event
Michal Kazior [Tue, 10 Mar 2015 14:21:54 +0000 (16:21 +0200)]
ath10k: implement wmi roam event

This can be used to implement offloaded rssi
threshold, beacon miss or even automatic
in-firmware BSS roaming in the future.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix WPA crypto
Michal Kazior [Mon, 9 Mar 2015 13:24:17 +0000 (14:24 +0100)]
ath10k: fix WPA crypto

Commit 370e567363e6 ("ath10k: fix broken traffic for 802.1x in client mode")
introduced a regression on WPA crypto. All keys were treated as if they were
WEP which resulted in WPA being incorrectly installed to fw/hw and subsequently
no traffic.

Reported-by: Marek Puzyniak <marek.puzyniak@tieto.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix CAC regression
Michal Kazior [Mon, 9 Mar 2015 13:20:55 +0000 (14:20 +0100)]
ath10k: fix CAC regression

Commit 548462133d98 ("ath10k: fix interrupt storm") introduced a
regression. The condition responsible for bringing up monitor vdev was broken
and it was never started for CAC so effectivelly CAC would not detect radar
pulses.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix patching mistake for AP/IBSS CSA
Michal Kazior [Mon, 9 Mar 2015 13:19:24 +0000 (14:19 +0100)]
ath10k: fix patching mistake for AP/IBSS CSA

Mistakenly v1 of `ath10k: fix AP/IBSS CSA with
template based fw`
(81a9a17db5d766d2872c4ab8a77b8666d22031ec) was
applied.

This patch applies the missing bits from v2:
 * remove unnecessary locking
 * add some (sanity) checks

There are no practical functionality differences
between v1 and v2.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: save/restore pci config space properly
Michal Kazior [Mon, 2 Mar 2015 12:22:14 +0000 (13:22 +0100)]
ath10k: save/restore pci config space properly

The check was't really necessary and couldn't even
work to begin with because pci_restore_state()
restores only first 64 bytes of PCI configuration
space.

Actually the PCI subsystem takes care of this so
there's no need for explicit calls to save PCI
state in ath10k.

This is necessary for future WoWLAN support.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix some pci wake/sleep issues
Michal Kazior [Mon, 2 Mar 2015 12:22:13 +0000 (13:22 +0100)]
ath10k: fix some pci wake/sleep issues

In some cases the device ends up sleeping while
ath10k didn't expect it to leading to reading
garbage from registers, e.g. when shared irqs are
used and the driver is in powered down state.

This effectively makes the device remain awake all
the time even when all interfaces are down.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix interrupt storm
Vasanthakumar Thiagarajan [Mon, 2 Mar 2015 12:15:28 +0000 (17:45 +0530)]
ath10k: fix interrupt storm

Promiscuous mode is enabled when wlan interface is added to
bridge. ath10k creates a monitor mode when promiscuous mode
is enabled. When monitor vdev is running along with other
vdev(s) there is a huge number of interrupts generated
especially in noisy condition. Fix this by not enabling
promiscuous(monitor) mode when already a vdev is running.
As disabling promiscuous mode may have issues with 4-address
bridging in STA mode, the change is done specific to non-sta/ibss
mode types. This does not change the support of virtual interface of
type monitor along with other vdevs of any type.

This could fix management frame drop in fw due to unavailable
buffers because in monitor mode device receives everything seen
on the air. In noisy condition, disabling monitor mode helps assoc
go through without any issue.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: move ath10k_vdev_stop() up before ath10k_vdev_start_restart()
Vasanthakumar Thiagarajan [Mon, 2 Mar 2015 12:15:27 +0000 (17:45 +0530)]
ath10k: move ath10k_vdev_stop() up before ath10k_vdev_start_restart()

This patches does not modify any functionality. Just a code move
so that ath10k_vdev_stop() can be used in ath10k_vdev_start_restart()
for any failure cases which involves vdev_stop().

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: improve 11b coex
Michal Kazior [Mon, 2 Mar 2015 10:21:17 +0000 (11:21 +0100)]
ath10k: improve 11b coex

This improves coexistance with 11b legacy devices
on wmi-tlv and qca6174.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: implement handling of p2p noa event
Michal Kazior [Thu, 26 Feb 2015 12:23:18 +0000 (13:23 +0100)]
ath10k: implement handling of p2p noa event

Since new wmi-tlv firmware doesn't have SWBA event
the only way to deliver P2P NoA information is
through a new dedicated event.

This fixes P2P GO Probe Responses to include P2P
NoA when appropriate on the new firmware.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: refactor p2p noa code
Michal Kazior [Thu, 26 Feb 2015 12:23:17 +0000 (13:23 +0100)]
ath10k: refactor p2p noa code

Some files are getting bloated and it makes sense
to split some of the code into separate files. Do
so with the P2P NoA code and prepare it for reuse.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix TxBF VHT capabilities for 2+ RF-chain devices
Michal Kazior [Thu, 26 Feb 2015 10:11:22 +0000 (11:11 +0100)]
ath10k: fix TxBF VHT capabilities for 2+ RF-chain devices

Firmware doesn't report a complete and
ready-to-use vht cap. Instead the driver is
supposed to fill in the missing bits related to
number of chains.

This effectively increases Compressed Steering
Number and Number of Sounding Dimensions in
AssocReq frames for devices with more than one RF
chain and should improve TxBF performance.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix ap u-apsd cmd on qca6174 w/ wmi-tlv
Michal Kazior [Wed, 25 Feb 2015 10:39:36 +0000 (11:39 +0100)]
ath10k: fix ap u-apsd cmd on qca6174 w/ wmi-tlv

The command was truncated so the parameter value
was seen in fw as 0. This caused U-APSD enabled
stations to be misconfigured and mistreated by AP.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: increase duty cycle maximum limit
Rajkumar Manoharan [Thu, 19 Feb 2015 17:55:05 +0000 (23:25 +0530)]
ath10k: increase duty cycle maximum limit

Allow user to configure the duty cycle upto 100%. Since thermal
mitigation algorithm is running in user space, remove the driver
level limitation and let the user to control the temperature.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix broken traffic for static WEP in IBSS
Michal Kazior [Wed, 18 Feb 2015 13:02:27 +0000 (14:02 +0100)]
ath10k: fix broken traffic for static WEP in IBSS

When WEP keys are uploaded it's possible that
there are stations associated already (e.g. when
merging) without any keys. Static WEP needs an
explicit per-peer key upload.

Make sure to re-upload wep keys if necessary.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix broken traffic for 802.1x in client mode
Michal Kazior [Wed, 18 Feb 2015 13:02:26 +0000 (14:02 +0100)]
ath10k: fix broken traffic for 802.1x in client mode

When running 802.1x WEP keys must be installed
without pairwise-groupwise swap (which is
necessary for static WEP).

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: update MODULE_FIRMWARE definitions for QCA6174
Bartosz Markowski [Wed, 18 Feb 2015 12:16:37 +0000 (13:16 +0100)]
ath10k: update MODULE_FIRMWARE definitions for QCA6174

This has been missed while adding the QCA6174 support.
As in the last time, without advertising the firmware files
as needed (or optional) for ath10k, these won't be built into
ram disk for instance.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agoath10k: fix AP/IBSS CSA with template based fw
Michal Kazior [Thu, 5 Mar 2015 14:02:17 +0000 (16:02 +0200)]
ath10k: fix AP/IBSS CSA with template based fw

qca6174 with wmi-tlv firmware uses offloaded
beaconing scheme (i.e. templates). This requires a
little different approach when implementing CSA.

Add missing code to update CS count and report CSA
completion to mac80211. Without it channel switch
was never finished.

To avoid races during interface teardown data_lock
has been used to protect is_up and is_started so
they can be compared against before scheduling
count down work.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
9 years agocfg80211: Schedule timeout for all CRDA calls
Ilan peer [Wed, 4 Mar 2015 05:32:07 +0000 (00:32 -0500)]
cfg80211: Schedule timeout for all CRDA calls

Timeout was scheduled only in case CRDA was called due to user hints,
but was not scheduled for other cases. This can result in regulatory
hint processing getting stuck in case that there is no CRDA configured.

Change this by scheduling a timeout every time CRDA is called. In
addition, in restore_regulatory_settings() all pending requests are
restored (and not only the user ones).

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Acked-by: Luis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agocfg80211: Add API to change the indoor regulatory setting
Ilan peer [Wed, 4 Mar 2015 05:32:06 +0000 (00:32 -0500)]
cfg80211: Add API to change the indoor regulatory setting

Previously, the indoor setting configuration assumed that as
long as a station interface is connected, the indoor environment
setting does not change. However, this assumption is problematic
as:

- It is possible that a station interface is connected to a mobile
  AP, e.g., softAP or a P2P GO, where it is possible that both the
  station and the mobile AP move out of the indoor environment making
  the indoor setting invalid. In such a case, user space has no way to
  invalidate the setting.
- A station interface disconnection does not necessarily imply that
  the device is no longer operating in an indoor environment, e.g.,
  it is possible that the station interface is roaming but is still
  stays indoor.

To handle the above, extend the indoor configuration API to allow
user space to indicate a change of indoor settings, and allow it to
indicate weather it controls the indoor setting, such that:

1. If the user space process explicitly indicates that it is going
   to control the indoor setting, do not clear the indoor setting
   internally, unless the socket is released. The user space process
   should use the NL80211_ATTR_SOCKET_OWNER attribute in the command
   to state that it is going to control the indoor setting.
2. Reset the indoor setting when restoring the regulatory settings in
   case it is not owned by a user space process.

Based on the above, a user space tool that continuously monitors the
indoor settings, i.e., tracking power setting, location etc., can
indicate environment changes to the regulatory core.

It should be noted that currently user space is the only provided mechanism
used to hint to the regulatory core over the indoor/outdoor environment --
while the country IEs do have an environment setting this has been completely
ignored by the regulatory core by design for a while now since country IEs
typically can contain bogus data.

Acked-by: Luis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: ArikX Nemtsov <arik@wizery.com>
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>