linux-drm-fsl-dcu.git
8 years agoMerge tag 'mac80211-next-for-davem-2015-08-14' into next
Emmanuel Grumbach [Sun, 16 Aug 2015 07:20:58 +0000 (10:20 +0300)]
Merge tag 'mac80211-next-for-davem-2015-08-14' into next

Another pull request for the next cycle, this time with quite
a bit of content:
 * mesh fixes/improvements from Alexis, Bob, Chun-Yeow and Jesse
 * TDLS higher bandwidth support (Arik)
 * OCB fixes from Bertold Van den Bergh
 * suspend/resume fixes from Eliad
 * dynamic SMPS support for minstrel-HT (Krishna Chaitanya)
 * VHT bitrate mask support (Lorenzo Bianconi)
 * better regulatory support for 5/10 MHz channels (Matthias May)
 * basic support for MU-MIMO to avoid the multi-vif issue (Sara Sharon)
along with a number of other cleanups.

8 years agoiwlwifi: mvm: add debug info to schedule scan complete message.
Ayala Beker [Wed, 22 Jul 2015 10:54:31 +0000 (13:54 +0300)]
iwlwifi: mvm: add debug info to schedule scan complete message.

Add more information to schedule scan complete message.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: remove partial and full scan lists from lmac sched scan
David Spinadel [Sun, 21 Jun 2015 08:57:36 +0000 (11:57 +0300)]
iwlwifi: mvm: remove partial and full scan lists from lmac sched scan

Lmac sched scan supports partial scans, so we can set some channels to be
scanned on every scan iteration and others to be scanned only on some
iterations. Currently we set all channels to be scanned every iteration,
but still have some configuration of which iterations should be partial
and which should be full.

Remove all partial/full scan configuration to reduce confusions.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: simplify calculating scan dwells and other timing values
David Spinadel [Mon, 22 Jun 2015 10:20:00 +0000 (13:20 +0300)]
iwlwifi: mvm: simplify calculating scan dwells and other timing values

Remove timing values from iwl_mvm_scan_params and use defines and
arrays of values instead.

While at that fix few values and corner cases and align all OSs
to ChromeOS values.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Reviewed-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: make sure d3_suspend/resume ops exist
Eliad Peller [Thu, 30 Jul 2015 13:53:27 +0000 (16:53 +0300)]
iwlwifi: make sure d3_suspend/resume ops exist

We added calls to d3_suspend/resume trans ops during the
suspend/resume flow.

However, the wrapper code didn't verify the trans ops were
actually defined, resulting in panic when they were not
(such as in the case of sdio trans)

Fixes: 6dfb36c89dc2 ("iwlwifi: call d3_suspend/resume in d0i3 case as well")
Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agomac80211: fix BIT position for TDLS WIDE extended cap
Emmanuel Grumbach [Sun, 19 Jul 2015 13:09:12 +0000 (16:09 +0300)]
mac80211: fix BIT position for TDLS WIDE extended cap

The bit was not according to ieee80211 specification.
Fix that.

Reviewed-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: use DECLARE_EWMA
Johannes Berg [Mon, 13 Jul 2015 10:26:46 +0000 (12:26 +0200)]
mac80211: use DECLARE_EWMA

Instead of using the out-of-line average calculation, use the new
DECLARE_EWMA() macro to declare a signal EWMA, and use that.

This actually *reduces* the code size slightly (on x86-64) while
also reducing the station info size by 80 bytes.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agoaverage: provide macro to create static EWMA
Johannes Berg [Mon, 13 Jul 2015 10:17:25 +0000 (12:17 +0200)]
average: provide macro to create static EWMA

Having the EWMA parameters stored in the runtime struct imposes
memory requirements for the constant values that could just be
inlined in the code. This particularly makes sense if there are
a lot of such structs, for example in mac80211 in the station
table where each station has a number of these in an array, and
there can be many stations.

Provide a macro DECLARE_EWMA() that declares the necessary struct
and inline functions to access it with the parameters hard-coded;
using this also means the user no longer needs to 'select AVERAGE'
as it's entirely self-contained.

In the mac80211 case, on x86-64, this actually slightly *reduces*
code size, while also saving 80 bytes of runtime memory per sta.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211_hwsim: unregister genetlink family properly
Su Kang Yin [Fri, 7 Aug 2015 08:54:10 +0000 (16:54 +0800)]
mac80211_hwsim: unregister genetlink family properly

During hwsim_init_netlink(), we should call genl_unregister_family()
if failed on netlink_register_notifier() since the genetlink is
already registered.

Signed-off-by: Su Kang Yin <cantona@cantona.net>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: add rate mask logic for vht rates
Lorenzo Bianconi [Thu, 6 Aug 2015 21:47:33 +0000 (23:47 +0200)]
mac80211: add rate mask logic for vht rates

Define rc_rateidx_vht_mcs_mask array and rate_idx_match_vht_mcs_mask()
method in order to apply mcs mask for vht rates

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: define rate_control_apply_mask_ratetbl()
Lorenzo Bianconi [Thu, 6 Aug 2015 21:47:32 +0000 (23:47 +0200)]
mac80211: define rate_control_apply_mask_ratetbl()

Define rate_control_apply_mask_ratetbl() in order to apply ratemask in
rate_control_set_rates() for station rate table

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: remove ieee80211_tx_rate dependency in rate mask code
Lorenzo Bianconi [Thu, 6 Aug 2015 21:47:31 +0000 (23:47 +0200)]
mac80211: remove ieee80211_tx_rate dependency in rate mask code

Remove ieee80211_tx_rate dependency in rate_idx_match_legacy_mask(),
rate_idx_match_mcs_mask() and rate_idx_match_mask() in order to use the
previous logic to define a ratemask in rate_control_set_rates() for
station rate table. Moreover move rate mask definition logic in
rate_control_cap_mask()

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: remove ieee80211_tx_info from rate_control_apply_mask signature
Lorenzo Bianconi [Thu, 6 Aug 2015 21:47:30 +0000 (23:47 +0200)]
mac80211: remove ieee80211_tx_info from rate_control_apply_mask signature

Remove unnecessary ieee80211_tx_info pointer from rate_control_apply_mask
signature. rate_control_apply_mask() will be used to define a ratemask in
rate_control_set_rates() for station rate table

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: Make OCB mode set BSSID
Bertold Van den Bergh [Wed, 5 Aug 2015 14:02:50 +0000 (16:02 +0200)]
mac80211: Make OCB mode set BSSID

