cascardo/linux.git
7 years agoiwlwifi: decouple PCIe transport from mac80211
Johannes Berg [Tue, 21 Jun 2016 11:11:48 +0000 (13:11 +0200)]
iwlwifi: decouple PCIe transport from mac80211

The PCIe transport needs to store two pointers in each TX SKB, and
currently assumes mac80211's ieee80211_tx_info is present in the CB
to do that.

In order to remove that assumption, have the opmodes pass in the
offset to where the pointers can be stored in the CB and use the
offset in the PCIe code.

To make the disentanglement complete, remove mac80211.h includes
from everywhere in the generic iwlwifi code. This required adding
an include of cfg80211.h in one place.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: tracing: decouple from mac80211
Johannes Berg [Tue, 21 Jun 2016 10:44:21 +0000 (12:44 +0200)]
iwlwifi: tracing: decouple from mac80211

In order to be able to properly record SKBs that didn't come through
mac80211, don't rely on the IEEE80211_TX_CTRL_PORT_CTRL_PROTO flag
but instead check for ETH_P_PAE directly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: store cipher scheme independent of mac80211
Johannes Berg [Tue, 21 Jun 2016 10:34:36 +0000 (12:34 +0200)]
iwlwifi: store cipher scheme independent of mac80211

In order to reduce reliance on mac80211 structs in the core
iwlwifi code, store the cipher schemes in the format given
by the firmware and convert it later, rather than storing it
in the mac80211 format.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: free RX reorder buffer on restart
Sara Sharon [Tue, 21 Jun 2016 11:14:08 +0000 (14:14 +0300)]
iwlwifi: mvm: free RX reorder buffer on restart

Restart flow zeroes the rx_ba_sessions counter. Mac80211 asks
driver to tear down of the session only afterwards, and as a
result driver didn't free the data. Fix it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Fixes: 10b2b2019d81 ("iwlwifi: mvm: add infrastructure for tracking BA session in driver")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add RX aggregation prints
Sara Sharon [Tue, 21 Jun 2016 09:12:10 +0000 (12:12 +0300)]
iwlwifi: mvm: add RX aggregation prints

Add some prints to track BAID assignment.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support dqa-mode scd queue redirection
Liad Kaufman [Wed, 30 Sep 2015 14:44:28 +0000 (16:44 +0200)]
iwlwifi: mvm: support dqa-mode scd queue redirection

Make sure that in DQA mode, the SCD's configuration of a
queue is redirected to the lower AC of the streams of the
queue.

Make sure that this queue is redirected to the lowest AC
when adding a new RA/TID to an existing queue. If it isn't -
redirect the queue.

Also, as redirection revealed a bug in the marking of a
shared queue, this patch contains a small fix to make
sure a shared queue maintains the appropriate "shared queue
marking".

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support tdls in dqa mode
Liad Kaufman [Sun, 5 Jun 2016 07:49:02 +0000 (10:49 +0300)]
iwlwifi: mvm: support tdls in dqa mode

Support TDLS when working in DQA mode.

This is done mainly by NOT doing any special things
for TDLS, as the queues are dynamically created anyway,
so no need to allocate them ahead of time.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: don't use vid 0
Sara Sharon [Tue, 21 Jun 2016 08:13:47 +0000 (11:13 +0300)]
iwlwifi: pcie: don't use vid 0

In cases of hardware or DMA error, the vid read from
a zeroed location will be 0, and we will access the rxb
at index 0 in the global table, while it may be NULL or
owned by hardware.
Invalidate vid 0 in order to detect the situation and
bail out.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: unmap the paging memory before freeing it
Emmanuel Grumbach [Sun, 19 Jun 2016 17:57:02 +0000 (20:57 +0300)]
iwlwifi: mvm: unmap the paging memory before freeing it

This led to a DMA splat.

Fixes: a6c4fb4441f4 ("iwlwifi: mvm: Add FW paging mechanism for the UMAC on PCI")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: remove iwl_ht_params.smps_mode
Johannes Berg [Tue, 21 Jun 2016 10:23:35 +0000 (12:23 +0200)]
iwlwifi: remove iwl_ht_params.smps_mode

This struct member is never set, so remove it.

Since this is the last thing that needs mac80211.h, also change
the includes to no longer use mac80211.h

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix the channel inhibition table for Channel 14
Emmanuel Grumbach [Wed, 22 Jun 2016 07:51:31 +0000 (10:51 +0300)]
iwlwifi: mvm: fix the channel inhibition table for Channel 14

The value for Channel 14 was wrong. Fix it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix coex related comments
Emmanuel Grumbach [Mon, 20 Jun 2016 06:40:40 +0000 (09:40 +0300)]
iwlwifi: mvm: fix coex related comments

Those comments were wrong, fix them.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: write the correct internal TXF index
Golan Ben-Ami [Wed, 15 Jun 2016 06:16:24 +0000 (09:16 +0300)]
iwlwifi: mvm: write the correct internal TXF index

The TX fifos are arranged consecutively in the SMEM, beginning
with the regular fifos, and tailed by the internal fifos.
In the current code, while trying to read the internal fifos,
we read the fifos beginning with the index zero.
By doing this we actually re-read the regular fifos.

In order to read the internal fifos, start the reading index
from the number of regular fifos configured by the fw.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Fixes: 39654cb3a6a2 ("iwlwifi: don't access a nonexistent register upon assert")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: fix access to scratch buffer
Sara Sharon [Thu, 9 Jun 2016 14:19:35 +0000 (17:19 +0300)]
iwlwifi: pcie: fix access to scratch buffer

