Commit Graph

412651 Commits

Author SHA1 Message Date
Ilan Peer be2056fce8 iwlwifi: mvm: Do not allow AP MAC context update if not active
Fix a regression introduced in "iwlwifi: mvm: fix ht protection flags"
where an AP/IBSS MAC context could have been updated even before the
context was added to the FW. This fix avoids the following warning:

WARNING: ... at .../drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c:1132
    iwl_mvm_mac_ctxt_changed+0x75/0x90 [iwlmvm]()
Changing inactive MAC 0c:8b:fd:01:1a:30/3
Modules linked in: [...]
Call Trace:
[<c16041fd>] dump_stack+0x41/0x52
[<c1041074>] warn_slowpath_common+0x84/0xa0
[<f80d8f45>] ? iwl_mvm_mac_ctxt_changed+0x75/0x90 [iwlmvm]
[<f80d8f45>] ? iwl_mvm_mac_ctxt_changed+0x75/0x90 [iwlmvm]
[<c1041133>] warn_slowpath_fmt+0x33/0x40
[<f80d8f45>] iwl_mvm_mac_ctxt_changed+0x75/0x90 [iwlmvm]
[<f80d517a>] iwl_mvm_bss_info_changed+0x22a/0x4b0 [iwlmvm]
[<c160831d>] ? mutex_unlock+0xd/0x10
[<f80d4678>] ? iwl_mvm_configure_filter+0x58/0x70 [iwlmvm]
[<f80d4f50>] ? iwl_mvm_mac_tx+0xc0/0xc0 [iwlmvm]
[<f8132d83>] ieee80211_bss_info_change_notify+0xa3/0x1d0 [mac80211]
[<f8149247>] ? ieee80211_del_virtual_monitor+0x127/0x1f0 [mac80211]
[<f8149cac>] ieee80211_do_open+0x12c/0xeb0 [mac80211]
[<c106c6de>] ? __raw_notifier_call_chain+0x1e/0x30
[<c106c70f>] ? raw_notifier_call_chain+0x1f/0x30
[<f814aa8d>] ieee80211_open+0x5d/0x60 [mac80211]
[<c1500c7b>] __dev_open+0xab/0x140
[<c160b39a>] ? _raw_spin_unlock_bh+0x2a/0x30
[<c1500f41>] __dev_change_flags+0x81/0x160
[<c10ab6fc>] ? __lock_is_held+0x3c/0x60
[<c15010d1>] dev_change_flags+0x21/0x60

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reported-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:57 +02:00
Emmanuel Grumbach c2d284d547 iwlwifi: mvm: fixup Makefile
debufs.o appeared twice in the Makefile. Fix that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:56 +02:00
Eyal Shapira 4e4b815c08 iwlwifi: mvm: rs: refactor rate scale action decision
Extract the scale action decision to a different function
in preparation of modifying it. While at it also convert
the scale action values from hardcoded values to a clear enum.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:56 +02:00
Eyal Shapira 4107dbd277 iwlwifi: mvm: rs: remove unnecessary debug logs
The logs are emitted in a flow in which there were retries
and the rates in the rate table entry didn't match the active
or search table. This doesn't indicate a problem and is
expected in most cases where there will be retries for some
reason. Remove the logs.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:55 +02:00
Eyal Shapira e07be6d3fe iwlwifi: mvm: rs: improve rates table algo
The new logic will attempt more rates with less retries
per rate. Also when starting off with MIMO it will
fallback to SISO with the same MCS and only then to Legacy.
Previously we fell back directly to Legacy.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:54 +02:00
Eyal Shapira ca6f38ff4b iwlwifi: mvm: rs: avoid recalc of supported legacy rate mask
The supported legacy rate mask is initialized when rs
is initialized based on the remote peer supported rates.
There's no need to re mask it repeatedly with the supported
remote peer rates.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:54 +02:00
Eyal Shapira 8fc7c58c03 iwlwifi: mvm: rs: refactor building the LQ command
Simplify the code a bit more by extracting the rates table
building logic into a separate function and handle setting
a fixed rate for debug in a separate flow.
Also avoid using and saving ucode rate format in different
places. Instead use rs_rate struct and convert to ucode format
only when filling the rates table in the LQ command.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:53 +02:00
Alexander Bondar 752096727c iwlwifi: mvm: Add and examine TLV flag for P2P client uAPSD support
Current firmware doesn't handle well uAPSD in P2P Client.
When it will be fixed, the firmware will set a TLV flag to notify
the driver that uAPSD is supported in P2P client mode.
Check this flag when sending power command for P2P client.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:52 +02:00
Arik Nemtsov 128cb89e1d iwlwifi: trans: turn set_pmi into an optional callback
It is not currently implemented for SDIO, and not required for other slave
buses as well.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:52 +02:00
Arik Nemtsov efbf6e3ba2 iwlwifi: trans: clear FW_ERROR status in common code
Clear the FW_ERROR status before the common start_fw transport code.
Remove the transport specific clears.

