History log of /drivers/net/wireless/iwlwifi/mvm/sta.c
Revision Date Author Comments
efed66407d465549e0457b2c1f5419503edfb79b 14-Sep-2014 Eyal Shapira <eyal@wizery.com> iwlwifi: mvm: rs: fix logic in case of multiple TIDs

In case of traffic on multiple TIDs where one is aggregated
and the other is not RS would toggle between considering
traffic vs. the station as aggregated and not aggregated.
Instead consider the sta state as aggregated as long as
there's at least one TID aggregated.
This limitation is because the rates table is kept per
station and not per TID.

Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
3edf8ff6179dc470d53f3b88d4a778e241a73654 30-Jul-2014 Avri Altman <avri.altman@intel.com> iwlwifi: mvm: prepare for scheduler config command

The scheduler is a HW sub-block that directs the work of the Flow
Handler by issuing requests for frame transfers, specifying source
and destination. Its primary function is to allocate flows into the
TX FIFOs based upon a pre-determined mapping.

The driver has some responsibilities to the scheduler, namely
initialising and maintaining the hardware registers. This is
currently done by directly accessing them, which can cause races
with the firmware also accessing the registers.

To address this problem, change the driver to no longer directly
access the registers but go through the firmware for this if the
firmware has support for DQA and thus the new command.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
f7f89e7baef643788f09d9629012ea1612d827bb 05-Aug-2014 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: disable aggregation queues in station DB in FW

When disabling aggregation, disable the queues in the station
DB in the firmware, otherwise we leave the tfd_queue_mask in
a wrong state after an aggregation session has been torn down.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
712b24adc105518f7cbbb6f9f353efea48954bb9 04-Aug-2014 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: clean up AUX station handling

The auxiliary station is being handled using the internal
station helper functions, clean that up and make the helpers
static.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
013290aa46689a97447ef93c7058436315e476d7 04-Aug-2014 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: clean up broadcast station handling

Unify all the functions that handle the per-interface broadcast
station and make them have mvm and vif parameters. While at it,
add a new function to allocate the broadcast station instead of
open-coding it, and make the combined alloc+send and free+send
functions use the alloc/free & send functions.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9e848010bfa1c0da21292afb7a98957b5c35622d 04-Aug-2014 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: use tdls indication from mac80211

Instead of checking whether a given station is the first to
be added on a client interface check for the new TDLS flag
and warn in the unexpected cases.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8b4139dc9f2171f313fc703c08269f6f8a6f6fc4 24-Jul-2014 Johannes Berg <johannes.berg@intel.com> iwlwifi: add Intel Mobile Communications copyright

Our legal structure changed at some point (see wikipedia), but
we forgot to immediately switch over to the new copyright
notice.

For files that we have modified in the time since the change,
add the proper copyright notice now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
d4578ea810ce468fdb8e1b7014818c31db9be5e2 01-Aug-2014 Johannes Berg <johannes.berg@intel.com> iwlwifi: trans: allow skipping scheduler hardware config

In a later patch, the hardware configuration will be moved to
firmware. Prepare for this by allowing hardware configuration
in the transport to be skipped by not passing a configuration
on enable and passing configure_scd=false on disable.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
7da91b0ee4884568cb91a77cff122c84953e5698 06-Jul-2014 Ariej Marjieh <ariej.marjieh@intel.com> iwlwifi: mvm: Enabling Aux Queue

Enabling the Aux queue and mapping it to FIFO 5.
Defining the Aux queue for the Aux station.

Signed-off-by: Ariej Marjieh <ariej.marjieh@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
4b8265ab4d701989bc70371ecc4347c9debc1a03 13-Jul-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: use C99 initializers for add_sta

Instead of code the fixed values, use a C99 initializer.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
003e5236a1fcab3fc4576fe643e31a3d83027256 25-May-2014 Andrei Otcheretianski <andrei.otcheretianski@intel.com> iwlwifi: mvm: Use CS tx block bit for AP/GO