This fixes a pretty ancient bug that hasn't manifested itself
until now.
The scratchbuf for command queue is allocated only for 32 slots
but is accessed with the queue write pointer - which can be
up to 256.
Since the scratch buf size was 16 and there are up to 256 TFDs
we never passed a page boundary when accessing the scratch buffer,
but when attempting to increase the size of the scratch buffer a
panic was quick to follow when trying to access the address resulted
in a page boundary.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Fixes: 38c0f334b359 ("iwlwifi: use coherent DMA memory for command header")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: Enable MSI mode when using MSI interrupts
Ido Yariv [Tue, 14 Jun 2016 14:27:57 +0000 (10:27 -0400)]
iwlwifi: pcie: Enable MSI mode when using MSI interrupts

On some of the chipsets MSI & INTA interrupts are disabled by default in
the HW registers, and need to be explicitly enabled to be used.

In case MSI-X isn't used, make sure MSI mode is enabled by setting
the relevant HW register.

Signed-off-by: Ido Yariv <idox.yariv@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: read SAR BIOS table from ACPI
Luca Coelho [Mon, 30 May 2016 10:00:44 +0000 (13:00 +0300)]
iwlwifi: mvm: read SAR BIOS table from ACPI

Read the SAR BIOS table from the ACPI and parse it into the
iwl_mvm_sar_table structure.  If the table is enabled, send it to the
firmware via REDUCE_TX_POWER_CMD.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: cleanup the coex code
Emmanuel Grumbach [Mon, 13 Jun 2016 07:02:04 +0000 (10:02 +0300)]
iwlwifi: mvm: cleanup the coex code

We removed support for old API for coexistence, but we
forgot to remove defines and variable that are not needed
anymore.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: checksum IPv6 fragmented packet
Sara Sharon [Wed, 8 Jun 2016 12:15:41 +0000 (15:15 +0300)]
iwlwifi: mvm: checksum IPv6 fragmented packet

Our HW does not support checksum of fragmented packets.
Fix code accordingly to checksum those packets in the driver.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Fixes: 5e6a98dc4863 ("iwlwifi: mvm: enable TCP/UDP checksum support for 9000 family")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlmvm: mvm: set correct state in smart-fifo configuration
striebit [Tue, 7 Jun 2016 12:05:26 +0000 (15:05 +0300)]
iwlmvm: mvm: set correct state in smart-fifo configuration

Currently the state sent in SF configuration is always
FULL_ON.
This commit sets the correct state (e.g. INIT_OFF
when station is not associated).

Fixes: commit f4a3ee493e69 ("iwlwifi: mvm: Always enable the smart FIFO")
Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: enable interrupts before releasing the NIC's CPU
Emmanuel Grumbach [Wed, 8 Jun 2016 20:07:31 +0000 (23:07 +0300)]
iwlwifi: pcie: enable interrupts before releasing the NIC's CPU

The NIC's CPU gets started after the firmware has been
written to its memory. The first thing it does is to
send an interrupt to let the driver know that it is
running. In order to get that interrupt, the driver needs
to make sure it is not masked. Of course, the interrupt
needs to be enabled in the driver before the CPU starts to
run.
I mistakenly inversed those two steps leading to races
which prevented the driver from getting the alive interrupt
from the firmware.
Fix that.

Cc: <stable@vger.kernel.org> [4.5+]
Fixes: a6bd005fe92 ("iwlwifi: pcie: fix RF-Kill vs. firmware load race")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: Add a000 HW family support
Haim Dreyfuss [Tue, 31 May 2016 08:13:09 +0000 (11:13 +0300)]
iwlwifi: Add a000 HW family support

Add a000 family configuration to iwl-cfg struct

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support new statistics notification
Sara Sharon [Sun, 10 Apr 2016 12:06:55 +0000 (15:06 +0300)]
iwlwifi: mvm: support new statistics notification

For 9000 family we will get extended statistics notification
with averaged data for RSSI, TCM and rogue AP detection.
Support it. Future patches will added the required algorithms.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add support for GCMP encryption
Ayala Beker [Thu, 7 Apr 2016 13:21:57 +0000 (16:21 +0300)]
iwlwifi: mvm: add support for GCMP encryption

Newer hardware supports GCMP and GCMP 256-bit ciphers.
Add support for adding/setting GCMP key for TX mode.

In the TX command handling GCMP-256 is handled in a different
way as the key size should be up to 128-bits:
Set the key value to the key index in the key table,
and specify that this key should be taken form the key table
instead of from the TX command.

While at it - convert security control flags to an enum.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: Reserve iwl_fw_error_dump_type enum
Golan Ben-Ami [Thu, 19 May 2016 04:46:20 +0000 (07:46 +0300)]
iwlwifi: Reserve iwl_fw_error_dump_type enum

Reserve a single iwl_fw_error_dump_type enum for external
code utilities.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: add dump of RFH
Sara Sharon [Sun, 22 May 2016 13:25:40 +0000 (16:25 +0300)]
iwlwifi: add dump of RFH

Add support of dumping new RFH instead of FH registers.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: dvm: Remove unused array 'iwlagn_loose_lookup'
Guenter Roeck [Fri, 3 Jun 2016 21:39:19 +0000 (14:39 -0700)]
iwlwifi: dvm: Remove unused array 'iwlagn_loose_lookup'

gcc-6 reports the following error if -Werror=unused-const-variable
is enabled.

drivers/net/wireless/intel/iwlwifi/dvm/lib.c:210:21: error:
'iwlagn_loose_lookup' defined but not used

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix txq aggregation bug
Oren Givon [Sun, 29 May 2016 11:05:50 +0000 (14:05 +0300)]
iwlwifi: mvm: fix txq aggregation bug

