History log of /linux-master/drivers/net/wireless/ath/ath6kl/cfg80211.c
Revision Date Author Comments
# b82730bf 29-Jan-2024 Johannes Berg <johannes.berg@intel.com>

wifi: cfg80211/mac80211: move puncturing into chandef

Aloka originally suggested that puncturing should be part of
the chandef, so that it's treated correctly. At the time, I
disagreed and it ended up not part of the chandef, but I've
now realized that this was wrong. Even for clients, the RX,
and perhaps more importantly, CCA configuration needs to take
puncturing into account.

Move puncturing into the chandef, and adjust all the code
accordingly. Also add a few tests for puncturing in chandef
compatibility checking.

Link: https://lore.kernel.org/linux-wireless/20220214223051.3610-1-quic_alokad@quicinc.com/
Suggested-by: Aloka Dixit <quic_alokad@quicinc.com>
Link: https://msgid.link/20240129194108.307183a5d2e5.I4d7fe2f126b2366c1312010e2900dfb2abffa0f6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# bb55441c 25-Sep-2023 Johannes Berg <johannes.berg@intel.com>

wifi: cfg80211: split struct cfg80211_ap_settings

Using the full struct cfg80211_ap_settings for an update is
misleading, since most settings cannot be updated. Split the
update case off into a new struct cfg80211_ap_update.

Change-Id: I3ba4dd9280938ab41252f145227a7005edf327e4
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 66f85d57 27-Jul-2023 Aloka Dixit <quic_alokad@quicinc.com>

wifi: cfg80211: modify prototype for change_beacon

Modify the prototype for change_beacon() in struct cfg80211_op to
accept cfg80211_ap_settings instead of cfg80211_beacon_data so that
it can process data in addition to beacons.
Modify the prototypes of ieee80211_change_beacon() and driver specific
functions accordingly.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230727174100.11721-4-quic_alokad@quicinc.com
[while at it, remove pointless "if (info)" check in tracing that just
makes all the lines longer than they need be - it's never NULL]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 076fc877 28-Aug-2023 Johannes Berg <johannes.berg@intel.com>

wifi: cfg80211: remove wdev mutex

Since we're now protecting everything with the wiphy mutex
(and were really using it for almost everything before),
there's no longer any real reason to have a separate wdev
mutex. It may feel better, but really has no value.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# b345f063 30-Jan-2023 Aloka Dixit <quic_alokad@quicinc.com>

wifi: cfg80211: include puncturing bitmap in channel switch events

Add puncturing bitmap in channel switch notifications
and corresponding trace functions.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Link: https://lore.kernel.org/r/20230131001227.25014-4-quic_alokad@quicinc.com
[fix qtnfmac]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# e7a7b84e 29-Jul-2022 Veerendranath Jakkam <quic_vjakkam@quicinc.com>

wifi: cfg80211: Add link_id parameter to various key operations for MLO

Add support for various key operations on MLD by adding new parameter
link_id. Pass the link_id received from userspace to driver for add_key,
get_key, del_key, set_default_key, set_default_mgmt_key and
set_default_beacon_key to support configuring keys specific to each MLO
link. Userspace must not specify link ID for MLO pairwise key since it
is common for all the MLO links.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/20220730052643.1959111-4-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# efbabc11 08-Jun-2022 Veerendranath Jakkam <quic_vjakkam@quicinc.com>

cfg80211: Indicate MLO connection info in connect and roam callbacks

The MLO links used for connection with an MLD AP are decided by the
driver in case of SME offloaded to driver.

Add support for the drivers to indicate the information of links used
for MLO connection in connect and roam callbacks, update the connected
links information in wdev from connect/roam result sent by driver.
Also, send the connected links information to userspace.

Add a netlink flag attribute to indicate that userspace supports
handling of MLO connection. Drivers must not do MLO connection when this
flag is not set. This is to maintain backwards compatibility with older
supplicant versions which doesn't have support for MLO connection.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 7b0a0e3c 14-Apr-2022 Johannes Berg <johannes.berg@intel.com>

wifi: cfg80211: do some rework towards MLO link APIs

In order to support multi-link operation with multiple links,
start adding some APIs. The notable addition here is to have
the link ID in a new nl80211 attribute, that will be used to
differentiate the links in many nl80211 operations.

So far, this patch adds the netlink NL80211_ATTR_MLO_LINK_ID
attribute (as well as the NL80211_ATTR_MLO_LINKS attribute)
and plugs it through the system in some places, checking the
validity etc. along with other infrastructure needed for it.

For now, I've decided to include only the over-the-air link
ID in the API. I know we discussed that we eventually need to
have to have other ways of identifying a link, but for local
AP mode and auth/assoc commands as well as set_key etc. we'll
use the OTA ID.

Also included in this patch is some refactoring of the data
structures in struct wireless_dev, splitting for the first
time the data into type dependent pieces, to make reasoning
about these things easier.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# f2e2a083 18-Oct-2021 Jakub Kicinski <kuba@kernel.org>

ath6kl: use eth_hw_addr_set()

Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

Do the special encoding on the stack, then copy the address.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211018235021.1279697-5-kuba@kernel.org


# 708884e7 18-Oct-2021 Jakub Kicinski <kuba@kernel.org>

wireless: use eth_hw_addr_set()

Convert all WiFi drivers from memcpy(... ETH_ADDR)
to eth_hw_addr_set():

@@
expression dev, np;
@@
- memcpy(dev->dev_addr, np, ETH_ALEN)
+ eth_hw_addr_set(dev, np)

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211018235021.1279697-2-kuba@kernel.org


# 75596eab 26-May-2021 Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

ath6kl: Fix inconsistent indenting

Eliminate the follow smatch warning:

drivers/net/wireless/ath/ath6kl/cfg80211.c:3308
ath6kl_cfg80211_sscan_start() warn: inconsistent indenting.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1622026376-68524-1-git-send-email-jiapeng.chong@linux.alibaba.com


# 2fe8ef10 22-Jan-2021 Johannes Berg <johannes.berg@intel.com>

cfg80211: change netdev registration/unregistration semantics

We used to not require anything in terms of registering netdevs
with cfg80211, using a netdev notifier instead. However, in the
next patch reducing RTNL locking, this causes big problems, and
the simplest way is to just require drivers to do things better.

Change the registration/unregistration semantics to require the
drivers to call cfg80211_(un)register_netdevice() when this is
happening due to a cfg80211 request, i.e. add_virtual_intf() or
del_virtual_intf() (or if it somehow has to happen in any other
cfg80211 callback).

Otherwise, in other contexts, drivers may continue to use the
normal netdev (un)registration functions as usual.

Internally, we still use the netdev notifier and track (by the
new wdev->registered bool) if the wdev had already been added
to cfg80211 or not.

Link: https://lore.kernel.org/r/20210122161942.cf2f4b65e4e9.Ida8234e50da13eb675b557bac52a713ad4eddf71@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 8238bf0d 27-Jul-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

ath6kl: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1].

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200727195111.GA1603@embeddedor


# 6cd536fe 16-Apr-2020 Johannes Berg <johannes.berg@intel.com>

cfg80211: change internal management frame registration API

Almost all drivers below cfg80211 get the API wrong (except for
cfg80211) and are unable to cope with multiple registrations for
the same frame type, which is valid due to the match filter.
This seems to indicate the API is wrong, and we should maintain
the full information in cfg80211 instead of the drivers.

Change the API to no longer inform the driver about individual
registrations and unregistrations, but rather every time about
the entire state of the entire wiphy and single wdev, whenever
it may have changed. This also simplifies the code in cfg80211
as it no longer has to track exactly what was unregistered and
can free things immediately.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Link: https://lore.kernel.org/r/20200417124300.f47f3828afc8.I7f81ef59c2c5a340d7075fb3c6d0e08e8aeffe07@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 2638eb8b 31-May-2019 Florian Westphal <fw@strlen.de>

net: ipv4: provide __rcu annotation for ifa_list

ifa_list is protected by rcu, yet code doesn't reflect this.

Add the __rcu annotations and fix up all places that are now reported by
sparse.

I've done this in the same commit to not add intermediate patches that
result in new warnings.

Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 192a986d 05-Dec-2018 Kyle Roeschley <kyle.roeschley@ni.com>

ath6kl: Use debug instead of error message when disabled

This is not an unexpected condition, so we don't need to be shouting to the
world about it.

Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 5803c128 05-Dec-2018 Kyle Roeschley <kyle.roeschley@ni.com>

ath6kl: Fix off by one error in scan completion

When ath6kl was reworked to share code between regular and scheduled scans
in commit 3b8ffc6a22ba ("ath6kl: Configure probed SSID list consistently"),
probed SSID entry changed from 1-index to 0-indexed. However,
ath6kl_cfg80211_scan_complete_event() was missed in that change. Fix its
indexing so that we correctly clear out the probed SSID list.

Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# fb376a49 05-Dec-2018 Kyle Roeschley <kyle.roeschley@ni.com>

ath6kl: Only use match sets when firmware supports it

Commit dd45b7598f1c ("ath6kl: Include match ssid list in scheduled scan")
merged the probed and matched SSID lists before sending them to the
firmware. In the process, it assumed match set support is always available
in ath6kl_set_probed_ssids, which breaks scans for hidden SSIDs. Now, check
that the firmware supports matching SSIDs in scheduled scans before setting
MATCH_SSID_FLAG.

Fixes: dd45b7598f1c ("ath6kl: Include match ssid list in scheduled scan")
Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 3152a974 03-Dec-2018 Sagi Grimberg <sagi@lightbitslabs.com>

ath6kl: add ath6kl_ prefix to crypto_type

Prevent a namespace conflict as in following patches as skbuff.h will
include the crypto API.

Acked-by: David S. Miller <davem@davemloft.net>
Cc: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sagi Grimberg <sagi@lightbitslabs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>


# 22d0d2fa 17-Jun-2018 Omer Efrat <omer.efrat@tandemg.com>

wireless-drivers: use BIT_ULL for NL80211_STA_INFO_ attribute types

The BIT macro uses unsigned long which some architectures handle as 32 bit
and therefore might cause macro's shift to overflow when used on a value
equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).

Since 'filled' member in station_info changed to u64, BIT_ULL macro
should be used with all NL80211_STA_INFO_* attribute types instead of BIT
to prevent future possible bugs when one will use BIT macro for higher
attributes by mistake.

This commit cleans up all usages of BIT macro with the above field
in wireless-drivers by changing it to BIT_ULL instead. In addition, there are
some places which don't use BIT nor BIT_ULL macros so align those as well.

Signed-off-by: Omer Efrat <omer.efrat@tandemg.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 4de30c90 25-May-2018 Gustavo A. R. Silva <gustavo@embeddedor.com>

ath6kl: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Steve deRosier <derosier@cal-sierra.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 6396bb22 12-Jun-2018 Kees Cook <keescook@chromium.org>

treewide: kzalloc() -> kcalloc()

The kzalloc() function has a 2-factor argument form, kcalloc(). This
patch replaces cases of:

kzalloc(a * b, gfp)

with:
kcalloc(a * b, gfp)

as well as handling cases of:

kzalloc(a * b * c, gfp)

with:

kzalloc(array3_size(a, b, c), gfp)

as it's slightly less ugly than:

kzalloc_array(array_size(a, b), c, gfp)

This does, however, attempt to ignore constant size factors like:

kzalloc(4 * 1024, gfp)

though any constants defined via macros get caught up in the conversion.

Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.

The Coccinelle script used for this was:

// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@