An AP/GO may perform the channel switch slightly before its stations.
This scenario may result in packet loss, since the transmission may start
before the client is actually on a new channel. In order to prevent
potential packet loss disable tx to all the stations when the channel
switch flow starts. Clear the disable_tx bit when a station is seen on a
target channel, or after IWL_MVM_CS_UNBLOCK_TX_TIMEOUT beacons on a new
channel. In addition call ieee80211_sta_block_awake in order to inform
mac80211 that the frames for this station should be buffered.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
09b0ce1a874a644fb5799ebf5e54563632714115 25-May-2014 Andrei Otcheretianski <andrei.otcheretianski@intel.com> iwlwifi: mvm: Introduce an API to set STA_FLG_DISABLE_TX flag

Introduce new station flag STA_FLG_DISABLE_TX, which is modified with ADD_STA
command. This flag, when set, disables tx to the STA.
Provide an API (iwl_mvm_sta_modify_disable_tx) to modify this flag, which
should be used in channel switch and immediate quiet flows.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
a10229271946731959b2269370d0492d88cfab23 12-May-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: remove CMD_SYNC

CMD_SYNC is really 0 which is confusing:

if (cmd.flags & CMD_SYNC) is always false.
Fix this by simply removing its definition.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
f9dc0004a1029ff1d5f9b46191f3303e3a95f8a7 30-Mar-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: remove IWL_UCODE_TLV_FLAGS_STA_KEY_CMD flag

All the supported firmwares have this flag set.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
c531c77150693759ca0b886a80973d6ae6a1a0d5 23-Mar-2014 Monam Agarwal <monamagarwal123@gmail.com> iwlwifi: mvm: Use RCU_INIT_POINTER(x, NULL)

rcu_assign_pointer() ensures that the initialization of a structure is
carried out before storing a pointer to that structure. However, in the
case that NULL is assigned there's no structure to initialize so using
RCU_INIT_POINTER instead is safe and more efficient.

Signed-off-by: Monam Agarwal <monamagarwal123@gmail.com>
[rewrite commit log]
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
d13c8dca67e0ae1a529978849886525f9bdbabbc 24-Mar-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: don't set AP STA to EINVAL

Now that mac80211 calls pre_rcu_remove and we set the
fw_id_to_mac_id pointer to -ENOENT before the station is
removed, we don't need to set fw_id_to_mac_id to -EINVAL
when the station is really removed.
Leave fw_id_to_mac_id to be -ENOENT which will let the
drain worker (iwl_mvm_sta_drained_wk) know that this station
is not to be drained.
We don't need to drain this station since it is our AP in
managed mode and we flush all its frames synchronously
anyway.

Setting the AP station to -EINVAL could lead to confusion
since internal stations are also reserved with -EINVAL,
this confusion showed up in the logs as:

Drained sta 0, but it is internal?

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
b2492501d234ef7a99613576550126b88b377070 12-Mar-2014 Arik Nemtsov <arik@wizery.com> iwlwifi: mvm: reconfigure qos seq on D0i3 exit

In order to restore the qos seq number on d0i3 exit,
we need to read it from the wowlan status.

However, in order to make sure we use correct seq num
for tx frames, we need to defer any outgoing frames,
and re-enqueue them only after the seq num is configured
correctly.

Sync new Tx aggregations with D0i3 so that the correct
seq num is used for them. Wait synchronously for D0i3
exit before starting a new Tx agg.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
b797e3fbab399ed023bdaeaf7fb63236f67eaa1c 06-Mar-2014 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: BT Coex - enable per-AC BT priority

We can now define the priority against BT per AC. This is
possible with a newer firmware that allows to define the
priority with 2 bits.
Note that this change is compatible with older firmware
since older firmware will simply ignore the new bit (11),
and we still set the old bit (12) in the same cases as
before.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
b92e661b401897928040d89b3a9d0cd74ce6e9a1 23-Jan-2014 Eliad Peller <eliad@wizery.com> iwlwifi: mvm: reserve sta_id 0 to station