Fix an issue where nullfunc frames and block ack requests
had the same tid as aggregation frames and were queued on
a non aggregation queue. The pending frames counter included
those frames but the check whether to decrement the pending
frames counter relied on the tid status and not on the txq id.
The result was an inconsistent state of the pending frames
counter followed by a failure to remove the station.
This failure triggered SYSASSERT 0x3421.

In addition, fix a situation in DQA mode where the number
of pending frames turned negative. This was due to the TX queue
being on the IWL_EMPTYING_HW_QUEUE_DELBA state and its frames
were still decremented.

Even though the SYSASSERT issue is fixed when DQA is disabled,
the issue is not completely solved when DQA is enabled and
should still be fixed.

Signed-off-by: Oren Givon <oren.givon@intel.com>
Fixes: cf961e16620f ("iwlwifi: mvm: support dqa-mode agg on non-shared queue")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: avoid harmless -Wmaybe-uninialized warning
Arnd Bergmann [Fri, 27 May 2016 13:07:03 +0000 (15:07 +0200)]
iwlwifi: mvm: avoid harmless -Wmaybe-uninialized warning

gcc is apparently unablel to track the state of the local 'resp_v2'
variable across the kzalloc() function, and warns about the response
variable being used without an initialization:

drivers/net/wireless/intel/iwlwifi/mvm/nvm.c: In function ‘iwl_mvm_update_mcc’:
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c:727:36: warning: ‘mcc_resp_v1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   resp_cp->n_channels = mcc_resp_v1->n_channels;
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c:721:3: warning: ‘mcc_resp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   memcpy(resp_cp, mcc_resp, resp_len);

The warning showed up in x86 allmodconfig after my patch to
unhide -Wmaybe-uninitialized warnings by default was merged,
though it always existed in randconfig builds. I did not
catch the warning earlier because I was testing on ARM, which
never produced the warning.

This rearranges the code in a way that improves readability for
both humans and the compiler, and that avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 6fa52430f0b3 ("iwlwifi: mvm: change mcc update API")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: rs: add rate scaling support for 160MHz channels
Gregory Greenman [Wed, 25 May 2016 15:31:39 +0000 (18:31 +0300)]
iwlwifi: mvm: rs: add rate scaling support for 160MHz channels

Expand TLC to support 160MHz channels. Full support for A-MSDU
case will be added separately.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix RX mpdu status enum
Ayala Beker [Wed, 1 Jun 2016 08:46:20 +0000 (11:46 +0300)]
iwlwifi: mvm: fix RX mpdu status enum

FW sets status for each RX packet.
Enum in the driver doesn't match with FW definition - fix it.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: Do not open aggregations for null data packets
Matti Gottlieb [Tue, 17 May 2016 07:50:08 +0000 (10:50 +0300)]
iwlwifi: mvm: Do not open aggregations for null data packets

Currently we try to open an aggregation for every packet (given that one
is not already open).

This causes redundant overhead (addba/delba) for null data packets.

Do not open an aggregation for null data packets.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: poll RFH for RX DMA stop
Sara Sharon [Thu, 19 May 2016 14:53:42 +0000 (17:53 +0300)]
iwlwifi: pcie: poll RFH for RX DMA stop

Somehow we ended up stopping RX using legacy RX registers
even for devices that support RFH. Fix it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove unnecessary device conversion when reading the MCC
Luca Coelho [Mon, 30 May 2016 09:52:43 +0000 (12:52 +0300)]
iwlwifi: mvm: remove unnecessary device conversion when reading the MCC

We convert the mvm device to a PCI device and then back again when
trying to find the handle for the device's ACPI data.  This is
unnecessary, so it can be removed.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: add new 8265
Oren Givon [Mon, 23 May 2016 06:58:17 +0000 (09:58 +0300)]
iwlwifi: add new 8265

Add 6 new 8265 series PCI IDs:
  - (0x24FD, 0x1130)
  - (0x24FD, 0x0130)
  - (0x24FD, 0x0910)
  - (0x24FD, 0x0930)
  - (0x24FD, 0x0950)
  - (0x24FD, 0x0850)

CC: <stable@vger.kernel.org> [4.6+]
Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: add new 8260 PCI IDs
Oren Givon [Mon, 23 May 2016 06:58:17 +0000 (09:58 +0300)]
iwlwifi: add new 8260 PCI IDs

Add 3 new 8260 series PCI IDs:
  - (0x24F3, 0x10B0)
  - (0x24F3, 0xD0B0)
  - (0x24F3, 0xB0B0)

CC: <stable@vger.kernel.org> [4.1+]
Signed-off-by: Oren Givon <oren.givon@intel.com>
Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support dqa-enable hcmd
Liad Kaufman [Mon, 31 Aug 2015 11:33:23 +0000 (14:33 +0300)]
iwlwifi: mvm: support dqa-enable hcmd

Support sending the DQA-enablement HCMD to the FW when
working in DQA mode.

This HCMD will enable DQA-specific flows in the FW.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: update aux queue in dqa mode
Liad Kaufman [Tue, 1 Sep 2015 13:36:25 +0000 (16:36 +0300)]
iwlwifi: mvm: update aux queue in dqa mode

In DQA mode the AUX queue is mapped elsewhere than in non-
DQA mode. Update the code to reflect this.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: set sta_id in SCD_QUEUE_CONFIG cmd
Liad Kaufman [Mon, 31 Aug 2015 10:41:26 +0000 (13:41 +0300)]
iwlwifi: mvm: set sta_id in SCD_QUEUE_CONFIG cmd

Set the correct sta_id in the SCD_QUEUE_CONFIG command sent
to the FW when enabling/disabling queues. This is needed in
DQA-mode to allow the FW to associate between queue and STA.