(
kzalloc(
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
kzalloc(
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)

// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@

(
kzalloc(
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)

// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@

(
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)

// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@

- kzalloc
+ kcalloc
(
- SIZE * COUNT
+ COUNT, SIZE
, ...)

// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@

(
kzalloc(
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)

// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@

(
kzalloc(
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)

// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@

(
kzalloc(
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)

// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@

(
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)

// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@

(
kzalloc(sizeof(THING) * C2, ...)
|
kzalloc(sizeof(TYPE) * C2, ...)
|
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(C1 * C2, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * E2
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * (E2)
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- E1 * E2
+ E1, E2
, ...)
)

Signed-off-by: Kees Cook <keescook@chromium.org>


# d786ebb2 25-Nov-2017 Kenneth Lu <kuohsianglu@gmail.com>

ath6kl: remove redundant variable ies_len

To get rid of W=1 warning: variable ‘ies_len’ set but not used.
Variable ies_len is being assigned but never read.

Signed-off-by: Kenneth Lu <kuohsianglu@gmail.com>
Reviewed-by: Steve deRosier <derosier@gmail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 7ac76764 24-Oct-2017 Kees Cook <keescook@chromium.org>

ath: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# b34939b9 28-Apr-2017 Arend Van Spriel <arend.vanspriel@broadcom.com>

cfg80211: add request id to cfg80211_sched_scan_*() api

Have proper request id filled in the SCHED_SCAN_RESULTS and
SCHED_SCAN_STOPPED notifications toward user-space by having the
driver provide it through the api.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 29ce6ecb 26-Apr-2017 Avraham Stern <avraham.stern@intel.com>

cfg80211: unify cfg80211_roamed() and cfg80211_roamed_bss()

cfg80211_roamed() and cfg80211_roamed_bss() take the same arguments
except that cfg80211_roamed() requires the BSSID and
cfg80211_roamed_bss() requires the bss entry.

Unify the two functions by using a struct for driver initiated
roaming information so that either the BSSID or the bss entry can be
passed as an argument to the unified function.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
[modified the ath6k, brcm80211, rndis and wlan-ng drivers accordingly]
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
[modify brcmfmac to remove the useless cast, spotted by Arend]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 3a3ecf1d 21-Apr-2017 Arend Van Spriel <arend.vanspriel@broadcom.com>

cfg80211: add request id parameter to .sched_scan_stop() signature

For multiple scheduled scan support the driver needs to know which
scheduled scan request is being stopped. Pass the request id in the
.sched_scan_stop() callback.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# ca986ad9 21-Apr-2017 Arend Van Spriel <arend.vanspriel@broadcom.com>

nl80211: allow multiple active scheduled scan requests

This patch implements the idea to have multiple scheduled scan requests
running concurrently. It mainly illustrates how to deal with the incoming
request from user-space in terms of backward compatibility. In order to
use multiple scheduled scans user-space needs to provide a flag attribute
NL80211_ATTR_SCHED_SCAN_MULTI to indicate support. If not the request is
treated as a legacy scan.

Drivers currently supporting scheduled scan are now indicating they support
a single scheduled scan request. This obsoletes WIPHY_FLAG_SUPPORTS_SCHED_SCAN.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
[clean up netlink destroy path to avoid allocations, code cleanups]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 818a986e 12-Apr-2017 Johannes Berg <johannes.berg@intel.com>

cfg80211: move add/change interface monitor flags into params

Instead passing both flags, which can be NULL, and vif_params,
which are never NULL, move the flags into the vif_params and
use BIT(0), which is invalid from userspace, to indicate that
the flags were changed.

While updating all drivers, fix a small bug in wil6210 where
it was setting the flags to 0 instead of leaving them unchanged.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# b51040fc 16-Mar-2017 Rostyslav Khudolii <rkhudolii@airtame.com>

ath6kl: Remove old 802.11a-only channels

Channels 34/38/42/46 can only be used for compatibility with old devices sold
in Japan. Modern products, such as AR6003/AR6004 don't support these channels.
Keeping them in the upstream is error prone and requires full network stack
support. A custom patch should be used in case such compatibility is required.

Without this one, a user is able to start an AP using wpa_supplicant,
for example, on one of these channels (34/38/42/46), without getting
any warning/error from the cfg80211 or ath6kl - which is correct
(since these channels match regdom rules). However, the AR6003 and its
firmware (we're using v3.4.0.225) will fail and return
"WMI_CMDERROR_EVENTID" with "INVALID_PARAM" error code.

Signed-off-by: Rostyslav Khudolii <rkhudolii@airtame.com>
Cc: Attila Sukosd <attila@airtame.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 174cd4b1 02-Feb-2017 Ingo Molnar <mingo@kernel.org>

sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h>

Fix up affected files that include this signal functionality via sched.h.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>


# cabd34d0 30-Aug-2016 Eric Bentley <eric.bentley@lairdtech.com>

ath6kl: Allow the radio to report 0 dbm txpower without timing out

The ath6kl driver attempts to get the txpower value from the radio by first
clearing the existing stored value and then watching the value to become
non-zero.

APs allow setting client power to values from -127..127, but this radio
is not capable of setting values less then 0 and so will report txpower
as 0dbm for both negative and 0 client power values.

When the radio has txpower set to 0dbm txpower (equivalent to 1mw) the
ath6kl_cfg80211_get_txpower() function will remain in the
wait_event_interruptible_timeout() loop waiting for the value to be
non-zero, and will eventually timeout. This results in a 5 second delay in
response. However, the correct value of zero is eventually returned.

The 6004 defaults to 63dbm which is then limited by regulatory and
hardware limits with max of 18dbm (6003 max is 16dbm), therefore we can
use values larger then these to be able to determine when the value has
been updated.

To correct the issue, set the value to a nonsensical value (255) and wait
for it to change to the valid value.

Tested on both 6003 and 6004 based radios. Return value of zero is
correctly returned in an expected amount of time (similar to when
returning non-zero values) when AP client power is set to both 0 and
negative values.

Signed-off-by: Eric Bentley <eric.bentley@lairdtech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 97f2645f 03-Aug-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

tree-wide: replace config_enabled() with IS_ENABLED()

The use of config_enabled() against config options is ambiguous. In
practical terms, config_enabled() is equivalent to IS_BUILTIN(), but the
author might have used it for the meaning of IS_ENABLED(). Using
IS_ENABLED(), IS_BUILTIN(), IS_MODULE() etc. makes the intention
clearer.

This commit replaces config_enabled() with IS_ENABLED() where possible.
This commit is only touching bool config options.

I noticed two cases where config_enabled() is used against a tristate
option:

- config_enabled(CONFIG_HWMON)
[ drivers/net/wireless/ath/ath10k/thermal.c ]

- config_enabled(CONFIG_BACKLIGHT_CLASS_DEVICE)
[ drivers/gpu/drm/gma500/opregion.c ]

I did not touch them because they should be converted to IS_BUILTIN()
in order to keep the logic, but I was not sure it was the authors'
intention.

Link: http://lkml.kernel.org/r/1465215656-20569-1-git-send-email-yamada.masahiro@socionext.com
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Stas Sergeev <stsp@list.ru>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: Joshua Kinard <kumba@gentoo.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: "Dmitry V. Levin" <ldv@altlinux.org>
Cc: yu-cheng yu <yu-cheng.yu@intel.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Will Drewry <wad@chromium.org>
Cc: Nikolay Martynov <mar.kolya@gmail.com>
Cc: Huacai Chen <chenhc@lemote.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Cc: Rafal Milecki <zajec5@gmail.com>
Cc: James Cowgill <James.Cowgill@imgtec.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Alex Smith <alex.smith@imgtec.com>
Cc: Adam Buchbinder <adam.buchbinder@gmail.com>
Cc: Qais Yousef <qais.yousef@imgtec.com>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Roland McGrath <roland@hack.frob.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Tony Wu <tung7970@gmail.com>
Cc: Huaitong Han <huaitong.han@intel.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Juergen Gross <jgross@suse.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andrea Gelmini <andrea.gelmini@gelma.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Rabin Vincent <rabin@rab.in>
Cc: "Maciej W. Rozycki" <macro@imgtec.com>
Cc: David Daney <david.daney@cavium.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 42e54152 08-Jul-2016 Dan Kephart <dan.kephart@lairdtech.com>

ath6kl: sme_state shortcut to SME_DISCONNECTED removed

When an NL80211_DISCONNECT is sent to cfg80211, the driver's cfg80211
disconnect function sets the sme_state to SME_DISCONNECTED before receiving
a WMI_DISCONNECT_EVENT from the firmware. This caused cfg80211 to not know
that the connection is disconnected because the driver fails to notify
cfg80211 upon receiving WMI_DISCONNECT_EVENT from the firmware believing
it is already disconnected.

Signed-off-by: Dan Kephart <dan.kephart@lairdtech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 76b817f6 18-Jul-2016 Pierre Le Magourou <plemagourou@aldebaran.com>

ath6kl: Unset IFF_LOWER_UP flag on AP mode leave.

When disabling tethering after having enabled it, the ath6kl driver does
not set the IFF_LOWER_UP flag to 0 (carrier off) on the wlan interface.

The upper layers (eg. connman) are not notified of the tethering mode
status change. So, tethering can not be activated anymore.

This patch adds a netif_carrier_off() call when stopping AP mode to fix
the problem.

Signed-off-by: Pierre Le Magourou <plemagourou@aldebaran.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f3651bae 18-Jul-2016 Pierre Le Magourou <plemagourou@aldebaran.com>

ath6kl: Fix wrong regulatory domain disconnection.

One minute after a successful connection, the kernel checks if the
frequency and the channel width are well configured for the country we
are in. (regulatory domain)

ath6kl driver was setting the NL80211_CHAN_HT20 channel without checking
for the HT capabilities. (we should have NL80211_CHAN_NO_HT in our
case because the firmware did not support HT)

This patch adds a check on ht_cap.ht_supported in order to create the
channel corresponding to the firmware capabilities.

Signed-off-by: Pierre Le Magourou <plemagourou@aldebaran.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 1d76250b 05-Jul-2016 Avraham Stern <avraham.stern@intel.com>

nl80211: support beacon report scanning

Beacon report radio measurement requires reporting observed BSSs
on the channels specified in the beacon request. If the measurement
mode is set to passive or active, it requires actually performing a
scan (passive or active, accordingly), and reporting the time that
the scan was started and the time each beacon/probe was received
(both in terms of TSF of the BSS of the requesting AP). If the
request mode is table, this information is optional.
In addition, the radio measurement request specifies the channel
dwell time for the measurement.

In order to use scan for beacon report when the mode is active or
passive, add a parameter to scan request that specifies the
channel dwell time, and add scan start time and beacon received time
to scan results information.

Supporting beacon report is required for Multi Band Operation (MBO).

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 57fbcce3 12-Apr-2016 Johannes Berg <johannes.berg@intel.com>

cfg80211: remove enum ieee80211_band

This enum is already perfectly aliased to enum nl80211_band, and
the only reason for it is that we get IEEE80211_NUM_BANDS out of
it. There's no really good reason to not declare the number of
bands in nl80211 though, so do that and remove the cfg80211 one.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 26ca14d4 30-Nov-2015 Ben Greear <greearb@candelatech.com>

ath6kl: fix tx/rx antenna reporting for 2x2 devices

My previous patch incorrectly reported the antenna
for 2x2 devices. It should be a mask instead of
a numeric count. This patch fixes that.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 13eff531 22-Oct-2015 Ben Greear <greearb@candelatech.com>

ath6kl: implement ethtool stats

This supports a way to get target stats through normal
ethtool stats API.

For instance:
# ethtool -S wlan1
NIC statistics:
tx_pkts_nic: 353
tx_bytes_nic: 25142
rx_pkts_nic: 6
rx_bytes_nic: 996
d_tx_ucast_pkts: 89
d_tx_bcast_pkts: 264
d_tx_ucast_bytes: 3020
d_tx_bcast_bytes: 22122
...

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 7fd98524 21-Oct-2015 Ben Greear <greearb@candelatech.com>

ath6kl: add error message to explain lack of HT

It can take a user a while to understand why their
NIC that advertises 802.11n support cannot actually
do 802.11n. Print out a warning in the logs to save
the next poor person to use this NIC some trouble.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 9c2e90ff 21-Oct-2015 Ben Greear <greearb@candelatech.com>

ath6kl: report antenna configuration

This lets 'iw phy phy0 info' report antennas for
the radio device:

...
Available Antennas: TX 0x2 RX 0x2
Configured Antennas: TX 0x2 RX 0x2
...

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 3b06d277 12-Oct-2015 Avraham Stern <avraham.stern@intel.com>

cfg80211: Add multiple scan plans for scheduled scan

Add the option to configure multiple 'scan plans' for scheduled scan.
Each 'scan plan' defines the number of scan cycles and the interval
between scans. The scan plans are executed in the order they were
configured. The last scan plan will always run infinitely and thus
defines only the interval between scans.
The maximum number of scan plans supported by the device and the
maximum number of iterations in a single scan plan are advertised
to userspace so it can configure the scan plans appropriately.

When scheduled scan results are received there is no way to know which
scan plan is being currently executed, so there is no way to know when
the next scan iteration will start. This is not a problem, however.
The scan start timestamp is only used for flushing old scan results,
and there is no difference between flushing all results received until
the end of the previous iteration or the start of the current one,
since no results will be received in between.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# bffb7db2 05-Oct-2015 Geliang Tang <geliangtang@163.com>

ath6kl: drop unlikely behind WARN_ON()

WARN_ON() already contain an unlikely compiler flag. Drop it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 80279fb7 22-May-2015 Johannes Berg <johannes.berg@intel.com>

cfg80211: properly send NL80211_ATTR_DISCONNECTED_BY_AP in disconnect

When we disconnect from the AP, drivers call cfg80211_disconnect().
This doesn't know whether the disconnection was initiated locally
or by the AP though, which can cause problems with the supplicant,
for example with WPS. This issue obviously doesn't show up with any
mac80211 based driver since mac80211 doesn't call this function.

Fix this by requiring drivers to indicate whether the disconnect is
locally generated or not. I've tried to update the drivers, but may
not have gotten the values correct, and some drivers may currently
not be able to report correct values. In case of doubt I left it at
false, which is the current behaviour.

For libertas, make adjustments as indicated by Dan Williams.

Reported-by: Matthieu Mauger <matthieux.mauger@intel.com>
Tested-by: Matthieu Mauger <matthieux.mauger@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 6bab2e19 18-Mar-2015 Tom Gundersen <teg@jklm.no>

cfg80211: pass name_assign_type to rdev_add_virtual_intf()

This will expose in /sys whether the ifname of a device is set by
userspace or generated by the kernel. The latter kind (wlanX, etc)
is not deterministic, so userspace needs to rename these devices
to names that are guaranteed to stay the same between reboots. The
former, however should never be renamed, so userspace needs to be
able to reliably tell the difference.

Similar functionality was introduced for the rtnetlink core in
commit 5517750f058e ("net: rtnetlink - make create_link take name_assign_type")

Signed-off-by: Tom Gundersen <teg@jklm.no>
Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: Brett Rudley <brudley@broadcom.com>
Cc: Arend van Spriel <arend@broadcom.com>
Cc: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Cc: Hante Meuleman <meuleman@broadcom.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
[reformat changelog to fit 72 cols]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 93803b33 02-Mar-2015 Joe Perches <joe@perches.com>

wireless: Use eth_<foo>_addr instead of memset

Use the built-in function instead of memset.

Miscellanea:

Add #include <linux/etherdevice.h> where appropriate
Use ETH_ALEN instead of 6

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 6eb18137 08-Feb-2015 Dedy Lansky <dlansky@codeaurora.org>

cfg80211: add bss_type and privacy arguments in cfg80211_get_bss()

802.11ad adds new a network type (PBSS) and changes the capability
field interpretation for the DMG (60G) band.
The same 2 bits that were interpreted as "ESS" and "IBSS" before are
re-used as a 2-bit field with 3 valid values (and 1 reserved). Valid
values are: "IBSS", "PBSS" (new) and "AP".

In order to get the BSS struct for the new PBSS networks, change the
cfg80211_get_bss() function to take a new enum ieee80211_bss_type
argument with the valid network types, as "capa_mask" and "capa_val"
no longer work correctly (the search must be band-aware now.)

The remaining bits in "capa_mask" and "capa_val" are used only for
privacy matching so replace those two with a privacy enum as well.

Signed-off-by: Dedy Lansky <dlansky@codeaurora.org>
[rewrite commit log, tiny fixes]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# b51f3bee 15-Jan-2015 Johannes Berg <johannes.berg@intel.com>

cfg80211: change bandwidth reporting to explicit field

For some reason, we made the bandwidth separate flags, which
is rather confusing - a single rate cannot have different
bandwidths at the same time.

Change this to no longer be flags but use a separate field
for the bandwidth ('bw') instead.

While at it, add support for 5 and 10 MHz rates - these are
reported as regular legacy rates with their real bitrate,
but tagged as 5/10 now to make it easier to distinguish them.

In the nl80211 API, the flags are preserved, but the code
now can also clearly only set a single one of the flags.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 319090bf 17-Nov-2014 Johannes Berg <johannes.berg@intel.com>

cfg80211: remove enum station_info_flags

This is really just duplicating the list of information that's
already available in the nl80211 attribute, so remove the list.
Two small changes are needed:
* remove STATION_INFO_ASSOC_REQ_IES complete, but the length
(assoc_req_ies_len) can be used instead
* add NL80211_STA_INFO_RX_DROP_MISC which exists internally
but not in nl80211 yet

This gets rid of the duplicate maintenance of the two lists.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 89c771e5 10-Oct-2014 Jouni Malinen <jouni@qca.qualcomm.com>

cfg80211: Convert del_station() callback to use a param struct

This makes it easier to add new parameters for the del_station calls
without having to modify all drivers that use this.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 5bc8c1f2 12-Aug-2014 Johannes Berg <johannes.berg@intel.com>

cfg80211: allow passing frame type to cfg80211_inform_bss()

When using the cfg80211_inform_bss[_width]() functions drivers
cannot currently indicate whether the data was received in a
beacon or probe response. Fix that by passing a new enum that
indicates such (or unknown).

For good measure, use it in ath6kl.

Acked-by: Kalle Valo <kvalo@qca.qualcomm.com> [ath6kl]
Acked-by: Arend van Spriel <arend@broadcom.com> [brcmfmac]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# c835a677 14-Jul-2014 Tom Gundersen <teg@jklm.no>

net: set name_assign_type in alloc_netdev()

Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert
all users to pass NET_NAME_UNKNOWN.

Coccinelle patch:

@@
expression sizeof_priv, name, setup, txqs, rxqs, count;
@@

(
-alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
+alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs)
|
-alloc_netdev_mq(sizeof_priv, name, setup, count)
+alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count)
|
-alloc_netdev(sizeof_priv, name, setup)
+alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup)
)

v9: move comments here from the wrong commit

Signed-off-by: Tom Gundersen <teg@jklm.no>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# eba95bce 16-Jun-2014 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: convert ar6004 hardware flags to firmware feature flags

The functionality defined through these flags were actually firmware features
which can change between firmware versions. To make it possible to support
different firmware versions with the same driver, convert the flags to firmware
feature flags.

For backwards compatibility support for old ar6004 firmware FW
API 3 or smaller images we forcefully set the feature bits in the driver.
Starting from FW API 5 the firmware image needs to set them.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 3b3a0162 19-May-2014 Johannes Berg <johannes.berg@intel.com>

cfg80211: constify MAC addresses in cfg80211 ops

This propagates through all the drivers and mac80211.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# a5d8f9df 10-Mar-2014 Kalle Valo <kvalo@qca.qualcomm.com>

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>


# 3629fa14 10-Mar-2014 Kalle Valo <kvalo@qca.qualcomm.com>

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>


# fe94f3a4 29-Jan-2014 Antonio Quartulli <antonio@open-mesh.com>

cfg80211: fix channel configuration in IBSS join

When receiving an IBSS_JOINED event select the BSS object
based on the {bssid, channel} couple rather than the bssid
only.
With the current approach if another cell having the same
BSSID (but using a different channel) exists then cfg80211
picks up the wrong BSS object.
The result is a mismatching channel configuration between
cfg80211 and the driver, that can lead to any sort of
problem.

The issue can be triggered by having an IBSS sitting on
given channel and then asking the driver to create a new
cell using the same BSSID but with a different frequency.
By passing the channel to cfg80211_get_bss() we can solve
this ambiguity and retrieve/create the correct BSS object.
All the users of cfg80211_ibss_joined() have been changed
accordingly.

Moreover WARN when cfg80211_ibss_joined() gets a NULL
channel as argument and remove a bogus call of the same
function in ath6kl (it does not make sense to call
cfg80211_ibss_joined() with a zero BSSID on ibss-leave).

Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: Arend van Spriel <arend@broadcom.com>
Cc: Bing Zhao <bzhao@marvell.com>
Cc: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Cc: libertas-dev@lists.infradead.org
Acked-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
[minor code cleanup in ath6kl]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# ea73cbce 24-Jan-2014 Johannes Berg <johannes.berg@intel.com>

nl80211: fix scheduled scan RSSI matchset attribute confusion

The scheduled scan matchsets were intended to be a list of filters,
with the found BSS having to pass at least one of them to be passed
to the host. When the RSSI attribute was added, however, this was
broken and currently wpa_supplicant adds that attribute in its own
matchset; however, it doesn't intend that to mean that anything
that passes the RSSI filter should be passed to the host, instead
it wants it to mean that everything needs to also have higher RSSI.

This is semantically problematic because we have a list of filters
like [ SSID1, SSID2, SSID3, RSSI ] with no real indication which
one should be OR'ed and which one AND'ed.

To fix this, move the RSSI filter attribute into each matchset. As
we need to stay backward compatible, treat a matchset with only the
RSSI attribute as a "default RSSI filter" for all other matchsets,
but only if there are other matchsets (an RSSI-only matchset by
itself is still desirable.)

To make driver implementation easier, keep a global min_rssi_thold
for the entire request as well. The only affected driver is ath6kl.

I found this when I looked into the code after Raja Mani submitted
a patch fixing the n_match_sets calculation to disregard the RSSI,
but that patch didn't address the semantic issue.

Reported-by: Raja Mani <rmani@qti.qualcomm.com>
Acked-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# e487eaeb 21-Nov-2013 Simon Wunderlich <sw@simonwunderlich.de>

cfg80211/mac80211/ath6kl: acquire wdev lock outside ch_switch_notify

The channel switch notification should be sent under the
wdev/sdata-lock, preferably in the same moment as the channel change
happens, to avoid races by other callers (e.g. start/stop_ap).
This also adds the previously missing sdata_lock protection in
csa_finalize_work.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# b176e629 18-Nov-2013 Andrei Otcheretianski <andrei.otcheretianski@intel.com>

cfg80211: aggregate mgmt_tx parameters into a struct

Change cfg80211 and mac80211 to use cfg80211_mgmt_tx_params
struct to aggregate parameters for mgmt_tx functions.
This makes the functions' signatures less clumsy and allows
less painful parameters extension.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
[fix all other drivers]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# bfd634d0 11-Jun-2013 Antonio Quartulli <antonio@open-mesh.com>

ath6kl: make mgmt_tx accept a NULL channel

cfg80211 passes a NULL channel to mgmt_tx if the frame has
to be sent on the one currently in use by the device.
Make the implementation of mgmt_tx correctly handle this
case

Cc: Nicolas Cavallari <Nicolas.Cavallari@lri.fr>
Acked-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 964dc9e2 03-Jun-2013 Johannes Berg <johannes.berg@intel.com>

cfg80211: take WoWLAN support information out of wiphy struct

There's no need to take up the space for devices that don't
support WoWLAN, and most drivers can even make the support
data static const (except where it's modified at runtime.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 77ee7c89 14-Feb-2013 Johannes Berg <johannes.berg@intel.com>

cfg80211: comprehensively check station changes

The station change API isn't being checked properly before
drivers are called, and as a result it is difficult to see
what should be allowed and what not.

In order to comprehensively check the API parameters parse
everything first, and then have the driver call a function
(cfg80211_check_station_change()) with the additionally
information about the kind of station that is being changed;
this allows the function to make better decisions than the
old code could.

While at it, also add a few checks, particularly in mesh
and clarify the TDLS station lifetime in documentation.

To be able to reduce a few checks, ignore any flag set bits
when the mask isn't set, they shouldn't be applied then.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 4ce720b6 22-Feb-2013 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath6kl: Remove NETDEV_REGISTERED flag

Currently its no where used.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# bc52aab3 22-Feb-2013 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath6kl: Protect ath6kl_cfg80211_vif_cleanup using rtnl_locks

ath6kl_cfg80211_vif_cleanup calls 'unregister_netdevice' which
inturn calls 'unregister_netdevice_queue' and it requires holding
rtnl_lock semaphore protection.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 0db96de6 22-Feb-2013 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath6kl: Cosmetic change in checking for free vif slot

A minor optimization is done in finding the free slot
available for the new virtual interface in the firmware.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 8457703f 05-Feb-2013 Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>

ath6kl: provide 64-bit per-station byte counters

Internally, 64-bit byte counters maintained for per-station
statistics. Tell to the netlink that full 64-bit value provided

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5b112d3d 31-Jan-2013 Johannes Berg <johannes.berg@intel.com>

cfg80211: pass wiphy to cfg80211_ref_bss/put_bss

This prepares for using the spinlock instead of krefs
which is needed in the next patch to track the refs
of combined BSSes correctly.

Acked-by: Bing Zhao <bzhao@marvell.com> [mwifiex]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 0c0280bd 11-Jan-2013 Luis R. Rodriguez <mcgrof@do-not-panic.com>

wireless: make the reg_notifier() void

The reg_notifier()'s return value need not be checked
as it is only supposed to do post regulatory work and
that should never fail. Any behaviour to regulatory
that needs to be considered before cfg80211 does work
to a driver should be specified by using the already
existing flags, the reg_notifier() just does post
processing should it find it needs to.

Also make lbs_reg_notifier static.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
[move lbs_reg_notifier to not break compile]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 6f7c1adb 16-Nov-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath6kl: minor optimization using if, else if

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 355b3a98 16-Nov-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath6kl: Move and rename ath6kl_cleanup_vif function

Rename ath6kl_cleanup_vif function as 'ath6kl_cfg80211_vif_stop'
which is the more appropriate name considering the functionality
of the module and vif specific cleanup is actually done by
ath6kl_cfg80211_vif_cleanup. Also move it to cfg80211.c.
Also make ath6kl_cfg80211_sta_bmiss_enhance as static function.
This addresses a FIXME/TODO.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# eb922e4b 16-Nov-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath6kl: Parse beacon interval from userspace

Parse beacon interval from userspace to
firmware. Incase the firmware does not
supports it, just print a warning message
and continue with AP settings.

Cc: Sumathi Mandipati <sumathi@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 8aa659d2 16-Nov-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath6kl: trivial cleanup on interface type selection

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

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 3d9d1d66 08-Nov-2012 Johannes Berg <johannes.berg@intel.com>

nl80211/cfg80211: support VHT channel configuration

Change nl80211 to support specifying a VHT (or HT)
using the control channel frequency (as before) and
new attributes for the channel width and first and
second center frequency. The old channel type is of
course still supported for HT.

Also change the cfg80211 channel definition struct
to support these by adding the relevant fields to
it (and removing the _type field.)

This also adds new helper functions:
- cfg80211_chandef_create to create a channel def
struct given the control channel and channel type,
- cfg80211_chandef_identical to check if two channel
definitions are identical
- cfg80211_chandef_compatible to check if the given
channel definitions are compatible, and return the
wider of the two

This isn't entirely complete, but that doesn't matter
until we have a driver using it. In particular, it's
missing
- regulatory checks on the usable bandwidth (if that
even makes sense)
- regulatory TX power (database can't deal with it)
- a proper channel compatibility calculation for the
new channel types

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 683b6d3b 08-Nov-2012 Johannes Berg <johannes.berg@intel.com>

cfg80211: pass a channel definition struct

Instead of passing a channel pointer and channel type
to all functions and driver methods, pass a new channel
definition struct. Right now, this struct contains just
the control channel and channel type, but for VHT this
will change.

Also, add a small inline cfg80211_get_chandef_type() so
that drivers don't need to use the _type field of the
new structure all the time, which will change.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 42d97a59 08-Nov-2012 Johannes Berg <johannes.berg@intel.com>

cfg80211: remove remain-on-channel channel type

As mwifiex (and mac80211 in the software case) are the
only drivers actually implementing remain-on-channel
with channel type, userspace can't be relying on it.
This is the case, as it's used only for P2P operations
right now.

Rather than adding a flag to tell userspace whether or
not it can actually rely on it, simplify all the code
by removing the ability to use different channel types.
Leave only the validation of the attribute, so that if
we extend it again later (with the needed capability
flag), it can't break userspace sending invalid data.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# f0ed67ec 12-Oct-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath6kl: Fix a mismatch in power management debug message

Power Save Enabled : REC_POWER - conserve power
without sacrificing performance.
Power Save Disabled : MAX_PERF_POWER - maximum
performance at the expense of power.
Hence fix the debug message.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# ff7e6867 15-Nov-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: support NL80211_USER_REG_HINT_CELL_BASE events

As ath6kl firmware can't do intersections the driver should only listen
to regdom changes from cellular base stations, all other requests need to
be refused.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# c8442118 24-Oct-2012 Johannes Berg <johannes.berg@intel.com>

cfg80211: allow per interface TX power setting

The TX power setting is currently per wiphy (hardware
device) but with multi-channel capabilities that doesn't
make much sense any more.

Allow drivers (and mac80211) to advertise support for
per-interface TX power configuration. When the TX power
is configured for the wiphy, the wdev will be NULL and
the driver can still handle that, but when a wdev is
given the TX power can be set only for that wdev now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 7ac25eac 27-Sep-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath6kl: Fix inactivity timeout for AR6004

Currently AR6004 handles the inactivity timeout resolution
in minutes rather than seconds. So parse the inactivity timeout
to the firmware in minutes. For now we will cleanup the
inactive station entries to the nearest converted minutes
(ex: an inactive time of 70 seconds would take atleast 2 - 3 minutes)
Tested with surprise removal of client cards/host shutdown.

Cc: Manikandan Radhakrishnan <mradhakr@qca.qualcomm.com>
Reported-by: Leela Kella <leela@qca.qualcomm.com>
Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# c0b34e2b 27-Sep-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath6kl: Rename ATH6KL_HW_FLAG_64BIT_RATES

Rename ATH6KL_HW_FLAG_64BIT_RATES to ATH6KL_HW_64BIT_RATES.
This seemed to be necessary to add/use new hardware flags
without exceeding 80 lines. We shall be adding new hw flags
dropping the FLAG term.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 58109df6 10-Sep-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Fix reconnection issue after recovery

Disallowing any wmi commands while re-initializing the
firmware results in connection failures after recovery
is done in open/WEP mode. To fix this, clear WMI_READY,
to make sure no wmi command is tried while fw is down.
Remove ATH6KL_STATE_RECOVERY state check in ath6kl_control_tx()
so that any configuration during fw init time will go through
using wmi commands.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 92332993 29-Aug-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Add support to detect fw error through heart beat

This patch adds support to detect fw error condition by sending
periodic message (heart beat challenge) to firmware. Upon reception
of the message, fw would send a response event to driver. When
there are no reponses from fw for about 5 cmd driver would
trigger the recovery logic assuming that fw has gone into an
error state.

Capable fw will advertise this capability through
ATH6KL_FW_CAPABILITY_HEART_BEAT_POLL bit. This feature
is disabled by default, can be enabled through a modparam
(heart_beat_poll). This modparam also confiures the polling
interval in msecs.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 84caf800 29-Aug-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Recover from fw crash

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

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 38142644 24-Aug-2012 Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>

ath6kl: trivial cleanup on interface type selection

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

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 2c07cf44 20-Aug-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: consolidate WoW pattern length

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

Reported-by Kalle Valo <kvalo@qualcomm.com>
Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# b1f47e3a 15-Aug-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: rework scheduled scan

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

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

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

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

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

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f21243a8 27-Jul-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: reconfigure RSN capabilities when restarting AP

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

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

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# fd4377b6 09-Aug-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: configure wow filters per-vif

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

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

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

WoW is cancelled if no connected vifs are found.

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

kvalo: fix a checkpatch warning in ath6kl_wow_resume()

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 84841ba2 19-Jul-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: add support for changing contry code

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

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 11f0bfcf 19-Jul-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: refactor wmi scan command

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

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 279b2862 17-Jul-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: support TX error rate notification

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

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# c95dcb59 10-Jul-2012 Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>

ath6kl: use custom MAC address for newly created interfaces

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

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 85b20fc2 21-Jun-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: support rssi threshold for sched scan

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

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 04b2312a 11-Oct-2012 Arend van Spriel <arend@broadcom.com>

wireless: drivers: make use of WLAN_EID_VENDOR_SPECIFIC

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

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

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

Cc: Jouni Malinen <j@w1.fi>
Cc: Dan Williams <dcbw@redhat.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Acked-by: Kalle Valo <kvalo@qca.qualcomm.com> [ath6kl]
Acked-by: Bing Zhao <bzhao@marvell.com> [mwifiex]
Acked-by: Stanislav Yakovlev <stas.yakovlev@gmail.com> [ipw2x00]
Signed-off-by: Arend van Spriel <arend@broadcom.com>
[change libipw as well]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# b292219f 12-Oct-2012 Johannes Berg <johannes.berg@intel.com>

wireless: use OR operation to set wiphy features

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

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

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 552bff0c 19-Sep-2012 Johannes Berg <johannes.berg@intel.com>

cfg80211: constify name parameter to add_virtual_intf

The name can't be modified by the driver,
make it const.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# fd014284 18-Jun-2012 Johannes Berg <johannes.berg@intel.com>

nl80211: move scan API to wdev

The new P2P Device will have to be able to scan for
P2P search, so move scanning to use struct wireless_dev
instead of struct net_device.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 84efbb84 15-Jun-2012 Johannes Berg <johannes.berg@intel.com>

cfg80211: use wireless_dev for interface management

In order to be able to create P2P Device wdevs, move
the virtual interface management over to wireless_dev
structures.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 71bbc994 15-Jun-2012 Johannes Berg <johannes.berg@intel.com>

cfg80211: use wdev in mgmt-tx/ROC APIs

The management frame and remain-on-channel APIs will be
needed in the P2P device abstraction, so move them over
to the new wdev-based APIs. Userspace can still use both
the interface index and wdev identifier for them so it's
backward compatible, but for the P2P Device wdev it will
be able to use the wdev identifier only.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# dfb89c56 27-Jun-2012 Johannes Berg <johannes.berg@intel.com>

cfg80211: don't allow WoWLAN support without CONFIG_PM

When CONFIG_PM is disabled, no device can possibly
support WoWLAN since it can't go to sleep to start
with. Due to this, mac80211 had even rejected the
hardware registration. By making all the code and
data for WoWLAN depend on CONFIG_PM we can promote
this runtime error to a compile-time error.

Add #ifdef around all WoWLAN code to remove it in
systems that don't need it as they never suspend.

Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Acked-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# d154f32e 30-May-2012 Etay Luz <eluz@qca.qualcomm.com>

ath6kl: support changing dtim period on AP mode

This patch adds support for dtim_period configuration in beacon.

kvalo: add a comment about ignoring the error, use vif_idx,
add \n to the warning message

Signed-off-by: Etay Luz <eluz@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f1ff32e8 30-May-2012 Joe Perches <joe@perches.com>

ath6kl: Add missing newline terminations

Messages without newlines can be interleaved.
Avoid this by adding terminations.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# aa430da4 16-May-2012 Johannes Berg <johannes.berg@intel.com>

cfg80211: provide channel to start_ap function

Instead of setting the channel first and then
starting the AP, let cfg80211 store the channel
and provide it as one of the AP settings.

This means that now you have to set the channel
before you can start an AP interface, but since
hostapd/wpa_supplicant always do that we're OK
with this change.

Alternatively, it's now possible to give the
channel as an attribute to the start-ap nl80211
command, overriding any preset channel.

Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 67b3f129 29-May-2012 Kiran Reddy <c_lreddy@qca.qualcomm.com>

ath6kl: separate ht cap for each band

In virtual interface structure, for each band separate ht cap
is needed. so that one can disable or enable ht capability band
wise.
This will fix the following issue:

1) Disable 11n from supplicant and start a P2P GO.
2) In beacon frames no HT-CAP IE is seen which is expected.
3) Now remove the P2P GO and kill the supplicant.
4) Beacon stops
5) Now using iw associate to an external AP in 5 GHZ
6) In 5 GHZ no HT IE going in assoc request but
when associated in 2.4 GHZ can see HT IES over the air
in assoc request.