The d3/d0i3 fw code requires the sta_id to be 0
(this is used to determine the rates and keys
to use in arp offloading).

Reserve sta_id 0 to station interface in order
to comply with this requirement.

Change some functions prototypes in order to
make the allocation function know about
the interface type.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
37577fe2499a4d83c39910702959832baf589bab 05-Dec-2013 Eliad Peller <eliad@wizery.com> iwlwifi: mvm: get status on D0i3 exit

Schedule work to query the wakeup reasons, and
disconnect in some cases (e.g. beacon loss).

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
3e56eadfb6a1f28d753afa9fe27296258ae240e5 15-Feb-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: implement AP/GO uAPSD support

Newer firmware will support uAPSD clients in AP/GO mode, so complete
the driver support for it. The way it works is described in comments
in the code, but basically the driver just has to pass down all the
mac80211 requests and do accounting on agg/non-agg queues properly.

For older firmware, this doesn't change anything as it ignores the
fields used by the new firmware, and we only advertise uAPSD support
when the firmware does.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
a4243402274343d8e596fb0b25674e52088a7488 20-Jan-2014 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: make local pointer non-static

The address pointer used in the function shouldn't be static
since it's local data only. Having it static causes races if
a single machine has two devices, as the pointer would be
shared between instances.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
51368bf792c79eb917694a4155d62f04359e3734 30-Dec-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: Update Copyright to 2014

Happy new year!

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
124adcabc6133c9c7c4e4659891c7c69e57223c6 17-Dec-2013 Eyal Shapira <eyal@wizery.com> iwlwifi: mvm: rs: fix RTS protection being set indefinitely

RTS protection was turned on once aggregation was enabled but it
was never turned off. Remove turning on RTS protection in the LQ command
completely as TX_CMD_FLG_PROT_REQUIRE gets set in iwl_mvm_set_tx_cmd
for every Tx which is part of an aggregation. This would already cause
RTS protection to be used during aggregations.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
e36e5433c98d0411af51683c53578e84dee42470 27-Aug-2013 Max Stepanov <Max.Stepanov@intel.com> iwlwifi: mvm: add a generic cipher scheme support

This patch adds a cipher scheme support to extend a set of
the supported ciphers. The driver reads a cipher scheme list TLV
from FW image and passes it to mac80211 on hw registration.
After the cipher schemes are registered the driver handles key
installation and Tx/Rx calls related to the new ciphers.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
1ddbbb0c83de82599b1baf14bf6bb69a774d4fc7 04-Dec-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: use pre-RCU-sync sta removal operation

iwlmvm relies on the current mac80211 behaviour of allowing
station pointers to be valid for an RCU grace period after
returning from the sta_state() callback. To optimise these
cases, this behaviour is going away, so make the driver use
the new sta_pre_rcu_remove() method to clear the pointer in
the fw_id_to_mac_id[] array.

Since this may happen while the station is still present in
the firmware, don't set the pointer to NULL but to -ENOENT
to mark this particular case. In client mode, the station
is kept even longer (until marking the MAC as unassociated)
so the drain flow must take this new behavior into account.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5b577a90fb3d86447ee86f8e0c6ddbd5da2ef8c9 14-Nov-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: add iwl_mvm_sta_from_mac80211

This is just a helper function to go from the mac80211
station struct to our internal one, to later allow us
to avoid temporary 'mvmsta' variables.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
9e680946a48be7f7c074a60d8583b21815526d61 08-Nov-2013 Eyal Shapira <eyal@wizery.com> iwlwifi: mvm: simplify iwl_mvm_send_lq_cmd

Remove the flags parameter which should be set to sync or async
according to whether this is called during sta init or not.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
5023d96616a1faf46656f8bb5545387d7cca9026 31-Jul-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: add IBSS support

At the firmware level, IBSS support has similar programming
requirements as AP/GO support, so use the same functions with
just small differences.

With IBSS only a single virtual interface can be used, so no
changes in the advertised interface combinations are needed.