In case the queue isn't connected to a specific station but
rather is a static "generic" queue - the sta_id should be
set to 0x10 (max supported STA is 0x0f).

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support dqa queue sharing
Liad Kaufman [Mon, 2 May 2016 11:01:14 +0000 (14:01 +0300)]
iwlwifi: mvm: support dqa queue sharing

Support DQA queue sharing when no free queue exists for
allocation to a STA that already exists. This means that
a single queue will serve more than a single TID (although
the RA will be the same for all TIDs served).

We try to choose the lowest AC possible, to ensure the
shared queues have the lowest possible combined AC
requirements. The queue to share is chosen only from the
same RA's DATA queues as follows (in descending priority):
 1. An AC_BE queue
 2. Same AC queue
 3. Highest AC queue that is lower than new AC
 4. Any existing AC (there always is at least 1 DATA queue)

If any aggregations existed for any of the TIDs of the
shared queue - they are stopped (the FW is notified), but
no delBA is sent.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: silence uninitialized variable warning
Dan Carpenter [Wed, 4 May 2016 06:19:54 +0000 (09:19 +0300)]
iwlwifi: mvm: silence uninitialized variable warning

"max_amsdu_len" isn't set if kstrtouint() fails.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove an unused variable
Dan Carpenter [Wed, 4 May 2016 06:19:13 +0000 (09:19 +0300)]
iwlwifi: mvm: remove an unused variable

We never initialize ampdu_status so it causes a static checker warning
when we pass it to iwl_mvm_pass_packet_to_mac80211().  Fortunately, it's
never used so we can just remove it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: change scan timeout to a delayed work
Luca Coelho [Tue, 3 May 2016 09:18:33 +0000 (12:18 +0300)]
iwlwifi: mvm: change scan timeout to a delayed work

Some transports may sleep when writing to registers, which is done
when calling iwl_force_nmi().  So we can't call iwl_force_nmi() in a
timer context.  To solve that, convert the scan timeout timer to a
delayed work.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix possible division by zero
Sara Sharon [Wed, 4 May 2016 11:22:10 +0000 (14:22 +0300)]
iwlwifi: mvm: fix possible division by zero

Theoretically we may get only one IRQ from OS, in which
case we will have only 1 queue even in MSIx mode.
This will cause division by zero in the indirection table
calculation.
We do not need send the command in that case, as there is
only one queue so all RX traffic will be directed to it
anyway. Bail out early if there is only one queue.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: unify restock calls on init
Sara Sharon [Sun, 1 May 2016 08:40:49 +0000 (11:40 +0300)]
iwlwifi: pcie: unify restock calls on init

Currently code calls restock for mq devices during the init
function, unlike sq where restock is called after init.
This causes an harmless but alarming deadlock warning from
lockdep, to fix this - unify the init code.
Rename the restock functions while at it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support dqa queue inactivation upon timeout
Liad Kaufman [Wed, 19 Aug 2015 14:34:28 +0000 (17:34 +0300)]
iwlwifi: mvm: support dqa queue inactivation upon timeout

Support marking queues as inactive upon a timeout expiring,
and allow inactive queues to be re-assigned to other RA/TIDs
if no other queue is free.

This is done by keeping a timestamp of the latest frame TXed
for every RA/TID, and then going over the queues currently in
use when a new queue is needed, inactivating all those that
are inactive.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: change fw.mvm_fw to fw.type
Johannes Berg [Thu, 28 Apr 2016 12:40:59 +0000 (14:40 +0200)]
iwlwifi: change fw.mvm_fw to fw.type

Instead of explicitly indicating the difference between just
DVM and MVM with an mvm_fw boolean change this to fw.type to
be more extensible and easier to understand.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: remove useless enum values
Johannes Berg [Thu, 28 Apr 2016 12:39:22 +0000 (14:39 +0200)]
iwlwifi: remove useless enum values

Since the values of this enum are used only internally,
we can let the compiler number them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: handle FRAME_RELEASE in MQ code
Johannes Berg [Wed, 27 Apr 2016 11:33:26 +0000 (13:33 +0200)]
iwlwifi: mvm: handle FRAME_RELEASE in MQ code

For some reason, the FRAME_RELEASE message handling for the
default queue ended up being in the only/default queue for
non-RSS devices; fix that and handle FRAME_RELEASE properly
on the default queue for RSS devices.

Fixes: 585a6fccf5b8 ("iwlwifi: mvm: infrastructure for frame-release message")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: Support CSA countdown offloading
Andrei Otcheretianski [Sun, 28 Feb 2016 15:12:21 +0000 (17:12 +0200)]
iwlwifi: mvm: Support CSA countdown offloading

Add support CSA countdown offloading. When CSA starts, the driver
specifies the offsets to the eCSA and CSA IEs in the beacon template
command and the fw performs the countdown.
The fw notifies the driver when the channel switch flow
should be performed.
Beacon sent notifications are not used anymore.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: make sure packet arrived to destined queue
Sara Sharon [Thu, 21 Apr 2016 17:15:40 +0000 (20:15 +0300)]
iwlwifi: pcie: make sure packet arrived to destined queue

Add a warning in case packet didn't end up in the HW
destined queue.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: allow more than one frame in RB for 9000 devices
Sara Sharon [Thu, 21 Apr 2016 14:41:39 +0000 (17:41 +0300)]
iwlwifi: pcie: allow more than one frame in RB for 9000 devices

We now have 9000 devices that support multiple frames in
a single RB. Enable it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: set RB chunk size per bus
Sara Sharon [Thu, 21 Apr 2016 13:38:43 +0000 (16:38 +0300)]
iwlwifi: pcie: set RB chunk size per bus

For 9000 devices we can have PCIe bus for discrete
devices and IOSF bus for integrated devices.
PCIe supports maximum transfer size of 128B while IOSF
bus supports maximum transfer size of 64B.
Configure RB size accordingly.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: workaround HW shadow registers bug
Sara Sharon [Sun, 17 Apr 2016 13:28:18 +0000 (16:28 +0300)]
iwlwifi: pcie: workaround HW shadow registers bug

