cascardo/linux.git
8 years agoiwlwifi: mvm: remove IWL_UCODE_TLV_API_SINGLE_SCAN_EBS TLV flag
Emmanuel Grumbach [Wed, 26 Aug 2015 10:55:11 +0000 (13:55 +0300)]
iwlwifi: mvm: remove IWL_UCODE_TLV_API_SINGLE_SCAN_EBS TLV flag

All the supported firmwares have this flag set.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: remove IWL_UCODE_TLV_API_TX_POWER_DEV TLV flag
Emmanuel Grumbach [Wed, 26 Aug 2015 10:52:54 +0000 (13:52 +0300)]
iwlwifi: mvm: remove IWL_UCODE_TLV_API_TX_POWER_DEV TLV flag

All the supported firmwares use the new API.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: remove IWL_UCODE_TLV_API_HDC_PHASE_0 TLV flag
Emmanuel Grumbach [Wed, 26 Aug 2015 10:50:59 +0000 (13:50 +0300)]
iwlwifi: mvm: remove IWL_UCODE_TLV_API_HDC_PHASE_0 TLV flag

All the supported firwmares support the new API.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: remove SCD_QUEUE_CONFIG TLV flag
Liad Kaufman [Mon, 24 Aug 2015 13:23:58 +0000 (16:23 +0300)]
iwlwifi: mvm: remove SCD_QUEUE_CONFIG TLV flag

We don't support firmwares that don't use the new API.
This also allows to use all the SCD queues, so increase
the reported number of queues to 31.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: don't load -12.ucode anymore
Emmanuel Grumbach [Wed, 26 Aug 2015 10:48:55 +0000 (13:48 +0300)]
iwlwifi: mvm: don't load -12.ucode anymore

-13.ucode has been published long ago. Deprecate old
versions of the firmware.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: don't NUL-terminate low-latency debugfs file
Johannes Berg [Wed, 26 Aug 2015 10:22:12 +0000 (12:22 +0200)]
iwlwifi: mvm: don't NUL-terminate low-latency debugfs file

There's obviously no reason to write a NUL-terminating byte into
the debugfs file. Apparently nobody tried to use this from a tool
that doesn't strip NUL bytes though, so we never noticed. Fix it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: make sure d0i3 exit work runs before suspending
Luciano Coelho [Mon, 24 Aug 2015 11:53:25 +0000 (14:53 +0300)]
iwlwifi: mvm: make sure d0i3 exit work runs before suspending

If we are in d0i3 when entering suspend, we leave d0i3 so that
mac80211 can call us to remove connections or whatever before going to
suspend.  We do this by calling pm_runtime_resume() early in the slave
transport flow and reactivating it later, when the wiphy suspend flow
runs.

The problem is that we queue a work in order to leave d0i3.  If this
work hasn't run yet when the wiphy suspend flow is called, we have a
race and entering d0i3 fails (because we're still holding the
IWL_MVM_REF_EXIT_WORK reference).

To solve this, simply flush the d0i3_exit_work at the beginning of the
iwl_mvm_suspend() function.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: don't ask for beacons when AP vif and no assoc sta
Gregory Greenman [Mon, 24 Aug 2015 11:38:35 +0000 (14:38 +0300)]
iwlwifi: mvm: don't ask for beacons when AP vif and no assoc sta

When in AP mode, we need beacons from other APs for HT protection.
However, when there's no any associated station we will not do
any Tx and thus don't really need beacons. On the other hand, these
beacons will cause a lot of unnecessary wakeups which increase our
power consumption. Handle this by asking FW to pass beacons only when
there's at least one associated station.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: Deinline iwl_{read,write}(8,32}
Emmanuel Grumbach [Sun, 23 Aug 2015 10:29:36 +0000 (13:29 +0300)]
iwlwifi: Deinline iwl_{read,write}(8,32}

With CONFIG_IWLWIFI_DEVICE_TRACING=y, these functions are rather large,
too big for inlining.

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

iwl_read32  475 bytes, 51 callsites
iwl_write32 477 bytes, 90 callsites
iwl_write8  493 bytes, 3 callsites

Reduction in size is about 74,000 bytes:

    text     data      bss       dec     hex filename
90758147 17226024 36659200 144643371 89f152b vmlinux0
90687995 17221928 36659200 144569123 89df323 vmlinux.after