For now, don't use hardware crypto for the GTKs in IBSS mode,
the firmware should support it though.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
6d9d32b89ab0f9cbd182f807cc484e66e15c6972 06-Aug-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: keep connection to AP after WoWLAN

Until now, after WoWLAN, we weren't able to keep the
connection to the AP because the firmware didn't give
us the right information. Since the firmware API has
been changed to include all the information we need,
change the driver to work with the new API (if it is
available) and program all the relevant information
in mac80211 to keep the connection.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19e737c98479f040e23987e50596a861e5e88b92 09-Sep-2013 Eytan Lifshitz <eytan.lifshitz@intel.com> iwlwifi: mvm: add support for NICs which have only 16 Tx queues.

Some NICs embedded in platforms that have only 16 Tx queues,
this affect the mapping of the Tx queues.

Signed-off-by: Eytan Lifshitz <eytan.lifshitz@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5a258aaeecba57f1bf8bb5d1603c7c094377992b 07-Apr-2013 Max Stepanov <Max.Stepanov@intel.com> iwlwifi: mvm: split ADD_STA and ADD_STA_KEY in firmware API

Add support for new station management firmware API. The old
ADD_MODIFY_STA command has been replaced with two: a modified
ADD_MODIFY_STA and a new ADD_MODIFY_STA_KEY command.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
b6658ff80c43bcf84be0bbe371c88af1452e7776 24-Jul-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: fix flushing not started aggregation sessions

When a not fully started aggregation session is destroyed
and flushed, we get a warning, e.g.

WARNING: at drivers/net/wireless/iwlwifi/pcie/tx.c:1142 iwl_trans_pcie_txq_disable+0x11c/0x160
queue 16 not used
Modules linked in: [...]
Pid: 5135, comm: hostapd Tainted: G W O 3.5.0 #10
Call Trace:
wlan0: driver sets block=0 for sta 00:03:7f:10:44:d3
[<ffffffff81036492>] warn_slowpath_common+0x72/0xa0
[<ffffffff81036577>] warn_slowpath_fmt+0x47/0x50
[<ffffffffa0368d6c>] iwl_trans_pcie_txq_disable+0x11c/0x160 [iwlwifi]
[<ffffffffa03a2099>] iwl_mvm_sta_tx_agg_flush+0xe9/0x150 [iwlmvm]
[<ffffffffa0396c43>] iwl_mvm_mac_ampdu_action+0xf3/0x1e0 [iwlmvm]
[<ffffffffa0293ad3>] ___ieee80211_stop_tx_ba_session+0x193/0x920 [mac80211]
[<ffffffffa0294ed8>] __ieee80211_stop_tx_ba_session+0x48/0x70 [mac80211]
[<ffffffffa029159f>] ieee80211_sta_tear_down_BA_sessions+0x4f/0x80 [mac80211]
[<ffffffffa028a686>] __sta_info_destroy+0x66/0x370 [mac80211]
[<ffffffffa028abb4>] sta_info_destroy_addr_bss+0x44/0x70 [mac80211]
[<ffffffffa02a3e26>] ieee80211_del_station+0x26/0x50 [mac80211]
[<ffffffffa01e6395>] nl80211_del_station+0x85/0x200 [cfg80211]

when a station deauthenticated from us without fully setting
up the aggregation session.

Fix this by checking the aggregation state before removing
the hardware queue.

Cc: stable@vger.kernel.org
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
113a04470d9178170a5d1aa165809515884f39a8 02-Jul-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: track the number of Rx BA sessions

The firmware / HW can't support more than 16 Rx BA sessions.
Deny any attemps to open more sessions than that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
93a426673fbfeae7fa6b27008828e2ac4c08dbee 02-Jul-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: fix L2P BA ressources leak

We didn't release the Rx AMPDU ressources properly.
This bug led to firmware assert after 16 BA sessions.

Cc: <stable@vger.kernel.org> [3.9+]
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
e126b5d9c58870c0866357c951b4da9ed005f364 28-Jun-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: remove unneeded argument from iwl_mvm_tx_protection()