Integrated 9000 devices have a bug with shadow registers
value retention.
If driver writes RBD registers while MAC is asleep the
values are stored in shadow registers to be copied whenever
MAC wakes up.
However, in 9000 devices a MAC wakeup is not triggered
and when the bus powers down due to inactivity the shadow
values and dirty bits are lost.
Turn on the chicken-bits that cause MAC wakeup for RX-related
values as well when the device is in D0.
When the device is in low power mode turn the RX wakeup chicken
bits off since driver is idle and this W/A is not needed.
Remove previous W/A which was ineffective.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: free dqa queues on STA removal also in non-bss
Liad Kaufman [Mon, 24 Aug 2015 12:23:14 +0000 (15:23 +0300)]
iwlwifi: mvm: free dqa queues on STA removal also in non-bss

Support queue removal in DQA mode in iwl_mvm_rm_sta() also when
the device isn't a STA connected to an AP.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: update mpdu metadata API
Sara Sharon [Mon, 4 Apr 2016 16:28:45 +0000 (19:28 +0300)]
iwlwifi: mvm: update mpdu metadata API

rx_phy notification is no longer sent in devices with
multiple rx queues.
All the needed data is now set in the metadata - update
code accordingly to reflect all the features as in the
previous RX path.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove RX_PHY support for 9000 device
Sara Sharon [Sun, 3 Apr 2016 12:27:55 +0000 (15:27 +0300)]
iwlwifi: mvm: remove RX_PHY support for 9000 device

In multiple RX queues architecture, the RX_PHY notification
is no longer useful as it is received in the default queue
even for packets that are received on RSS queue, and cannot
be accessed without locking.
All the needed data is in the new RX packet metadata and
firmware will no longer send this notification for 9000
devices. Remove support of it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: rename CAPA_P2P_STANDALONE_UAPSD to CAPA_P2P_SCM_UAPSD
Avraham Stern [Wed, 20 Apr 2016 06:29:18 +0000 (09:29 +0300)]
iwlwifi: rename CAPA_P2P_STANDALONE_UAPSD to CAPA_P2P_SCM_UAPSD

Ucode capability bit 26 indicates support for UAPSD on P2P interface
even with a simultaneous BSS station interface, as long as both
interfaces are in the same binding. Change the name of the
capability bit to reflect that.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: fix comment indentation
Johannes Berg [Wed, 13 Apr 2016 12:31:40 +0000 (14:31 +0200)]
iwlwifi: mvm: fix comment indentation

Somehow we ended up without leading spaces here, fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: do not trust NSSN for amsdu sub-frames
Sara Sharon [Sun, 17 Apr 2016 11:15:17 +0000 (14:15 +0300)]
iwlwifi: mvm: do not trust NSSN for amsdu sub-frames

We cannot trust NSSN for AMSDU sub-frames that are not the
last.
The reason is that NSSN advances on the first sub-frame,
and may cause the reorder buffer to advance before all the
sub-frames arrive.
Example:
Reorder buffer contains SN 0 & 2.
We receive AMSDU with SN 1 and NSSN for first sub frame 3.
The result us that driver releases SN 0,1, 2.
When sub-frame 1 arrives - reorder buffer is already ahead and
it will be dropped.
If the last sub-frame is not on this queue - we will get frame
release notification with up to date NSSN.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: advertise maximal MPDU length when Rx MQ is supported
Emmanuel Grumbach [Thu, 7 Apr 2016 13:44:42 +0000 (16:44 +0300)]
iwlwifi: advertise maximal MPDU length when Rx MQ is supported

The new hardware that supports multiple queue also
de-aggregates A-MSDUs. This means that we can advertise
the maximal size of A-MSDUs regardless of the receive
buffer's size.
In order to be able to forcefully use a lower A-MSDU size,
add a default value for the module parameter. Pre-9000
will have a default of 4K, and 9000 will have 12K.
Setting the amsdu_size module parameter to 4K will limit
the A-MSDU on 9000 as well.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoMAINTAINERS: add myself as co-maintainer of the iwlwifi driver
Luca Coelho [Tue, 19 Apr 2016 09:03:45 +0000 (12:03 +0300)]
MAINTAINERS: add myself as co-maintainer of the iwlwifi driver

I'm starting to take a more active role in the iwlwifi driver
maintainership.

Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: add default value to disable_11ac mod param description
Emmanuel Grumbach [Mon, 14 Mar 2016 13:21:06 +0000 (15:21 +0200)]
iwlwifi: add default value to disable_11ac mod param description

Small change to make it clear that the default value is false.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: grab NIC access only once on RX init
Sara Sharon [Tue, 12 Apr 2016 15:41:32 +0000 (18:41 +0300)]
iwlwifi: pcie: grab NIC access only once on RX init

When initializing RX we grab NIC access for every read and
write. This is redundant - we can just grab access once.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: use shadow registers for updating write pointer
Sara Sharon [Sun, 17 Apr 2016 12:08:59 +0000 (15:08 +0300)]
iwlwifi: pcie: use shadow registers for updating write pointer

The RX queues have a shadow register for the write pointer
that enables updates without grabbing NIC access. Use them
instead of the periphery registers because accessing those
is much more expensive.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support dqa-mode agg on non-shared queue
Liad Kaufman [Thu, 13 Aug 2015 16:16:08 +0000 (19:16 +0300)]
iwlwifi: mvm: support dqa-mode agg on non-shared queue

In non-shared queues, DQA requires re-configuring existing
queues to become aggregated rather than allocating a new
one. It also requires "un-aggregating" an existing queue
when aggregations are turned off.