After these patches the FW_ERROR flag is only set and cleared by common
transport code.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:51 +02:00
Arik Nemtsov 2a988e9808 iwlwifi: trans: prevent reprobe on repeated FW errors before restart
In case a sync command timeouts or Tx is stuck while a FW error
interrupt arrives, we might call iwl_op_mode_nic_error twice before
a restart has been initiated. This will cause a reprobe. Unify calls
to this function at the transport level and only call it on the first
FW error in a given by checking the transport FW error flag.

While at it, remove the privately defined iwl_nic_error from PCIE code
and use the common callback instead.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:50 +02:00
Eliad Peller 8c678ed466 iwlwifi: mvm: check iwl_nvm_init return value
iwl_nvm_init() return value wasn't checked in some
path, which resulted in the following panic (if
there was some issue with the nvm):

Unable to handle kernel NULL pointer dereference at virtual address 00000004
pgd = d0460000
[00000004] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP
Modules linked in: iwlmvm(+) iwlwifi mac80211 cfg80211 compat [last unloaded: compat]
PC is at iwl_mvm_mac_setup_register+0x12c/0x460 [iwlmvm]
LR is at 0x2710
pc : [<bf50dd4c>]    lr : [<00002710>]    psr: 20800013
sp : d00cfe18  ip : 0000081e  fp : d006b908
r10: d0711408  r9 : bf532e64  r8 : d006b5bc
r7 : d01af000  r6 : bf39cefc  r5 : d006ab00  r4 : d006b5a4
r3 : 00000001  r2 : 00000000  r1 : d006a120  r0 : d006b860

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:50 +02:00
Emmanuel Grumbach 03b67e982c iwlwifi: remove pointer to transport from op_mode
This pointer was not used anywhere.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:49 +02:00
Eyal Shapira a0c38b2119 iwlwifi: mvm: rs: move rs_program_fix_rate to cleanup ifdefs
Move rs_program_fix_rate right before it's caller where we're
already in the context of an ifdef CPTCFG_MAC80211_DEBUGFS so
we can get rid of the extra ifdefs surrounding the original
location.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:48 +02:00
Arik Nemtsov 3fc07953ba iwlwifi: trans: prevent tx and cmds during FW error
Stop Tx and commands from arriving to the transport layer when a FW
error has occurred. A HW recovery should take place before. Remove
transport specific checks of the same nature (note that not all
transports were protected).

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:48 +02:00
Arik Nemtsov eb7ff77edd iwlwifi: trans: use a unified transport status
The same bits are employed in all transport layers. Put the status
field in the common transport layer. This allows us to employ them
in common transport code.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:47 +02:00
Arik Nemtsov a408284367 iwlwifi: trans: divide stop_hw into stop_device/op_mode_leave
The stop_hw trans callback is not well defined. It is missing in many
cleanup flows and the division of labor between stop_device/stop_hw
is cumbersome. Remove stop_hw and use stop_device to perform both.
Implement this for all current transports.

PCIE needs some extra configuration the op-mode is leaving to configure
RF kill. Expose this explicitly as a new op_mode_leave trans callback.
Take the call to stop_device outside iwl_run_mvm_init_ucode, this
makes more sense and WARN when we want to run the INIT firmware while
it has run already.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:46 +02:00
Johannes Berg 8b206d198c iwlwifi: mvm: clarify smps_requests documentation
The documentation for smps_requests is unclear, rewrite it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:46 +02:00
Eliad Peller dcbc3e1a3b iwlwifi: mvm: configure phy_ctxt with min_def
Configure the phy context to the minimum required
bandwidth, given by ctx->min_def.

Tuning to a narrower bandwidth should reduce the
noise level and consume less power.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:45 +02:00
Eliad Peller e59647eaad iwlwifi: mvm: add multicast filtering support
Configure the fw to filter multicast according to
the addresses given by mac80211.