The LQ command argument isn't needed, it's always taken from the
station struct that's already passed, remove the argument.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
837fb69f10588caafc883c4473a864660e1403ce 09-Jun-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: don't set the MCAST queue in STA's queue list

The MCAST queue should be enabled after DTIM only.
According to fw API, the MCAST must not be attached to any
station, but should appear in the mcast_qid of the AP's
mac context only.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5af01772ee1d6e96849adf728ff837bd71b119c0 08-Jun-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: properly tell the fw that a STA is awake

The firmware API wasn't being used correctly, fix that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9ee718aa9269cf56040cf12f0f6ac6e0057397b2 19-May-2013 Eytan Lifshitz <eytan.lifshitz@intel.com> iwlwifi: mvm: add thermal throttling and CT kill

In order to avoid NIC destruction due to high temperature,
CT kill will power down the NIC.

To avoid this, thermal throttling will decrease throughput
to prevent the NIC from reaching the temperature at which
CT kill is performed.

Signed-off-by: Eytan Lifshitz <eytan.lifshitz@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
e3d4bc8cc0230e8dc8033484666f03f87392a8c4 07-May-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: fix aggregation drain flow

Move the counter for non-AMPDU frames to mvm. It is needed
for the drain flow which happens once the ieee80211_sta has
been freed, so keeping it in iwl_mvm_sta which is embed into
ieee80211_sta is not a good idea.

Also, since its purpose it to remove the STA in the fw only
after all the frames for this station have exited the shared
Tx queues, we need to decrement it in the reclaim flow. This
flow can happen after ieee80211_sta has been removed, which
means that we have no iwl_mvm_sta there. So we can't know
what is the vif type. Hence, we know audit these frames for
all the vif types.
In order to avoid spawning sta_drained_wk all the time, we
now check that we are in a flow in which draining might
happen - only when mvmsta is NULL. This is better than
previous code that would spawn sta_drained_wk all the time
in AP mode.

Cc: stable@vger.kernel.org [3.9]
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
881acd8987f6633280247087219df465de784a69 19-Mar-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: clean up invalid station handling

Using IWL_MVM_STATION_COUNT and IWL_INVALID_STATION together
isn't a good idea as they have different values. Always use
IWL_MVM_STATION_COUNT for an invalid station in MVM and move
the definition of the IWL_INVALID_STATION constant into the
DVM driver to avoid making such mistakes again. The one use
in the transport code can be hard-coded to -1 instead as the
station ID is passed as an integer there.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5bc5aaad407ccc49262d9fd3456d6ab332286395 12-Feb-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: set up initial SMPS/NSS station info

When a station is added, we need to tell the firmware what
the SMPS settings and number of streams are. After having
the initial data, the firmware will track future changes
by itself.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
e3d9e7ce4cd8ea7299cad568b21d50873a29f011 19-Feb-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: support IEEE80211_AMPDU_TX_STOP_FLUSH

mac80211 tells us when we need to dump the frames from the
AGG queue instead of releasing them as single MPDUs.
Being able to differentiate between the different cases
(IEEE80211_AMPDU_TX_STOP_*) allows us to handle races better.

When the station is removed, mac80211 asks to flush and
removes the station right away.
This allows to avoid a case where we still have frames in
AGG queues, but the station has been remove already.

Note that we can have frames on the shared queues, but this
is not a problem: the station in the fw will be kept until
all the frames on the shared queues have been drained.
AGG queues are a special case since they are dynamically
allocated.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
80d8565557747854d6ff7fc0a756cc71a9fa2372 19-Feb-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: free AGG queue when we STA is removed

When we stop an AGG session, we need to look at the sequence
numbers in in the private area of the ieee80211_sta struct.
This allows us to know is the queue is empty. To get access
to this private area, we use fw_id_to_mac_id that maps
sta_id (index of the STA in fw table) to ieee80211_sta.

When the STA exists in fw, but not in mac80211, we set
an ERR ptr in fw_id_to_mac_id.