Support this requirement for non-shared queues.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: avoid msleep() with short timeout
Johannes Berg [Wed, 13 Apr 2016 08:31:14 +0000 (10:31 +0200)]
iwlwifi: pcie: avoid msleep() with short timeout

Since msleep is based on jiffies, it can sleep for a long time.
Use usleep_range() instead to shorten the maximum time.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: extend device reset delay
Johannes Berg [Wed, 13 Apr 2016 08:24:59 +0000 (10:24 +0200)]
iwlwifi: pcie: extend device reset delay

Newer hardware generations will take longer to be accessible again
after reset, so we need to wait longer before continuing any flow
that did a reset.

Rather than make the wait time configurable, simply extend it for
all.

Since all of these code paths can sleep, use usleep_range() rather
than mdelay().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: turn on SGI support for VHT 160MHz
Gregory Greenman [Tue, 12 Apr 2016 12:16:24 +0000 (15:16 +0300)]
iwlwifi: turn on SGI support for VHT 160MHz

Devices supporting VHT 160MHz width are supporting also Short GI.
Turn on this capability in vht cap.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: make configuration structs smaller
Johannes Berg [Tue, 12 Apr 2016 10:36:01 +0000 (12:36 +0200)]
iwlwifi: make configuration structs smaller

Since we have a lot of configuration structs (almost 70) saving
some memory in each one of them leads to an overall saving of
~2.6KiB of memory.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: don't access a nonexistent register upon assert
Emmanuel Grumbach [Tue, 12 Apr 2016 10:07:52 +0000 (13:07 +0300)]
iwlwifi: don't access a nonexistent register upon assert

The commit below added code to dump the content of FIFOs
that are present only on dual CPU products (8000 and up).
This broke 7265D whose firmware does advertise
IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG but doesn't have 2
CPUs. The current code does check the length of the FIFO
before dumping them (and the nonexistent FIFO has a 0
length), but we still accessed a register to set the FIFO
number and that made the DMA unhappy.

The impact was a much longer recovery upon firmware assert.

Fixes: 5b086414293f ("iwlwifi: mvm: support dumping UMAC internal txfifos")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: remove IWLWIFI_DEBUG_EXPERIMENTAL_UCODE
Emmanuel Grumbach [Sun, 10 Apr 2016 05:48:46 +0000 (08:48 +0300)]
iwlwifi: remove IWLWIFI_DEBUG_EXPERIMENTAL_UCODE

This Kconfig option allows to load a firmware for
debugging with a different name. This mechanism has not
been used for a few years now and replacing the firmware
file works as well.
Kill this Kconfig option and all the code that goes with it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: use helpers to get iwl_mvm_sta
Sara Sharon [Sun, 10 Apr 2016 12:51:54 +0000 (15:51 +0300)]
iwlwifi: mvm: use helpers to get iwl_mvm_sta

Getting the mvm station out of station id requires dereferencing
the station id to get ieee80211_sta, then checking for pointer
validity and only then extract mvm station out.
Given that there are helpers to do it - use them instead of
duplicating the code whenever we need only mvm station.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: remove redundant alloc_ctx parameter
Sara Sharon [Sun, 10 Apr 2016 13:02:12 +0000 (16:02 +0300)]
iwlwifi: mvm: remove redundant alloc_ctx parameter

iwl_phy_db_set_section() is get called only from atomic
context, the alloc_ctx parameter is not needed. Remove it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: make phy_db size dynamic
Sara Sharon [Sun, 10 Apr 2016 09:27:25 +0000 (12:27 +0300)]
iwlwifi: mvm: make phy_db size dynamic

Driver is agnostic to the number of the phy_db entries and
only serves the firmware as a pipe to move the data from init
image to RT image.
As the size of the arrays may change (as it does in 9000 device)
allocate it dynamically. Firmware sends the largest index first
so we can use this to know how much we should allocate.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: set correct vht capability
Sara Sharon [Thu, 7 Apr 2016 14:26:53 +0000 (17:26 +0300)]
iwlwifi: mvm: set correct vht capability

Our device supports only 160 GHz and not 80+80. Fix
VHT flag accordingly.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: loosen nssn comparison to reorder buffer head
Sara Sharon [Wed, 30 Mar 2016 17:04:48 +0000 (20:04 +0300)]
iwlwifi: mvm: loosen nssn comparison to reorder buffer head

Up till now, the reorder buffer uses standard spec based comparison
when comparing the buffer status to NSSN. This indeed works for the
regular case, since we shouldn't cross the 2048 boundary without
getting a frame release notification.
However, this is problematic due to packet filtering that may be
performed by the FW while we are in d0i3. Theoretically we may
filter over 2048 packets, and then the check of the NSSN will get
incorrect.
Change the comparison to always trust nssn unless it is 64 or less
frames behind the head - which might happen due to a timeout.
This new comparison is to be used only when comparing reorder buffer
head with nssn, and not when comparing the packet SN to nssn or
reorder buffer head.
Put this in a separate commit as the logic is a bit tricky and
stands for its own commit message.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: pcie: don't wake up the NIC when writing CSRs in MSIX mode
Haim Dreyfuss [Sun, 3 Apr 2016 17:15:26 +0000 (20:15 +0300)]
iwlwifi: pcie: don't wake up the NIC when writing CSRs in MSIX mode

CSR registers are always available even when the NIC is not awake, no
need to wake up the NIC before accessing them. This has a huge impact
when we re-enable an interrupt at the end of the ISR since waking up the
NIC can take some time.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: Fix firmware name maximum length definition
Haim Dreyfuss [Wed, 6 Apr 2016 07:45:05 +0000 (10:45 +0300)]
iwlwifi: Fix firmware name maximum length definition