Perform the BSS_CHANGED_BSSID action when joining an OCB network.
This is required to set the broadcast BSSID in some network drivers.

Signed-off-by: Bertold Van den Bergh <bertold.vandenbergh@esat.kuleuven.be>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: Only accept data frames in OCB mode
Bertold Van den Bergh [Wed, 5 Aug 2015 14:02:42 +0000 (16:02 +0200)]
mac80211: Only accept data frames in OCB mode

Currently OCB mode accepts frames with bssid==broadcast and type!=beacon.
Some non-data frames are sent matching this, for example probe responses.
This results in unnecessary creation of STA entries.

Signed-off-by: Bertold Van den Bergh <bertold.vandenbergh@esat.kuleuven.be>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: Set txrc.bss to true for OCB interfaces
Bertold Van den Bergh [Wed, 5 Aug 2015 14:02:28 +0000 (16:02 +0200)]
mac80211: Set txrc.bss to true for OCB interfaces

To make mac80211 accept the multicast rate requested by the user the
rate control should be told that it is operating in BSS mode.
Without this, the default rate is selected in rate_control_send_low
(!pubsta and !txrc->bss)

Signed-off-by: Bertold Van den Bergh <bertold.vandenbergh@esat.kuleuven.be>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agonl80211: Allow setting multicast rate on OCB interfaces
Bertold Van den Bergh [Wed, 5 Aug 2015 14:02:21 +0000 (16:02 +0200)]
nl80211: Allow setting multicast rate on OCB interfaces

Allow setting multicast rate on OCB interfaces.
Current behaviour results in EOPNOTSUPP when attempting this.

Signed-off-by: Bertold Van den Bergh <bertold.vandenbergh@esat.kuleuven.be>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: propagate set_wiphy failure to userspace
Michal Kazior [Mon, 3 Aug 2015 08:55:24 +0000 (10:55 +0200)]
cfg80211: propagate set_wiphy failure to userspace

If driver failed to setup wiphy params (e.g. rts
threshold, fragmentation treshold) userspace
wasn't properly notified about this. This could
lead to user confusion who would think the command
succeeded even if that wasn't the case.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: regulatory: handle 5 and 10 MHz channels properly
Matthias May [Fri, 17 Jul 2015 13:28:39 +0000 (15:28 +0200)]
cfg80211: regulatory: handle 5 and 10 MHz channels properly

The original assumption of 20MHz wide channels hasn't been true since
the addition of support for 5 and 10 MHz channels.
Change the code to no longer disable all channels that don't fit into
the 20MHz grid, but instead set the appropriate flags to disable
operation on specific bandwidths.