In the code for del_beacon in cfg80211.c,set_ht_cap is being
called first for 2.4 GHZ and then for 5 GHZ. When called
for the first time for 2.4 GHZ the enable flag will be set to true
and so when called for the second time for 5 GHZ it just returns
after checking the flag.

Also using this one can have different HT capabilities
per band (for example one may decide not to use 20/40 in 2.4 GHZ
but use it in 5 GHZ). So maintaining a single context is not ok.
it is true for even the enable/disable flag and other HT
capabilities as well

Signed-off-by: Kiran Reddy <c_lreddy@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 06e360ac 22-May-2012 Bala Shanmugam <bkamatch@qca.qualcomm.com>

ath6kl: Add support for setting tx rateset.

Tx legacy and mcs rateset can configured using iw for
2.4 and 5 bands. Add support for the same in driver.

kvalo: add an enum for the hw flags and rename the flag accordingly,
rename ath6kl_cfg80211_set_bitrate_mask() to a shorter version to make
it easier to indent

Signed-off-by: Bala Shanmugam <bkamatch@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 33a6664a 16-May-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: issue wmi disconnect after notifying cfg80211

ath6kl would issue a wmi disconnect command in response to a remote
disconnect and return early without notifying cfg80211, only sending a
cfg80211_disconnected (with reason code always 3) in response to the
second disconnect firmware event.