Previous patch had changed firmware name convention for
new generation product. The firmware name is now longer
than the former convention. Adapt max firmware name length
to the new convention.

Fixes: e1ba684f762b ("iwlwifi: 8000: fix MODULE_FIRMWARE input")
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: don't allow negative reference count
Sara Sharon [Mon, 4 Apr 2016 16:30:05 +0000 (19:30 +0300)]
iwlwifi: mvm: don't allow negative reference count

Currently code allows mvm reference to become negative and
only warns in case mvm reference is released while reference
counting is 0.
However, we better prevent this from happening at all since
iwl_mvm_unref() may race against iwl_mvm_unref_all_except()
which is called on restart.
As a result we might get the same reference unreferenced twice
ending with a negative value:
An example for an easily reproduced log:
    [ 2689.909166] iwl_mvm_ref Take mvm reference - type 8
    [ 2690.732716] iwl_mvm_unref_all_except Cleanup: remove mvm ref type 8 (1)
    [ 2690.849708] iwl_mvm_unref Leave mvm reference - type 8
    [ 2690.849721] WARNING: ... iwl_mvm_unref+0xb0/0xc0 [iwlmvm]()

If there will be yet another another restart iwl_mvm_unref_all_except
will run from 0 up to ref count, and since it is unsigned, we will throw
the transport ref count completely out of balance:
    iwl_mvm_unref_all_except[I] -- Cleanup: remove mvm ref type 8 (255)
    iwl_trans_slv_unref[I] -- rpm counter: 0
    iwl_trans_slv_unref[I] -- rpm counter: -1
    iwl_trans_slv_unref[I] -- rpm counter: -2
 ...
    iwl_trans_slv_unref[I] -- rpm counter: -253
    iwl_trans_slv_unref[I] -- rpm counter: -254

As there is no valid scenario where we can get to a negative
reference count - prevent it from happening.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add more registers to dump upon error
Golan Ben-Ami [Wed, 6 Apr 2016 08:59:50 +0000 (11:59 +0300)]
iwlwifi: mvm: add more registers to dump upon error

Add UREG, RXFC, RFH, WMAL and RL2P registers to the prph dump
upon error. These regesiters could help to debug MSI-X and other
issues.

These register should be dumped only when multi-queue rx is supported
so separate the prph ranges static array to two different arrays,
and enable dumping different prph ranges according to run-time
decision.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add a new mvm reference type for RX data
Luca Coelho [Wed, 30 Mar 2016 12:05:56 +0000 (15:05 +0300)]
iwlwifi: mvm: add a new mvm reference type for RX data

When a data packet is received, we need to make sure that we stay
awake until it can be processed and wait a while before trying to
enter runtime_suspend os system_suspend again.  To do so, add a new
reference type for RX data and take the reference when sending the
packet to mac80211.  We only do this for data packets, all the other
RX packets sent by the firmware (e.g. notifications) are not a reason
to prevent suspend.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: pass station to mac80211 RX where known
Johannes Berg [Thu, 10 Mar 2016 10:55:44 +0000 (11:55 +0100)]
iwlwifi: mvm: pass station to mac80211 RX where known

When we've already looked up the transmitter station, we can just
pass it to mac80211 using the new ieee80211_rx_napi(). This saves
the overhead of looking it up in mac80211 again.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: consider VHT 160MHz while parsing NVM
Gregory Greenman [Sun, 3 Apr 2016 11:06:12 +0000 (14:06 +0300)]
iwlwifi: consider VHT 160MHz while parsing NVM

Devices belonging to 9000 family can support VHT 160MHz channel
width, so need to consider it when configuring VHT capabilities.
However, NVM file doesn't have a single bit specifying that 160MHz
is supported. This patch turns on 160MHz support in VHT capabilities
in case there's at least one channel supporting 160MHz.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: allow combining different phy images with mac images
Haim Dreyfuss [Sun, 3 Apr 2016 16:55:59 +0000 (19:55 +0300)]
iwlwifi: allow combining different phy images with mac images

Currently there is one to one function between device id to it's ucode.
The new generation devices allows to combine different phy and mac images.
Now we have two different ucode images with the same device id.
Read RF ID to identify phy image and overwrite it if needed.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: wake from runtime suspend before sending sync commands
Luca Coelho [Fri, 11 Mar 2016 10:12:16 +0000 (12:12 +0200)]
iwlwifi: wake from runtime suspend before sending sync commands

If a host command was queued while in runtime suspend, it would go out
before the D0I3_END_CMD was sent.  Sometimes it works, but sometimes
it fails, and it is obviously the wrong thing to do.

To fix this, have the opmode take a reference before sending a SYNC
command and make the pcie trans wait for the runtime state to become
active before actually queueing the command.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: allow a debug knob for Tx A-MSDU even if rate control forbids it
Emmanuel Grumbach [Sun, 3 Apr 2016 07:15:59 +0000 (10:15 +0300)]
iwlwifi: mvm: allow a debug knob for Tx A-MSDU even if rate control forbids it

There is a debugfs knob to configure the maximal length
of the A-MSDU. If this value is not 0 (which is the
default), allow Tx A-MSDU even if the rate control
disallows it.
While at it, add "unlikely" to the if that limits the
length of the A-MSDU based on the debugfs hook.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: Rename 9560 to 9260 and add new PCI IDs for it
Haim Dreyfuss [Sun, 3 Apr 2016 15:56:15 +0000 (18:56 +0300)]
iwlwifi: Rename 9560 to 9260 and add new PCI IDs for it

Rename 9560 to 9260.
Add new PCI ID for 9260 and change some entries from 5165 to 9260.
Also order the 9000 series.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add a flag to disable checksum
Sara Sharon [Sun, 3 Apr 2016 07:19:16 +0000 (10:19 +0300)]
iwlwifi: mvm: add a flag to disable checksum