Signed-off-by: Matthias May <matthias.may@neratec.com>
[reword commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: remove always true condition
Dan Carpenter [Mon, 27 Jul 2015 08:11:11 +0000 (11:11 +0300)]
mac80211: remove always true condition

The outside if statement checks that IEEE80211_TX_INTFL_MLME_CONN_TX is
set so this condition is always true.  Checking twice upsets the static
checkers.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: remove ieee80211_aes_cmac_calculate_k1_k2()
Johannes Berg [Wed, 8 Jul 2015 12:41:48 +0000 (15:41 +0300)]
mac80211: remove ieee80211_aes_cmac_calculate_k1_k2()

The iwlwifi driver was the only driver that used this, but as
it turns out it never needed it, so we can remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agoiwlwifi: mvm: don't set K1/K2 for AES-CMAC
Johannes Berg [Fri, 19 Jun 2015 08:20:10 +0000 (10:20 +0200)]
iwlwifi: mvm: don't set K1/K2 for AES-CMAC

According to firmware engineers, the firmware has never required
these fields and the values have always been calculated, they were
just leftovers from a previous implementation.

Therefore remove the unnecessary calculation.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agorfkill: Allow compile test of GPIO consumers if !GPIOLIB
Geert Uytterhoeven [Sun, 2 Aug 2015 09:09:54 +0000 (11:09 +0200)]
rfkill: Allow compile test of GPIO consumers if !GPIOLIB

The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.

Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
appropriate.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agoiwlwifi: mvm: set different pm_timeout for action frames
Avri Altman [Sun, 12 Jul 2015 06:10:05 +0000 (09:10 +0300)]
iwlwifi: mvm: set different pm_timeout for action frames

When building a Tx Command for management frames, we are lacking
a check for action frames, for which we should set a different
pm_timeout.  This cause the fw to stay awake for 100TU after each
such frame is transmitted, resulting an excessive power consumption.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: ToF - Set correct range request cmd id
Assaf Krauss [Wed, 22 Jul 2015 11:21:31 +0000 (14:21 +0300)]
iwlwifi: mvm: ToF - Set correct range request cmd id

Command ID of ToF range request command adapted to new FW commands grouping
scheme.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Add FW paging mechanism for the UMAC on SDIO
Matti Gottlieb [Sun, 19 Jul 2015 08:15:07 +0000 (11:15 +0300)]
iwlwifi: mvm: Add FW paging mechanism for the UMAC on SDIO

Family 8000 products has 2 embedded processors, the first
known as LMAC (lower MAC) and implements the functionality from
previous products, the second one is known as UMAC (upper MAC)
and is used mainly for driver offloads as well as new features.
The UMAC is typically “less” real-time than the LMAC and is used
for higher level controls.
The UMAC's code/data size is estimated to be in the mega-byte arena,
taking into account the code it needs to replace in the driver and
the set of new features.

In order to allow the UMAC to execute code that is bigger than its code
memory, we allow the UMAC embedded processor to page out code pages on
DRAM.

When the device is slave on the bus(SDIO) the driver saves the UMAC's
image pages in blocks of 32K in the DRAM and sends the layout of the
pages to the FW. When the FW wants load / unload pages, it creates an
interrupt, and the driver uploads / downloads the page to an address in
the a specific address on the device's memory.

The driver can support up to 1 MB of pages.

Add paging mechanism for the UMAC on SDIO in order to allow the program to
use a larger virtual space while using less physical memory on the device
itself.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: New RBD allocation model
Sara Sharon [Tue, 28 Apr 2015 09:56:54 +0000 (12:56 +0300)]
iwlwifi: pcie: New RBD allocation model

As a preperation for multiple RX queues change the RBD
allocation model.

The new model includes a background allocator. The allocator is
called by the interrupt handler when there are two released
buffers by the queue, and the allocator starts allocating eight
pages per request.
When the queue has released 8 pages it tries claiming the
request. If the pages are not ready - it keeps claiming.
This new model should make sure that RBDs are always available
across the multiple queues.

The RBDs are transferred between the allocator and the queue.
The queue moves the free RBDs upon freeing them to the allocator.
The allocator moves them back to the queue's possession when the
request is claimed.
The allocator has an initial pool to make sure there are always RBDs
available for the request completion.
Release of the buffers at exit is done per pools - the allocator
frees its own initial pool and the queue frees its own pool.

Existing code refactor -
-Queue's initial pool is the size of the queue only as the allocation
of the new buffers no longer uses this pool.
-Removal of replenish background work, and replenish calls in the
interrupt handler and restock().
-The replenish() and the rxq used_list are used only during
initialization.
-Moved page allocation to a new function for code reuse.

New code -
Allocator code - new structure and functions.
Interrupt handler uses the allocator functions for replenishing buffers.
Reuse of the restock() method.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoMerge remote-tracking branch 'iwlwifi-fixes/master' into next
Emmanuel Grumbach [Tue, 4 Aug 2015 18:30:10 +0000 (21:30 +0300)]
Merge remote-tracking branch 'iwlwifi-fixes/master' into next

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Conflicts:
drivers/net/wireless/iwlwifi/pcie/internal.h

8 years agoiwlwifi: mvm: add the ability to trigger only monitor dumps
Oren Givon [Wed, 15 Jul 2015 12:47:28 +0000 (15:47 +0300)]
iwlwifi: mvm: add the ability to trigger only monitor dumps

Change the FW debug trigger tlv to include a monitor only
option. Setting this option to true will cause fw dump triggers
to only collect monitor data and skip other dumps such as
SMEM, SRAM, CSR, PRPH, etc.
This option is used when accessing the different parts of the
firmware memory is not wanted and can cause unwanted behavior
like when debugging TX latency.

Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: support frag SKBs
Johannes Berg [Fri, 17 Apr 2015 14:38:31 +0000 (16:38 +0200)]
iwlwifi: pcie: support frag SKBs

Allow frag SKBs in PCIe and advertise the maximum number of frags
to the opmode. As a fallback. linearize the SKB if it exceeds the
maximum number of fragments. This allows using the hardware better
(filling more TBs) and should improve performance when used by the
opmode.

Also adjust tracing to be able to deal with this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: add new TLV capability flag for gscan support
Avraham Stern [Sun, 22 Mar 2015 11:11:01 +0000 (13:11 +0200)]
iwlwifi: add new TLV capability flag for gscan support

Gscan is a scan feature which is supported on certain devices only,
hence the need for a TLV flag for it. For devices that support gscan
store the gscan capabilities advertised by the FW so the driver can
report it to upper layers.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: Add max TX aggregation size for 8260 SDIO devices series
Alexander Bondar [Thu, 4 Jun 2015 07:32:43 +0000 (10:32 +0300)]
iwlwifi: Add max TX aggregation size for 8260 SDIO devices series

Set max TX aggregation size for 8260 SDIO devices series to 40 frames.
Fine tune max RX aggregation size - change it to 21.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: revert to our old skip over dtim policy
Avri Altman [Thu, 18 Jun 2015 03:39:41 +0000 (06:39 +0300)]
iwlwifi: mvm: revert to our old skip over dtim policy

Our firmware scheduler used to suffer from false wake-up on 500 time units.
We had to came up with a formula to address this buggy behavior.
Now that our firmware is fixed, we can go back to our old policy.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: dump RBs when FW error occurs
Emmanuel Grumbach [Wed, 15 Jul 2015 20:15:08 +0000 (23:15 +0300)]
iwlwifi: pcie: dump RBs when FW error occurs

Add support for dumping all the RBs in the RX queue
when FW error occurs.
This will assist debugging.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: print secboot status registers on alive timeout
Dor Shaish [Wed, 15 Jul 2015 08:41:21 +0000 (11:41 +0300)]
iwlwifi: mvm: print secboot status registers on alive timeout

Print the CPU1 and CPU2 secured boot status registers from the NIC
to indicate a SYSASSERT during secured engine unlocking process
on init/protocol image.

Signed-off-by: Dor Shaish <dor.shaish@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Add FW paging mechanism for the UMAC on PCI
Matti Gottlieb [Wed, 15 Jul 2015 13:19:29 +0000 (16:19 +0300)]
iwlwifi: mvm: Add FW paging mechanism for the UMAC on PCI

Family 8000 products has 2 embedded processors, the first
known as LMAC (lower MAC) and implements the functionality from
previous products, the second one is known as UMAC (upper MAC)
and is used mainly for driver offloads as well as new features.
The UMAC is typically “less” real-time than the LMAC and is used
for higher level controls.
The UMAC's code/data size is estimated to be in the mega-byte arena,
taking into account the code it needs to replace in the driver and
the set of new features.

In order to allow the UMAC to execute code that is bigger than its code
memory, we allow the UMAC embedded processor to page out code pages on
DRAM.

When the device is master on the bus(PCI) the driver saves the UMAC's
image pages in blocks of 32K in the DRAM and sends the layout of the
pages to the FW. The FW can load / unload the pages on its own.

The driver can support up to 1 MB of pages.

Add paging mechanism for the UMAC on PCI in order to allow the program
to use a larger virtual space while using less physical memory on the
device.

Signed-off-by: Eran Harary <eran.harary@intel.com>
Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: clean up fw-api-scan.h
David Spinadel [Wed, 24 Jun 2015 08:03:56 +0000 (11:03 +0300)]
iwlwifi: mvm: clean up fw-api-scan.h

Remove outdated and unused definitions

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: add wide firmware command support for debug triggers
Sara Sharon [Mon, 13 Jul 2015 11:23:59 +0000 (14:23 +0300)]
iwlwifi: mvm: add wide firmware command support for debug triggers

Add support for extended command id in triggers handling.
Extended command id header contains group id in addition to command id.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: add wide firmware command infrastructure for RX
Avraham Stern [Thu, 9 Jul 2015 14:17:03 +0000 (17:17 +0300)]
iwlwifi: mvm: add wide firmware command infrastructure for RX

Add support for extended firmware event header that contains
a group id as well as the command id.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: add wide firmware command support for notifications
Sara Sharon [Mon, 13 Jul 2015 11:50:47 +0000 (14:50 +0300)]
iwlwifi: add wide firmware command support for notifications

Add support for extended command id in notification system.
Extended command id header contains group id in addition to command id.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: make various functions void in the file rs.c
Nicholas Krause [Wed, 8 Jul 2015 15:02:15 +0000 (11:02 -0400)]
iwlwifi: make various functions void in the file rs.c

This makes various functions in the file rs.c void due to these
functions never returning a error code to signal to their callers
if and how they have failed to complete their intended work.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: move TX PN assignment for CCMP to the driver
Johannes Berg [Mon, 20 Apr 2015 15:54:54 +0000 (17:54 +0200)]
iwlwifi: mvm: move TX PN assignment for CCMP to the driver

Move the TX PN assignment (for CCMP only) to the driver. This prepares
the driver for future DSO (driver segmentation offload) where it will
split an SKB into multiple MPDUs by itself.

For TDLS, split out the CCMP TX command handling so that it won't get
a PN assigned, the firmware assigns the PN in that case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: reset write pointer on ict reset
Eliad Peller [Thu, 16 Jul 2015 17:17:42 +0000 (20:17 +0300)]
iwlwifi: pcie: reset write pointer on ict reset

Since the CSR_DRAM_INIT_TBL_WRITE_POINTER bit wasn't set
on ict reset, in some flows (like disable ict followed by
immediate reset ict) the driver and hardware went out
of sync (the driver cleared the ict_index, while the hw
kept it intact).

Fix it by setting the flag when resetting ict.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: call d3_suspend/resume in d0i3 case as well
Eliad Peller [Thu, 9 Jul 2015 11:17:24 +0000 (14:17 +0300)]
iwlwifi: call d3_suspend/resume in d0i3 case as well

Some CSR registers have to be configured also
in case of suspend/resume with unified image
(which doesn't includes reconfiguration flow).

Reuse the existing d3_suspend/d3_resume trans ops,
while making sure some configurations are a bit
different, according to the wowlan type.

After this change, we no longer need the special
wowlan_d0i3 configurations done in iwl_pci_resume,
as they are already being done in the d3_resume op.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: ignore CQM when setting beacon filtering in D0i3 enter flow
Gregory Greenman [Mon, 20 Jul 2015 09:55:34 +0000 (12:55 +0300)]
iwlwifi: mvm: ignore CQM when setting beacon filtering in D0i3 enter flow

CQM overwrites a few thresholds in the bf command. On the other hand,
when entering D0i3 the thresholds are set to higher values on purpose,
so ignore CQM in this case.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: fix beacon filtering temperature thresholds for D0i3
Gregory Greenman [Wed, 22 Jul 2015 12:46:37 +0000 (15:46 +0300)]
iwlwifi: mvm: fix beacon filtering temperature thresholds for D0i3

The slow filtering threshold should be higher in D0i3 case.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Enable Rx Checksum hw
Avri Altman [Sat, 27 Dec 2014 07:09:47 +0000 (09:09 +0200)]
iwlwifi: mvm: Enable Rx Checksum hw

TCP software implementation on the host requires extensive computing
power.  Offloading even some of the TCP/IP stack to the NIC might save
a significant overhead. In order to enable this feature on our hw,
we need to configure it first. Once done, we mark this capability,
to be advertised later to the OS via ieee80211_register_hw.
The driver Rx indications for TCP Checksum is integrated within the
standard Rx status. The driver responds to those indications as follows:
If the frame was tested by hw and checksum ok report CHECKSUM_UNNECESSARY.
Otherwise, report CHECKSUM_NONE.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: provide a way to stop configuration if it is forbidden
Haim Dreyfuss [Mon, 20 Jul 2015 11:16:21 +0000 (14:16 +0300)]
iwlwifi: pcie: provide a way to stop configuration if it is forbidden

The firmware debug infrastructure allows the user to
provide a firmware that will toggle a few registers to
configure the debugging capabilities.
On certain devices, certain operations are forbidden.
Executing a forbidden operation will cause the hardware to
die in a way that only driver unload / load will bring it
back to life.
Fortunately, there is a way to know in advance if those
operations will be accepted by the device. This is where
the new PRPH_BLOCKBIT operation plays its role. If the bit
X from PRPH register Y is set, then we should prevent any
further register configuration. When that happens, drop a
line in the kernel log since this is really an error state:
the user won't have his device configured as he expected.
Add operations that will be used in the future:
INDIRECT_ASSIGN, INDIRECT_SETBIT, and INDIRECT_CLEARBIT.

Other debugging configurations (such as destination
configuration for the monitor) will take place in any case.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Use the AP station for non_sta transmit
Ilan Peer [Wed, 24 Jun 2015 06:23:01 +0000 (09:23 +0300)]
iwlwifi: mvm: Use the AP station for non_sta transmit

In iwl_mvm_tx_skb_non_sta(), in case of managed interface,
use the AP station for multicast frames instead of the auxiliary
station as otherwise the frames can be sent to an absent P2P GO as
the FW does not block transmissions for the auxiliary station
since it is not associated with the station MAC context.

Note that this is not possible for unicast frames, as a TDLS
discovery response is sent without a station entry, and in this
case the P2P GO NoA should not block transmission to the peer.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: update comment of power_scheme module parameter
Avri Altman [Sun, 28 Jun 2015 05:10:46 +0000 (08:10 +0300)]
iwlwifi: mvm: update comment of power_scheme module parameter

Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: return error if d0i3 was aborted
Eliad Peller [Thu, 4 Jun 2015 18:59:32 +0000 (21:59 +0300)]
iwlwifi: return error if d0i3 was aborted

Allow the transport layer to return an error upon suspend.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Reviewed-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoRevert "iwlwifi: mvm: move deferred d0i3 exit to resume_complete op"
Eliad Peller [Wed, 17 Jun 2015 12:32:37 +0000 (15:32 +0300)]
Revert "iwlwifi: mvm: move deferred d0i3 exit to resume_complete op"

This reverts commit 088070a2f6575402d3dd82e1c5a4a8e1941805f6.

When working in d0i3_on_idle mode, we explicitly go out
of d0i3 on resume (so other potential commands could
be sent).

However, D0I3_DEFER_WAKEUP is currently cleared on
resume complete (which happens only later on), causing
d0i3 exit to timeout.

Since mac80211 was modified to accept incoming frames
once drv_resume was called, we can safely revert this
patch, and handle the pending work on iwl_mvm_resume().

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: move existing UMAC commands to group 1
Johannes Berg [Tue, 30 Jun 2015 13:31:22 +0000 (15:31 +0200)]
iwlwifi: mvm: move existing UMAC commands to group 1

Existing UMAC commands already use the long header, but are sent
with group 0 and the long header inserted manually. Move them to
the group 1 to take advantage of the header building in the low-
level transport.

Existing firmware ignores the group_id field (it's reserved) and
the first firmware that really supports long command headers can
parse all commands in both group 0 (with short header) and group
1 (with long header.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: add wide firmware command infrastructure for TX
Aviya Erenfeld [Tue, 9 Jun 2015 13:45:52 +0000 (16:45 +0300)]
iwlwifi: add wide firmware command infrastructure for TX

As the firmware is slowly running out of command IDs and grouping of
commands is desirable anyway, the firmware is extending the command
header from 4 bytes to 8 bytes to introduce a group (in place of the
former flags field, since that's always 0 on commands and thus can
be easily used to distinguish between the two.

In order to support this most easily in the driver widen the command
command ID used in the command sending functions and encode the new
values (group and version) in the ID. That way existing code doesn't
have to be changed (since the higher bits are 0 automatically) and
newer code can easily use the new ID generation function to create a
value to use in place of just the command ID.

Signed-off-by: Aviya Erenfeld <aviya.erenfeld@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: add basic Time of Flight (802.11mc FTM) support
Gregory Greenman [Tue, 2 Jun 2015 15:06:16 +0000 (18:06 +0300)]
iwlwifi: mvm: add basic Time of Flight (802.11mc FTM) support

ToF is a time based method for measurement of the WiFi device
location within a WiFi environment. The driver functionality provided
by this patch is the interface for communication with FW and receiving
location related updates from the FW. The interface provided by this
patch is via debugfs.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: remove IWL_UCODE_TLV_API_BASIC_DWELL
Sara Sharon [Sun, 7 Jun 2015 07:36:23 +0000 (10:36 +0300)]
iwlwifi: mvm: remove IWL_UCODE_TLV_API_BASIC_DWELL

All the supported firmwares support this API.
This includes removing dwell per band, as band is no longer a factor
in calculating the dwell. Only basic dwell is used and FW will calculate
the actual dwell time.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: remove command header flags field
Johannes Berg [Tue, 30 Jun 2015 12:45:40 +0000 (14:45 +0200)]
iwlwifi: remove command header flags field

The 'flags' field really has been reserved in the firmware API for a
very long time, probably since 4965. As a consequence, the field is
always 0 and checking for a IWL_CMD_FAILED_MSK flag makes no sense.

Rename the field to 'reserved', get rid of IWL_CMD_FAILED_MSK and
all the code for it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: don't warn on long MPDUs when supported
Emmanuel Grumbach [Thu, 2 Jul 2015 11:53:02 +0000 (14:53 +0300)]
iwlwifi: pcie: don't warn on long MPDUs when supported

In iwlmvm firmwares, the Byte count written in the scheduler
byte count table is in DWORDs and not in bytes.
We should check that this value fits in the 12 bits and
the value can be either in bits of in DWORD or bytes
depending on the firmware. Check the value after the
translation to DWORDs is done (if needed).

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: add missing calls to synchronize_irq()
Emmanuel Grumbach [Thu, 25 Jun 2015 09:55:45 +0000 (12:55 +0300)]
iwlwifi: pcie: add missing calls to synchronize_irq()

In a few places, we were disabling interrupts but didn't
make sure that the interrupt handler has finished running.
Add calls to synchronize_irq() to ensure we finish handling
the interrupts before we free resources or other things that
could lead to a crash if the interrupt were to be handled
later.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: cancel Tx timer upon firmware crash
Emmanuel Grumbach [Wed, 24 Jun 2015 11:58:13 +0000 (14:58 +0300)]
iwlwifi: pcie: cancel Tx timer upon firmware crash

When the firmware crashes, we can't expect the Tx queues to
progress. Cancel their timer.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Do not sample the device time for session protection
Ilan Peer [Wed, 24 Jun 2015 07:25:26 +0000 (10:25 +0300)]
iwlwifi: mvm: Do not sample the device time for session protection

Since the time-event is sent with the immediate flag set, there is
no need to sample the device time.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: remove command and return value from opmode RX
Johannes Berg [Tue, 23 Jun 2015 19:58:17 +0000 (21:58 +0200)]
iwlwifi: remove command and return value from opmode RX

With the previous patch series, no opmode continues using the
command or handler_status (i.e. the return value from the RX)
so it can be removed now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: remove command/return value from RX handlers
Johannes Berg [Tue, 23 Jun 2015 19:22:09 +0000 (21:22 +0200)]
iwlwifi: mvm: remove command/return value from RX handlers

In the mvm driver, neither the old command nor the return value
are used, so remove them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: dvm: remove command/return value from RX handlers
Johannes Berg [Tue, 23 Jun 2015 19:22:09 +0000 (21:22 +0200)]
iwlwifi: dvm: remove command/return value from RX handlers

After the previous patches, the command that's passed in nor the
return value are used any more, so can be removed.

While at it, make some functions static.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: dvm: remove ADD_STA prints relying on station ID
Johannes Berg [Tue, 23 Jun 2015 19:01:44 +0000 (21:01 +0200)]
iwlwifi: dvm: remove ADD_STA prints relying on station ID

This makes the logging a little less useful, but as they're mostly
synchronous commands it won't matter much. It gets rid of the
dependency on the input command, which this is the only user of.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: dvm: move ADD_STA response handling to sync command
Johannes Berg [Tue, 23 Jun 2015 18:56:45 +0000 (20:56 +0200)]
iwlwifi: dvm: move ADD_STA response handling to sync command

This driver currently has some very confusing ADD_STA response handling
that runs asynchronously in the background for all of the commands, but
is only really necessary for synchronous ones (the really asynchronous
ones can only be done for already existing stations), and for the sync
ones it actually waits for the RX handler to return a status code.

Rework this to keep the debug printing in the handler, but do the code
that's supposed to have an effect only for sync commands in the command
sending function.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: LRU-assign key offsets
Johannes Berg [Tue, 16 Jun 2015 15:09:18 +0000 (17:09 +0200)]
iwlwifi: mvm: LRU-assign key offsets

The current key offset assignment algorithm always uses the lowest
unused key offset, which will potentially lead to issues when the
firmware will change to take the key material for TX from the key
table rather than from the TX command.

In order to avoid those issues (and avoid forgetting about them)
change the key offset allocation algorithm now to avoid reusing key
offsets quickly.

The new algorithm always picks as the next offset the least recently
freed offset, i.e. the offset that has been unused for the longest
amount of time. This is implemented by having a generation counter
for each key offset that is incremented every time a key is deleted,
except for the one that's deleted, which is reset to zero. Thus the
highest counter is the key that's been unused longest.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: Set scheduler to work on auto mode
Haim Dreyfuss [Sun, 14 Jun 2015 08:17:07 +0000 (11:17 +0300)]
iwlwifi: pcie: Set scheduler to work on auto mode

During NIC initialization shared HW is reset and this disables the
scheduler. Some HW platforms do not activate the scheduler after it.
Consequently all HCMD sent by the driver stay at the queues which cause
to queue stuck.
Set the scheduler to work on auto active mode so it would be activated upon
change over one of the queues' write pointer.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: fix stuck queue detection for sleeping clients
Emmanuel Grumbach [Wed, 29 Jul 2015 20:06:41 +0000 (23:06 +0300)]
iwlwifi: pcie: fix stuck queue detection for sleeping clients

The stuck queue detection mechanism allows to detect queues
that are stuck. For sleeping clients, a queue may rightfully
be stuck: if a poor client implementation stays asleep for
more than 10s, then we don't want to trigger recovery flows
because of that client.
In order to cope with this, I added a mechanism that
monitors the state of the client: when a client goes to
sleep, the timer of his queues is frozen. When he wakes up,
the timer is reset to the right value so that if a client
was awake for more than 10s and the queues are stuck, only
then, the recovery flow will kick in.
This is valid only on non-shared queues: A-MPDU queues.

There was a bug in case we Tx to a sleeping client that has
an empty A-MPDU queue: the timer was armed to now + 10s.
This is bad, but pretty harmless.
The problem is that when the client wakes up, the timer is
modified to be now + remainder. But remainder is 0 since the
queue was empty when that client went to sleep...

Fix this by checking the state of the client before playing
with the timer when we add a packet to an empty queue.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Fix regular scan priority
Avraham Stern [Tue, 7 Jul 2015 13:53:42 +0000 (16:53 +0300)]
iwlwifi: mvm: Fix regular scan priority

The code checks the total number of iterations to differentiate
between regular scan and scheduled scan. However, regular scan has
a total of one iteration, not zero. As a result, regular scan will
have lower priority than it should have, and in case scheduled
scan is already running when regular scan is requested, regular scan
will be delayed until scheduled scan is aborted.
Fix that by checking for total iterations number of one as an
identifier for regular scan.

Fixes: 133c8259f885 ("iwlwifi: mvm: rename generic_scan_cmd functions to dwell")
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: fix prepare card flow
Emmanuel Grumbach [Mon, 20 Jul 2015 09:14:39 +0000 (12:14 +0300)]
iwlwifi: pcie: fix prepare card flow

When the card is not owned by the PCIe bus, we need to
acquire ownership first. This flow is implemented in
iwl_pcie_prepare_card_hw. Because of a hardware bug, we
need to disable link power management before we can
request ownership otherwise the other user of the device
won't get notified that we are requesting the device which
will prevent us from acquire ownership.

Same holds for the down flow where we need to make sure
that any other potential user is notified that the driver
is going down.

CC: <stable@vger.kernel.org> [4.1]
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agomac80211: deinline rate_control_rate_init, rate_control_rate_update
Denys Vlasenko [Wed, 15 Jul 2015 12:56:06 +0000 (14:56 +0200)]
mac80211: deinline rate_control_rate_init, rate_control_rate_update

With this .config: http://busybox.net/~vda/kernel_config,
after deinlining these functions have sizes and callsite counts
as follows:

rate_control_rate_init: 554 bytes, 8 calls
rate_control_rate_update: 1596 bytes, 5 calls

Total size reduction: about 11 kbytes.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: John Linville <linville@tuxdriver.com>
CC: Michal Kazior <michal.kazior@tieto.com>
CC: Johannes Berg <johannes.berg@intel.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: deinline drv_sta_state
Denys Vlasenko [Wed, 15 Jul 2015 12:56:05 +0000 (14:56 +0200)]
mac80211: deinline drv_sta_state

With this .config: http://busybox.net/~vda/kernel_config,
after deinlining the function size is 3132 bytes and there are
7 callsites.

Total size reduction: about 20 kbytes.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: John Linville <linville@tuxdriver.com>
CC: Michal Kazior <michal.kazior@tieto.com>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: select an AID when creating new mesh STAs
Bob Copeland [Tue, 14 Jul 2015 12:31:59 +0000 (08:31 -0400)]
mac80211: select an AID when creating new mesh STAs

Instead of using peer link id for AID, generate a new
AID when creating mesh STAs in the kernel peering manager.
This enables smaller TIM elements and more closely follows
the standard, and it also enables mesh to work on drivers
that require a valid AID when the STA is inserted (ath10k
firmware has this requirement, for example).

In the case of userspace-managed stations, we use the AID
from NL80211_CMD_NEW_STATION.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: mesh: separate plid and aid concepts
Bob Copeland [Tue, 14 Jul 2015 12:31:58 +0000 (08:31 -0400)]
mac80211: mesh: separate plid and aid concepts

According to 802.11-2012 13.3.1, a mesh STA should assign an AID
upon receipt of a mesh peering open frame rather than using the link
id of the peer.  Using the peer link id has two potential issues:
it may not be unique among the peers, and by its nature it is random,
so the TIM may not compress well.

In preparation for allocating it properly, use sta->sta.aid, but keep
the existing behavior of using the plid in the aid we send.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: reorder mesh_plink to remove forward decl
Bob Copeland [Tue, 14 Jul 2015 12:31:57 +0000 (08:31 -0400)]
mac80211: reorder mesh_plink to remove forward decl

Move mesh_plink_frame_tx() above the first caller to remove
the forward declaration.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: clear local->suspended before calling drv_resume()
Eliad Peller [Wed, 8 Jul 2015 12:41:47 +0000 (15:41 +0300)]
mac80211: clear local->suspended before calling drv_resume()

Currently, mac80211 calls drv_resume() on wowlan resume,
but drops any incoming frame until local->suspended is
cleared later on.

This requires the low-level driver to support a new state,
in which it is expected to fully work (as it was resumed)
but not passing rx frames yet (as they will be dropped).

iwlwifi (and probably other drivers as well) has issues
supporting such mode.

Since in the wowlan case we already short-circuit
ieee80211_reconfig, there's nothing that prevents us from
clearing local->suspend before calling drv_resume(),
and letting the low-level driver work normally.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: TDLS: deny ch-switch req on disallowed channels
Arik Nemtsov [Wed, 8 Jul 2015 12:41:46 +0000 (15:41 +0300)]
mac80211: TDLS: deny ch-switch req on disallowed channels

If a TDLS station is not allowed to beacon on a channel, don't accept
a channel switch request to this channel.
Move channel building code up to avoid lockdep violations - reg_can_beacon
needs to take the wdev lock.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: TDLS: handle chan-switch in RTNL locked work
Arik Nemtsov [Wed, 8 Jul 2015 12:41:45 +0000 (15:41 +0300)]
mac80211: TDLS: handle chan-switch in RTNL locked work

Move TDLS channel-switch Rx handling into an RTNL locked work. This is
required to add proper regulatory checking to incoming channel-switch
requests.
Queue incoming requests in a dedicated skb queue and handle the request
in a device-specific work to avoid deadlocking on interface removal.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agoMerge branch 'mac80211' into mac80211-next
Johannes Berg [Fri, 17 Jul 2015 13:39:38 +0000 (15:39 +0200)]
Merge branch 'mac80211' into mac80211-next

This is necessary to merge the new TDLS and mesh patches,
as they depend on some fixes.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: Add support for declaring MU-MIMO capability
Sara Sharon [Wed, 8 Jul 2015 12:41:43 +0000 (15:41 +0300)]
mac80211: Add support for declaring MU-MIMO capability

Add support for declaring MU-MIMO beamformee capability for
relevant hardware.
When sending association request, the capability is included if both
hardware and the AP support it, and no other virtual interface
is using it.
This is in order to avoid multiple interfaces using MU-MIMO in parallel
which might lead to contradictions in the group-id mechanism.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: account TX MSDUs properly with segmentation offload
Johannes Berg [Tue, 23 Jun 2015 09:50:52 +0000 (11:50 +0200)]
mac80211: account TX MSDUs properly with segmentation offload

If an SKB will be segmented by the driver, count it for multiple
MSDUs that are being transmitted rather than just a single.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agowireless: remove superfluous if statement in regulatory code
John Linville [Wed, 24 Jun 2015 15:42:25 +0000 (11:42 -0400)]
wireless: remove superfluous if statement in regulatory code

Commit eeca9fce1d71 ('cfg80211: Schedule timeout for all CRDA calls')
left behind a superfluous check after it removed some earlier code.

In reg_process_hint, the test of "treatment == REG_REQ_IGNORE ||
treatment == REG_REQ_ALREADY_SET" is superfluous because the code in the
if-then branch is identical to the code after the if statement.

Coverity CID #1295939

I also removed the unnecessary assignment of treatment in this case,
and added a comment reminding any future patch authors to ensure that
treatment is properly assigned before it is used after the switch.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agocfg80211: allow mgmt_frame_register callback to sleep
Johannes Berg [Tue, 23 Jun 2015 15:47:05 +0000 (17:47 +0200)]
cfg80211: allow mgmt_frame_register callback to sleep

This callback is currently not allowed to sleep, which makes it more
difficult to implement proper driver methods in mac80211 than it has
to be. Instead of doing asynchronous work here in mac80211, make it
possible for the callback to sleep by doing some asynchronous work
in cfg80211. This also enables improvements to other drivers, like
ath6kl, that would like to sleep in this callback.

While at it, also fix the code to call the driver on the implicit
unregistration when an interface is removed, and do that also when
a P2P-Device wdev is destroyed (otherwise we leak the structs.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: shrink struct ieee80211_fragment_entry
Johannes Berg [Fri, 26 Jun 2015 07:21:01 +0000 (09:21 +0200)]
mac80211: shrink struct ieee80211_fragment_entry

Most of the fields in this struct use too wide types, change
that to shrink the struct from 64 to 48 bytes (on 64-bit.)

This results in a total saving of 64 bytes for each interface.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: mesh: move fail_avg into mesh struct
Johannes Berg [Thu, 18 Jun 2015 14:20:08 +0000 (16:20 +0200)]
mac80211: mesh: move fail_avg into mesh struct

This value is only used in mesh, so move it into the new mesh
sub-struct of the station info.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: add pointer for driver use to key
Johannes Berg [Fri, 12 Jun 2015 12:55:34 +0000 (14:55 +0200)]
mac80211: add pointer for driver use to key

Some drivers may need to store data per key, for example for PN
validation. Allow this by adding a pointer to the struct that
the driver can assign.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211_hwsim: support wider TDLS bandwidth
Johannes Berg [Wed, 17 Jun 2015 11:07:14 +0000 (13:07 +0200)]
mac80211_hwsim: support wider TDLS bandwidth

There's no reason not to support this, allow it to test
those code paths.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: minstrel_ht: handle peers in dynamic SMPS
Krishna Chaitanya [Thu, 11 Jun 2015 21:04:52 +0000 (02:34 +0530)]
mac80211: minstrel_ht: handle peers in dynamic SMPS

In case of Dynamic SMPS enable RTS/CTS for all rates.

Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
[change comment]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: mesh process the target only subfield for mesh hwmp
Chun-Yeow Yeoh [Mon, 15 Jun 2015 03:58:53 +0000 (11:58 +0800)]
mac80211: mesh process the target only subfield for mesh hwmp

This patch does the following:
- Remove unnecessary flags field used by PERR element
- Use the per target flags defined in <linux/ieee80211.h>
- Process the target only subfield based on case E2 of
  IEEE802.11-2012 13.10.9.3

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: TDLS: correctly configure SMPS state
Arik Nemtsov [Sun, 14 Jun 2015 13:53:46 +0000 (16:53 +0300)]
mac80211: TDLS: correctly configure SMPS state

The IEEE802.11-2012 specification is vague regarding SMPS operation during
TDLS. It does not define a clear way to transition between SMPS states.

To avoid interop issues, set SMPS to off when TDLS peers are connected.
Accomplish this by extending the definition of the AUTOMATIC state. If the
driver forces a state other than OFF, disconnect all TDLS peers.

While at it, avoid changing the SMPS state of the peer STA. We have no
way to control it, so try and behave correctly towards it.

Move the TDLS peer-teardown function to where the rest of the TDLS code
resides.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: enable assoc check for mesh interfaces
Bob Copeland [Sat, 13 Jun 2015 14:16:31 +0000 (10:16 -0400)]
mac80211: enable assoc check for mesh interfaces

We already set a station to be associated when peering completes, both
in user space and in the kernel.  Thus we should always have an
associated sta before sending data frames to that station.

Failure to check assoc state can cause crashes in the lower-level driver
due to transmitting unicast data frames before driver sta structures
(e.g. ampdu state in ath9k) are initialized.  This occurred when
forwarding in the presence of fixed mesh paths: frames were transmitted
to stations with whom we hadn't yet completed peering.

Cc: stable@vger.kernel.org
Reported-by: Alexis Green <agreen@cococorp.com>
Tested-by: Jesse Jones <jjones@cococorp.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: mac80211: Check SN for deactivated mpaths
Jesse Jones [Fri, 12 Jun 2015 22:38:07 +0000 (15:38 -0700)]
mac80211: mac80211: Check SN for deactivated mpaths

When processing a PREQ or PREP it's critical to use the incoming SN. If
that is improperly done routing loops and other types of badness can
happen. But the code was always processing path messages for deactivated
paths. This path fixes that so that if we have a valid SN then we use it
to verify that it is a message we can accept. For reference the relevant
section of the standard is 13.10.8.4 which doesn't address the deactivated
path case at all.

I also included a special case for when our peer reboots or restarts
networking. This is an important case because without it there can be a
very long delay before we accept path messages from that peer. It's also a
simple case and intimately associated with processing messages for
deactivated paths so I used one patch instead of two.

Signed-off-by: Alexis Green <agreen@cococorp.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: mesh: don't invalidate SN on discovery failure
Jesse Jones [Fri, 12 Jun 2015 21:13:09 +0000 (14:13 -0700)]
mac80211: mesh: don't invalidate SN on discovery failure

The 2012 spec mentions that path SNs can be invalid when created (see
section 13.10.8.4 table 13-9) but AFAICT never talks about invalidating
SNs. Which makes sense: if we have figured out the path to a target at a
certain SN then we want to remember that fact. Failing to do so can lead
to routing loops because if we don't have a valid SN then we have no way
of knowing whether an incoming path message leads to or away from the
target.

However currently when discovery fails we zero out mpath->flags which
clears MESH_PATH_SN_VALID. This patch fixes that so that only the
discovery relevant flags are cleared.

Signed-off-by: Alexis Green <agreen@cococorp.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: mesh: add missing case to PERR processing
Alexis Green [Wed, 10 Jun 2015 18:02:09 +0000 (11:02 -0700)]
mac80211: mesh: add missing case to PERR processing

When the nexthop is unable to resolve its own nexthop it will send back a
PERR with a zero target_sn. According to section 13.10.11.4.3 step b in the
2012 standard that perr should be forwarded and the associated mpath->sn
should be incremented. Neither one of those was happening which is rather
bad because the originator was not told that packets are black holing.

Signed-off-by: Alexis Green <agreen@cococorp.com>
CC: Jesse Jones <jjones@cococorp.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: upgrade BW of TDLS peers when possible
Arik Nemtsov [Wed, 10 Jun 2015 17:41:23 +0000 (20:41 +0300)]
mac80211: upgrade BW of TDLS peers when possible

Define a station chandef, to be used for wider-bw TDLS peers. When both
peers support the feature, upgrade the channel bandwidth to the maximum
allowed by both peers and regulatory. Currently widths up to 80MHz are
supported in the 5GHz band.

When a TDLS peer connects/disconnects recalculate the channel type of the
current chanctx.
Make the chanctx width calculation consider wider-bw TDLS peers and
similarly fix the max_required_bw calculation for the chanctx min_def.
Since the sta->bandwidth is calculated only later on, take
bss_conf.chandef.width as the minimal width for station interface.

Set the upgraded channel width in the VHT-operation set during TDLS setup.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: define TDLS wider BW support bits
Arik Nemtsov [Wed, 10 Jun 2015 17:42:59 +0000 (20:42 +0300)]
mac80211: define TDLS wider BW support bits

Allow a device to specify support for the TDLS wider-bandwidth feature.
Indicate this support during TDLS setup in the ext-capab IE and set an
appropriate station flag when our TDLS peer supports it.
This feature gives TDLS peers the ability to use a wider channel than
the base width of the BSS. For instance VHT capable TDLS peers connected
on a 20MHz channel can extend the channel to 80MHz, if regulatory
considerations allow it.

Do not cap the bandwidth of such stations by the current BSS channel width
in mac80211.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: clear local->in_reconfig on reconfig error
Eliad Peller [Wed, 10 Jun 2015 17:19:37 +0000 (20:19 +0300)]
mac80211: clear local->in_reconfig on reconfig error

If reconfiguration fails, local->in_reconfig is never
cleaned, resulting in rx frames being dropped next
time the device is started.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: allow passing NULL to ieee80211_vif_to_wdev()
Johannes Berg [Wed, 10 Jun 2015 17:18:55 +0000 (20:18 +0300)]
mac80211: allow passing NULL to ieee80211_vif_to_wdev()

Simply return NULL in this case, instead of crashing. This can
simplify callers that would otherwise have to check for this
explicitly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agomac80211: avoid unnecessary beacon deref on CSA counter update
Wojciech Dubowik [Wed, 10 Jun 2015 11:06:53 +0000 (13:06 +0200)]
mac80211: avoid unnecessary beacon deref on CSA counter update

The beacon struct is already available in many contexts that
are also already in an RCU read-locked section. Avoid that by
using the existing beacon struct pointer directly.

Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
[rewrite subject/add commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>