Pass the right reason code to cfg80211 on the first disconnect instead.

This fixes at least one bug where a p2p client would stop trying to
connect after receiving a stale RSN deauth which was reported to
cfg80211 as GO leaving BSS.

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# dd45b759 16-May-2012 Naveen Singh <navesing@qca.qualcomm.com>

ath6kl: Include match ssid list in scheduled scan

Scheduled scan implementation was only taking probed list into
consideration. The matched list was dropped. This would cause
FW not to report the AP as the list never had that AP's SSID
populated. This was causing long connection time when supplicant
would just issue a wild card SSID in probed list. As a part of
this implementation, ath6kl driver would create a complete list
by taking both probed and matched list and pass it to FW. FW would
probe for the SSID that it needs to and would match against the
relevant SSIDS that is been configured.

kvalo: whitespace changes, less indentation in the for loop, use ++

Signed-off-by: Naveen Singh <navesing@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# c422d52d 15-May-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: enable enhanced bmiss detection

Enable enhanced bmiss detection if the firmware supports it. This
feature is only enabled on some firmwares since it comes with a power
cost.

Also add a few missing command ids to keep the enums straight.

kvalo: fix a compiler with ath6kl_err(), add few empty lines

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 6821d4f0 11-May-2012 Naveen Gangadharan <ngangadh@qca.qualcomm.com>

ath6kl: Add wow multicast firmware capability support

Infrastructure to enable Multicast WOW support based on
firmware capability added to the driver.This enables
different customers or chips to control this feature based
on firmware capability.

kvalo: Firmware capability infrastructure for multicast wow feature,
indetation fixes.

Signed-off-by: Naveen Gangadharan <ngangadh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 8ab5415d 09-May-2012 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Use correct max-scan-SSIDs limit

The currently used firmware images support 16 SSIDs in the scan
request (indexes 0..15), so update the host driver to use the same
limit to allow some more SSIDs to be scanned per request. In addition,
change the max-index to max-SSIDs to make it easier to understand the
implementation and fix couple of off-by-one checks that could limit
the maximum number of entries too strictly.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 954e6ce5 24-Apr-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Fix bss filter setting while scanning

bss filter is configured to allow the frames from all the bss other
than the currenly connected one, this is done when a scan is requested
in connected state. There is no reason to filter out the currently
connected bss, configure the filter to allow all the bss. This would
fix the reporting of stale rssi of the current bss while scanning.

Reported-by: Naveen singh <navesing@qca.qualcomm.com>
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 7fd1ce7e 24-Apr-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Don't advertise HT capability for incapable firmware

With firmwares which do not support rsn capability override
(ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE) from host would
cause 4-way handshake failure when HT cap is advertised.
To fix this, do not advertise HT cap with cfg80211 for
those fw.

kvalo: fix a checkpatch warning

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 6251d801 20-Apr-2012 Naveen Gangadharan <ngangadh@qca.qualcomm.com>

ath6kl: Multicast filter support in wow suspend and non-suspend

This patch enables all multicast packets in non suspend mode
and enable multicast filtering in wow suspend mode. This also
fixes a bug in multicast where the driver assumed disable
multicast-all command disabled/filtered all multicast
packets, which was wrong assumption, because firmware will
apply the programmed filter.

Multicast requirements
- Enable forward all multicast packets(no filtering) in
non suspend mode.
- Enable multicast filtering in wow suspend mode for both
AP and CLIENT.

kvalo: fix a checkpatch warning and drop unrelated newline removal

Signed-off-by: Naveen Gangadharan <ngangadh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 77ed4e45 19-Apr-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: disallow WoW with multiple vifs

The ath6kl fw does not have enough memory to support the WoW filters of
more than one vif. Disallow WoW suspend if this is the case.

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 37a2f950 19-Apr-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: only restore supported HT caps

Now that we know the supported PHY capabilities, only restore supported
bands / HT capabilities in firmware when stopping AP.

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# d92917e4 19-Apr-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: support fw reporting phy capabilities

Currently the supported bands are just hard coded in the driver.
However, the ath6kl FW will include its 11n and band capabilites in a
WMI_READY event. Handle this and report capabilites to cfg80211
accordingly.

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 3b8ffc6a 16-Apr-2012 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Configure probed SSID list consistently

Set max_scan_ssids and max_sched_scan_ssids to same value. These use the
same probed SSID list, so there is no point in using different maximum
number of SSIDs.

Clear probed SSID entries that are not used. This was already done for
sched_scan, but not for scan. Be consistent and clear the table for both
cases to avoid leaving bogus entries.

In addition, share the same function for setting the probed SSIDs for
scan and sched_scan paths. This fixes setting of wildcard SSID flag
(ANY_SSID_FLAG) and changes the scan path to use probed SSID index
consistently (i.e., start with 0 similarly to sched_scan; firmware
will handle the needed internal mapping).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# a432e7cc 16-Apr-2012 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Remove incorrect Probe Response offload support for Interworking

ath6kl does not support Probe Response offloading for Interworking (IEEE
802.11u), so remove the incorrectly added capability flag for it.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# d472b5e4 16-Apr-2012 Subramania Sharma Thandaveswaran <sharmat@qca.qualcomm.com>

ath6kl: Fix bug in bg scan configuration in schedule scan

Background scan interval should not be modified while starting
schedule scanning as it changes the bg scan interval when connected to AP.
Use the currently configured interval instead.

kvalo: improve commit log

Signed-off-by: Subramania Sharma <sharmat@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# eb38987e 16-Apr-2012 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Retain bg scan period value modified by the user

Added a new member bg_scan_period in struct ath6kl_vif
to retain background scan period value configured via debugfs
entry 'bgscan_interval'. This backup is needed in schedule scan
path while configuring scan parameters.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 48f27587 13-Apr-2012 Ming Jiang <mjiang@qca.qualcomm.com>

ath6kl: allow deepsleep_suspend function when wlan interface down

Aafter wlan interface is down WLAN_ENABLED flags will be cleared and
deepsleep_suspend function will be blocked in this senario. This patch
allows deepsleep_suspend function when wlan interface down by removed
the WLAN_ENABLED flag checking.

kvalo: fix commit log

Signed-off-by: Ming Jiang <mjiang@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# cdeb8602 12-Apr-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: merge split format strings into one

Found by checkpatch:

WARNING: quoted string split across lines

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 9e8b16db 10-Apr-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Configure 0 as rsn cap when it is not there in rsn ie

Currently rsn capability is not set when it is not available in
rsn IE. Set it to 0 in firmware when it is not there in the ie to
make sure host and target are consistent.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 798985c6 10-Apr-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Fix possible unaligned memory access in ath6kl_get_rsn_capab()

alignment is not taken care in accessing pairwise cipher and AKM suite
count which are parsed from rsn ie. Fix this alignment issue.

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# c4f7863e 06-Apr-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: handle concurrent AP-STA channel switches

If an ath6kl AP vif is beaconing on one channel, and a STA vif
associates on a different channel, a WMI_DISCONNECT event will be sent
to the AP vif. Make the AP vif follow the STA interface, and notify
userspace.

kvalo: fix a sparse warning with vif->next_chan

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 516304b0 18-Mar-2012 Joe Perches <joe@perches.com>

ath: Add and use pr_fmt, convert printks to pr_<level>

Use a more current logging style.
Make sure all output is prefixed appropriately.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# d97c121b 09-Apr-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Fix 4-way handshake failure in AP and P2P GO mode

RSN capability field of RSN IE which is generated (which is what really
advertised in beacon/probe response) differs from the one generated in
wpa_supplicant. This inconsistency in rsn IE results in 4-way handshake
failure. To fix this, configure rsn capability used in wpa_supplicant
in firmware using a new wmi command, WMI_SET_IE_CMDID. There is a bit
(ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE) in fw_capabilities to advertise
this support to driver.

Signed-off-by: Subramania Sharma <sharmat@qca.qualcomm.com>
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# df90b369 09-Apr-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Configure htcap in fw based on the channel type in AP mode