Note that bssid should be given even if we want
to pass all the multicast frames.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:44 +02:00
Emmanuel Grumbach ee9c6cb07a iwlwifi: mvm: move iwl_mvm_set_tx_power to PHY area
This is more related to phy contexts than to mac context.
Move this function to there.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:44 +02:00
Alexander Bondar e45a941deb iwlwifi: mvm: add per-vif power debugfs hooks
This allows to tweak the power parameters per vif.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:43 +02:00
Alexander Bondar 51498cf6d8 iwlwifi: mvm: Enable power save on a single P2P client interface
Enable power save on P2P client interface only if it is the
only bound interface.
Avoid using uAPSD if P2P client is associated to GO that uses
opportunistic power save. This is due to current FW limitation.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:42 +02:00
Alexander Bondar 92d8556250 iwlwifi: mvm: Disable power save for monitor interface
When monitor interface is activated device power save needs
to be disabled.
Re-consider power management status on other active
interfaces when monitor interface is bound or unbound.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:42 +02:00
Alexander Bondar 1c2abf724b iwlwifi: mvm: Change power management dependency on multi MAC
FW still does not support power management on multiple MAC interfaces.
Currently the driver enforce this limitation by disabling PM if second
interface is added. Change this behavior to allow PM on a single interface
even if other interfaces exist but not bound to any specific PHY.
PM will be enabled if only one single interface is bound.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:41 +02:00
Alexander Bondar 175a70b7f2 iwlwifi: mvm: Add uAPSD misbehaving AP notification handling
FW implements protective algorithm to identify AP's improper uAPSD
behavior. FW sends misbehaving AP notification in this case.
Add this notification handling. Avoid using uAPSD in next association
to the exactly same AP. Refactor iwl_mvm_power_build_cmd() to move
uAPSD related code to a separate function.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:40 +02:00
Eyal Shapira 5f7a6f9b25 iwlwifi: publish Tx STBC support in VHT
If the device is MIMO and VHT capable it supports Tx STBC.
Unlike HT, any chip that supports VHT also support STBC so
no need for a config parameter.
Using num_of_ants multiple times warranted caching it.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:40 +02:00
Eyal Shapira 48e6de6117 iwlwifi: set VHT beamformee STS cap correctly
It was set to zero which reflects support of a single STS.
Set according to the number of Rx antennas which correctly
reflects the number of STSs the STA can receive in a VHT NDP.
This improves beamforming and has been tested to improve Rx
throughput.

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>
2013-12-17 19:39:39 +02:00
Eyal Shapira 183d281d26 iwlwifi: publish STBC support in HT
Not all chips support STBC so allow this to be
another config parameter per chip type. If STBC
is supported then publish it in the HT caps.

Since 7260/7265/3160 chips support it - set the stbc
support bit.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:38 +02:00
Max Stepanov e36e5433c9 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>
2013-12-17 19:39:38 +02:00
Lilach Edelstein 1f3b0ff8ec iwlwifi: mvm: Add Smart FIFO support
Send firmware a Smart FIFO Configuration host command to allow
interrupt coalescing. The smart FIFO is enabled when there is
only one bound interface (other than  p2p devices which are
ignored) and it is of type station, and activated while the
station is associated.

Smart Fifo allows aggragations of DMA transactions and by that
causes processor and memory controller to stay for a longer time
on lower c-states, thus saving platform power.
Firmware relies on driver to activate and disable it.

Signed-off-by: Lilach Edelstein <lilach.edelstein@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17 19:39:37 +02:00
Marcel Holtmann 1bc5ad168f Bluetooth: Fix HCI User Channel permission check in hci_sock_sendmsg
The HCI User Channel is an admin operation which enforces CAP_NET_ADMIN
when binding the socket. Problem now is that it then requires also
CAP_NET_RAW when calling into hci_sock_sendmsg. This is not intended
and just an oversight since general HCI sockets (which do not require
special permission to bind) and HCI User Channel share the same code
path here.

Remove the extra CAP_NET_RAW check for HCI User Channel write operation
since the permission check has already been enforced when binding the
socket. This also makes it possible to open HCI User Channel from a
privileged process and then hand the file descriptor to an unprivilged
process.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Tested-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2013-12-17 13:47:27 +02:00
Janusz Dziedzic 204e35a91c nl80211: add VHT support for set_bitrate_mask
Add VHT MCS/NSS set support for nl80211_set_tx_bitrate_mask().
This should be used mainly for test purpose, to check
different MCS/NSS VHT combinations.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 16:05:17 +01:00
Max Stepanov 31f1f4ec51 mac80211: read station mgmt keys via get_key call
Allow to read management keys stored in a station's gtk key
array with a get_key function.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 15:10:18 +01:00
Max Stepanov 354e159d8c mac80211: check pairwise key_idx on get_key call
Verify that a pairwise key index value on ieee80211_get_key call
doesn't exceed the boundaries of the pairwise key array.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 15:10:10 +01:00
Luciano Coelho dddd586bee mac80211: align ieee80211_ibss_csa_beacon() with ieee80211_assign_beacon()
The return value of ieee80211_ibss_csa_beacon is not aligned with the
return value of ieee80211_assign_beacon().  For consistency and to be
able to use both functions with similar code, change
ieee80211_ibss_csa_beacon() not to send the bss changed notification
itself, but return what has changed so the caller can send the
notification instead.