Reported-by: Denys Vlasenko <dvlasenk@redhat.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: add debugfs hook to send ECHO_CMD to the firmware
Emmanuel Grumbach [Mon, 17 Aug 2015 07:45:50 +0000 (10:45 +0300)]
iwlwifi: mvm: add debugfs hook to send ECHO_CMD to the firmware

ECHO_CMD is a simple command that can be sent to the
firmware just to check that it is alive.
This command is useful for debug purpose, provide a debugfs
hook to send it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: fix statistics variables type
Sara Sharon [Thu, 20 Aug 2015 11:12:58 +0000 (14:12 +0300)]
iwlwifi: mvm: fix statistics variables type

When receiving statistics notification there is a field of average energy.
This is defines as signed 8 bit, while FW refers to it as unsigned.
when the energy is higher than 127 this causes in iwl_mvm_stat_iterator
a wrong computation of the signal
     int sig = -stats->general.beacon_filter_average_energy;
resulting in incorrect CQM event (change from low to high).

While at it - update the rest of the fields to the correct type.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: remove netdetect debugfs entry
Luciano Coelho [Tue, 18 Aug 2015 09:07:48 +0000 (12:07 +0300)]
iwlwifi: mvm: remove netdetect debugfs entry

This debugfs entry was implemented just as a proof-of-concept before
the full support for netdetect via cfg80211/mac80211 was implemented.
Now that we have a proper way to enable netdetect from userspace, this
entry is redundant and should be removed to avoid unnecessary
maintenance work.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
8 years agoiwlwifi: mvm: bump firmware API to 17
Emmanuel Grumbach [Sun, 23 Aug 2015 09:54:16 +0000 (12:54 +0300)]
iwlwifi: mvm: bump firmware API to 17

The driver is now able to handle -17.ucode.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: support new TX power command
Johannes Berg [Tue, 18 Aug 2015 13:15:36 +0000 (15:15 +0200)]
iwlwifi: mvm: support new TX power command

Add support for the new (bigger) TX power command. This doesn't
actually take advantage of the new capabilities (to set per-chain
TX power limits) but makes the code compatible with newer firmware
images expecting the larger command.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: split debug message to avoid exceeding 110 characters
Ayala Beker [Thu, 20 Aug 2015 01:00:38 +0000 (04:00 +0300)]
iwlwifi: mvm: split debug message to avoid exceeding 110 characters

split long debug messages that may result warning in tracing.