This patch disables HT in start_ap if the type of the channel on
which the AP mode is going to be operating is non-HT. HT is enabled
with default ht cap setting if the operating channel is going to be
11n.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# bed56e31 09-Apr-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Don't advertise HT40 support in 2.4 Ghz

HT40 is not supported in 2.4Ghz.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 1e8d13b0 06-Apr-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Fix target assert in p2p bringup with multi vif

Using interface 0 for p2p causes target assert. This is because
interface 0 is always initialized to non-p2p operations. Fix this
issue by initializing all the interfaces for p2p when fw is capable
of dynamic interface switching. When fw is not capable of dynamic
switching, make sure p2p is not brought up on interface which is
not initialized for this purpose.

Reported-by: Naveen Singh navesing@qca.qualcomm.com
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 3d79499c 28-Mar-2012 Vivek Natarajan <nataraja@qca.qualcomm.com>

ath6kl: Fix scan related issue on suspend-resume

When a scan request is pending while going to suspend, any new
scan request after resume will fail. So, cancel all scan requests
in all the vifs before moving to suspend state.

Signed-off-by: PingYang Zhang <pingzhan@qca.qualcomm.com>
Signed-off-by: Vivek Natarajan <nataraja@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f599359c 26-Mar-2012 Bala Shanmugam <bkamatch@qca.qualcomm.com>

ath6kl: Set background scan period.

After connect command, send scan params WMI command to
set background scan period. If period value is zero
send 0xffff as bg scan period to disable bg scan.
Set default bg scan period to be 60 seconds if
not specified.

This patch depends on below patch
cfg80211: Add background scan period attribute.

kvalo: fix open parenthesis alignment

Signed-off-by: Bala Shanmugam <bkamatch@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 5b35dff0 28-Mar-2012 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Store scan request info in-advance before sending SCAN request

In current code, Scan request info is recorded in vif->scan_req
after sending SCAN request to the firmware in ath6kl_cfg80211_scan().

In some corner cases, firmware sends SCAN_COMPLETE event immediately
when it receives SCAN request, which internally executes scan
complete event handler ath6kl_cfg80211_scan_complete_event() first.
So, Scan completion handler will a get a chance to executed even
before storing scan request info in ath6kl_cfg80211_scan().

Scan completion handler never report SCAN_COMPLETE event to
cfg80211 if scan request info(vif->scan_req) is NULL. This leads
to scan failure issue ("Device or resource busy error") during
next SCAN request from the user space. This patch ensures that scan
request info is stored before sending SCAN request.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 03bdeb0d 21-Mar-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Configure inactivity timeout in fw

Configure the inactivity timeout passed in start_ap() to
firmware. This capability is advertised only when fw supports
it, there is a new bit (ATH6KL_FW_CAPABILITY_INACTIVITY_TIMEOUT)
in firmware capability ie for driver to learn fw's capability.
After the fw finds out the station is inactive, it will probe
the station with null func frames. By default, the timeout is
10 secs.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 40abc2de 21-Mar-2012 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Optimize target power in deep sleep suspend

Adding below steps helps to get good power numbers
in deep sleep suspend path,

* Disable WOW mode.
* Flush data packets and wait for all control packets.
to be cleared in TX path before deep sleep suspend.
* Set host sleep mode to SLEEP.

Below steps are added to perform the recovery action
while the system resume from deep sleep,

* Set host sleep mode to AWAKE.
* Reset scan parameters to default value.

In addition, Debug prints are added to track deep sleep
suspend/resume state.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 055bde49 21-Mar-2012 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Isolate host sleep mode config part from ath6kl_wow_suspend

The piece of code used in ath6kk_wow_suspend function
to configure the host sleep mode is needed in deep sleep
case also.

Moving that portion to a separate function called
ath6kl_update_host_mode() would be helpful to avoid
the duplication of the same code in deep sleep path.

There is no functional change.

kvalo: move inline functions to cfg80211.c and fix a long line

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# b4d13d3b 21-Mar-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: abort normal scan when scheduled scan is started

If the device disconnects from an AP when it is in suspending state. You will
get the following message from wpa_supplicant after waking the device up and
sending scan request:

"Scan trigger failed: ret=-16 (Device or resource busy)"

Fix the issue by sending a scan complete event before starting scheduled
scan.

kvalo: cosmetic changes to commit log

Signed-off-by: Isaac.li <shonmou@gmail.com>
Tested-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# c86e4f44 15-Mar-2012 Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>

ath6kl: handle probe response from P2P device in P2P GO mode

When the device is in P2P GO mode and in listen state, the correct behavior is
to see two different probe response frames - one from P2P device and the other
from GO. wpa_supplicant uses the same mechanism to send the frame in both cases
(ath6kl_mgmt_tx). For GO probe response, ath6kl needs to call
ath6kl_send_go_probe_resp (this will add only WSC/P2P IEs and the rest of the
IEs are filled in by the firmware). That was done based on the nw_type ==
AP_NETWORK which would work if P2P Device role were in a separate netdev. When
P2P Device and GO use the same netdev, ath6kl needs to use the special GO probe
response case only if SSID is longer than P2P wildcard SSID.

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Reviewed-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# b5283871 12-Mar-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: use max_t() in ath6kl_cfg80211_connect()

ath6kl/cfg80211.c:589: WARNING: max() should probably be
max_t(u16, vif->listen_intvl_t, ATH6KL_MAX_WOW_LISTEN_INTL)

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 17a7b16d 08-Mar-2012 Aarthi Thiruvengadam <aarthi.thiruvengadam@qca.qualcomm.com>

ath6kl: Fix merge error in ath6kl_set_ies()

Portion of the commit id 080eec4fb4 ("ath6kl: Clear the IE in firmware
if not set") was overwritten by mistake due to a merge
conflict. This patch fixes the code back to how it should be.

kvalo: more details to the commit log

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 8c9bb054 07-Mar-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: fix open paranthesis alignment in ath6kl_cfg80211_connect()

ath6kl/cfg80211.c:462: CHECK: Alignment should match open parenthesis

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# d0d670ab 07-Mar-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: remove multiple assignments

Found by checkpatch:

drivers/net/wireless/ath/ath6kl/cfg80211.c:1295: CHECK: multiple assignments should be avoided
drivers/net/wireless/ath/ath6kl/cfg80211.c:3000: CHECK: multiple assignments should be avoided

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# ddc3d77c 07-Mar-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: logical continuations should be on the previous line

All found by checkpatch:

ath6kl/wmi.c:1036: CHECK: Logical continuations should be on the previous line

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 96f1fadc 07-Mar-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: alignment should match open parenthesis

Fix the issues which checkpatch found and were easy to fix. Especially
callers of ath6kl_bmi_write() are tricky and that needs to be fixed
separately.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# ce0dc0cf 20-Feb-2012 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Set optimal listen intvl,bmiss,scan params while going to wow suspend

* In order to save the target power in WOW suspend state,
configure the best optimal values for the below parameters,
- listen interval.
- beacon miss interval.
- scan parameters.

Default values for above attributes are reverted in
wow resume operation.

* The default listen interval is set before the host issue
connect request.

* New function is added to configure beacon miss count.

kvalo: minor changes to fix open parenthesis alignment

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 8f46fccd 20-Feb-2012 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Maintain the listen interval per VIF specific

Firmware has the option to support the listen interval
per vif specific. Fix this.

Listen interval can be set by the TUs or by the number
of beacons. Current code enables the user to configure
the listen interval in the unit of 'number of beacons'
using debugfs entry "listen_interval". Going forward,
we need to alter the listen interval in the unit of TUs
to get good power numbers while going to WOW suspend/resume.

Allowing the user to change the listen interval in
the unit of "number of beacons" in debugfs and changing
listen interval in wow suspend/resume in the unit of
time (TUs) would lead us to confuse.

This patch make sures the listen interval is changed only
in the unit of time (TUs).

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 390a8c8f 06-Mar-2012 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Check wow state before sending control and data pkt

Below two scenarios are taken care in this patch which helped
to fix the firmware crash during wow suspend/resume.

* TX operation (ctrl tx and data tx) has to be controlled based
on suspend state. i.e, with respect to WOW mode, control packets
are allowed to send from the host until the suspend state goes
ATH6KL_STATE_WOW and the data packets are allowed until WOW
suspend operation starts.

* Similarly, wow resume is NOT allowed if WOW suspend is in progress.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 1e9a905d 06-Mar-2012 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Add provision to define suspend policy in disconnected state.

It gives flexibility to the user to define suspend policy
when the suspend mode is set to WOW and the device is in
disconnected state at the time of suspend.

New module parameter wow_mode is added to get the choice
from the user. This parameter is valid only if the module
parameter suspend_mode is set to WOW.

To force WOW in connected state and cut power
in disconnected state:
suspend_mode=0x3 wow_mode=0x1

To force WOW in connected state and deep sleep
in disconnected state (this is also the default wow_mode):
suspend_mode=0x3 wow_mode=0x2

If there is no value specified to wow_mode during insmod,
deep sleep mode will be tried in the disconnected state.

kvalo: clarified commit log

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 67cd22e4 28-Feb-2012 Thomas Pedersen <c_tpeder@qca.qualcomm.com>

ath6kl: implement hidden ssid

The ath6kl FW does not distinguish between different types of hidden
SSIDs (empty or null), so treat all cfg80211 requests for hidden ssid
the same.

Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 080eec4f 28-Feb-2012 Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>

ath6kl: Clear the IE in firmware if not set

Remove check so that IE in firmware is cleared if not set. Without this fix, any
previously set IE will be used incorrectly in the next frame. For example,
consider the scenario where a P2P device scan is followed by a regular station
scan. The P2P IE set by the P2P scan needs to be cleared, otherwise the station
scan will contain the P2P IE.

kvalo: indentation fixes

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# e5348a1e 25-Feb-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Make sure wiphy is registered before calling regulatory_hint()

As regulatory events are processed even before the wiphy is registered,
calling regulatory_hint() at early stage should be fixed.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f2afdac7 28-Feb-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Group wiphy initialization into ath6kl_cfg80211_init()

There are some code which initializes various wiphy members
left outside ath6kl_cfg80211_init(), in ath6kl_core_init().
Move them into a single palce.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# faaf1929 26-Feb-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Register driver ht capabilities in wiphy

Register driver's ht capabilities in wiphy to avoid failures
in setting ht channels from hostapd.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 13423c31 21-Feb-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Make foreground scan a deterministic one

This makes the device get into scan state as soon as a
scan request is received, instead of blocking the scan
request till the traffic comes down. It is necessary
for the deterministic foreground scan particularly when
having multiple vif operating where, if the scan is non-
deterministic, scan on one interface will not start
as long as there are traffic on the other interface. This
change passes 50 msec as foreground scan interval to fix this.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# cc4d623d 14-Feb-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Remove bogus non-NULL pointer check

In ath6kl_cfg80211_add_key(), params is checked for non-NULL
but this pointer has been deferenced many times before this check. This
gives the following smatch warning. add_key() can never carry NULL as
params, remove this bogus check.

ath6kl_cfg80211_add_key(86) warn: variable dereferenced before check 'params'

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# d0ff7383 08-Feb-2012 Naveen Gangadharan <ngangadh@qca.qualcomm.com>

ath6kl: Add unicast mgmt frame buffering

PS buffering of unicast Action frames that are sent in a context
of a BSS. In AP mode when the recepient station goes to powersave
and PS_POLL flag is not set, we would buffer the frames. Send out
unicast mgmt bufferred frame when PS_POLL is received.

This fixes a bug in P2P GO behavior when sending a GO Discoverability
Request to a client that is in sleep mode.

kvalo: indentation fixes

Signed-off-by: Thirumalai Pachamuthu <tpachamu@qca.qualcomm.com>
Signed-off-by: Naveen Gangadharan <ngangadh@qca.qualcomm.com>
Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 8860020e 13-Feb-2012 Johannes Berg <johannes.berg@intel.com>

cfg80211: restructure AP/GO mode API

The AP/GO mode API isn't very clearly defined, it
has "set beacon" and "new beacon" etc.

Modify the API to the following:
* start AP -- all settings
* change beacon -- new beacon data
* stop AP -- stop AP mode operation

This also reflects in the nl80211 API, rename
the commands there correspondingly (but keep
the old names for compatibility.)

Overall, this makes it much clearer what's going
on in the API.

Kalle developed the ath6kl changes, I created
the rest of the patch.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 1b2df407 06-Feb-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Update license header

Update license header with the copyright to Qualcomm Atheros, Inc.
for the year 2011-2012.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 3c325fbd 31-Jan-2012 Masanari Iida <standby24x7@gmail.com>

ath6kl: Fix typo in cfg80211.c

Correct spelling "spported" to "supported" in
drivers/net/wireless/ath/ath6kl/cfg80211.c

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 3c411a43 30-Jan-2012 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Return a proper error code when not in connected state

Error code ENOTCONN is more suitable than EINVAL to report
when the driver is not in connected state in ath6kl_wow_suspend().

I found this during code review.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 081c7a84 30-Jan-2012 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Wait for host sleep mode cmd processed event during WOW suspend

For every WMI_SET_HOST_SLEEP_MODE_CMDID command (send from the host),
the firmware sends WMI_SET_HOST_SLEEP_MODE_CMD_PROCESSED_EVENTID as
an acknowledgement to the host.

In order to being sync with the firmware, the host has to wait for
WMI_SET_HOST_SLEEP_MODE_CMD_PROCESSED_EVENT event before going to
the suspend state. This patch ensures ath6kl_wow_suspend() waits
until it gets this event after sending set host sleep mode command.

This patch adds,
* New command WMI_SET_HOST_SLEEP_MODE_CMD_PROCESSED_EVENTID in
WMI event table.
* New WMI function ath6kl_wmi_host_sleep_mode_cmd_prcd_evt_rx()
to process the event.
* New flag HOST_SLEEP_MODE_CMD_PROCESSED in VIF flags to record
the arrival of the event.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# d91e8eee 30-Jan-2012 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Configure WOW patterns while going to wow_suspend

First preference is given to the user configured WOW patterns.
If the user doesn't configure any patterns (for ex, via iw command),
the default patterns will be configured based on the current mode
(vif->nw_type) while going to WOW suspend.

Summary of changes:

* ath6kl_wow_ap() is added to configure the below default
patterns when the system enters into WOW suspend in AP mode.
+ Unicast IP, EAPOL-like and ARP packet pattern
+ ARP packet pattern
+ mDNS/SSDP/LLMNR pattern
+ DHCP broadcast pattern

* ath6kl_wow_sta() is added to configure the below default
patterns when the system enters into WOW suspend in STA mode.
+ Unicast packet pattern
+ mDNS/SSDP/LLMNR pattern

* Move the user provided WOW patterns configuration code
from ath6kl_wow_suspend() to a separate function called
ath6kl_wow_usr().

* Two argument variable's ('filter' and 'mask) data type in
ath6kl_wmi_add_wow_pattern_cmd() are changed from 'u8 *' to
'const u8 *'. This is needed to make all pattern and mask
arrays to be 'static const u8' in the caller function.