Tested by: Simon Wunderlich <sw@simonwunderlich.de>
Acked by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 15:07:47 +01:00
Luciano Coelho 82a8e17d4a mac80211: refactor ieee80211_ibss_process_chanswitch()
Refactor ieee80211_ibss_process_chanswitch() to use
ieee80211_channel_switch() and avoid code duplication.

Tested by: Simon Wunderlich <sw@simonwunderlich.de>
Acked by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 15:07:46 +01:00
Thomas Pedersen 43552be1da mac80211: update adjusting TBTT bit in beacon
This regression was introduced in "mac80211: cache mesh
beacon".

mesh_sync_offset_adjust_tbtt()  was assuming that the
beacon would be rebuilt in every single pre-tbtt
interrupt, but now the beacon update happens on the
workqueue, and it must be ready for immediate delivery to
the driver.

Save a pointer to the meshconf IE in the beacon_data (this
works because both the IE pointer and beacon buffer are
protected by the same rcu_{dereference,assign_pointer}())
for quick updates during pre-tbtt. This is faster and a
little prettier than iterating over the elements to find
the meshconf IE every time.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 14:21:22 +01:00
David Spinadel d43c6b6e6f mac80211: reschedule sched scan after HW restart
Keep the sched scan req when starting sched scan, and reschedule
it in case of HW restart during sched scan.
The upper layer don't have to know about the restart.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 13:47:26 +01:00
Luciano Coelho 0ae07968f6 mac80211: make ieee80211_assign_beacon() static
This function is not used anywhere else than in cfg.c, so there's no
need to export it.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 13:46:21 +01:00
Luciano Coelho 6f07d216f5 mac80211: lock sdata in ieee80211_csa_connection_drop_work()
We call ieee80211_ibss_disconnect(), which requires sdata to be
locked, so lock the sdata during ieee80211_csa_connection_drop_work().

Cc: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 13:38:49 +01:00
Felix Fietkau 70dabeb74e mac80211: let the driver reserve extra tailroom in beacons
Can be used to add extra IEs (such as P2P NoA) without having to
reallocate the buffer.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 12:14:07 +01:00
Johannes Berg bd02cd2549 radiotap: fix bitmap-end-finding buffer overrun
Evan Huus found (by fuzzing in wireshark) that the radiotap
iterator code can access beyond the length of the buffer if
the first bitmap claims an extension but then there's no
data at all. Fix this.

Cc: stable@vger.kernel.org
Reported-by: Evan Huus <eapache@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 12:06:43 +01:00
Johannes Berg 7907c7d33c mac80211: free all AP/VLAN keys at once
When the AP interface is stopped, free all AP and VLAN keys at
once to only require synchronize_net() once. Since that does
synchronize_net(), also move two such calls into the function
(using the new force_synchronize parameter) to avoid doing it
twice.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 11:29:48 +01:00
Johannes Berg e716251d77 mac80211: optimise mixed AP/VLAN station removal
Teach sta_info_flush() to optionally also remove stations
from all VLANs associated with an AP interface to optimise
the station removal (in particular, synchronize_net().)

To not have to add the vlans argument throughout, do some
refactoring.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 11:29:47 +01:00
Johannes Berg d778207b06 mac80211: optimise synchronize_net() for sta_info_flush
There's no reason to have one synchronize_net() for each
removed station, refactor the code slightly to have just
a single synchronize_net() for all stations.

Note that this is currently useless as hostapd removes
stations one by one and this coalescing never happens.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 11:29:47 +01:00
Johannes Berg c878207844 mac80211: move synchronize_net() before sta key removal
There's no reason to do this inside the sta key removal
since the keys can only be reached through the sta (and
not by the driver at all) so once the sta can no longer
be reached, the keys are safe.

This will allow further optimisation opportunities with
multiple stations.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 11:29:46 +01:00
Johannes Berg d34ba2168a mac80211: don't delay station destruction
If we can assume that stations are never referenced by the
driver after sta_state returns (and this is true since the
previous iwlmvm patch and for all other drivers) then we
don't need to delay station destruction, and don't need to
play tricks with rcu_barrier() etc.

This should speed up some scenarios like hostapd shutdown.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 11:29:45 +01:00
Johannes Berg a710c8160d mac80211: move 4-addr sta pointer clearing before synchronize_rcu()
The pointer should be cleared before synchronize_rcu() so that the
consequently dead station won't be found by any lookups in the TX
or RX paths.

Also check that the station is actually the one being removed, the
check is not needed because each 4-addr VLAN can only have a single
station and non-4-addr VLANs always have a NULL pointer there, but
the code is clearer this way (and we avoid the memory write.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-12-16 11:29:45 +01:00
Johannes Berg 1ddbbb0c83 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>
2013-12-16 11:29:44 +01:00