Fixes: 1a84e7716086 ("iwlwifi: mvm: add debug info 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: correctly size command string arrays
Johannes Berg [Wed, 19 Aug 2015 14:51:33 +0000 (16:51 +0200)]
iwlwifi: correctly size command string arrays

The command string array is assumed to be indexable by a full u8, so it
must have 256 entries (0-255), not just 255. A recent firmware change
(apparently) started using the command 0xff for a notification to the
host, causing the driver to crash in debug message/tracing code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: update wakeup reason enum
Sara Sharon [Wed, 19 Aug 2015 13:29:31 +0000 (16:29 +0300)]
iwlwifi: mvm: update wakeup reason enum

when waking from d0i3 there is a wakeup reason.
Enum in driver is not up to date with FW api - fix it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: catch underflow error earlier
Dan Carpenter [Fri, 21 Aug 2015 08:48:21 +0000 (11:48 +0300)]
iwlwifi: mvm: catch underflow error earlier

My static checker complains that we don't check for underflows in
iwl_dbgfs_fw_dbg_conf_write().  This is harmless because we have a
sanity check in iwl_mvm_start_fw_dbg_conf(), but we may as well make
this unsigned and silence the underflow warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: fix a race in D0i3 vs. Tx path
Emmanuel Grumbach [Mon, 17 Aug 2015 12:54:41 +0000 (15:54 +0300)]
iwlwifi: mvm: fix a race in D0i3 vs. Tx path

When we enter D0i3, we must stop TXing otherwise the
sequence number we use might conflict with the firmware's
internal TX. In order to do so, we have
IWL_MVM_STATUS_IN_D0I3 which should prevent any Tx while we
enter D0i3. There is a bug in this code since we may Tx even
if IWL_MVM_STATUS_IN_D0I3 is set. This can happen as long as
mvm->d0i3_ap_sta_id is not set.

To make sure that we don't have any packet in the Tx path
while we set mvm->d0i3_ap_sta_id, call synchronize_net only
after we already set mvm->d0i3_ap_sta_id.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: don't disconnect on beacon loss in D0I3
David Spinadel [Thu, 6 Aug 2015 07:26:50 +0000 (10:26 +0300)]
iwlwifi: mvm: don't disconnect on beacon loss in D0I3

Currently if we wake up during D0I3 due to beacon loss we disconnect
immediately. This behaviour causes redundant disconnection, which could
be prevented by polling as it is usually done in mac80211.
Instead, we prefer reporting beacon loss and let mac80211 try polling
before disconnection.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: out-of-bounds access in iwl_init_sband_channels
Adrien Schildknecht [Fri, 14 Aug 2015 00:35:32 +0000 (02:35 +0200)]
iwlwifi: out-of-bounds access in iwl_init_sband_channels

KASan error report:
==================================================================
BUG: KASan: out of bounds access in iwl_init_sband_channels+0x207/0x260 [iwlwifi] at addr ffff8800c2d0aac8
Read of size 4 by task modprobe/329
==================================================================

Both loops of this function compare data from the 'chan' array and then
check if the index is valid.

The 2 conditions should be inverted to avoid an out-of-bounds access.

Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: bump mvm firmware API to 16
Emmanuel Grumbach [Sun, 16 Aug 2015 07:39:49 +0000 (10:39 +0300)]
iwlwifi: bump mvm firmware API to 16

The driver is now able to handle -16.ucode.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: rs: disable MIMO only if allowed in configuration
Alexander Bondar [Tue, 28 Jul 2015 13:50:51 +0000 (16:50 +0300)]
iwlwifi: rs: disable MIMO only if allowed in configuration

Fix bug where MIMO is disabled for low latency TX on P2P VIF
regardless of configuration. Make it dependent on
IWL_MVM_RS_DISABLE_P2P_MIMO compilation option. Change configuration
so that MIMO will be disabled only in SDIO platforms.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: Enable power management on low-latency bss
Avri Altman [Wed, 5 Aug 2015 20:07:42 +0000 (23:07 +0300)]
iwlwifi: mvm: Enable power management on low-latency bss

Currently the driver disable power management on all low-latency
interfaces, while it should disable it on WiDi interfaces only.
Non-P2P interfaces that runs voice and video traffic should enable
power management.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: support TDLS wider-bandwidth
Arik Nemtsov [Thu, 30 Apr 2015 15:31:45 +0000 (18:31 +0300)]
iwlwifi: mvm: support TDLS wider-bandwidth

When TDLS support is declared by the FW, set the bit indicating wider-BW
support as well.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: fix a range check in debugfs code
Dan Carpenter [Mon, 10 Aug 2015 21:45:03 +0000 (00:45 +0300)]
iwlwifi: mvm: fix a range check in debugfs code

The &mvm->tof_data.range_req.ap[] array has IWL_MVM_TOF_MAX_APS elements
so the check should be >= instead of >.  Also the test can underflow so
I have changed "i" to unsigned.

Fixes: ce7929186a39 ('wlwifi: mvm: add basic Time of Flight (802.11mc FTM) support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: convert hex_dump_to_buffer() to %*ph
Andy Shevchenko [Thu, 16 Jul 2015 12:42:14 +0000 (15:42 +0300)]
iwlwifi: convert hex_dump_to_buffer() to %*ph

There is no need to use hex_dump_to_buffer() in the cases like this:

hexdump_to_buffer(buf, len, 16, 1, outbuf, outlen, false); /* len <= 16 */
sprintf("%s\n", outbuf);

since it maybe easily converted to simple:

sprintf("%*ph\n", len, buf);

Note: it seems in one case the output is groupped by 2 bytes and looks like a
typo. Thus, patch changes that to plain byte stream.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pass NAPI struct from transport layer
Johannes Berg [Thu, 11 Jun 2015 14:51:24 +0000 (16:51 +0200)]
iwlwifi: pass NAPI struct from transport layer

The mac80211 patch to pass the NAPI struct only changed iwlwifi to
store the NAPI struct, but we can do better: pass it directly from
the lower transport layer to the opmode during RX, and then on to
mac80211 from there.

When we add multiple RX queues, we can then pass the appropriate
NAPI struct properly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
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>