* New conditional check is added to make sure user
configured pattern count is within the limit (WOW_MAX_FILTERS_PER_LIST).

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 1d2a4456 21-Jan-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Fix bug in maintaining aggregation state in AP mode

Currently rx aggregation related states are maintained per
vif, but this will not properly work when operating in AP mode.
Aggregation is completely broken when more than one
11n stations are connected to AP mode vif. Fix this issue
by keeping station specific aggregation state in sta_list.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 7baef812 21-Jan-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Define a structure for connection specific aggregation information

This patch just groups connection specific aggregation information
from struct aggr_info into a new structure (struct aggr_info_conn)
so that, in softAP mode, this can be used when each connected station
is made to have it's own aggregation state.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# d6a434d6 17-Jan-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: create ath6kl_core.ko

Now ath6kl is ready for splitting core code to ath6kl_core.ko module.
This also makes it possible to link both sdio and usb code to kernel
at the same time, which earlier failed miserably.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 45eaa78f 17-Jan-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: create core.c

Currently core functions are spread between various files, group all
the functions into file and rename the functions to follow the style
used elsewhere in the driver. This will make it easier to a separate core
module.

Also fix a bug where wiphy is freed too early.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 46d33a21 17-Jan-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: unify cfg80211 init/cleanup functions

Group them together and change the naming to follow the common style in
ath6kl. No functional changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# c25889e8 17-Jan-2012 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: rename vif init and cleanup functions

ath6kl_cfg80211_vif_init/cleanup() follow more closely the style used
elsewhere in ath6kl.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# c1762a3f 12-Jan-2012 Thirumalai Pachamuthu <tpachamu@qca.qualcomm.com>

ath6kl: Add support for uAPSD

* A new APSD power save queue is added in the station structure.
* When a station has APSD capability and goes to power save, the frame
designated to the station will be buffered in APSD queue.
* When the host receives a frame which the firmware marked as trigger,
host delivers the buffered frame from the APSD power save queue.
Number of frames to deliver is decided by MAX SP length.
* When a station moves from sleep to awake state, all frames buffered
in APSD power save queue are sent to the firmware.
* When a station is disconnected, all frames bufferes in APSD power save
queue are dropped.
* When the host queues the first frame to the APSD queue or removes the
last frame from the APSD queue, it is indicated to the firmware using
WMI_AP_APSD_BUFFERED_TRAFFIC_CMD.

kvalo: fix buggy handling of sks queues, made it more obvious
the user priority when wmm is disabled, remove unneed else block and
combined some variable declarations

Signed-off-by: Thirumalai Pachamuthu <tpachamu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 8232736d 09-Jan-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath6kl: Fix listen interval handling

This patch addresses a few problems with the commit:

"ath6kl: Implement support for listen interval from userspace"

* The debugfs file required for reading/writing the listen interval
wasn't created. Fix this.

* The interface index was being hardcoded to zero. Fix this.

* Two separate parameters, "listen_interval_time and listen_interval_beacons"
were being used. This fails to work as expected because the FW assigns
higher precedence to "listen_interval_beacons" and "listen_interval_time"
ends up being never used at all.

To handle this, fix the host driver to exclusively use listen interval
based on units of beacon intervals.

To set the listen interval, a user would now do something like this:

echo "10" > /sys/kernel/debug/ieee80211/*/ath6kl/listen_interval

kvalo: fix two checkpatch warnings

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 4a8ce2fd 09-Jan-2012 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath6kl: Remove redundant pointer check

'params' is already used earlier and there is no point
in checking for a NULL condition again.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 80abaf9b 03-Jan-2012 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Implement ndo_set_rx_mode()

There are maximum of seven multicast filter are supported
by hw. When the requested number of filters exceeds the
maximum supported one, multicast filtering is completely
disabled, the requested filters will be configured in
firmware and the only multicast frames that host is interested
in will be passed to host for further processing otherwise.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>


# 792ecb33 29-Dec-2011 Vivek Natarajan <nataraja@qca.qualcomm.com>

ath6kl: Remove redundant key_index check.

Less-than-zero comparison of an unsigned value is never true.

kvalo: remove WMI_MIN_KEY_INDEX altogether, it's useless

Signed-off-by: Vivek Natarajan <nataraja@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# ba1f6fe3 27-Dec-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Advertise TX/RX support for frames in AP mode

This is needed to fix current hostapd/wpa_supplicant AP operations for
frame registration. P2P GO mode already advertised these, but AP mode
was forgotten and could not be used after the hostapd/wpa_supplicant
frame registration changes.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 33e5308d 27-Dec-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Add del_station cfg80211_ops

hostapd/wpa_supplicant AP mode uses this operation to flush the station
entries. Implement this in ath6kl to avoid unnecessary warnings from
NL80211_CMD_DEL_STATION failing.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# e68f6750 21-Dec-2011 Sujith Manoharan <c_manoha@qca.qualcomm.com>

ath6kl: Fix panic when setting a channel

cfg80211 could pass a NULL net_device to the driver via the
set_channel() callback, when it receives a request to set the
device's channel. Not handling this case properly results in this panic:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000cb0
IP: [<ffffffffa0374e49>] ath6kl_cfg80211_ready+0x9/0x70 [ath6kl_sdio]

Call Trace:
[<ffffffffa0374ed7>] ath6kl_set_channel+0x27/0x90 [ath6kl_sdio]
[<ffffffffa04dfd5f>] cfg80211_set_freq+0xff/0x1d0 [cfg80211]
[<ffffffffa04d3275>] ? nl80211_set_wiphy+0x85/0x660 [cfg80211]
[<ffffffffa04d3198>] __nl80211_set_channel.isra.39+0x118/0x140 [cfg80211]
[<ffffffffa04d34f3>] nl80211_set_wiphy+0x303/0x660 [cfg80211]
[<ffffffff813678d7>] ? rtnl_lock+0x17/0x20
[<ffffffffa04ca165>] ? nl80211_pre_doit+0xb5/0x150 [cfg80211]
[<ffffffff81382a45>] genl_rcv_msg+0x1d5/0x250
[<ffffffff81382870>] ? genl_rcv+0x40/0x40
[<ffffffff81381be9>] netlink_rcv_skb+0xa9/0xd0
[<ffffffff81382855>] genl_rcv+0x25/0x40
[<ffffffff811354f0>] ? might_fault+0x40/0x90
[<ffffffff81381519>] netlink_unicast+0x2d9/0x320
[<ffffffff813818e6>] netlink_sendmsg+0x2c6/0x320
[<ffffffff81343800>] ? sock_update_classid+0xb0/0x110
[<ffffffff8133f52e>] sock_sendmsg+0x10e/0x130
[<ffffffff81169933>] ? mem_cgroup_update_page_stat+0x193/0x250
[<ffffffff811354f0>] ? might_fault+0x40/0x90
[<ffffffff811354f0>] ? might_fault+0x40/0x90
[<ffffffff81135539>] ? might_fault+0x89/0x90
[<ffffffff811354f0>] ? might_fault+0x40/0x90
[<ffffffff8134d126>] ? verify_iovec+0x56/0xd0
[<ffffffff8133f9e6>] __sys_sendmsg+0x396/0x3b0
[<ffffffff8108e823>] ? up_read+0x23/0x40
[<ffffffff81040e68>] ? do_page_fault+0x208/0x4e0
[<ffffffff81193151>] ? vfsmount_lock_local_unlock+0x21/0x60
[<ffffffff811947d0>] ? mntput_no_expire+0x30/0xe0
[<ffffffff8119489f>] ? mntput+0x1f/0x30
[<ffffffff81342149>] sys_sendmsg+0x49/0x90
[<ffffffff81425482>] system_call_fastpath+0x16/0x1b

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# c08631c6 16-Dec-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Send own IP addr to the firmware during WOW suspend

Firmware ARP module requires own IP addr in order to respond
to the outside world when the target is in WOW suspend state.

At present, firmware ARP module has capability to hold 2 IP addr.
So, WOW mode will be disabled if the total IP addr configured in
net_dev for our device is greater than firmware limit (MAX_IP_ADDRS)
which is 2 at this moment.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Thirumalai Pachamuthu <tpachamu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 6e786cb1 15-Dec-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Fix connect command to clear previously used IEs

Empty IE buffer means that the new association is not supposed to
include extra IEs. Make sure any previously configured (Re)Association
Request frame IEs get cleared in such a case. This is based on a patch
from Shuibing.

Cc: Dai Shuibing <shuibing@qca.qualcomm.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 5e13fd35 13-Dec-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Use cfg80211_roamed_bss() to report roaming event

This is to avoid the scenario where the bss entry of the AP got
expired when reporting roaming event to current AP. As the bss
entry for the current bss is available in driver, pass this bss
to cfg80211. This fixes WARNING: at net/wireless/sme.c:586.

This patch depends on the following patch in cfg80211
"cfg80211: Fix race in bss timeout".

Reported-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 3ca9d1fc 13-Dec-2011 Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>

ath6kl: support for P2P mgmt operations on station interface

This patch enables support for doing P2P management operations like device
discovery on top of a station interface. After group formation, the station
interface will become a P2P GO/client interface as the case may be.

This feature requires modifications to a couple of existing WMI structures and
therefore new command ids and structures have been defined in order to be
compatible with older firmware versions and other chips. The exception here is
the wmi_connect_cmd. Adding a new field to the end of the structure will not
cause any issues with previous firmware versions since firmware only checks for
minimum length of the command. The other structures are of variable length,
hence it was not possible to add new fields to the end.

The new command ids have to be added to the end of enum wmi_cmd_id, so it has
updated to match the firmware.

The driver will support both the 'old' and the 'new' commands for a while by
checking the firmware capabilities.

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 10509f90 13-Dec-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: implement scheduled scan

ath6kl firmware supports scheduled scan functionality with the wow ssid
filter. But the firmware does not send any events after scan results
so I had to add a timer which notifies about new scan results.

Sched scan needs firmware version 3.2.0.6 or later. If firmware doesn't
support sched scan the driver will not enable the feature.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 7125f01d 13-Dec-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: implement ath6kl_cfg80211_stop_all()

During suspend we need to stop all vifs, not just the first.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# c97a31b0 13-Dec-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: remove a workaround from ath6kl_cfg80211_stop()

There's a workaround in ath6kl_cfg80211_stop() which emits disconnected
even when sme_state was disconnected. This is legacy from the old
staging driver and I can't repoduce the old problem anymore. I assume the
bug got fixed while the driver was cleaned up so let's get
rid of the hack.

This makes it possible to call ath6kl_cfg80211_stop from ath6kl_close()
which happens in a followup patch.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# d6d5c06c 25-Nov-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: cleanup ath6kl_priv()

It really should not return a void pointer. Also remove useless casts
from its users.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 4703290a 08-Dec-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Use delayed key configuration for WAPI in AP mode

This is needed to allow WAPI AP to configure the initial group key
to the target in the same way as is done with TKIP/CCMP. This
fixes broadcast data frame delivery with the initial group key.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 0bb4e30f 23-Nov-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: remove unused sc_params from struct ath6kl

It was only initialised but not used anywhere. Also remove two defines
which ended up unused after this change.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# b992a285 23-Nov-2011 Luis R. Rodriguez <mcgrof@qca.qualcomm.com>

ath6kl: fix ath6kl's set tx power

ath6kl assumed cfg80211 passed to us power in dBm but it is in mBm.

Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 743b4518 18-Nov-2011 Dan Carpenter <dan.carpenter@oracle.com>

ath6kl: unlock if ath6kl_cfg80211_connect() fails

There is an unlock missing on this error path.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f143379d 17-Nov-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Find ar->max_norm_iface in firmware IE parsing

Currently the max number of vifs which can be used for non-p2p
mode is determined in ath6kl_core_alloc(). But the maximum
supported vifs are parsed from firmware IE in ath6kl_fetch_fw_api2()
which would happen after ath6kl_core_alloc().

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 774439ad 17-Nov-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Remove modparam multi_norm_if_support

This modparam was introduced to enable non-p2p mode operation
on two virtual interfaces. It does not seem to be necessary to
have a separate module parameter to do that. Instead, this option
can be enabled when any one of the interfaces is not going to be
used for p2p (ath6kl_p2p).

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 59500b48 16-Nov-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Fix AP mode operation after interface down/up

When operating AP interface is brough down the mode is reset to
STA. This STA will be reconfigured into AP mode when the interface
is brought up again. This sequence will be successful only when
change_virtual_intf() returns with no error, but there is a
check in this callback which does the type change only when
that interface is active. This callback does nothing more
than saving the new interface type to vif and wdev, so the
sanity check for interface state and wmi state is not necessary.
This makes the AP interface functional again after interface down/up.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 542c519a 15-Nov-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Clear WPS ctrl flag if zero length IE is received from cfg80211

Connect control flag CONNECT_WPS_FLAG has to be cleared
by default even if the driver receives zero length IE
from cfg80211.

Otherwise this flag would be always set after WPS exchange
which would lead wpa_supplicant to fail to connect with
the received WPS credentials. This issue is observed only
in OPEN security.

kvalo: use cfg80211 instead of CFG in the commit log

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 71f96ee6 14-Nov-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: make maximum number of vifs runtime configurable

Needed when detecting how many vifs firmware supports.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# be5abaaf 11-Nov-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Fix bug in setting dot11_auth_mode in AP mode

OPEN_AUTH is passed as dot11_auth_mode by default, this would
affect the AP mode when configured with shared authentication
type. Assign appropriate auth type to fix this from driver.
A patch in wpa_supplicant (wpa_supplicant: Set configured auth_algs)
is also needed to fix this.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 7cefa44f 11-Nov-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Fix bug in setting default key index for tx in AP mode

vif->def_txkey_index is set to key_index in ath6kl_cfg80211_add_key().
If the interface is configured with multiple static wep keys,
vif->def_txkey_index would be holding the index of the last key configured,
not the default tx key index. Remove this unnecessary default key index setting
in ath6kl_cfg80211_add_key() to configure the right key index in WEP thereby
make it work when multiple wep keys are configured.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 4eab6f4f 09-Nov-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Fix cfg80211 warning while starting IBSS mode

When the connect event is received from the target in IBSS mode,
cfg80211_ibss_joined() is called without informing BSS info to
cfg80211 layer which internally hits the below WARN_ON message.

WARNING: at net/wireless/ibss.c:33 __cfg80211_ibss_joined+0x153/0x180 [cfg80211]()
[..]
[ 4916.845878] Call Trace:
[ 4916.845889] [<c10427d2>] warn_slowpath_common+0x72/0xa0
[ 4916.845905] [<f8bccc63>] ? __cfg80211_ibss_joined+0x153/0x180 [cfg80211]
[ 4916.845918] [<f8bccc63>] ? __cfg80211_ibss_joined+0x153/0x180 [cfg80211]
[ 4916.845923] [<c1042822>] warn_slowpath_null+0x22/0x30
[ 4916.845934] [<f8bccc63>] __cfg80211_ibss_joined+0x153/0x180 [cfg80211]
[ 4916.845941] [<c1025108>] ? default_spin_lock_flags+0x8/0x10
[ 4916.845952] [<f8bb7fcd>] cfg80211_process_rdev_events+0x19d/0x220 [cfg80211]
[ 4916.845962] [<f8bb669b>] cfg80211_event_work+0x2b/0x50 [cfg80211]
[ 4916.845968] [<c105aae6>] process_one_work+0x116/0x3c0
[ 4916.845977] [<f8bb6670>] ? cfg80211_get_dev_from_info+0x40/0x40 [cfg80211]
[ 4916.845982] [<c105cdf0>] worker_thread+0x140/0x3b0
[ 4916.845986] [<c105ccb0>] ? manage_workers+0x1f0/0x1f0
[ 4916.845991] [<c1060c64>] kthread+0x74/0x80
[ 4916.845995] [<c1060bf0>] ? kthread_worker_fn+0x160/0x160
[ 4916.846001] [<c14e7bbe>] kernel_thread_helper+0x6/0x10
[ 4916.846005] ---[ end trace 769254924e409367 ]---

This patch make sures that BSS info is delivered via cfg80211_inform_bss()
to cfg80211 in advance before intimating IBSS status to cfg80211.

In addition to this, one debug message is also added to know
ad-hoc mode status (creator/joiner).

kvalo: change subject

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# b8214df1 03-Nov-2011 Dai Shuibing <shuibing@qca.qualcomm.com>

ath6kl: Allow SMS4 to be configured in AP mode

Signed-off-by: Dai Shuibing <shuibing@qca.qualcomm.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 5e07021e 03-Nov-2011 Dai Shuibing <shuibing@qca.qualcomm.com>

ath6kl: Add support for configuring SMS4 keys

Indicate support for WPI-SMS4 cipher and allow SMS4 keys to be
configured.

Signed-off-by: Dai Shuibing <shuibing@qca.qualcomm.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# eae9e066 07-Nov-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Expose ath6kl's WOW capabilities to cfg80211

Set the list of ath6kl's WOW trigger options in wiphy->wowlan.flags
variable during wiphy registration. So that, those options can be
configured via iw.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# a918fb3c 07-Nov-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Perform WOW resume in RX path in case of SDIO IRQ wake up

The target triggers sdio data line to wake up the host when
WOW pattern matches. This causes sdio irq handler is being
executed in the host side which internally hits ath6kl's RX path.

WOW resume should happen before start processing any data from
the target. So it's required to perform WOW resume in RX path.

This area needs bit rework to avoid WOW resume in RX path,
As of now it's fine to have this model, rework will be done later.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# d7c44e0b 07-Nov-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Invoke WOW suspend/resume calls during PM operation

Link ath6kl's wow suspend/resume functions with the actual suspend/resume path.

WOW mode is selected when the host sdio controller supports both
MMC_PM_KEEP_POWER and MMC_PM_WAKE_SDIO_IRQ capabilities.

kvalo: also adds a missing break in ath6kl_cfg80211_resume(), luckily
it didn't have any effect on functionality.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 524441e3 07-Nov-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Move ath6kl_cfg80211_stop() call specific to deep sleep and cut pwr

ath6kl_cfg80211_stop() call is not applicable for WOW mode. Hence moving
this call to deep sleep and cut pwr specific cases.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 0f60e9f4 07-Nov-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Include new parameter in suspend path for wowlan

cfg80211 layer provides user defined wow parameters like Filter options, Patterns,
Pattern's mask, etc via "struct cfg80211_wowlan *wow" to suspend function.

Right now, this wowlan parameter is not handled in __ath6kl_cfg80211_suspend func.
This parameter has to be passed to HIF layer, So that it can be passed back to
ath6kl's cfg interface layer when WOW mode is selected.

In case of deep sleep and cut power mode, it's not handled.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 6cb3c714 07-Nov-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Add WOW suspend/resume implementation

This is the core WOW suspend/resume functions will be called
in PM suspend/resume path.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f3e61ece 02-Nov-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Do not hide ath6kl_wmi_addkey_cmd() error values

Instead of converting any error to EIO, just return the real error
value to upper layers.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f4bb9a6f 02-Nov-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Fix key configuration to copy at most seq_len from seq

There is no guarantee on the caller using 8-octet buffer for
key->seq, so better follow the key->seq_len parameter on figuring
out how many octets to copy.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 11f6e40d 01-Nov-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Fix lockdep warning

The following is the lockdep warning which detects possible
deadlock condition with the way ar->lock and ar->list_lock
are being used.

(&(&ar->lock)->rlock){+.-...}, at: [<ffffffffa0492d13>] ath6kl_indicate_tx_activity+0x83/0x110 [ath6kl]
but this lock took another, SOFTIRQ-unsafe lock in the past:
(&(&ar->list_lock)->rlock){+.+...}

and interrupts could create inverse lock ordering between them.

other info that might help us debug this:
Possible interrupt unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&(&ar->list_lock)->rlock);
local_irq_disable();
lock(&(&ar->lock)->rlock);
lock(&(&ar->list_lock)->rlock);
<Interrupt>
lock(&(&ar->lock)->rlock);

*** DEADLOCK ***

softirqs have to be disabled when acquiring ar->list_lock to avoid
the above deadlock condition. When the above warning printed the
interface is still up and running without issue.

Reported-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# b4b2a0b1 01-Nov-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: cut power during suspend

If sdio controller doesn't support keep power, cut power from hardware
during suspend and restart firmware during resume. If we are connected
during suspend, send a disconnected event to user space.

Earlier suspend failed with an error if sdio didn't support keep power.
Now suspend will happen succesfully even with that case.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 76a9fbe2 01-Nov-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: add state variable depicting hw/fw state

This way it's easier to track state changes and in the future add
more warnings about using hardware in wrong states. Currently there
are few random flags for trying to do the same, those will be cleaned
and removed in the future.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 52d81a68 01-Nov-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: implement ath6kl_cfg80211_suspend()

This is in preparation for cutpower suspend feature. HIF layer makes
the decision based on information provided by cfg80211 and what hardware
actually supports. Then it calls ath6kl_cfg80211_suspend() to enable
the chosen mode.

Functionality should be the same, this is just preparation for
more suspend modes (cutpower and wow).

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 1f4052551 01-Nov-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: reset CONNECT_PEND and CONNECTED flags in ath6kl_cfg80211_stop()

Otherwise first connection establish after cutpower suspend will
fail.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# ec4b7f60 01-Nov-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: create ath6kl_cfg80211_stop()

Just take code from deep sleep for now, will be improved later. No
functional changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 1c17d313 01-Nov-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: add aborted parameter to ath6kl_cfg80211_scan_complete_event()

Currently it takes an error code as status, but what we really want to
tell is if the scan was aborted or not.

Also fix a bug where we were comparing firmware scan status values
with kernel error codes, which is obviously wrong. This meant
that ath6kl didn't detect when firmware informed about failed scans. I
doubt that this fix doesn't make any difference in practise but it
still needs to be fixed. This is fixed by adding an enum for the success
status code and checking for that.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# cb93821a 27-Oct-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: don't use cfg80211_scan_request after cfg80211_scan_done()

Use of cfg80211_scan_request is not valid after calling cfg80211_scan_done()
but ath6kl_cfg80211_scan_complete_event() was doing exactly that. Change
the function to call cfg80211_scan_done() last.

This was found during code review, I didn't see any visible problems
due to this bug.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 1052261e 27-Oct-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Report unique remain-on-channel cookie values

Even though only a single concurrent remain-on-channel operation is
supported, there may be two pending remain-on-channel events (one to
indicate end of a canceled operation and another to indicate start of a
new operation). User space won't be able to distinguish these events
unless unique cookies are used.

The previous behavior resulted in wpa_supplicant getting quite
confused about the driver's offchannel state in various sequences
and this made the P2P state machine behave incorrectly. Use of
more than a single remain-on-channel cookie value fixes this.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 63541212 25-Oct-2011 Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>

ath6kl: add support for WPS

Add control flag CONNECT_WPS_FLAG if a WPS IE is present in the
Association Request IEs. This flag is needed when the station must
connect to a WPS-enabled AP.

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 551959d8 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Use appropriate wdev from vif

Remove the wdev reference in struct ath6kl.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 3226f68a 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Add a modparam to enable multi normal interface support

This option lets operate more than one vif in normal mode (AP/STA/IBSS)
when support for multiple vif is enabled. This modparam needs to be used
as

modprobe ath6kl multi_norm_if_support=1

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 55055976 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Implement add_virtual_intf() and del_virtual_intf()

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 27929723 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Use the other variant of netdev (un)register APIs

Use replace (un)register_netdev() with (un)register_netdevice()
so that the same ath6kl function can be used with
add_virtual_intf()/del_virtual_intf().

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 990bd915 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Maintain virtual interface in a list

This patch removes all references to ar->vif and takes
vif from a list.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 478ac027 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Introduce spinlock to protect vif specific information

Use this spinlock to protect the vif's data instead of
one from ath6kl.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 6db8fa53 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Refactor ath6kl_destroy()

So that the deinitialization of ath6kl and vif are separated.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# e29f25f5 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Cleanup parameters in ath6kl_init_control_info() and ath6kl_init_profile_info()

Pass vif structure to those functions instead of ath6kl because these
functions do vif specific information initialization.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 28ae58dd 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Remove net_device from ath6kl

Use one which is available in vif structure instead.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 240d2799 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Take vif information from wmi event

Interface index is passed in wmi command header from target.
Use this index to get the appropriate vif.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 334234b5 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Maintain firmware interface index in struct ath6kl_vif

Pass this index to target in wmi commands to specify the interface
for which the command needs to be handled.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# b95907a7 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Make net and target stats vif specific

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# cf5333d7 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Move few more vif specific information to struct ath6kl_vif

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 14ee6f6b 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Move scan_req info and sme_state to vif

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# de3ad713 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Move disconnect timer to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 2132c69c 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Move aggregation information to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 6f2a73f9 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Move key information to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f74bac54 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Move channel information to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 8c8b65e3 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Move bssid information to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f5938f24 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Move nw_type to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 3450334f 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Move ssid and crypto information to vif structure

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 59c98449 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Define interface specific states

Currently ar->flag maintains interface stats. Move interface
specific states from ar->flag to vif->flags.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 108438bc 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Define an initial vif structure and use it

vif specific information need to be moved from struct ath6kl.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 8dafb70e 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Refactor wiphy dev and net dev init functions

This refactoring is done in a manner that it can be used
for multiple virtual interface.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# be98e3a4 25-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Keep wiphy reference in ath6kl structure

This is to avoid using ar->wdev to get wiphy pointer, this
may need further cleanup for multi vif support.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 837cb97e 11-Oct-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Allow CCKM AKM and KRK to be configured

Use vendor-specific suite selectors to allow CCKM to be configured.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 6981ffdc 06-Oct-2011 Kevin Fang <kevin.fang@qca.qualcomm.com>

ath6kl: Add WSC IE on the associate message

For some WPS test items, such as item "5.1.14"
STAUT must include the WSC IE in the 802.11 Association Request frame.
Therefore, add the corresponding IE in association message.

Signed-off-by: Kevin Fang <kevin.fang@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# aa6cffc1 05-Oct-2011 Chilam Ng <chilamng@qca.qualcomm.com>

ath6kl: make sure WLAN power save is enabled during suspend

Power save is enabled during ath6kl init. But when user space disables power
save, the system will go into suspend with power save disabled. The ath6kl
driver will now explicitly enable power save prior to entering suspend and
restore its previous setting upon resume

Signed-off-by: Chilam Ng <chilamng@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f1f92179 01-Oct-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Enable force foreground scan in connected state

This was disabled beacause there was a network stall
issue when scan is issued. This issue does not happen
with the new firmware (3.1.1.609), enable it back.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# e247bd90 04-Nov-2011 Johannes Berg <johannes.berg@intel.com>

cfg80211/mac80211: allow management TX to not wait for ACK

For probe responses it can be useful to not wait for ACK to
avoid retransmissions if the station that sent the probe is
already on the next channel, so allow userspace to request
not caring about the ACK with a new nl80211 flag.

Since mac80211 needs to be updated for the new function
prototype anyway implement it right away -- it's just a
few lines of code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 6eb07caf 15-Sep-2011 Paul Gortmaker <paul.gortmaker@windriver.com>

drivers/net: Add moduleparam.h to drivers as required.

These files were using moduleparam infrastructure, but were not
including anything for it -- which is fine when module.h is being
implicitly included in all files, but that is going away.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>


# 5f68a2b0 11-Oct-2011 John W. Linville <linville@tuxdriver.com>

ath6kl: fixup merge damage in ath6kl_mgmt_tx

CC [M] drivers/net/wireless/ath/ath6kl/cfg80211.o
drivers/net/wireless/ath/ath6kl/cfg80211.c:1838:2: warning: initialization from incompatible pointer type

Caused by commit e9f935e3e8dc0bddd0df6d148165d95925422502...

Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 9a730834 27-Sep-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: silence "invalid rate" warning

For some reason firmware is sending invalid rates when we try to
query current bitrate from ath6kl_get_station() and a warning is issued:

[ 3810.415720] ath6kl: invalid rate: 1935633515
[ 3811.105493] ath6kl: invalid rate: 1935633515
[ 3811.556063] ath6kl: invalid rate: 1935633515

As the warning happens way too often, convert the warning to a debug
message once we have a proper fix. But to make it easy to follow
how often the problem appears, add a debugfs to print
various statistics about workarounds and make this issue the first WAR.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 1de547d6 22-Sep-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Fix disconnect event reporting

Driver does not report disconnect event properly when in connecting state,
this leads to issues failures in starting reconnection. Send a disconnect
command to target when a disconnect event is received with reason code
other than 3 (DISCONNECT_CMD - disconnect request from host) to make the
frimware stop trying to connect even after giving disconnect event. There
will be one more disconnect event for this disconnect command with reason
code DISCONNECT_CMD which will be notified to cfg80211.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 32c10874 19-Sep-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Export beacon interval and DTIM period through STA info

Now that we allow the first Beacon frame after each connection to
be processed at the host, we can figure out the DTIM period and
expose it with Beacon interval through STA info BSS parameters
to user space.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 551185ca 19-Sep-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Update BSS information after connection

Since we may end up using a dummy BSS entry when roaming, allow one Beacon
frame -based bssinfo from the current BSS to be processed prior to starting
to filter all bssinfo events. This allows cfg80211 BSS table to be filled
with proper data in the roaming case where the full Beacon data may not
have been present at the time of roamed event.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 457fb041 19-Sep-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Remove the unused node table implementation

Now that the scan results are reported directly to the cfg80211 BSS
table there is no need for maintaining this internal node table
implementation for scan results. Remove the definitions and node
table functions.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 01cac476 19-Sep-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Fix BSS update on roaming

This fixes the BSS "update" just before the connected or roamed event.
The previous implementation was completely broken: it forced a hardcoded
signal strength and IEs from Association _Request_ frame instead of any
Beacon information. This broke various things, including PMKSA caching.

The current workaround for creating a dummy BSS entry before the roamed
event is not exactly ideal, but that is quite a bit better than the
previous state. As a future improvement, cfg80211 could potentially be
extended to allow this type of use or ath6kl could delay sending the
roamed event before receiving a BSS info event.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 151411e8 15-Sep-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Fix static WEP configuration in AP mode

Configuration of the WEP keys needs to be delayed until the AP mode has
been properly started at the target. Partial support for delaying the
WEP key configuration was already in place in the driver, but the actual
part of deciding when to do this was missing.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 170826dd 10-Sep-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Set the sme_state to disconnected in disconnect() callback

After a successful completion of disconnect() driver needs to set
it's sme_state to SME_DISCONNECTED to be in sync with cfg80211
state.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# ac59a2b2 10-Sep-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Remove auth type fall back in auto authentication mode

Target already tries with different authentication mechanism
when authentication type is configured to NL80211_AUTHTYPE_AUTOMATIC.
Remove this piece of code from driver. Having this code in driver
even affects auto + WEP authentication in some cases.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 6bbc7c35 05-Sep-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Allow enabling of P2P support

For now, use a module parameter (ath6kl_p2p) to allow P2P support
to be enabled. This is needed since there is no mechanism for
enabling the P2P mode more dynamically for a single netdev.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 6e4604c8 05-Sep-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Allow AP mode to be configured

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 11869bef 02-Sep-2011 Jouni Malinen <jouni@qca.qualcomm.com>

athk6l: Fix channel list processing in scan requests

Limit the length of the channel list to WMI_MAX_CHANNELS to avoid
rejection of the request in wmi.c. Since there is not really much
point in using a specific list of more than 32 channels, drop the
channel list if more channels are specified and scan all channels.

Fix cfg80211 scan API use: ar->scan_req must be set only if returning
success from scan() handler. The previous version would result in use
of freed memory and likely kernel panic should the scan request fail
to be sent to the target.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 003353b0d 01-Sep-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: add testmode support

This is port from the staging version of ath6kl. The interface to user space
is exactly same.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 1b1e6ee3 30-Aug-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Return error from wmi.c instead of -EIO in ath6kl_cfg80211_scan

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 8bdfbf40 30-Aug-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Include P2P IE(s) in GO Probe Response depending on request

P2P has special rules on when to include P2P IE(s) in Probe Response
frame based on the Probe Request frame. Handle P2P IE(s) separately
to follow these rules.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 229ed6b5 30-Aug-2011 Edward Lu <elu@qca.qualcomm.com>

ath6kl: Fix default key installation in AP mode

Signed-off-by: Edward Lu <elu@qca.qualcomm.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 38acde3c 30-Aug-2011 Edward Lu <elu@qca.qualcomm.com>

ath6kl: Fix a typo in ath6k context

Signed-off-by: Edward Lu <elu@qca.qualcomm.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 6b5e5d25 30-Aug-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Add support for new P2P iftypes in mode changes

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f80574ae 30-Aug-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Advertise supported mgmt_stypes

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# ae32c30a 30-Aug-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Report received Probe Request frames to cfg80211

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 1276c9ef 30-Aug-2011 Edward Lu <elu@qca.qualcomm.com>

ath6kl: Support channel set request for startscan command

Signed-off-by: Edward Lu <elu@qca.qualcomm.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# b84da8c7 30-Aug-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Use set_appie command to add Probe Request IEs

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 8a6c8060 30-Aug-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Implement mgmt_tx

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 63fa1e0c 30-Aug-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Implement remain_on_channel and cancel_remain_on_channel

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 23875136 30-Aug-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Use change_station() to authorize/unauthorize STAs

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 9a5b1318 30-Aug-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Delay initial group key setup in AP mode

The target is not ready to accept addkey commands until the connect
event has been delivered, so delay these operations for the initial GTK.
In addition, properly set interface connected and mark netdev ready when
the AP mode setup has been completed.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 6a7c9bad 30-Aug-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Add functionality for starting AP mode

Use cfg80211 add/del_beacon callbacks for starting/stopping AP mode and
set_beacon to update AP configuration (mainly, to update Beacon and
Probe Response IEs).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# abcb344b 21-Jul-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: implement suspend support

For now this is implemented so that if host supports power is kept in
the chip. If that's not supported, an error is returned and sdio stack
will remove the device during suspend.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 0e5cc8e6 12-Aug-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Check sme state before delivering disconnect event to cfg80211

In some random cases, the firmware is sending two disconnect event to
the host. In the current model, both diconnect events are passed to
cfg80211 without checking local sme state machine, which is screwing
cfg80211 layer state.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# f91db9bb 12-Aug-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Avoid finding bss presence in cfg80211 scan list

Connect event handler function is always reporting BSS info
to CFG80211 layer first and then followed by connect event is passed.

Before these steps, BSS presence is retrieved from CFG80211 layer,
but it is not used. Hence, removing that part.

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 0ce77920 10-Aug-2011 Jouni Malinen <jouni@qca.qualcomm.com>

ath6kl: Use cfg80211_inform_bss instead of cfg80211_inform_bss_frame

There is no point in generating a bogus Beacon frame for
cfg80211_inform_bss_frame when cfg80211_inform_bss can be used
instead.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 9aa60357 04-Aug-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Fix crash during the connection process

Sometimes, the network manager is failing to connect to the AP due
to the below kernel crash message. The reason behind this,
after issuing the connect command to the chip, the chip is sending
disconnect event and then immediately one connect event to the host
in some random cases.

The host driver resets all states (including cfg80211 state machine)
when it receives disconnect event from the chip. But, still the host
driver reports the next received connect event to cfg80211, at that time
cfg80211 SME state would have been in IDLE state, which was causing
the below kernel crash.

Now, host driver's sme state machine is checked every time before
delivering connect event to cfg80211

WARNING: at net/wireless/sme.c:517 cfg80211_connect_result+0x10d/0x120()
[..]
Call Trace:
[<c0145732>] warn_slowpath_common+0x72/0xa0
[<c05d676d>] ? cfg80211_connect_result+0x10d/0x120
[<c05d676d>] ? cfg80211_connect_result+0x10d/0x120
[<c0145782>] warn_slowpath_null+0x22/0x30
[<c05d676d>] cfg80211_connect_result+0x10d/0x120
[<f83ff497>] ath6kl_cfg80211_connect_event+0x427/0x4f0 [ath6kl]
[<c035d26a>] ? put_dec+0x2a/0xa0
[<c035d645>] ? number+0x365/0x380
[<c0154675>] ? mod_timer+0x135/0x260
[<c035e00e>] ? format_decode+0x2fe/0x370
[<c01263c8>] ? default_spin_lock_flags+0x8/0x10
[<c05fd91f>] ? _raw_spin_lock_irqsave+0x2f/0x50
[<c0146032>] ? console_unlock+0x172/0x1c0
[<f8402659>] ath6kl_connect_event+0x89/0x400 [ath6kl]
[<f840826e>] ath6kl_wmi_control_rx+0x98e/0x1d60 [ath6kl]
[<c01335b5>] ? __wake_up+0x45/0x60
[<f84053aa>] ath6kl_rx+0x56a/0x770 [ath6kl]
[<c04d0242>] ? mmc_release_host+0x22/0x40
[<c04d9329>] ? sdio_release_host+0x19/0x30
[<f840a27a>] ? ath6kl_sdio_read_write_sync+0x7a/0xc0 [ath6kl]
[<f83f82b1>] do_rx_completion+0x41/0x50 [ath6kl]
[<f83faa6a>] htc_rxmsg_pending_handler+0x6ba/0xbd0 [ath6kl]
[<f8404bb0>] ? ath6kl_tx_data_cleanup+0x30/0x30 [ath6kl]
[<f840a1c0>] ? ath6kl_sdio_irq_handler+0x30/0x70 [ath6kl]
[<f83f7cd5>] ath6kldev_intr_bh_handler+0x2a5/0x630 [ath6kl]
[<f840a1c0>] ath6kl_sdio_irq_handler+0x30/0x70 [ath6kl]
[<c04d97c7>] sdio_irq_thread+0xc7/0x2d0
[<c013aeb0>] ? default_wake_function+0x10/0x20
[<c012fc98>] ? __wake_up_common+0x48/0x70
[<c04d9700>] ? sdio_claim_irq+0x200/0x200
[<c0163854>] kthread+0x74/0x80
[<c01637e0>] ? kthread_worker_fn+0x160/0x160
[<c0604c06>] kernel_thread_helper+0x6/0x10

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 91db35da 21-Jul-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Cleanup void * in ath6kl_cfg80211_scan_node()

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 8a8bc5a4 21-Jul-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Use ath6kl_cfg80211_scan_node() directly instead of function pointer

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 77fccc78 21-Jul-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Remove ath6kl_wmi_iterate_nodes()

Use wlan_iterate_nodes() directly.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 39dd3fcb 21-Jul-2011 Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>

ath6kl: Pass only the needed scan_table to ath6kl_wmi_iterate_nodes()

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 6fd1eace 21-Jul-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: fix crash when interface is closed but scan is ongoing

When ath6kl module was removed while a scan was ongoing the driver would
crash in ath6kl_cfg80211_scan_complete_event().

Fix the function not to iterate nodes when the scan is aborted. The nodes
are already freed when the module is being unloaded. This patch removes the
null check entirely as the wmi structure is not accessed anymore during
module unload.

Also fix a bug where the status was checked as a bitfield with '&' operator.
But it's not a bitfield, just a regular error code.

This is a port of my patch from ath6kl staging with the same title.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# cf104c2a 21-Jul-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: fix atomicity in ath6kl_cfg80211_scan_node()

ath6kl_cfg80211_scan_node() was calling cfg80211_inform_bss_frame()
with CFP_KERNEL but the function is executed with a spin lock taken.
This is wrong and the function must use GFP_ATOMIC instead.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# b2c76bbe 21-Jul-2011 Kalle Valo <kvalo@qca.qualcomm.com>

ath6kl: don't force foreground scan when connected

In my setup data transfer stalls when there's data transmission during
scan. After some testing I found out that using background scan
when connected to makes the problem go away. This is more like
a workaround than a proper fix, but as the stall is so severe the
workaround is justified.

With a dual band card this increases scan time when connected from
1.9s to 4.4s. When not connected the scan time is not affected and
is the same 1.9s.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# 575b5f34 19-Jul-2011 Raja Mani <rmani@qca.qualcomm.com>

ath6kl: Use bit field macros to maintain wlan enabled and disabled status

Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>


# bdcd8170 17-Jul-2011 Kalle Valo <kvalo@qca.qualcomm.com>

Add ath6kl cleaned up driver

Last May we started working on cleaning up ath6kl driver which is
currently in staging. The work has happened in a separate
ath6kl-cleanup tree:

http://git.kernel.org/?p=linux/kernel/git/kvalo/ath6kl-cleanup.git;a=summary

After over 1100 (!) patches we have now reached a state where I would
like to start discussing about pushing the driver to the wireless
trees and replacing the staging driver.

The driver is now a lot smaller and looks like a proper Linux driver.
The size of the driver (measured with simple wc -l) dropped from 49
kLOC to 18 kLOC and the number of the .c and .h files dropped from 107
to 22. Most importantly the number of subdirectories reduced from 26
to zero :)

There are two remaining checkpatch warnings in the driver which we
decided to omit for now:

drivers/net/wireless/ath/ath6kl/debug.c:31:
WARNING: printk() should include KERN_ facility level
drivers/net/wireless/ath/ath6kl/sdio.c:527:
WARNING: msleep < 20ms can sleep for up to 20ms;
see Documentation/timers/timers-howto.txt

The driver has endian annotations for all the hardware specific
structures and there are no sparse errors. Unfortunately I don't have
any big endian hardware to test that right now.

We have been testing the driver both on x86 and arm platforms. The
code is also compiled with sparc and parisc cross compilers.

Notable missing features compared to the current staging driver are:

o HCI over SDIO support
o nl80211 testmode
o firmware logging
o suspend support

Testmode, firmware logging and suspend support will be added soon. HCI
over SDIO support will be more difficult as the HCI driver needs to
share code with the wifi driver. This is something we need to research
more.

Also I want to point out the changes I did for signed endian support.
As I wasn't able to find any support for signed endian annotations I
decided to follow what NTFS has done and added my own. Grep for sle16
and sle32, especially from wmi.h.

Various people have been working on the cleanup, the hall of
fame based on number of patches is:

543 Vasanthakumar Thiagarajan
403 Raja Mani
252 Kalle Valo
16 Vivek Natarajan
12 Suraj Sumangala
3 Joe Perches
2 Jouni Malinen

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Raja Mani <rmani@qca.qualcomm.com>
Signed-off-by: Vivek Natarajan <nataraja@qca.qualcomm.com>
Signed-off-by: Suraj Sumangala <surajs@qca.qualcomm.com>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>