But if we first set an ERR ptr to fw_id_to_mac_id, and only
then flush the queues, then we won't be able to access the
sequence numbers in ieee80211_sta from the reclaim flow.
This means that we will never be able to release an AGG
queue when a station is deleted.

So first, flush the queue. That will let the reclaim flow
call iwl_mvm_check_ratid_empty which will disable the AGG
queue as needed, and only then, remove the mapping in
fw_id_to_mac_id.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
410dc5aa5906ed49e2733b451a5287884e8a16dc 18-Feb-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: a few fixes in license

7000.c was released as GPL only by mistake: it should be
dual licensed - GPL / BSD.
The file that contains the license in the kernel is COPYING
and not LICENSE.GPL.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9a886586c82aa02cb49f8c85e961595716884545 15-Feb-2013 Johannes Berg <johannes.berg@intel.com> wireless: move sequence number arithmetic to ieee80211.h

Move the sequence number arithmetic code from mac80211 to
ieee80211.h so others can use it. Also rename the functions
from _seq to _sn, they operate on the sequence number, not
the sequence_control field.

Also move macros to convert the sequence control to/from
the sequence number value from various drivers.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
f9aa8dd33714f17c7229ad89309406a1ccb3cd3f 04-Mar-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: ignore STOP_AGG when restarting

Since the device is being restarted, all the Rx / Tx Block
Ack sessions are been wiped out by the driver. So ignore
the requests from mac80211 that stops Tx agg while
reconfiguring the device.

Note that stopping a non-existing Rx BA session is harmless,
so just honor mac80211's request.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9cc40712a082b7288d00c57e8652e3b248e2554d 15-Feb-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: fix GO powersave client manipulation

All station commands must include a valid MAC ID,
the ID 0 is randomly valid in some cases, but we
must set the ID properly. Do that by passing the
right station and using its mac_id_n_color.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7a4539736eaeecb6bec25a718492fed6377a23af 12-Feb-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: mvm: update station when marked associated

In managed mode, the HT/VHT capabilities aren't set when
the station is initially added, so update the station
when it is marked associated. In AP/GO mode, the station
will typically be added with full capabilities today,
but an upcoming change in hostapd may mean a similar
scenario as for managed mode, therefore do the update
unconditionally.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
c3eb536aabb966542a0b6b09ad38cc43abe9ad1a 06-Feb-2013 Beni Lev <beni.lev@intel.com> iwlwifi: mvm: fix TKIP key updating

When a TKIP key is updated with a station pointer that is NULL it is
a GTK, so it should use the AP's station ID. Fix the code to do that.

Signed-off-by: Beni Lev <beni.lev@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8115efbdc82acc935b54f0a849eb834129ea1fd0 05-Feb-2013 Emmanuel Grumbach <emmanuel.grumbach@intel.com> iwlwifi: mvm: fix the keyidx assignment

Fixes an issue that smatch pointed out:

1118
1119 key_flags = cpu_to_le16(keyconf->keyidx & STA_KEY_FLG_KEYID_MSK);
^^^^^^^^^^^^^^^
This is s8.
^^^^^^^^^^^^^^^^^^^^^
STA_KEY_FLG_KEYID_MSK is 0x300.

The result after the bitwise AND is always zero because 0xff & 0x300.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8ca151b568b67a7b72dcfc6ee6ea7c107ddd795c 24-Jan-2013 Johannes Berg <johannes.berg@intel.com> iwlwifi: add the MVM driver

Newer firmware revisions have a completely new
firmware API. This is the new driver for this
new API.

I've listed the people who directly contributed
code, but many others from various teams have
contributed in other ways.

Cc: Alexander Bondar <alexander.bondar@intel.com>
Cc: Amit Beka <amit.beka@intel.com>
Cc: Amnon Paz <amnonx.paz@intel.com>
Cc: Assaf Krauss <assaf.krauss@intel.com>
Cc: David Spinadel <david.spinadel@intel.com>
Cc: Dor Shaish <dor.shaish@intel.com>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Eytan Lifshitz <eytan.lifshitz@intel.com>
Cc: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>