Add a constant to allow disabling checksum. This will enable easier
debugging in early phases.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: advertise RSS queue usage
Johannes Berg [Wed, 30 Mar 2016 09:05:16 +0000 (11:05 +0200)]
iwlwifi: mvm: advertise RSS queue usage

In order for mac80211 to use per-CPU statistics for RSS RX, the
driver needs to advertise that it uses RSS. Do this when using
more than a single queue.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: trans: don't call the trans-specific ref/unref directly
Luca Coelho [Wed, 30 Mar 2016 17:59:27 +0000 (20:59 +0300)]
iwlwifi: trans: don't call the trans-specific ref/unref directly

It's cleaner to always call the iwl_trans_ref/unref() functions
instead of sometimes calling the trans-specific ops directly.  This
also prepares for moving some of the code from the trans-specific ops
to the common trans code.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support queue removal in ADD_STA hcmd
Liad Kaufman [Mon, 21 Sep 2015 12:14:23 +0000 (14:14 +0200)]
iwlwifi: mvm: support queue removal in ADD_STA hcmd

To indicate to the FW that a queue has been removed, an
existing flag in the ADD_STA HCMD (that hasn't been in use)
has been changed to indicate that a queue is being removed
from a STA.

Update this in the driver code.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: utilize the frame release infrastructure
Sara Sharon [Sun, 28 Feb 2016 13:41:47 +0000 (15:41 +0200)]
iwlwifi: mvm: utilize the frame release infrastructure

The firmware will send frame release notification in order
to release "stuck" frames on a queue where no more frames
arrive on.
Upon receiving the message the driver shall indicate the frames
up to the NSSN.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add reorder timeout per frame
Sara Sharon [Sun, 28 Feb 2016 18:28:17 +0000 (20:28 +0200)]
iwlwifi: mvm: add reorder timeout per frame

Add a timer in order to release expired frames from the
reorder buffer.
This is needed since some APs do not retransmit frames
to fill in the reorder holes and in TCP it results with
a complete stall of traffic.

This has a few side effects on the general design:

The nssn may not reflect the the head of the reorder buffer.
This situation is valid, and packets with SN lower than the
reorder buffer head will be dropped.

Another side effect is that since the reorder timer might expire
we need to lock the reorder buffer.
This however is fine since the locking is only inside a
single reorder buffer between RX path and reorder timeout and
there is no outside contention.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add reorder buffer per queue
Sara Sharon [Wed, 23 Mar 2016 14:32:02 +0000 (16:32 +0200)]
iwlwifi: mvm: add reorder buffer per queue

Next hardware will direct packets to core based on the TCP/UDP
streams.
This logic can create holes in reorder buffer since packets that
belong to other stream were directed to a different core.
However, those are valid holes and the packets can be indicated
in L3 order.

The hardware will utilize a mechanism of informing the driver of
the normalized ssn and the driver shall release all packets that
SN is lower than the nssn.
This enables managing the reorder across the queues without sharing
any data between them.

The reorder buffer is allocated and released directly in the RX path
in order to avoid various races between control path and rx path.
The code utilizes the internal messaging to notify rx queues of when
to delete the reorder buffer.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add firmware API name comment
Johannes Berg [Wed, 30 Mar 2016 09:57:01 +0000 (11:57 +0200)]
iwlwifi: mvm: add firmware API name comment

Add the firmware API name to the struct iwl_wowlan_gtk_status.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: add infrastructure for tracking BA session in driver
Sara Sharon [Sun, 20 Mar 2016 14:23:41 +0000 (16:23 +0200)]
iwlwifi: mvm: add infrastructure for tracking BA session in driver

According to the spec when a BA session is started there
is a timeout set for the session in the ADDBA request.
If there is not activity on the TA/TID then the session
expires and a DELBA is sent.
In order to check for the timeout, data must be shared
among the rx queues.
Add a timer that runs as long as BA session is active
for the station and stops aggregation session if needed.
This patch also lays the infrastructure for the reordering
buffer which will be enabled in the next patches.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: change RX sync notification to be an attribute and not a type
Sara Sharon [Wed, 23 Mar 2016 14:31:43 +0000 (16:31 +0200)]
iwlwifi: mvm: change RX sync notification to be an attribute and not a type

Currently the sync notification is a type of notification. However, it
is better fitted as an attribute of a notification, since there might
be another message in the payload (delba for instance) that should be
sent while control path is waiting for all queues to process.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: implement driver RX queues sync command
Sara Sharon [Thu, 18 Feb 2016 12:21:12 +0000 (14:21 +0200)]
iwlwifi: mvm: implement driver RX queues sync command

mac80211 will call the driver whenever there is a race between
RSS queues and control path that requires a processing of all
pending frames in RSS queues.
Implement that by utilizing the internal notification mechanism:
queue a message to all queues. When the message is received on
a queue it decrements the atomic counter. This guarantees that
all pending frames in the RX queue were processed since the message
is in order inside the queue.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: Edit the 8265 SDIO ID
Mordechai Goodstein [Tue, 29 Mar 2016 11:41:49 +0000 (14:41 +0300)]
iwlwifi: Edit the 8265 SDIO ID

Add new 8265 series SDIO ID.

Signed-off-by: Mordechai Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
7 years agoiwlwifi: mvm: support p2p device frames tx on dqa queue #2
Liad Kaufman [Sun, 9 Aug 2015 16:26:56 +0000 (19:26 +0300)]
iwlwifi: mvm: support p2p device frames tx on dqa queue #2

Support sending P2P device frames should be sent from
queue #2, as required in DQA mode.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>