History log of /linux-master/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
Revision Date Author Comments
# a8b5d480 11-Mar-2024 Ilan Peer <ilan.peer@intel.com>

wifi: iwlwifi: mvm: Configure the link mapping for non-MLD FW

In the non MLD firmware flows, although the deflink is used, the mapping
of link ID to BSS configuration was missing, which causes flows that need
this mapping to crash.

Fix this by adding the link ID to BSS configuration mapping to non MLD
flows as well.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240311081938.0b5c361e8f0c.Ib11f41815d2efa5d1ec57f855de4c8563142987b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 2e171a57 07-Feb-2024 Rafael J. Wysocki <rafael.j.wysocki@intel.com>

iwlwifi: mvm: Drop unused fw_trips_index[] from iwl_mvm_thermal_device

The fw_trips_index[] array in struct iwl_mvm_thermal_device is only
populated, but never read, so drop it.

Note that the iwl_mvm_send_temp_report_ths_cmd() code populating
fw_trips_index[] is questionable, because it accesses a trips table
of a thermal zone directly, which is not guaranteed to work in the
future.

No functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Miri Korenblit <Miriam.rachel.korenblit@intel.com>


# 5ecd5d82 28-Feb-2024 Johannes Berg <johannes.berg@intel.com>

wifi: mac80211: pass link conf to abort_channel_switch

Pass the link conf to the abort_channel_switch driver
method so the driver can handle things correctly.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240228095718.27f621106ddd.Iadd3d69b722ffe5934779a32a0e4e596a4e33ed4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 740dfecc 18-Feb-2024 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: handle per-phy statistics from fw

In the operational statistics notifications (both old and new
API) the driver receives the statistics per phy.
currently this statistics wasn't handled because they wasn't needed.

Now the channel_load_by_us parameter in these statistics will be used
for the link grading calculation (implemented in another patch),
so store its value in phy_ctxt.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240218194912.e84f975b69ee.Ibbc7817135827e45adaaa47b796be165f9f1ca48@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 32a5690e 18-Feb-2024 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: support wider-bandwidth OFDMA

To support wider-bandwidth OFDMA we need to configure the
PHY context in the firmware, which will in turn configure
the DSP accordingly. Pass the relevant information down.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240218194912.ca666ede5dd6.I357972823d20e9045e2c97dbb7ac24fe9f5a6e41@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 35c1bbd9 05-Feb-2024 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: remove IWL_MVM_STATUS_NEED_FLUSH_P2P

This is set when a P2P ROC ends, and uses as an indication inside
iwl_mvm_roc_done_wk that the resources used for this ROC (sta/link)
needs to be flushed/deactivated (respectively).
But we also have IWL_MVM_STATUS_ROC_RUNNING, which is set whenever
P2P ROC starts, and is not even used in iwl_mvm_roc_done_wk.
Use IWL_MVM_STATUS_ROC_RUNNING as an indicator, and remove the redundant
bit.
While at it, add a call to synchronize_net also for the
AUX ROC case, which is missing in the existing code.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240205211151.0494f75de311.Ic4aacacf7581a5c9046c4f1df87cbb67470853e7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 8cb3a308 08-Feb-2024 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: fix thermal kernel-doc

This was misnamed, fix it. Also add a space to make it
look cleaner.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240208185302.5eb9f05fbfe2.Id0a4df70f21e7e6d079a7a2084b748ab499b828c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 87f5b5f2 06-Feb-2024 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: remove flags for enable/disable beacon filter

The flags argument to enable/disable beacon filtering functions
is unused and always zero, so just remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240206175739.2c739c1034a5.I8619949ad4ebd31593d10ece371ebdc6c48db98f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# b7acc059 05-Feb-2024 Daniel Amosi <amosi.daniel@intel.com>

wifi: iwlwifi: mvm: Keep connection in case of missed beacons during RX

The client needs to disconnect from AP in case of more than 19 missed
beacons only if no data is coming from that AP, otherwise it needs to
stay connected.

Signed-off-by: Daniel Amosi <amosi.daniel@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240205211151.080195242c18.Ib166fc4e46666165a88e673a4a196cb8f18fdec4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# e047e0e3 04-Feb-2024 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: const-ify chandef pointers

In much of the PHY context handling code the chandef
coming from mac80211 is read-only, mark them const
to make that clearer.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240204235836.e7fbd3e26d85.I72d72e61dc5f5fc76c53e32cb60b66237eaedec3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 5932ad87 01-Feb-2024 Shaul Triebitz <shaul.triebitz@intel.com>

wifi: iwlwifi: mvm: make functions public

In the following patch, iwl_mvm_roc_duration_and_delay and
iwl_mvm_roc_add_cmd will be called also from time-event.c.
Move then there (where they more belong) and make then
public.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240201155157.3edafc4d59aa.Ic68e90758bcad9ae00e0aa602101842dac60e1a1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# ad5a85d8 31-Jan-2024 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: prepare for reading TAS table from UEFI

We are going to support reading BIOS tables from UEFI
too, Refactor the TAS table flow:

1. Rename and move the common code to the regulatory.h/c files.
2. Remove the IWL_TAS_BLOCK_LIST_MAX, as we can use IWL_WTAS_BLACK_LIST_MAX
instead.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.0c2197cf1feb.Ib0e83d5bd3f4d5cfa9c3d2925317ba49377d257f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 427661e4 31-Jan-2024 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: read SAR tables from UEFI

All the regulatory tables will be read from UEFI, and
only if it doesn't exist - they will be read from ACPI.
Read SAR tables (WRDS, EWRD and WGDS) from UEFI.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131091413.533b687e1efb.Icb316291e593c8d53f41fdea2d083367dc97e3c4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# ce1fa3ad 29-Jan-2024 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: refactor duplicate chanctx condition

Refactor the check for using a chanctx's def vs. min_def,
to have the same in both places and reuse it later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129211905.6fcde4051adf.I343934874612d21727ed167accaa967958b2c25b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 619a900f 31-Jan-2024 Ilan Peer <ilan.peer@intel.com>

wifi: iwlwifi: mvm: Add support for removing responder TKs

When removing a PASN station, the TK must be removed before
the station is removed as otherwise the FW would assert.

To handle this, store the key configuration, and use it to remove
the key when the station is removed.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240131230734.3e6364730c04.Ia76dc4a9d399f1f68ac6b157d844b63f74d5159f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 10159a45 31-Jan-2024 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: disable eSR when BT is active

eSR should be disabled when BT Coex is active and:
- LB link is the primary link.
- LB link is the secondary link and the predicted BT penalty
(the wifi loss rate caused by BT interference) is higher
than a given threshold.
If one of the conditions above is no longer true then re-enable eSR.

In order to implement this, add support for version 5 of
BT_PROFILE_NOTIFICATION, in which the bt penalty is provided
by FW.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240131225342.b922b6485af8.I7d808ce535a7372aca9cb85c045755e6788a4904@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# fdccafad 23-Jan-2024 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: add support for a wiphy_work rx handler

The wiphy_work infra ensures that the entire worker will run
with the wiphy mutex. It is useful to have RX handlers
running as a wiphy_work, when we don't want the handler to
run in parallel with mac80211 work (to avoid races).

For example - BT notification can disable eSR starting from the next
patch.
In ieee80211_set_active_links we first check that eSR is
allowed, (drv_can_activate_links) and then activate it.
If the BT notif was received after drv_can_activate_links
(which returned true), and before the activation - eSR will be
activated when it shouldn't.
If BT notif is handled with the wiphy mutex, it can't run in
parallel to ieee80211_set_active_links, which also holds that
mutex.

Add the necessary infrastructure here, for use in the next commit.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240123200528.ce83d16cdec8.I35ef53fa23f58b9ec17924099238b61deafcecd7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 6c8ce238 23-Jan-2024 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: change link id in time event to s8

Link ID in time event data is -1 when the time event is cleared.
Change the type of the link ID in the time event data structure
and in the affected function from unsigned to signed.

Fixes: 135065837310 ("wifi: iwlwifi: support link_id in SESSION_PROTECTION cmd")
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240123200528.50d4941f946c.Iea990b118c69bc3e1eb61c1d134c9d470b3a17ac@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# d3433d1b 18-Feb-2024 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

wifi: iwlwifi: mvm: fix the TXF mapping for BZ devices

Those devices' fifos are numbered differently.
Because of that, we were looking at the size of the VO fifo size to
determine the size of the A-MSDU which led to a lower throughput.

Note that for those devices the only user of the AC -> fifo mapping is
the size limitation of A-MSDU.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240218194912.da336ca2fa0a.I73e44d5fc474ebb6f275b9008950e59c012f33b2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 32dc0f8e 06-Dec-2023 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

wifi: iwlwifi: mvm: do not send STA_DISABLE_TX_CMD for newer firmware

Newest firmware has completely offloaded this logic and this command
will be deprecated soon. Based on a capability bit advertised by the
firmware, skip this command.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.e64ef70c0133.I9f47cdef2ba45f1f383b70023857376973de3a8c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 3a5a5cb0 06-Dec-2023 Ilan Peer <ilan.peer@intel.com>

wifi: iwlwifi: mvm: Correctly report TSF data in scan complete

For an MLO connection, the BSSID of the link used during the scanning
should be used (and not the one from the default link).

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.1e67dba640c1.I6c4941bfab3a04498370e58b402c64d990c39fbf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# b6e3d1ba 22-Oct-2023 Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>

wifi: iwlwifi: mvm: implement new firmware API for statistics

The new firmware API uses a new command and notification,
the command configures in which statistics types driver is
interested and the notification is sent periodically.
An additional change in the API is that most of the statistics
data is accumulated and reported by the firmware per MLO link.
Implement new command and notification handlers and adjust to
per-link statistics.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231022173519.8cc7df0ebff2.If1dcb57145841c5b3c68ed112bbfcd0201f7acc3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# ea02a208 16-Oct-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: fix regdb initialization

In order to get regulatory domain, driver sends MCC_UPDATE_CMD to the
FW. One of the parameters in the response is the status which can tell
if the regdomain has changed or not.

When iwl_mvm_init_mcc() is called during iwl_op_mode_mvm_start(), then
sband is still NULL and channel parameters (i.e. chan->flags) cannot be
initialized. When, further in the flow, iwl_mvm_update_mcc() is called
during iwl_mvm_up(), it first checks if the regdomain has changed and
then skips the update if it remains the same. But, since channel
parameters weren't initialized yet, the update should be forced in this
codepath. Fix that by adding a corresponding parameter to
iwl_mvm_init_fw_regd().

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231017115047.78b2c5b891b0.Iac49d52e0bfc0317372015607c63ea9276bbb188@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# ff8e3a40 16-Oct-2023 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

wifi: iwlwifi: mvm: simplify the reorder buffer

The firmware / hardware of devices supporting RSS is able to report
duplicates and packets that time out inside the reoder buffer. We can
now remove all the complex logic that was implemented to keep all the Rx
queues more the less synchronized: we used to send a message to all the
queues through the firmware to teach the different queues about what is
the current SSN every 2048 packets.

Now that we rely on the firmware / hardware to detect duplicates, we can
completely remove the code that did that in the driver and it has been
reported that this code was spuriously dropping legit packets.

Suggested-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231017115047.54cf4d3d5956.Ic06a08c9fb1e1ec315a4b49d632b78b8474dab79@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# a32973ee 16-Oct-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: remove set_tim callback for MLD ops

In new firmware, we don't need this any more and it won't
be called any more by mac80211, since powersave handling
is all done by firmware. Remove it from the MLD ops.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231017115047.1a1ded96ffc2.Ie49d3004acdd6299fb84346c76b2b2b2f195196b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 23673041 16-Oct-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: make time_events MLO aware

As session protection API is moving to be per link instead of per mac,
move the time events to be per link too.

Since there is only one concurrent time event per mac, it feels
unnecessary to have the time_event as a member of iwl_mvm_link_info.
(That way we will have to iterate over all links each time we want to
clear a time event, and also we will need mac80211 to tell us the link
id when mgd_tx_complete() is called.)
So leave this as a member of iwl_mvm_vif, but add the link id to the
time_event structure.

The link id in time_event will only be maintained and used for:
1. When SESSION_PROTECTION_CMD is supported (before it, we don't have MLO)
2. For time_events of types SESSION_PROTECT_CONF_ASSOC,
SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV, and
SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION
(not for aux roc/ Hot Spot time_events).

For P2P, non-MLO connections, and pre-MLD API, deflink id, meaning 0,
will be used

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231017115047.21496bcacb18.I79d037325b4fae4c12a22d9477e53fc9c537ad46@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 39176296 11-Oct-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: change iwl_mvm_flush_sta() API

This API is type unsafe and needs an extra parameter to know
what kind of station was passed, so it has two, but really it
only needs two values. Just pass the values instead of doing
this type-unsafe dance, which will also make it better to use
for multi-link.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231011130030.aeb3bf4204cd.I5b0e6d64a67455784bc8fbdaf9ceaf03699d9ce1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# df7e3098 11-Oct-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: cleanup MLO and non-MLO unification code

bss_info_changed() callback of mac80211 was originally in both
MLD and non-MLD API. Therefore, we extracted the common part
to a function which receives a callback structure with the
mode-specific (non-MLO\MLO) ops. Eventually, for MLO API,
bss_info_changed() callback was split into 2 callbacks:
link_info_changed() and vif_cfg_changed() so it is no longer in use
for MLO, only for non-MLO.
Remove the code that uses the mode-specific callback structure.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231011130030.b65fbcdb9295.I2a64a6f1178ee0466755d728addc77acbb2ed6f4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 84ef7cbe 03-Oct-2023 Ilan Peer <ilan.peer@intel.com>

wifi: iwlwifi: mvm: Don't always bind/link the P2P Device interface

It is not necessary to keep the P2P Device bound/linked to a PHY
context when there is no active ROC.

Modify the P2P Device flows so the binding/linking would be done
only while ROC is active. With this change the switch_phy_ctxt()
is no longer needed so remove it.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231004123422.c5b83b4bf9de.Ia80daf3ba0b5fec7d0919247fcbdbdb58bddf02b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# b9be67fb 03-Oct-2023 Ilan Peer <ilan.peer@intel.com>

wifi: iwlwifi: mvm: Add basic link selection logic

Add simple logic that would allow using EMLSR in case
there are multiple valid links:

- In case the connection establishment has just been
completed try to find a valid link pair for EMLSR
functionality where one of the links in the pair is
the current active link.
- In case the valid links changed after connection
was already established, try to find a valid link pair
for EMLSR functionality, in case the EMSLR is not active
yet.

If a valid link pair is found call mac80211 to asynchronously
set the new link pair, otherwise continue using the current active
links.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231004123422.0c7b89ab29c2.I6600bd16551d75e2bf520d8d0add525568a9f85f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# e9dd2555 03-Oct-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add a per-link debugfs

Add a per-link debugfs entry in iwlmvm level so we can read/write link
related parameters.
Do it by implementing the link_add_debugfs API introduced by mac80211.

Each entry will have a path like this:
.../netdev:wlan0/link-X/iwlmvm/<file_name>
for each link X.

For non-MLD vifs this callback is called when the original vif
debugfs dir is also created, so handle that case by not creating
the 'iwlmvm' directory again.

Note that we don't have to worry about the cleaning the iwlmvm/*
directory as it is already done by mac80211 when removing the link
(or netdev).

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231004123422.6a161f021ae8.Ic8f40f2b4682270c94036e3c11c3996ae34266fa@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# c36235ac 03-Oct-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: rework debugfs handling

mac80211 added a new callback to add a vif debugfs.
Implement it instead of adding the debugfs directly,
which will make it properly preserved over switching
the vif from non-MLD/MLD and back.

This requires some rework so that we still have the
symlink but trust mac80211 to add/remove the debugfs.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231004123422.818810e242e6.I805a28f9fbef5c52a3a575d04e7a6a909ecf9078@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 271d14b3 28-Sep-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: mac80211: make mgd_protect_tdls_discover MLO-aware

Since userspace can choose now what link to establish the
TDLS on, we should know on what channel to do session protection.
Add a link id parameter to this callback.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230928172905.ef12ce3eb835.If864f406cfd9e24f36a2b88fd13a37328633fcf9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 4ea1ed1d 21-Sep-2023 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

wifi: iwlwifi: mvm: support set_antenna()

set_antenna() is supported only when the device is not started in
mac80211 which translates to the firmware not being loaded in iwlwifi.

The tricky part is that iwlwifi populates the sband data during its boot
and doesn't touch this data afterwards, but if the antenna settings
forbid MIMO, we need to update the sband data.

Rework the nvm parsing code to allow to get an existing nvm_data and
modify the sband with additional constraints (tx / rx chains masks).

Suggested-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230921110726.81d94d630c95.I9473da818cbeeb51b2f89dcc59b00019113e7f55@changeid
[add bugfix from Benjamin for iwl_mvm_get_valid_rx_ant()]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 4f1847cf 13-Sep-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: move listen interval to constants

This can be moved to constants, while at it also rename
it to have a better name with MVM_ prefix.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230913145231.59823deebfda.Ied68b11ca40771d1cfc8c82ee8f9f2b9ea27da65@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 3d66848f 13-Sep-2023 Shaul Triebitz <shaul.triebitz@intel.com>

wifi: iwlwifi: mvm: enable FILS DF Tx on non-PSC channel

If the channel bandwidth is greater or equal than 80MHz,
enable FILS DF transmittion, even if the control channel is non-PSC.
That's because that in 80MHz there must be a sub 20MHz PSC
channel, and since the FILS DF is duplicated on all sub 20MHz
channels, within the 80MHz (hence it will be sent on a PSC channel).

Also, if FILS DF Tx is enabled, always configure the firmware
with the actual channel bandwidth, even before there is a connected
client (rather than the minimum bandwidth e.g. 20MHz), since FILS
DF transmission on a PSC channel take presedent over power
consumption.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230913145231.83b9a76fc6c4.I6703111cc6befcd0e9cd9adf3cb127a648dbb7b1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# e110bf0c 30-Aug-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: fix kernel-doc

Fix kernel-doc, adding various documentation, but in some
cases (notably rate scaling) just removing the erroneous
comment format.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230830112059.4ce1159b51ab.I2021ae335f6b8e50ee2c1c78a79c5eac1c1aa103@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 594de122 30-Aug-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: fix some kernel-doc issues

Fix kernel-doc issues.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230830112059.2edc4d82f717.Ic7c6f1153939903b067062c9aec8fb70e0a2c30d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# a469a593 28-Aug-2023 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

wifi: mac80211: add support for mld in ieee80211_chswitch_done

This allows to finalize the CSA per link.
In case the switch didn't work, tear down the MLD connection.
Also pass the ieee80211_bss_conf to post_channel_switch to let the
driver know which link completed the switch.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230828130311.3d3eacc88436.Ic2d14e2285aa1646216a56806cfd4a8d0054437c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 12a89f01 10-Jul-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: remove 'use_tfh' config to fix crash

This is equivalent to 'gen2', and it was always confusing to have
two identical config entries. The split config patch actually had
been originally developed after removing 'use_tfh" and didn't add
the use_tfh in the new configs as they'd later been copied to the
new files. Thus the easiest way to fix the init crash here now is
to just remove use_tfh (which is erroneously unset in most of the
configs now) and use 'gen2' in the code instead.

There's possibly still an unwind error in iwl_txq_gen2_init() as
it crashes if TXQ 0 fails to initialize, but we can deal with it
later since the original failure is due to the use_tfh confusion.

Tested-by: Xi Ruoyao <xry111@xry111.site>
Reported-and-tested-by: Niklāvs Koļesņikovs <pinkflames.linux@gmail.com>
Reported-and-tested-by: Jeff Chua <jeff.chua.linux@gmail.com>
Reported-and-tested-by: Zhang Rui <rui.zhang@intel.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=217622
Link: https://lore.kernel.org/all/9274d9bd3d080a457649ff5addcc1726f08ef5b2.camel@xry111.site/
Link: https://lore.kernel.org/all/CAAJw_Zug6VCS5ZqTWaFSr9sd85k%3DtyPm9DEE%2BmV%3DAKoECZM%2BsQ@mail.gmail.com/
Fixes: 19898ce9cf8a ("wifi: iwlwifi: split 22000.c into multiple files")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20230710145038.84186-2-johannes@sipsolutions.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>


# a6cc6ccb 20-Jun-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: support new flush_sta method

For iwlwifi this is simple to implement, and on newer hardware
it's an improvement since we have per-station queues.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.a1f8ec20b727.I48594b708b41aa55dc2b8c3d346b4412ad3a5ba3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# e119e740 20-Jun-2023 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

wifi: iwlwifi: mvm: make iwl_mvm_set_fw_mu_edca_params mld aware

We need to work on the right link there.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.8762a90e8857.Ic5b8e96140a449fd1ed7008907d67fc36fe98506@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 12bacfc2 15-Jun-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: handle eSR transitions

There several transitions to handle in eSR mode:
* SMPS should be disabled when in eSR mode
* indicate to the fw whether the new added link should use the
listen lmac or the main lmac
* RLC is offloaded when in eSR mode; adjust RLC command accordingly

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230615094410.fb6409f44aca.I502460dec15e0b76035ad3cd809afa4ac16e9fe1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 823a9708 15-Jun-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: fix max number of fw active links

The max active links that are supported by the FW is hard coded.
This is wrong since this value is HW-dependent. Fix this by
determining according to the actual HW.

Also remove a redundant check that the number of active links
doesn't exceeds the maximum.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230615094410.e78ad74c6715.I68b26911c0a312d72eaf25344b448d03b1c61f4e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 4670d8dc 13-Jun-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: track u-APSD misbehaving AP by AP address

If the AP is an AP MLD, then we shouldn't track just the BSSID
but the MLD address. Just generally use ap_addr since it has
the BSSID in the non-MLD case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123447.b6a4f7edd10c.Ie5a8029ed686b9441620ba06596d430432f65559@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# c4c95454 13-Jun-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: implement WPFC ACPI table loading

We skipped this in the past, but now we will need it for some
platforms. Implement loading the PHY filter configuration IDs
from the WPFC ACPI table. Note that the firmware must also be
aware of the right filter configuration IDs (they're just the
IDs of a filter configuration, not the actual configuration).

Remove the useless hardcoded zeroes while at it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123447.035026ea3169.I3a1fc1fe644fefa0d818ee1926c5fc331d68e8a3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# edcda51d 14-Jun-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: remove new checksum code

The hardware isn't going to get fixed, so this mode cannot work
in the foreseeable future. Remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614145722.ddbc16c4affe.Ia6921e4b8a9624d4f57489ac775105ed0e400313@changeid
[restore original subject]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 1724fc78 13-Jun-2023 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

wifi: iwlwifi: mvm: allow ADD_STA not to be advertised by the firwmare

Newest firmware don't advertise the version of ADD_STA because it has
been replaced by another command. There are old firmware images
that also don't advertise it. Replace all the checks with a new
inline, and in that check for either MLD API or the ADD_STA
command version.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.4b9305510223.I7cc143d87186f8441e9b8435cc550b76734c7eef@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# d615ea32 13-Jun-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: put only a single IGTK into FW

The firmware only supports a single IGTK, and due to some
changes it really doesn't like to have multiple programmed
in later versions. Since only newer firmware cannot remove
a key that isn't present any more, adjust only the MLD API
code to keep track of the previous IGTK and remove it when
a new one is added.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.3fde1ef09270.I2e12a3b0bba4325c07dc8fcce39b711f158bd621@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# d51439a6 13-Jun-2023 Ariel Malamud <ariel.malamud@intel.com>

wifi: iwlwifi: mvm: Refactor iwl_mvm_get_lmac_id()

The iwl_mvm_get_lmac_id() function is currently
defined as a static inline function under fw/api
and receives mvm's fw pointer. It will need the
ability to access other mvm struct members for
future capabilities such as debug. Move the function
out of the fw/api and into mvm proper as a regular
function and have it receive the pointer to mvm.

Signed-off-by: Ariel Malamud <ariel.malamud@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.507b2f9f64eb.I0ec91310e1911c33faf396b5e17bcb11a164f6ea@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# fd940de7 12-Jun-2023 Avraham Stern <avraham.stern@intel.com>

wifi: iwlwifi: mvm: FTM responder MLO support

Add a link configuration parameter to FTM responder start instead
of using the default link.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.b367f9bd19b8.I158c71998f39a6c15463ff5ae30129da8ad46d22@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# e9b63341 12-Jun-2023 Abhishek Naik <abhishek.naik@intel.com>

wifi: iwlwifi: update response for mcc_update command

Add support for the MCC update response version 8.
Versions 5-6 are already covered by the existing
flags conversion, and 7 isn't used.

The capabilities field in iwl_mcc_update_resp is 32 bits
wide now, and the flags moved, so some more changes are
needed.

While at it, convert the flags to bool (to avoid having
to deal with BIT(16) specially etc.) and use the
struct_size() macro for the memory allocation.

Signed-off-by: Abhishek Naik <abhishek.naik@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.71a7070aecd7.Ibddcb9fbfa74895f742c0ac20968720691c94853@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 3f244876 12-Jun-2023 Benjamin Berg <benjamin.berg@intel.com>

wifi: iwlwifi: make debugfs entries link specific

All of the station elements are really elements for the link. Create
them from the correct callback and return the link specific information
rather than always using the default link.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.a8e0c40d325e.I374d9433c3b8694667e1ce550d65f6f1f0d23c05@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 7d528eaf 06-Jun-2023 Johannes Berg <johannes.berg@intel.com>

Revert "wifi: iwlwifi: update response for mcc_update command"

This reverts commit b70813e4a88f ("wifi: iwlwifi: update response
for mcc_update command") since it causes a merge conflict, and it
seems easier to redo the patch later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# b70813e4 24-May-2023 Abhishek Naik <abhishek.naik@intel.com>

wifi: iwlwifi: update response for mcc_update command

Add support for the MCC update response version 8.
Versions 5-6 are already covered by the existing
flags conversion, and 7 isn't used.

The capabilities field in iwl_mcc_update_resp is 32 bits
wide now, and the flags moved, so some more changes are
needed.

While at it, convert the flags to bool (to avoid having
to deal with BIT(16) specially etc.) and use the
struct_size() macro for the memory allocation.

Signed-off-by: Abhishek Naik <abhishek.naik@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.fd9016f8f994.Ibddcb9fbfa74895f742c0ac20968720691c94853@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 3f302269 24-May-2023 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

wifi: iwlwifi: mvm: update the FW apis for LINK and MAC commands

The firmware added new fields to be able to pass the link_id as the AP
knows it and the esr_transition_timeout.
For now, pass only the link_id since we don't have access to the
esr_transition_timeout yet.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.bf80ce717458.Icd4174911227c00cd12783fe1f517ae8097809b9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 0945f976 24-May-2023 Avraham Stern <avraham.stern@intel.com>

wifi: iwlwifi: mvm: support PASN for MLO

When adding a PASN station, the non MLD API was used. This results
in assert when operating as MLD. Fix it to use the MLD API when
operating as MLD. For now, the default link is used for the added
station.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.7c35dccc8a12.I7bc78cd16d7c750f42fdd60e07e839a860d279d2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# a2906ea6 24-May-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: make internal callback structs const

There's no need for these to be writable, so they can
be const (and static).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.c41eb6687868.I2dac1158e5723187bda1973aa49fde8a794621c8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# d464550b 24-May-2023 Yedidya Benshimol <yedidya.ben.shimol@intel.com>

wifi: iwlwifi: mvm: use link ID in missed beacon notification

This new version of missed beacon notification uses link_id
instead of mac_id. Also add an option to use link id for
retrieving vif.

Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230524203151.17fe1cc632f1.Id1fabb532e2174712fe17d4ad86a2c8c64ae84da@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 9e26f098 30-Apr-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: rfi: disable RFI feature

This feature depends on a platform bugfix. Until we have a
mechanism that can verify a platform has the required bugfix,
disable RFI.

Fixes: ef3ed33dfc8f ("wifi: iwlwifi: bump FW API to 77 for AX devices")
Reported-by: Jeff Chua <jeff.chua.linux@gmail.com>
Link: https://lore.kernel.org/linux-wireless/CAAJw_ZvZdFpw9W2Hisc9c2BAFbYAnQuaFFaFG6N7qPUP2fOL_w@mail.gmail.com/
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 0d255883 17-Apr-2023 Avraham Stern <avraham.stern@intel.com>

wifi: iwlwifi: modify scan request and results when in link protection

When CSME is connected and has link protection set, the driver must
connect to the same AP CSME is connected to.
When in link protection, modify scan request parameters to include
only the channel of the AP CSME is connected to and scan for the
same SSID. In addition, filter the scan results to include only
results from the same AP. This will make sure the driver will connect
to the same AP and will do it fast enough to keep the session alive.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230418122405.c1b55de3d704.I3895eebe18b3b672607695c887d728e113fc85ec@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 8642ddb2 16-Apr-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: implement key link switching

Implement switching keys from one set of firmware station IDs
to another set, during link switch.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.c6a777dd5e47.I693f7fd7c52fe8b51a58af69d45488511367f49e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 9aa3856d 16-Apr-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: track station mask for BAIDs

When we have MLO connections, a BAID applies to multiple
firmware stations. Track the station mask instead of the
station ID, getting rid of a few more deflink cases and
preparing for handling link switching for BAIDs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230416154301.c08523808c34.I719b7bba499648d1495ed3e3a90889d4732ef15d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 7f11d17f 14-Apr-2023 Ilan Peer <ilan.peer@intel.com>

wifi: iwlwifi: mvm: Fix setting the rate for non station cases

The setting of the rate used for non station cases did not take into
consideration the interface type etc., thus when probe responses
are transmitted on P2P Device interface etc. CCK rates were used
which is not allowed.

Modify the code so the non station case would consider the
interface type etc. For HWs/FWs that do not support rate control,
preserve the previous behavior, i.e., take the rate from the
skb metadata and adjust as needed.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230414130637.fa0e4d42205d.Iab4784560c77b965fec070d4d0a1ec84171d94ff@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 7035b5ba 14-Apr-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: make iwl_mvm_mac_ctxt_send_beacon() static

We never needed this to be non-static, that was just an
artifact of the development process. Make it static.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230414130637.3c018c15f948.I87fd1aee288f33312a7206492608002d4e8e213e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 0c9a8f90 14-Apr-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: track AP STA pointer and use it for MFP

Instead of relying on the AP STA ID and dereferencing our
firmware -> mac80211 STA array when we really only need
the STA, not the per-link information (and might not have
it, e.g. for a pairwise key installation where this is
relevant), keep track of the AP STA as a pointer to the
mac80211 STA, protected by the mutex. Then use it here in
the key code instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230414130637.7db01b1508de.I88e6d252cdb0a6e4581d7c5fd7cbc037b4fd40ae@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 7a41d589 14-Apr-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: enable new MLD FW API

Enable the new FW API with MLD based on FW TLV.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230414130637.5dc66b08539e.I1c65024c879346b0349e1e431d36ec2b5fd85dd7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# a0c8ab93 13-Apr-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: refactor TX csum mode check

There are two modes now, and we have two places checking
that must be in sync. Refactor the logic into a new small
helper function.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230413102635.ef6246f4b73b.I44820ec095634dd0bba3007465cf25e4ce1c77c6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# de50140b 29-Mar-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: separate AP link management queues

The link management queues associated with the broadcast stations
were forgotten and so the same queue was used with both broadcast
stations. This leads to lost frames and warnings on cleanup and
HW restart.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.0671fa976832.Id5aa9856fd5984e447f247e6d0c3979d9794a21a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 9deccfcd 29-Mar-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: rework active links counting

Remove fw_active_links_num counter since we now have a bitmap of
active links in vif. Also, update link activation status only when
LINK_CONTEXT_MODIFY_ACTIVE bit set in changes parameter.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.1ecfb27b6b84.I3a5e0bc32b3728e4caae8a231bc3f04ea1d89cad@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 072573f6 29-Mar-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: remove only link-specific AP keys

When we remove the AP station, we iterate over the links
and remove all the keys, however, the key iteration will
return all keys for all links, so skip the ones that we
don't need based on the link ID.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.e724878f502e.I66870d4629244b4b309be79e11cbbd384bdf93be@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# b8a85a1d 29-Mar-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: rxmq: report link ID to mac80211

Add a fw_id_to_link_sta array in mvm to track the link
STA for each firmware station ID, and then use that to
report the link a frame was received on (since we know
the station ID from firmware).

Notably, this fixes beacon tracking for the correct link
since mac80211 now queues and processes those on the one
link identified by the link ID only.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.c7dd3ec18077.I12ef9eb4a5b8b5c2b9d6bcaa1fda73b59eba39d8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# ba9eef6b 29-Mar-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: adjust iwl_mvm_sec_key_remove_ap to MLO

It has to be done per link. We still don't support keys
configuration for several links, but the single vif link can
still point to a link different from deflink. For now handle
the removal of keys for the default link.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.19d729cc4654.I4ebe8e3eb5fc00a994761f7c0ad40107382705ca@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# bf976c81 28-Mar-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: implement link change ops

Implement the link change ops for links and stations.
Note that the stations one is empty for now as we only
have support for a single link so far, and then the
stations are created with the first link as deflink by
mac80211, so right now we don't really need anything.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.6186c5a37e99.Ifd00d3ee93356ddef273aa18f1e081cd8f2c84ae@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 57974a55 28-Mar-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: refactor iwl_mvm_mac_sta_state_common()

Move code handling specific state transitions into separate handlers
and adjust them for MLO. Adjust relevant callbacks as well.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.5a3f8a849723.I0670d20436858a1cd3c055e03c7528db81292811@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 4263ac7f 28-Mar-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: adjust to MLO assign/unassign/switch_vif_chanctx()

Pass link_conf when it's necessary and change the code accordingly.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.dc1074239c5b.I30db722af9009f1b274fa929f276fd2b78520dea@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# d6f6b0d8 28-Mar-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: add fw link id allocation

Driver uses link_id as an index in the array. FW currently can
support only 2 concurrently active links per vif with the ids in the
range 0-3. Add a mapping of dirver link ids to fw link id and track the
number of active link ids.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.a53e5df49c33.I02b25648d2d5ca370c0697bf19d0d34724eae8a1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 22c58834 28-Mar-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: replace bss_info_changed() with vif_cfg/link_info_changed()

These are two new handlers for MLO. As the configurations done in
bss_info_changed() are now split into two separate flows, use MLO
specific implementation instead of common functions with the non-MLO
code.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.7b238cae0895.Ieb87f204787fb1c7cb7562e1cbf54ef518d87123@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# cacc1d42 28-Mar-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: add link_conf parameter for add/remove/change link

Add link_conf parameter and change all the relevant calls accordingly.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.374015eed2e3.Icbf15a18e2599b53f4fa1c92fe3db64b551b84b1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 1a3e7039 28-Mar-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: adjust SMPS for MLO

Configure SMPS per-link. Add link_id parameter to
iwl_mvm_update_smps() and refactor iwl_mvm_intf_dual_chain_req()
since it has to handle all active links.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.da6a19db562c.Ic88b02338c8973f2934439ac3ee77c7451bc0054@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# be8897e2 28-Mar-2023 Avraham Stern <avraham.stern@intel.com>

wifi: iwlwifi: mvm: add set_hw_timestamp to mld ops

In mld ops, set_hw_timestamp was not set. Fix it.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.7b24a582b763.Ieb3139d41f1a01b2b566adecd32450da1bcdd5fa@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# cb145863 28-Mar-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: add link to firmware earlier

The firmware now allows adding a link that's not yet bound
to a PHY context. Make use of that to align the driver with
mac80211's API expectations. For now, just add the link at
the same time as the MAC since we don't yet have real MLD
support, but that'll obviously change later. This fixes an
issue with apStaId tracking in the firmware.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.097e5008b637.I4e75c6c11e21c08d28ff6a066be36629d3975db6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# f551d013 28-Mar-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: adjust some PS and PM methods to MLD

When using mvm vif PS/PM related properties, consider all links.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.8d9e18f7d74b.I048fc17405ecdddc1f6fe72859013cc4878b2a3b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 36cf5377 28-Mar-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: adjust mld_mac_ctxt_/beacon_changed() for MLO

HE/EHT support is reported to FW if there's at least one link
that supports it. Configure beacon separately for each link.
Don't send the beacon template before adding the MAC.

Co-developed-by: Johannes Berg <johannes.berg@intel.com>
Co-developed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.5ef4efeda2dd.I6ebda2b71c964b9aa63240c9fa1ee0d28099fe6e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# cbce62a3 28-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add all missing ops to iwl_mvm_mld_ops

Add all the callbacks that are not changing with the
new MLD API and register to mac80211 with the new ops.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.a2f724342522.I5d1d6a8f5f14e6275da56ea704c3c0063fee5226@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 03117f30 28-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add support for post_channel_switch in MLD mode

Adjust the existing iwl_mvm_post_channel_switch()
to the new MLD API and use it in the new MLD ieee80211_ops

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.fa3992f7dfd2.Ie298a9b1522e956d7b699f0432795548bc6e47f9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# fe8b2ad3 28-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add cancel/remain_on_channel for MLD mode

Add an MLD version of the remain_on_channel and
cancel_remain_on_channel callbacks.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.b51813dbebd4.Ia25bbd63d3138e4759237ce2be0cd0436fe01c0a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 660eba5a 28-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add some new MLD ops

Add MLD version of bss_info_changed/switch_vif_chanctx/
config_iface_filter and conf_tx() callbacks.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.9c83c253d610.Ibf2006be9ece87896c17cb43dfe3654ac73d81ff@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 87f7e243 28-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add sta handling flows for MLD mode

In MLD mode we have a new STA cmd. As a result, it is also changes
the flows of adding/updating/removing and handling state of
a station. Add these flows.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.b5548cfd8fe3.I70f9c8f3c95e18d5c9af0a5681e0830893509531@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 9e2de88d 28-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add an indication that the new MLD API is used

WE can't mix between the new MLD API and the old API.
I.e. - we can't send one of the new cmds and then one of the old ones.
This will cause a FW assert. So we need an indication what API should be
used. We use the new API if:
1. FW supports it
2. We are registered to mac80211 with the new MLD ops
Add an indication which will only be true if both conditions are true.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.5756b0907403.I0adce36d1783cce23d0e080e3c4a8953db33b515@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 650cadb7 28-Mar-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: mvm: vif preparation for MLO

In MLO, some fields of iwl_mvm_vif should be defined in the
context of a link. Define a separate structure for these fields and
add a deflink object to hold it as part of iwl_mvm_vif. Non-MLO legacy
code will use only deflink object while MLO related code will use the
corresponding link from the link array.

It follows the strategy applied in mac80211 for introducing MLO
changes.

The below spatch takes care of updating all driver code to access
fields separated into MLD specific data structure via deflink (need
to convert all references to the fields listed in var to deflink.var
and also to take care of calls like iwl_mvm_vif_from_mac80211(vif)->field).

@iwl_mld_vif@
struct iwl_mvm_vif *v;
struct ieee80211_vif *vv;
identifier fn;
identifier var = {bssid, ap_sta_id, bcast_sta, mcast_sta,
beacon_stats, smps_requests, probe_resp_data,
he_ru_2mhz_block, cab_queue, phy_ctxt,
queue_params};
@@

(
v->
- var
+ deflink.var
|
fn(vv)->
- var
+ deflink.var
)

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.4896576f0a9f.Ifaf0187c96b9fe52b24bd629331165831a877691@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 9457077d 19-Mar-2023 Abhishek Naik <abhishek.naik@intel.com>

wifi: iwlwifi: mvm: Add debugfs to get TAS status

Add debugfs file in mvm to retrieve TAS status per LMAC,
TAS block list, current mcc, OEM name and OEM allowed list.

Signed-off-by: Abhishek Naik <abhishek.naik@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.8efc8c41efae.I94e1a6efb9c33e2cdbcf4bf3ed2384005397dee9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# fd1a54c1 19-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add stop_ap() and leave_ibss() callbacks for MLD mode

This is another patch in the series adding all the ops
for the new MLD ieee80211_ops.
The callbacks added here use the new MLD FW API

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.42b0d4726b8d.I0755baace47c0ab1d9d70137448125d3140ef3af@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# f947b62c 19-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add start_ap() and join_ibss() callbacks for MLD mode

This is another patch in the series adding all the ops
for the new MLD ieee80211_ops.
The callbacks added here use the new MLD FW API

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.3eb485c359fc.I28be198ea9389083d5a01f68c92763722613ba9b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# a2f49f7d 19-Mar-2023 Avraham Stern <avraham.stern@intel.com>

wifi: iwlwifi: mvm: implement PHC clock adjustments

Implement the following PHC operations:
1. adjtime - for adding an offset to the PHC clock time.
2. adjfine - for adjusting the PHC clock frequency.
3. gettime64 - for getting the PHC clock time. This function returns
the time as adjusted by adjtime and adjfine.

The adjusted time will also be used for time sync frames timestamping.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.f59750deeee4.I110a7e3ac3c6d39d9dbe1fe77001e3f5bc3814eb@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# c7eca79d 19-Mar-2023 Avraham Stern <avraham.stern@intel.com>

wifi: iwlwifi: mvm: report hardware timestamps in RX/TX status

For TM/FTM frames, report the hardware timestamps reported by the
fw as part of the RX/TX status. Since the fw reports the timestamps
in a dedicated notification (and not as part of the RX/TX status),
hold the frame until the fw timestamps notification is received.
Timestamping is enabled when a station is connected and disabled
when disconnected. For AP interface, only the first station will
have timestamping enabled since the fw only supports timestamping
for one peer.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.e0392d498101.I9bf12c8ecfb3f17253a13dc48a48647ddd6e7855@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 1595ecce 19-Mar-2023 Krishnanand Prabhu <krishnanand.prabhu@intel.com>

wifi: iwlwifi: mvm: add support for PTP HW clock (PHC)

Add support to enable/disable PHC clock. The PHC clock includes support
for fetching the cross timestamp i.e. a non-atomic snapshot of the current
time from the hardware (WiFi device) clock and system clock (wall-clock)
simultaneously.

Signed-off-by: Krishnanand Prabhu <krishnanand.prabhu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.ae1d64f513b9.Ib3b6ad61c9fa2fc5908f1e0d6f59f4af6eec1a77@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# f311d011 14-Mar-2023 Solomon Tan <solomonbstoner@protonmail.ch>

wifi: iwlwifi: Replace space with tabs as code indent

This patch addresses the checkpatch.pl warning that code indent should
use tabs.

Signed-off-by: Solomon Tan <solomonbstoner@protonmail.ch>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.eaca2a9b08f2.Ic81d60185c13cfc750bf93fbabac57314cb5de13@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 6f71e90e 14-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add an unassign_vif_chanctx() callback for MLD mode

This is another patch in the series adding all the ops
for the new MLD ieee80211_ops.
The callback added here uses the new MLD FW API

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.5d4bcd384425.I263eef3aad8efe23a597843fe7c56924038c8fdc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 50e81437 14-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add an assign_vif_chanctx() callback for MLD mode

This is another patch in the series adding all the ops
for the new MLD ieee80211_ops.
The callback added here uses the new MLD FW API.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.d3753975e720.I45f89cc81370d2cf8d4f51748ccb3ec675eff1bd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 60efeca1 14-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: Add a remove_interface() callback for mld mode

As the MLD mode and its new APIs are introduced,
we've decided to add a new ieee80211_ops dedicated for
MLD callbacks. Add the MLD remove_interface() callback
which uses the new MLD APIs.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.b87c5c0a4b6b.I631173a73d6ffd7232aa539ea8b356a222fac398@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 1ab26632 14-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: Add an add_interface() callback for mld mode

As the MLD mode and its new APIs are introduced,
we've decided to add a new ieee80211_ops dedicated for
MLD callbacks. Add the MLD add_interface() callback
which uses the new MLD APIs added the previous patches.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.6adc29bff39b.I97ed469028009be9392dcc6f7b5ffbe45f4b2c43@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 55eb1c5f 14-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add support for the new LINK command

As a part of the new MLD FW API changes, we have a new LINK command
to add/remove/configure a link.
Add structures and enum definitions, along with the functions that
sends this command (i.e. add, remove and change mac ctxt).
These functions will be in used in the next patches.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.d7808329effb.I13bea2db206b78540bc866bc3ab755ad5be78c53@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 9be162a7 14-Mar-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: mvm: add support for the new MAC CTXT command

As a part of the new MLD FW API changes, we have a new MAC CTXT command.
Add structures and enum definitions, along with the functions that
sends this command (i.e. add, remove and change mac ctxt).
This functions will be in used in the next patches.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.99a41a5bc55f.I310312c829f5f2f69b64fcddce487b1eab80165b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 5abf3154 05-Mar-2023 Mordechay Goodstein <mordechay.goodstein@intel.com>

wifi: iwlwifi: mvm: add primary 80 known for EHT radiotap

Calculate the position of the control channel in the wide channel
based on the chandef, this is used to obtain the value of N in
802.11be D1.5 Table 9-53a in the column PHY MU/MRU index.

To avoid the need to calculate every frame the value, do it once
monitor vif is added.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230305124407.fe9a5b58e241.I291ee480252d098f62d9ec39040284d3e521d88e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 923bf981 17-Mar-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: protect TXQ list manipulation

Some recent upstream debugging uncovered the fact that in
iwlwifi, the TXQ list manipulation is racy.

Introduce a new state bit for when the TXQ is completely
ready and can be used without locking, and if that's not
set yet acquire the lock to check everything correctly.

Reviewed-by: Benjamin Berg <benjamin.berg@intel.com>
Tested-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# b58e3d43 17-Mar-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: fix mvmtxq->stopped handling

This could race if the queue is redirected while full, then
the flushing internally would start it while it's not yet
usable again. Fix it by using two state bits instead of just
one.

Reviewed-by: Benjamin Berg <benjamin.berg@intel.com>
Tested-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 3d2f20ad 14-Oct-2022 Daniel Lezcano <daniel.lezcano@linaro.org>

wifi: iwlwifi: Use generic thermal_zone_get_trip() function

The thermal framework gives the possibility to register the trip
points with the thermal zone. When that is done, no get_trip_* ops are
needed and they can be removed.

The get_trip_temp, get_trip_hyst and get_trip_type are handled by the
get_trip_point().

The set_trip_temp() generic function does some checks which are no
longer needed in the set_trip_point() ops.

Convert ops content logic into generic trip points and register them
with the thermal zone.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Kalle Valo <kvalo@kernel.org>
Acked-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20221014073253.3719911-1-daniel.lezcano@linaro.org


# b8133439 23-Nov-2022 Avraham Stern <avraham.stern@intel.com>

wifi: iwlwifi: mvm: trigger PCI re-enumeration in case of PLDR sync

When doing the PLDR flow, the fw goes through a re-read and needs
PCI re-enumeration in order to recover. In this case, skip the mac
start retry and fw dumps as all the fw and registers are invalid
until the PCI re-enumeration.

In addition, print the register that shows the re-read counter
when loading the fw.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Link: https://lore.kernel.org/r/20221123225313.9ae77968961e.Ie06e886cef4b5921b65dacb7724db1276bed38cb@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>


# ef2e7a51 02-Nov-2022 Ilan Peer <ilan.peer@intel.com>

wifi: iwlwifi: mvm: Fix getting the lowest rate

When setting the rate for Tx, the code tried to get the lowest
allowed rate but without considering the BSS basic rates. Fix this
by considering the basic rates.

In addition, declare support for configuring beacon Tx rate and when
configured use the configured Tx beacon rate to set beacon tx command rate.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20221102165239.be8403f0d5c0.I7d141646746b96310efd75fc77ca9aebc61aefcc@changeid


# 5c75a208 02-Nov-2022 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: mvm: support new key API

In order to support MLD, the key API is also changing to have
station masks instead of just the station ID etc. Change the
driver to support this, and add the new code in a new file so
it's more clearly separated.

For now this isn't separated at the mac80211 ops level, which
we wanted to do, but we're calling these functions in a place
when pre-start keys are installed in iwl_mvm_start_ap_ibss(),
and the function has some glue logic to mac80211. We may want
to change that later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20221102165239.ed9ccd814abc.Iacc7360de68807fbac19e5b67c86504b39cc15df@changeid


# 5aa7ce31 30-Oct-2022 Avraham Stern <avraham.stern@intel.com>

wifi: iwlwifi: mei: make sure ownership confirmed message is sent

It is possible that CSME will try to take ownership while the driver
is stopping. In this case, if the CSME takes ownership message arrives
after the driver started unregistering, the iwl_mei_cache->ops is
already invalid, so the host will not answer with the ownership
confirmed message.
Similarly, if the take ownership message arrived after the mac was
stopped or when iwl_mvm_up() failed, setting rfkill will not trigger
sending the confirm message. As a result, CSME will not take
ownership, which will result in a disconnection.

Fix it by sending the ownership confirmed message immediately in such
cases.

Fixes: 2da4366f9e2c ("iwlwifi: mei: add the driver to allow cooperation with CSME")
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20221030191011.b2a4c009e3e6.I7f931b7ee8b168e8ac88b11f23bff98b7ed3cb19@changeid


# 72c08d9f 23-Sep-2022 Kees Cook <keescook@chromium.org>

wifi: iwlwifi: Track scan_cmd allocation size explicitly

In preparation for reducing the use of ksize(), explicitly track the
size of scan_cmd allocations. This also allows for noticing if the scan
size changes unexpectedly. Note that using ksize() was already incorrect
here, in the sense that ksize() would not match the actual allocation
size, which would trigger future run-time allocation bounds checking.
(In other words, memset() may know how large scan_cmd was allocated for,
but ksize() will return the upper bounds of the actually allocated memory,
causing a run-time warning about an overflow.)

Cc: Gregory Greenman <gregory.greenman@intel.com>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Luca Coelho <luciano.coelho@intel.com>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Cc: Ilan Peer <ilan.peer@intel.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220923220853.3302056-1-keescook@chromium.org


# 731d5aa9 06-Sep-2022 Haim Dreyfuss <haim.dreyfuss@intel.com>

wifi: iwlwifi: mvm: don't check D0I3 version

This code is dead, even old FW versions don't use it.
The IWL_D0I3_RESET_REQUIRE flag will be sent by the FW via a notification,
instead of command, the notification handler will be introduced later
in the series.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.87c82482229a.I70456c38ed8f7beb7d62dd618f58e7dc0a7d33b2@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>


# 98c0de7b 16-May-2022 Miri Korenblit <miriam.rachel.korenblit@intel.com>

iwlwifi: mvm: remove vif_count

We used to count the number of ieee80211_vifs in mvm.
This was needed for the legacy PM API, which is no longer
supported. Remove it.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220517120045.8c91ae023b15.Ia6145e4930b1d28f3fcedc316b4f177295b00557@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 8b3d2c48 04-Mar-2022 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: remove cipher scheme support

There are no shipping firmware versions with this, and there
will also not be in the future, so remove the support.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220304131517.8b3c8b4adf41.Ib3ddb6b250ea2dd72b4ecc88bdd5cffb86af1dcc@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 227f2597 10-Feb-2022 Johannes Berg <johannes.berg@intel.com>

iwlwifi: support new queue allocation command

Newer firmware versions will support a new queue allocation
command, in order to deal with MLD where multiple stations
are used for a single queue. Add support for the new command.

This requires some refactoring of the queue allocation API,
which now gets
- the station mask instead of the station ID
- the flags without the "enable" flag, since that's no longer
used in the new API

Additionally, this new API now requires that we remove queues
before removing a station, the firmware will no longer do that
internally. Also add support for that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220210181930.acbf22ac2b66.I2bf38578c5ca1f7ffb2011a782f772db92fc4965@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# a54844d4 05-Feb-2022 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: make iwl_mvm_reconfig_scd() static

There's no need to have this in a different place, it's
only used in a single C file (sta.c).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220205112029.699b4b9c2232.I0d7970d800a51fee5135946ee03a7d9e8a811893@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 63b62a2d 05-Feb-2022 Gregory Greenman <gregory.greenman@intel.com>

iwlwifi: mvm: rfi: handle deactivation notification

Sometimes RFIm can be deactivated in FW due to internal
errors. In this case, FW will send a notification to the
driver about that. Add a log message in this case since
FW logs are not always available.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220205112029.48d0a1624fec.I8f9271959fc53223fa329ab097b12fd69b498b71@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ded5ded3 28-Jan-2022 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: starting from 22000 we have 32 Rx AMPDU sessions

Those devices have more BAIDs, which is the hardware module
that tracks the BA session.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220128153014.7120a90ed7d2.I9d6d907a2c1b965d1e42ff9f0886b1df627e4761@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 971cbe50 28-Jan-2022 Johannes Berg <johannes.berg@intel.com>

iwlwifi: make iwl_fw_lookup_cmd_ver() take a cmd_id

Instead of taking the group/command separately, make the function
take a combined command ID. In many cases, this allows us to pass
an existing command ID (e.g. cmd.id), or introduce a new variable
for it, so that we don't use the command ID twice.

This way, we can also use LONG_GROUP implicitly, so we don't need
to spell that out for many commands.

Apart from mvm.h, fw/img.{c,h} changes and some copyright and
indentation updates, this was done with spatch:

@@
identifier cmd;
expression fw, G, C, def;
@@
struct iwl_host_cmd cmd = {
.id = WIDE_ID(G, C),
...
};
...
-iwl_fw_lookup_cmd_ver(fw, G, C, def)
+iwl_fw_lookup_cmd_ver(fw, cmd.id, def)

@@
identifier cmd;
expression fw, C, def;
@@
struct iwl_host_cmd cmd = {
.id = C,
...
};
...
-iwl_fw_lookup_cmd_ver(fw, \(IWL_ALWAYS_LONG_GROUP\|LONG_GROUP\), C, def)
+iwl_fw_lookup_cmd_ver(fw, cmd.id, def)

@@
identifier func;
expression fw, G, C, mvm, flags, cmd, size, def;
type rettype;
@@
rettype func(...)
{
+u32 cmd_id = WIDE_ID(G, C);
...
-iwl_fw_lookup_cmd_ver(fw, G, C, def)
+iwl_fw_lookup_cmd_ver(fw, cmd_id, def)
...
-iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(G, C), flags, cmd, size)
+iwl_mvm_send_cmd_pdu(mvm, cmd_id, flags, cmd, size)
...
}

@@
identifier func;
expression fw, G, C, mvm, flags, cmd, size, def;
type rettype;
@@
rettype func(...)
{
+u32 cmd_id = C;
...
-iwl_fw_lookup_cmd_ver(fw, \(IWL_ALWAYS_LONG_GROUP\|LONG_GROUP\), C, def)
+iwl_fw_lookup_cmd_ver(fw, cmd_id, def)
...
-iwl_mvm_send_cmd_pdu(mvm, C, flags, cmd, size)
+iwl_mvm_send_cmd_pdu(mvm, cmd_id, flags, cmd, size)
...
}

@@
expression fw, C, def;
@@
-iwl_fw_lookup_cmd_ver(fw, \(IWL_ALWAYS_LONG_GROUP\|LONG_GROUP\), C, def)
+iwl_fw_lookup_cmd_ver(fw, C, def)

@@
expression fw, C, G, def;
@@
-iwl_fw_lookup_cmd_ver(fw, G, C, def)
+iwl_fw_lookup_cmd_ver(fw, WIDE_ID(G, C), def)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220128153014.c4ac213cef5c.I6fd9a4fcbcf16ef3a3ae20a2b08ee54ebe06f96f@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ad12b231 28-Jan-2022 Nathan Errera <nathan.errera@intel.com>

iwlwifi: mvm: offload channel switch timing to FW

Since FW is now in charge of timing the channel switch, there is no need
to send the add/modify/remove time event command to fw with every (e)CSA
element.
However, the driver needs to cancel the channel switch if the CS start
notification arrives and it does not know about an ongoing channel switch.

Signed-off-by: Nathan Errera <nathan.errera@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220128153013.ac3af0ff22c7.Ie87c62047b71b93b12aa80b5dc5391b4798dbe97@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 92883a52 28-Jan-2022 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: remove deprecated broadcast filtering feature

This feature has been deprecated and should not be used anymore. With
newer firmwares, namely *-67.ucode and above, trying to use it causes an
assertion failure in the FW, similar to this:

[Tue Jan 11 20:05:24 2022] iwlwifi 0000:04:00.0: 0x00001062 | ADVANCED_SYSASSERT

In order to prevent this feature from being used, remove it entirely
and get rid of the Kconfig option that
enables it (IWLWIFI_BCAST_FILTERING).

Fixes: cbaa6aeedee5 ("iwlwifi: bump FW API to 67 for AX devices")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215488
Cc: stable@vger.kernel.org # 5.16.x
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/iwlwifi.20220128144623.9241e049f13e.Ia4f282813ca2ddd24c13427823519113f2bbebf2@changeid


# 7cf800f4 28-Jan-2022 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: don't feed the hardware RFKILL into iwlmei

iwlmei can trigger a hardware RFKILL when the CSME firmware
does not want the host to touch the device.
But then, iwlmvm reports RFKILL which makes cfg80211 update
iwlmvm about RFKILL. iwlmvm then thinks there is a change in
the _software_ rfkill and it calls rfkill_blocked() to fetch
the RFKILL state. This returns that RFKILL is blocked (because
of iwlmei) and iwlmvm tells iwlmei that _software_ RFKILL is
asserted.

This is a bug of course.
Fix this by checking explicitly the software RFKILL state and
not the overall RFKILL state.

Fixes: 7ce1f2157e14 ("iwlwifi: mvm: read the rfkill state and feed it to iwlmei")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Fixes: 7ce1f2157e14 ("iwlwifi: mvm: read the rfkill state and feed it to iwlmei")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/iwlwifi.20220128142706.f293861a3f92.I9553d27df1de6fd5756a43ea5f8b89d06fa1a6f2@changeid


# 73ca8763 19-Dec-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: remove card state notification code

This notification ID was actually used for something else we
never implemented, but luckily we only had some debug code
here. Just remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211219132536.a67b5b9db259.Ic55b306fcd2a3525b3993f4b7e00622dd95053ba@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0792df68 19-Dec-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: support Bz TX checksum offload

Support TX checksum offload for Bz devices, where we have full
checksum offload (NETIF_F_HW_CSUM) and the hardware doesn't
need to parse the IP headers or anything.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211219132536.c0f44c98b36d.I75a688f3ac80cbe824c459ece4bb67843b9fce76@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4b992db6 04-Dec-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: optionally suppress assert log

Normally, when we hit an assert, we print out all the
assert data. However, in certain tests, when we trigger
it from debugfs intentionally, that can be useless and
confusing.

Allow writing the string "nolog\n" to the fw_nmi and
fw_restart files suppressing the assert dump as well
as - in the case of fw_restart - the

iwlwifi 0000:00:00.0: FW error in SYNC CMD REPLY_ERROR

message.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211204174546.75e29a2ab68d.Id3064feda2ce7a77c116c6d6e71ce5ff447c6e86@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# c48e93a6 03-Dec-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: support RLC configuration command

There's an RLC configuration command in the firmware that's
going to replace the chain information in the PHY context.
Add support for this command, while leaving the PHY context
fields unset when we know the RLC command will be used.

Also add support to send only the RLC configuration command
if only the # of chains used on the PHY context changes.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211204083238.55faa3782bb0.I3f9d0071e680cab513c59b093d0827af99d41c51@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7ce1f215 11-Nov-2021 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: read the rfkill state and feed it to iwlmei

Read the rfkill state upon boot, mac start and mac stop.

Reviewed-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211112062814.7502-6-emmanuel.grumbach@intel.com


# bfcfdb59 11-Nov-2021 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: add vendor commands needed for iwlmei

Add the vendor commands that must be used by the network manager
to allow proper operation of iwlmei.

* Send information on the AP CSME is connected to
* Notify the userspace when roaming is forbidden
* Allow the userspace to require ownership

Co-Developed-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

v6: remove the VENDOR_CMDS Kconfig option and make the whole infra
depend on IWLMEI directly
v7: remove // comments
remove an unneeded function
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211112062814.7502-5-emmanuel.grumbach@intel.com


# 6d19a5eb 11-Nov-2021 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: integrate with iwlmei

iwlmei needs to know about the follwing events:

* Association
* De-association
* Country Code change
* SW Rfkill change
* SAR table changes

iwlmei can take the device away from us, so report the new
rfkill type when this happens.
Advertise the required data from the CSME firmware to the
usersapce: mostly, the AP that the CSME firmware is currently
associated to in case there is an active link protection
session.
Generate the HOST_ASSOC / HOST_DISSASSOC messages.

Don't support WPA1 (non-RSNA) for now.
Don't support shared wep either.
We can then determine the AUTH parameter by checking the AKM.
Feed the cipher from the key installation.

SW Rfkill will be implemented later when cfg80211 will
allow us to read the SW Rfkill state.

Co-Developed-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

v7: Ayala added her signed-off
remove pointless function declaration
fix a bug due to merge conflict in the HOST_ASSOC message
v8: leave a print if we have a SAP connection on a device we do
not support (yet)
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211112062814.7502-4-emmanuel.grumbach@intel.com


# 5283dd67 10-Nov-2021 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: mvm: retry init flow if failed

In some very rare cases the init flow may fail. In many cases, this is
recoverable, so we can retry. Implement a loop to retry two more times
after the first attempt failed.

This can happen in two different situations, namely during probe and
during mac80211 start. For the first case, a simple loop is enough.
For the second case, we need to add a flag to prevent mac80211 from
trying to restart it as well, leaving full control with the driver.

Cc: <stable@vger.kernel.org>
Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20211110150132.57514296ecab.I52a0411774b700bdc7dedb124d8b59bf99456eb2@changeid


# 6905eb1c 24-Oct-2021 Nathan Errera <nathan.errera@intel.com>

iwlwifi: rename CHANNEL_SWITCH_NOA_NOTIF to CHANNEL_SWITCH_START_NOTIF

There is no relation between the name and the purpose of the
notification. This notification is sent from FW when the channel switch
starts.

Signed-off-by: Nathan Errera <nathan.errera@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211024181719.24b71b0cb741.I97deb70e18f259de51395a1e7c7e58c7b006c317@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8b75858c 17-Oct-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: set BT-coex high priority for 802.1X/4-way-HS

Set BT coex high priority during the 802.1X handshake to avoid
issues where BT is active enough to kill all the big negotiation
frames that we may need to send (e.g. with a large certificate),
leading to the connection not being established correctly. Give
WiFi priority over BT during this short but critical phase.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211017165728.a1825bbba397.I10315577fb41dfcec15c92e8f6785d9655f74c6a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# dc52fac3 17-Oct-2021 Miri Korenblit <miriam.rachel.korenblit@intel.com>

iwlwifi: mvm: Support new TX_RSP and COMPRESSED_BA_RES versions

As part of the new rate_n_flags, a new version of this
structures was added in the FW. Add support for this new
version and for the new rate_n_flags in this API.
Both these APIs were updated in one patch since they are
using the same functions.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211017162352.a28e7a92f558.I19f72735c674f815c6e7c11cecfad6230b4510ef@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cd2c46a7 17-Oct-2021 Miri Korenblit <miriam.rachel.korenblit@intel.com>

iwlwifi: mvm: Support new version of BEACON_TEMPLATE_CMD.

As part of the new rate_n_flags, a new version of
BEACON_TEMPLATE_CMD was added in FW in order to support
the new rate_n_flags.
Add support for the new version.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211017162352.b42e67f14293.Ic3f1ed8cb3a31cfaa51174497dd993936b00d398@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d35d95ce 17-Oct-2021 Miri Korenblit <miriam.rachel.korenblit@intel.com>

iwlwifi: mvm: Add support for new rate_n_flags in tx_cmd.

As part of the new rate_n_flags, tx_cmd API has changed.
Add support for these changes.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211017162352.26efa51624b1.Ic96ae4d81b3ff07fb514df2b5f6a8e470e4d3778@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 82cdbd11 16-Oct-2021 Miri Korenblit <miriam.rachel.korenblit@intel.com>

iwlwifi: mvm: Support version 3 of tlc_update_notif.

As part of the new rate_n_flags, a new version of tlc_update_notif
was added in FW in order to support the new rate_n_flags.
Add support for the new version, and move the all API to use the
new rate_n_flags only (if FW supports the old one - convert it).

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211017123741.9fc0cb5d5898.I1f88e02317f79f1be7f792c01236d836045a44b3@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 78a19d52 05-Aug-2021 Miri Korenblit <miriam.rachel.korenblit@intel.com>

iwlwifi: mvm: Read the PPAG and SAR tables at INIT stage

We used to read the PPAG, WRDS, EWRD, WGDS tables from ACPI
in the load stage only. This prevented vendor commands from
being executed before bringing the interface up. Move reading those tables
to INIT stage.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.ce3b60f0b426.I3643bf00e714aae930880cc7d6cf390b142eaccb@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# c1868c0b 02-Aug-2021 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: remove check for vif in iwl_mvm_vif_from_mac80211()

This check is useless, because we would return NULL in that case and
none of the callers actually check that the return value was not NULL
before accessing it.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802172232.f1c4844a2650.If4dc009e22cda51099a1dc4237d04bf4313055d6@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4db7cf1e 21-Jun-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: move error dump to fw utils

Conceptually, this belongs more into the firmware utils
rather than the mvm opmode, so move the collection and
output there.

Note that this slightly changes the format of the Status
line.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210621103449.b82b60d81346.Ide3b688107f6a59c7fc7eb1d8f2002b0a5c1f2d2@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 5c157941 21-Jun-2021 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: introduce iwl_wowlan_get_status_cmd

We need to pass the station id to teach the firmware on which
station id we want to get the status.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210621103449.45218d913d07.I61a086936508230d86b454636945ceb0b9ea09fd@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 2a7ce54c 17-Jun-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: honour firmware SMPS requests

The firmware can now request SMPS (due to thermal conditions), add
some code to honour such requests and bubble them up through the
stack, subject to our other SMPS constraints, e.g. from Bluetooth.

Then, if the firmware requests SMPS, then we know that it supports
a small extension to the PHY configuration API where a chain mask
of 0 means "use 1 but pick which one yourself", so in this case we
use that extension.

During firmware restart, we stay in the previous state, and the FW
will send us a notification at startup (only) if the temperature is
below the lower or above the high threshold, to sync the state.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210617100544.85656b7684b9.I7a661a0758d070a750d3a91874d1a0f5fab9febc@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# a171399f 17-Jun-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: apply RX diversity per PHY context

SMPS requests may differ per interfaces due to e.g. Bluetooth
only interfering on 2.4 GHz, so if that's the case we should,
in the case of multiple PHY contexts, still allow RX diversity
on PHY context that have no interfaces with SMPS requests.

Fix the code to pass through the PHY context in question and
skip interfaces with non-matching PHY context while iterating.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210617100544.123c6b05809d.I992e3d1c6a29850d02eeec01712b5b685b963a87@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# c4ae8b9d 12-Jun-2021 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: pass the clock type to iwl_mvm_get_sync_time()

Allow the caller to pass the clock type to iwl_mvm_get_sync_time() so
callers with different needs can decide whether to use boottime or
realtime.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210612142637.093f6660e69b.Ifd2328ac2130269f729c9c1bceec44ba01d79e88@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0c73f47b 10-Apr-2021 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: remove TCM events

Nobody uses that in the user space.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124417.b6560a5de0cd.I5dac9c60faed7f48b06d352aa2d65bcf8142c2dc@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e8fe3b41 30-Mar-2021 Ilan Peer <ilan.peer@intel.com>

iwlwifi: mvm: Add support for 6GHz passive scan

When doing scan while 6GHz channels are not enabled, the 6GHz band
is not scanned. Thus, if there are no APs on the 2GHz and 5GHz bands
(that will allow discovery of geographic location etc. that would
allow enabling the 6GHz channels) but there are non collocated APs
on 6GHz PSC channels these would never be discovered.

To overcome this, FW added support for performing passive UHB scan
in case no APs were discovered during scan on the 2GHz and 5GHz
channels.

Add support for enabling such scan when the following conditions are
met:

- 6GHz channels are supported but not enabled by regulatory.
- Station interface is not associated or less than a defined time
interval passed from the last resume or HW reset flows.
- At least 4 channels are included in the scan request
- The scan request includes the widlcard SSID.
- At least 50 minutes passed from the last 6GHz passive scan.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.7c7bd00e0aeb.Ib226ad57e416b43a710c36a78a617d4243458b99@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 5e1688ce 30-Mar-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: clean up queue sync implementation

When we do queue sync, it's confusing that we have the structures
declared in the FW API header files that aren't really firmware,
and the union is also confusing - especially now in the code that
checks the size on the return.

So rework this: change the type of sync and whether to do it in a
synchronous fashion to arguments, and build the data structure in
the function, so we don't need the union.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.f62833fd9893.I612d7ac1c655ec4880329360e15d207698c750bc@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8c082a99 10-Feb-2021 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: simplify iwl_mvm_dbgfs_register

No need to pass the dbgfs_dir just to assign it to mvm.
Assign to mvm and then call iwl_mvm_dbgfs_register.

This is a preparation towards the addition of a delayed
op_mode_start flow.
This will allow to split the op_mode_start flow.
Registration to debugfs must happen after we register to
mac80211 and the registration to mac80211 will soon be
delayed in certain cases. In order not to have to remember
the debugfs_dir in a separate variable, just set it into
the mvm structure so that it can be usable later.

Declare mvm->debugfs_dir in the iwl_mvm structure even when
IWLWIFI_DEBUGFS isn't enabled to simplify the source code.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210210171218.a92ee491863d.I047923aa3598fbf4fb6fce2cdff75a4969fedd76@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 21254908 10-Feb-2021 Gregory Greenman <gregory.greenman@intel.com>

iwlwifi: mvm: add RFI-M support

RF Interference Mitigation is a new feature targeted to handle the
problem of interference between DDR memory and WiFi. The role of
the driver is to configure FW with the table holding a mapping
between problematic channels/bands and the corresponding frequencies.

This patch adds RFI infrastructure and adds two debugfs hooks:
- send RFI configuration command (currently with a default table) which
will reset feature in the FW
- read the table, used by the FW (which can be a subset of the table
that driver sent).

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210210171218.2cea55a09bc7.I634b79795abad499ce442631d6672ffef8fc6d41@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d8367b12 05-Feb-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: make iwl_mvm_tt_temp_changed() static

This is only needed within tt.c, make it static.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210205110447.20a74526d395.Id24304ec1ae4b3096dbb8112bd146b364920e89e@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b1fdc250 05-Feb-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: advertise BIGTK client support if available

If the firmware has support, then advertise it to the stack and
send the key down. Since we re-check the protection in the host
anyway, we don't really need to do anything on RX except that we
should drop frames that the firmware _knows_ are replay errors,
since beacon filtering might otherwise result in replays being
possible.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210205110447.f5a3d53301b3.I23e84c9bb0b039d9106a07e9d6847776757f9029@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d4e3a341 17-Jan-2021 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: mvm: add support for new flush queue response

In the new api all the flush in the FW is done before we
get the response and in the response we only get the updated
read pointer and all queued packets don't get anymore rx_tx
per packet to free the queued packet, so driver needs to free
all queued packets on flushed queue at once after flush response.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210117130510.4bd0eca8c0ef.I1601aad2eb2cc83f6f73b8ca52be57bb9fd626ab@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f7d6ef33 17-Jan-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: handle CCA-EXT delay firmware notification

If there are frequent CCA delays due to the extension channel
as detected by the firmware, and we're on 2.4 GHz, then handle
this by disconnecting (with a reconnect hint).

When we disconnect, we'll also update our capabilities to use
only 20 MHz on the next connection (if it's on 2.4 GHz) as to
avoid the use of the extension channel that has too much noise.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210117130510.4de9c363b0b5.I709b7e6f73a7537c53f22d7418927691259de8a8@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 88181e6e 17-Jan-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: remove debugfs injection limitations

For testing features where the firmware may send some
notifications it can often be a lot easier to do that
from a test script. Remove most injection limitations
from debugfs to be able to do this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210117130510.9aff3c6b4607.I03b0ae7df094734451445ffcb7f9f0274969f1c0@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8e99ea8d 09-Dec-2020 Johannes Berg <johannes.berg@intel.com>

iwlwifi: use SPDX tags

Use SPDX tags instead of the long copyright notices. Also cleanup
some duplicate copyright notices and combine the years where possible.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201210000603.481bcb512a6f.I8146abe5a637079e7336209f23cb26af98b12b31@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 2f7a04c7 09-Dec-2020 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: do more useful queue sync accounting

We're currently doing accounting on the queue sync with an
atomic variable that counts down the number of remaining
notifications that we still need.

As we've been hitting issues in this area, modify this to
track a bitmap of queues, not just the number of queues,
and print out the remaining bitmap in the warning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.0a3fa177cd6b.I7c69ff999419368266279ec27dd618eb450908b3@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cf5b4627 09-Dec-2020 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: move iwl_mvm_stop_device() out of line

This function has grown quite a bit over time, move it
out of line before we grow it even further.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.1a0211e66906.I572eb69dc3738319310c9cbe03a36d942f4f68f7@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e20a5c9f 09-Dec-2020 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: clear up iwl_mvm_notify_rx_queue() argument type

The argument type to iwl_mvm_notify_rx_queue() is currently just
a u8 *, but that's misleading because we actually need the inner
data to be of type struct iwl_mvm_internal_rxq_notif, because we
interpret it when we get it back from the device (to check the
sync bool and possibly the cookie.)

Therefore, clear up any potential confusion and require that the
data passed is of type struct iwl_mvm_internal_rxq_notif *.

Also, while at it, rename the "count" to "notif_size" as "count"
doesn't really clearly say what it's counting.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.d28e14682bdc.I9ac366aa97db045be4daa4ba263267a3ac6a6a2f@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# eae94cf8 09-Dec-2020 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: add support for 6GHz

Add support to the 6GHz band (aka. Ultra High Band or UHB). This
allows us to scan and connect to channels in that band, including all
the relevant features, such as preferred scan channels, colocated
channels etc.

Co-developed-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Co-developed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Co-developed-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Co-developed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Co-developed-by: Tali Levi Rovinsky <Tali.Levi-rovinsky@intel.com>
Signed-off-by: Tali Levi Rovinsky <Tali.Levi-rovinsky@intel.com>
Co-developed-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Co-developed-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201210000657.0fdbfc3d7352.Idb648536faf21716e2ab2c6d6890d3e49f719cd3@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 3b25f1af 09-Dec-2020 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: remove the read_nvm from iwl_run_init_mvm_ucode

If we already read the NVM, we don't need to read it again.
Make sure that this is the case with a WARNING.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.8e0ffce7f873.Ie526042c4d4b93d9116c90f53180cbadef0b32cb@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f9084775 08-Oct-2020 Nathan Errera <nathan.errera@intel.com>

iwlwifi: mvm: prepare roc_done_wk to work sync

As part of changes made to properly support auxiliary activities in CDB
NICs, an aux sta will be added when using hot spot 2.0 and will need
to be removed when roc flow is done.
In order to do so, prepare the roc_done_wk to work synchronously as the
rm_aux_sta is a SYNC command.

Since now all of th iwl_mvm_flush_sta function are using it sync,
removed the flag argument from the function.

Signed-off-by: Nathan Errera <nathan.errera@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20201008180656.71b441c8b682.Ia1d216cb680308b91d6da9f73e23ae9f4baac79f@changeid


# be9ae34e 08-Oct-2020 Nathan Errera <nathan.errera@intel.com>

iwlwifi: mvm: get number of stations from TLV

FW is changing the max number of supported stations. To adapt to the
change we get the max number from the TLV and act according to the new
number.

Signed-off-by: Nathan Errera <nathan.errera@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20201008180656.863ab470babc.I393223392f36436663c4e66add03fefe77b74e60@changeid


# 2a42aea7 30-Sep-2020 Nathan Errera <nathan.errera@intel.com>

iwlwifi: mvm: support more GTK rekeying algorithms

add and use new API version for GTK rekeying. This will allow our
firmware to do GTK rekeying for more algorithms (GCMP 128, GCMP 256,
SAE).

Signed-off-by: Nathan Errera <nathan.errera@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200930161256.be16c51fef3c.If4fac0fbc5bede4679b5f875b60c4e9a6ea7ca7c@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0739a7d7 30-Sep-2020 Avraham Stern <avraham.stern@intel.com>

iwlwifi: mvm: initiator: add option for adding a PASN responder

Add an option for adding a PASN responder, specifying the HLTK and
TK (if not associated). When a receiving a range request for a
PASN responder, the driver will ask for a secured measurement with
the specified HLTK and TK.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200930161256.28c5f5266000.I2d58b72ff92c47ac33a6aacc27fbf3790b6dfc51@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 890d814b 30-Sep-2020 Avraham Stern <avraham.stern@intel.com>

iwlwifi: mvm: location: set the HLTK when PASN station is added

When a PASN station is added, set the HLTK to FW.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200930161256.1c7a59fd3164.I68005f0015ad04e53d0239e2d2ee85d5ffdeaa37@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b68bd2e3 30-Sep-2020 Ilan Peer <ilan.peer@intel.com>

iwlwifi: mvm: Add FTM initiator RTT smoothing logic

The overcome instabilities in the RTT results add smoothing logic
to the reported results. In short, the smoothing logic tracks the
RTT average of each responder for a period of time, and in case
a new RTT results is found to be a spur, the tracked RTT average
is reported instead of the current RTT measurement.

Smooth logic debug configuration using iwl-dbg-cfg.ini:

- MVM_FTM_INITIATOR_ENABLE_SMOOTH: Set to 1 to enable smoothing logic
(default=0).
- MVM_FTM_INITIATOR_SMOOTH_ALPHA: A value between 0 - 100, defining
the weight of the current RTT results vs. the RTT average tracked
based on the previous results. A value of 100 means use only the
current RTT results.
- MVM_FTM_INITIATOR_SMOOTH_AGE_SEC: The maximal time in seconds in which
the RTT average tracked based on previous results is considered valid.
- MVM_FTM_INITIATOR_SMOOTH_UNDERSHOOT: if the current RTT is positive
and below the RTT average by at least this value, report the average
RTT instead of the current one. In units of picoseconds.
- MVM_FTM_INITIATOR_SMOOTH_OVERSHOOT: if the current RTT is positive
and above the RTT average by at least this value, report the average
RTT instead of the current one. In units of picoseconds.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200930161256.48a9cec2081b.Iaec1e29f738232adfe9e2ea8e9eb9b6ff0323ae1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1c096d89 27-Sep-2020 Avraham Stern <avraham.stern@intel.com>

iwlwifi: mvm: add support for range request command ver 11

Version 11 of the range request command adds support for setting
the PN for secure ranging. For now, this is not yet supported.

The same functions that are used for version 9 and 10 are also
used for version 11 as the common part is the same.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200928121852.6f9ed4140e8c.I046e0d9f6dfaafda9794e5eb2ee1f02fcad2851a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e80bfd11 27-Sep-2020 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: fw: add default value for iwl_fw_lookup_cmd_ver

For new APIs this avoids checking every return if it's
IWL_FW_CMD_VER_UNKNOWN (99) or it's lower than the new API value

Done with spatch:
-iwl_fw_lookup_cmd_ver(E1, E2, E3)
+iwl_fw_lookup_cmd_ver(E1, E2, E3, IWL_FW_CMD_VER_UNKNOWN)

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200928121852.70bec6eb8008.I6ea78553801d33f7ed10fcd2e4be4ba781fe469a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# dd2a1256 27-Sep-2020 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: acpi: rename geo structs to contain versioning

Add the version number to the iwl_geo_tx_power_profile_cmd structs and
move the union into a common place. Additionally, reuse the code that
sets elements that are at the same place in the struct across
different versions.

While at it remove an unused variable, add a comment and move the v2
specific element setting to inside the if statement. Additionally,
invert the if for slightly more readability.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200928121852.23ec241f16cd.I8cd21fc5a2498e820b50e1f49a4cbfe545afe30e@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cfa5d0ca 25-Sep-2020 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: mvm: remove redundant support_umac_log field

Currently we have the same info in two variables,
If umac_error_event_table is 0, we know that UMAC log is not supported,
so we don't need the support_umac_log field.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200926002540.299959eeb47b.Ie1f3eecc06e3620098dda74f674f6409b90fe7fa@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# be82ecd3 11-Sep-2020 Avraham Stern <avraham.stern@intel.com>

iwlwifi: mvm: add an option to add PASN station

A FTM responder may do PASN authentication with unassociated stations
to allow secure ranging. In this case, the driver will add an internal
station and install the TK so the FW will accept protected FTM
request frames from this station and will send a protected FTM
response frame.

In addition, the driver needs to configure the HLTK to the FW so
the FW can derive the secure LTF bits. This is left for a later
patch since it is not yet supported by the FW.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200911204056.c915b44ad7dd.I72ef7f9753964555561c27ec503241105eddb14e@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 9617040e 24-Apr-2020 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: remove iwlmvm's tfd_q_hang_detect module parameter

This should be controlled by the firmware debugging mechanism
and not by a module parameter. This has always been true.
Remove it and assume it is set.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200424182644.b6e4982e62ae.I7f7352f79c40ada2f221bd4b41449a40821e833f@changeid


# 4af11950 21-Apr-2020 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: move API version lookup to common code

The API version lookup is parsed from a TLV and should be in shared code
make make it reusable across all opmodes.

Also change the function names from mvm to fw, since this is not
mvm-specific anymore.

Additionally, since this function is not just a single line of code, it
shouldn't be inline. Convert them to actual functions.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200421133326.cf94672dfcdb.I5ede9cc25ee8de7b8d2b5c574f917a18971da734@changeid


# 5d1234ba 04-Nov-2019 Tova Mussai <tova.mussai@intel.com>

iwlwifi: scan: support FW APIs with variable number of profiles

The FW changed the maximum number of scan offload profiles to 8 in new
APIs. Support it by changing the scan_offload_profile_cfg struct to be
more dynamic, so we can reuse most of the code and only change size of
the profiles array.

Change-Id: I65210cf541af46e2675a8c764d5871f7f5b070d6
Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f06021a1 16-Dec-2019 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: remove lar_disable module parameter

This is an old parameter that was used supposed to be used only when
LAR was still under development. It should not be used anymore, but,
since it's available, end-users have been mangling with it
unnecessarily. In some cases it can cause problems because when LAR
is supported the driver and the firmware do not expect it to be
disabled.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# df2378ab 11-Dec-2019 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: fix potential SKB leak on TXQ TX

When we transmit after TXQ dequeue, we aren't paying attention to
the return value of the transmit functions, leading to a potential
SKB leak.

Refactor the code a bit (and rename ..._tx to ..._tx_sta) to check
for this happening.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Fixes: cfbc6c4c5b91 ("iwlwifi: mvm: support mac80211 TXQs model")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1019f9ef 30-Sep-2019 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: update powersave correctly for D3

This fixes a long-standing bug - we haven't been able to check the
firmware image that was loaded for D3/not-D3 since the introduction
of the unified image...

Fix this by keeping a status flag for D3 instead of checking for
the firmware image that's loaded.

This reduces occurrences of checks for IWL_UCODE_WOWLAN to just the
code that actually loads the image or deals with it in other ways.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 39c1a972 15-Nov-2019 Ihab Zhaika <ihab.zhaika@intel.com>

iwlwifi: refactor the SAR tables from mvm to acpi

Refactored the SAR related functions from iwlmvm to acpi
in order to make it shared between different opmodes
in addition to removing unused variable ppag_rev.

Signed-off-by: Ihab Zhaika <ihab.zhaika@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 687db6ff 15-Nov-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: scan: make new scan req versioning flow

Implement a new versioning handling flow supported from version 11
onwards.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 19ff9b2c 15-Nov-2019 Tova Mussai <tova.mussai@intel.com>

iwlwifi: scan: adapt the code to use api ver 11

FW scan api ver 11 adds support for some new features,
in this version the fw did also some cleanup in the api,
which causes the driver not to be able to use the
current scan req struct.

Therefore, in this patch the driver has new version for the scan command
code

Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 3d206e68 29-Oct-2019 Ayala Beker <ayala.beker@intel.com>

iwlwifi: fw api: support new API for scan config cmd

The API was reduced to include only knowledge currently needed by the
FW scan logic, the rest is legacy. Support the new, reduced version.

Using the old API with newer firmwares (starting from
iwlwifi-*-50.ucode, which implements and requires the new API version)
causes an assertion failure similar to this one:

[ 2.854505] iwlwifi 0000:00:14.3: 0x20000038 | BAD_COMMAND

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 65b9425c 01-Aug-2019 Tova Mussai <tova.mussai@intel.com>

iwlwifi: rx: use new api to get band from rx mpdu

The FW introduce new API to get the band from the rx mpdu,
use this new API.

Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 3717f91a 31-Jul-2019 Tova Mussai <tova.mussai@intel.com>

iwlwifi: mvm: create function to convert nl80211 band to phy band

Create the function and use it.

Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 449a29d0 18-Jul-2019 Lior Cohen <lior2.cohen@intel.com>

iwlwifi: mvm: add notification for missed VAP

A missed VAP notification will be sent from umac when
the station is out of sync with its associated non-transmitted
BSSID. The notification will be sent only if the transmitted
BSSID is an EMA-AP one.

The driver will consider this notification as connection loss.

Signed-off-by: Lior Cohen <lior2.cohen@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d3b4dc01 23-Jul-2019 Haim Dreyfuss <haim.dreyfuss@intel.com>

iwlwifi: mvm: add support for new version for D0I3_END_CMD

During D3 state there are some flows which requires FW reset.
Add new API to support it.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# fe69b7d1 04-Jul-2019 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: handle BAR_FRAME_RELEASE (0xc2) notification

In prior hardware generations (e.g. 9000 series), we received the BAR
frame with fake NSSN information to handle releasing frames from the
reorder buffer for the default queue, the other queues were getting
the FRAME_RELEASE notification in this case.

With multi-TID block-ack, the firmware no longer sends us the BAR
frame because the fake RX is quite big (just the metadata is around
48 bytes or so). Instead, it now sends us one (or multiple) special
release notifications (0xc2). The hardware consumes these as well,
but only generates the FRAME_RELEASE (0xc3) for queues other than
the default queue. We thus need to handle them in the same way we
handle the normal FRAME_RELEASE.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0968fbfa 16-Jul-2019 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: drop BA sessions on too many old-SN frames

Certain APs (I think a certain Broadcom model) interact badly with our
full state BA bitmap handling, and if triggered badly with many powersave
transitions they keep sending frames from before the window, which our
hardware then doesn't appear to ACK (to them) since it has moved on and
is sending ACKs for higher SNs now.

Try to detect this situation and if this keeps happening, disable the
aggregation session.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7d34a7d7 12-Jul-2019 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: always access the trans configuration via trans

Stop accessing the trans configuration via the iwl_cfg structure and
always access it via the iwl_trans structure. This completes the
requirements to disassociate the trans-specific configuration from the
rest of the configuration.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 286ca8eb 12-Jul-2019 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: add a pointer to the trans_cfg directly in trans

Add a pointer to the iwl_trans structure and point it to the trans
part of the cfg. This is the first step in disassociating the trans
configuration from the rest of the configuration.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 79b6c8fe 02-Aug-2018 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: separate elements from cfg that are needed by trans_alloc

In order to be able to select the cfg depending on the HW revision or
on the RF ID, we need to set up the trans before selecting the cfg.
To do so, move the elements from cfg that are needed by
iwl_trans_alloc() to a separate struct at the top of the cfg, so it
can be used by other cfg types as well, before selecting the rest of
the configuration.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 6ce1e5c0 16-Jun-2019 Gil Adam <gil.adam@intel.com>

iwlwifi: support per-platform antenna gain

TX power limits as defined in the OTP assume the worst case scenario
in terms of the platform's atenna gain, but most platforms are below
that value so they can use more TX power without passing the regulatory
limit. If the platform indicates in the BIOS that it indeed has lower
gain, and the geographic location allows it, higher TX power can be
used. The driver reads the PPAG (Per-Platform Antenna Gain) data from
BIOS (if it exists), validates it and sends the appropriate command to
the FW. This flow happens once at FW init, in case of suspend/resume
there is no need to read again from BIOS as we save those values during
init, so just send the PPAG command again to FW.

Signed-off-by: Gil Adam <gil.adam@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ba7136f3 10-Jun-2019 Alex Malamud <alex.malamud@intel.com>

iwlwifi: Set w-pointer upon resume according to SN

During D3 state, FW may send packets.
As a result, "write" queue pointer will be incremented by FW.
Upon resume from D3, driver should adjust its shadows of "write" and "read"
pointers to the value reported by FW.

1. Keep TID used during wowlan configuration.
2. Upon resume, set driver's "write" and "read" queue pointers
to the value reported by FW.

Signed-off-by: Alex Malamud <alex.malamud@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 242d9c8b 11-Jun-2019 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: use FW thermal monitoring regardless of CONFIG_THERMAL

It doesn't make sense to use the FW thermal monitoring only if we
have CONFIG_THERMAL, because then we use the default thresholds
etc. which may be different from what the firmware implements, as
we don't maintain them in the driver now. Only the CTDP code needs
to actually be under CONFIG_THERMAL.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# de645c93 23-May-2019 Ayala Beker <ayala.beker@intel.com>

iwlwifi: scan: add support for new scan request command version

Scan API was changed to support 6Ghz channels as well.
Support the new version.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 66cdca01 06-Jun-2019 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: remove last leftovers of d0i3

We're now left with a status bit that is never set and a few
other leftovers.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 632fa0ea 06-Jun-2019 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: remove iwl_mvm_update_d0i3_power_mode

Also change the signature of the power functions that won't
receive d0i3=true anymore.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 99970e4a 06-Jun-2019 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: remove d0i3_ap_sta_id

This variable read, but never set. Remove it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0ea93388 06-Jun-2019 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: iwl_mvm_wowlan_config_key_params is for wowlan only

Now that d0i3 is dead, this function can't be called from d0i3
flows. Change its signature and make it static.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 45745363 06-Jun-2019 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: remove the d0i3 entry/exit flow

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4d4183c4 06-Jun-2019 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: remove the tx defer for d0i3

This is not needed anymore

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 58d3bef4 11-Jun-2019 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: remove all the d0i3 references

As part of the d0i3 removal.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 203c83d3 22-May-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: move debug recording stop from trans to op mode

The op mode should stop the debug recording and not the transport layer.
Rename iwl_fwrt_stop_device into iwl_fw_dbg_stop_sync and move the debug
stop recording to it.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4f58121d 19-May-2019 Ilan Peer <ilan.peer@intel.com>

iwlwifi: mvm: Block 26-tone RU OFDMA transmissions

In case that there are OBSS that do not know how to properly
interpret 26-tone RU OFDMA transmissions, instruct the FW not
to use such transmissions.

The check is currently only performed upon association.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cd4d6b0b 30-Jun-2019 Gregory Greenman <gregory.greenman@intel.com>

iwlwifi: mvm: send LQ command always ASYNC

The only place where the command was sent as SYNC is during
init and this is not really critical. This change is required
for replacing RS mutex with a spinlock (in the subsequent patch),
since SYNC comamnd requres sleeping and thus the flow cannot
be done when holding a spinlock.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 3c514bf8 24-Jun-2019 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: add a loose synchronization of the NSSN across Rx queues

In order to support MSI-X efficiently, we want to avoid
communication across Rx queues. Each Rx queue should have
all the data it needs to process a packet.

The reordering buffer is a challenge in the MSI-X world
since we can have a single BA session whose packets are
directed to different queues. This is why each queue has
its own reordering buffer. The hardware is able to hint
the driver whether we have a hole or not, which allows
the driver to know whether it can release a packet or not.
This indication is called NSSN. Roughly, if the packet's
SN is lower than the NSSN, we can release the packet to
the stack. The NSSN is the SN of the newest packet received
without any holes + 1.

This is working as long as we don't have packets that we
release because of a timeout. When that happens, we could
have taken the decision to release a packet after we have
been waiting for its predecessor for too long. If this
predecessor comes later, we have to drop it because we
can't release packets out of order. In that case, the
hardware will give us an indication that we can we release
the packet (SN < NSSN), but the packet still needs to be
dropped.
This is why we sometimes need to ignore the NSSN and we
track the head_sn in software.
Here is a specific example of this:

1) Rx queue 1 got packets: 480, 482, 483
2) We release 480 to to the stack and wait for 481
3) NSSN is now 481
4) The timeout expires
5) We release 482 and 483, NSSN is still 480
6) 481 arrives its NSSN is 484.

We need to drop 481 even if 481 < 484. This is why we'll
update the head_sn to 484 at step 2. The flow now is:

1) Rx queue 1 got packets: 480, 482, 483
2) We release 480 to to the stack and wait for 481
3) NSSN is now 481 / head_sn is 481
4) The timeout expires
5) We release 482 and 483, NSSN is still 480 but head_sn is 484.
6) 481 arrives its NSSN is 484, but head_sn is 484 and we drop it.

This code introduces another problem in case all the traffic
goes well (no hole, no timeout):

Rx queue 1: 0 -> 483 (head_sn = 484)
Rx queue 2: 501 -> 4095 (head_sn = 0)
Rx queue 2: 0 -> 480 (head_sn = 481)
Rx queue 1: 481 but head_sn = 484 and we drop it.

At this point, the SN of queue 1 is far behind: more than
4040 packets behind. Queue 1 will consider 481 "old"
because 481 is in [501-64:501] whereas it is a very new
packet.

In order to fix that, send an Rx notification from time to
time (twice across the full set of 4096 packets) to make
sure no Rx queue is lagging too far behind.

What will happen then is:

Rx queue 1: 0 -> 483 (head_sn = 484)
Rx queue 2: 501 -> 2047 (head_sn = 2048)
Rx queue 1: Sync nofication (head_sn = 2048)
Rx queue 2: 2048 -> 4095 (head_sn = 0)
Rx queue 1: Sync notification (head_sn = 0)
Rx queue 2: 1 -> 481 (head_sn = 482)
Rx queue 1: 481 and head_sn = 0.

In queue 1's data, head_sn is now 0, the packet coming in
is 481, it'll understand that the new packet is new and it
won't be dropped.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# c61b655a 24-Jun-2019 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: add a new RSS sync notification for NSSN sync

We will soon be using a new notification that will be
initiated by the driver, sent to the firmware and sent
back to all the RSS queues by the firmware. This new
notification will be useful to synchronize the NSSN across
all the queues.

For now, don't send the notification, just add the code to
handle it. Later patch will add the code to actually send
it.

While at it, validate the baid coming from the firmware to
avoid accessing an array with a bad index in the driver.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# c56e00a3 20-May-2019 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: delay GTK setting in FW in AP mode

In AP (and IBSS) mode, we can only set GTKs to firmware after we have
sent down the multicast station, but this we can only do after we've
enabled beaconing, etc.

However, during rfkill exit, hostapd will configure the keys before
starting the AP, and cfg80211/mac80211 accept it happily.

On earlier devices, this didn't bother us as GTK TX wasn't really
handled in firmware, we just put the key material into the TX cmd
and thus it only mattered when we actually transmitted a frame.

On newer devices, however, the firmware needs to track all of this
and that doesn't work if we add the key before the (multicast) sta
it belongs to.

To fix this, keep a list of keys to add during AP enable, and call
the function there.

Cc: stable@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0c3d7282 27-Feb-2019 Haim Dreyfuss <haim.dreyfuss@intel.com>

iwlwifi: Add support for SAR South Korea limitation

South Korea is adding a more strict SAR limit called "Limb SAR".
Currently, WGDS SAR offset group 3 is not used (not mapped to any country).
In order to be able to comply with South Korea new restriction:
- OEM will use WGDS SAR offset group 3 to South Korea limitation.
- OEM will change WGDS revision to 1 (currently latest revision is 0)
to notify that Korea Limb SAR applied.
- Driver will read the WGDS table and pass the values to FW (as usual)
- Driver will pass to FW an indication that Korea Limb SAR is applied
in case table revision is 1.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b5e2fe35 13-May-2019 Naftali Goldstein <naftali.goldstein@intel.com>

iwlwifi: mvm: correctly fill the ac array in the iwl_mac_ctx_cmd

The indexes into the ac array in the iwl_mac_ctx_cmd are from the iwl_ac
enum and not the txfs. The current code therefore puts the edca params
in the wrong indexes of the array, causing wrong priority for
data-streams of different ACs.
Fix this.

Note that this bug only occurs in NICs that use the new tx api, since in
the old tx api the txf number is equal to the corresponding ac in the
iwl_ac enum.

Signed-off-by: Naftali Goldstein <naftali.goldstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 3e832fd1 01-May-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: fw api: support adwell HB default APs number api

Support adaptive dwell high band default number of APs new api.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d6882e58 01-May-2019 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: mvm: remove multiple debugfs entries

Now that we have per station control over amsdu size no need for
multiple entries, especially that the old one is misleading due to not
setting it for all protocols as a limit.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b3500b47 29-May-2019 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: fix load in rfkill flow for unified firmware

When we have a single image (same firmware image for INIT and
OPERATIONAL), we couldn't load the driver and register to the
stack if we had hardware RF-Kill asserted.

Fix this. This required a few changes:

1) Run the firmware as part of the INIT phase even if its
ucode_type is not IWL_UCODE_INIT.
2) Send the commands that are sent to the unified image in
INIT flow even in RF-Kill.
3) Don't ask the transport to stop the hardware upon RF-Kill
interrupt if the RF-Kill is asserted.
4) Allow the RF-Kill interrupt to take us out of L1A so that
the RF-Kill interrupt will be received by the host (to
enable the radio).

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 23f57bfa 29-May-2019 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: remove d3_sram debugfs file

This debugfs file is really old, and cannot work properly since
the unified image support. Rather than trying to make it work,
which is difficult now due to multiple images (LMAC/UMAC etc.)
just remove it - we no longer need it since we properly do a FW
coredump even in D3 cases.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# afc1e3b4 27-Feb-2019 Avraham Stern <avraham.stern@intel.com>

iwlwifi: mvm: use correct GP2 register address for 22000 family

The device time register address has changed for 22000 devices.
Add a util function for getting the GP2 time and use the correct
register address depending on the device family.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# c9af7528 22-Jan-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

iwlwifi: mvm: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.

Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Luca Coelho <luciano.coelho@intel.com>
Cc: Intel Linux Wireless <linuxwifi@intel.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# fd1190b6 06-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: mvm: use dump worker during restart instead of sync dump

In restart flow, the driver requests HW restart from mac80211
and then mac80211 uses a worker to do the restart flow. In that flow a
sync dump is performed. Instead, schedule the dump worker before
requesting HW restart from mac80211. This approach simplifies the
restart flow.
Also, it is neeeded in order to differentiate between the handling of SW
and HW errors in a future commit.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 81b4e44e 17-Dec-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: track changes in beacon count during channel switch

There are some buggy APs that keeps changing the count while forcing
us to block TX. This eventually results in queue hang, assert, and
disconnection. Detect such APs and disconnect gracefully in advance.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f6780614 17-Dec-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: disconnect in case of bad channel switch parameters

In case we receive channel switch announcement with immediate
quiet and unknown switching time, we will switch when FW identifies
AP left channel. However, if AP remains on channel, we will
eventually get TX queue hang. Init a work to disconnect if
switch doesn't occur within 1500 milliseconds. Do it also
for a too long channel switch.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d47cdb88 02-Jan-2019 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: report all NO_DATA events to mac80211

Report all NO_DATA events to mac80211 so they get captured
in radiotap for usage in sniffer scenarios; map the info
type to a reasonable radiotap type for this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 475c6bde 06-Feb-2019 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: fix TX crypto on 22560+ devices

In the old days, we could transmit with HW crypto with an arbitrary
key by filling it into TX_CMD. This was broken first with the advent
of CCMP/GCMP-256 keys which don't fit there.

This was broken *again* with the newer TX_CMD format on 22560+,
where we simply cannot pass key material anymore. However, we forgot
to update all the cases when we get a key from mac80211 and don't
program it into the hardware but still return 0 for HW crypto on TX.

In AP mode with WEP, we tried to fix this by programming the keys
separately for each station later, but this ultimately turns out to
be buggy, for example now it leaks memory when we have more than one
WEP key.

Fix this by simply using only SW crypto for WEP in newer devices by
returning -EOPNOTSUPP instead of trying to program WEP keys later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cad7eb75 29-Jan-2019 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: remove IWL_MVM_INIT_STATUS_REG_HW_INIT_COMPLETE

There's no point in this, we already do everything in a nested
fashion, and if we didn't we'd already crash in iwl_mvm_leds_exit()
etc. Just remove the bit.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8bf52e0a 15-Jan-2019 Liad Kaufman <liad.kaufman@intel.com>

iwlwifi: mvm: add read debugfs for he_sniffer_params

Return the AID currently set when reading this debugfs entry.

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


# 90a12829 27-Jan-2019 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: reject new beacons when in inject mode

Verify we do not accept new beacon templates while beacon
injection is active.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 48e775e6 01-Jan-2019 Haim Dreyfuss <haim.dreyfuss@intel.com>

iwlwifi: mvm: add support for 32kHz external clock indication

In low power modes, the chip clock source for platform integrated
devices is 32kHz. It is generated internally and supplied by a crystal
oscillator. However using a 32kHz sourced from crystal oscillator
has high power penalty.

There is an option to get an external 32kHz clock from the platform. Past
experience shows that the reliability is platform dependent,
i.e. on some platforms it works good and on other it doesn’t.

Working from external clock will save 0.5 mW in sleep state, from overall
1.8mW that we have today, i.e. almost 30%.

Each OEM can enable or disable the use of the external 32kHz clock by
setting a BIOS configuration. In case the OEM configured to use 32kHz
external clock the driver will pass this indication to the FW.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 138664a3 08-Nov-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support beacon IE injection

This is useful for automated tests.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f130bb75 13-Dec-2018 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: add FW recovery flow

Add new API and TLV for the ability to send commands in the beginning
and end of reset flow.

The full flow of recovery is:

1. While loading FW, get address (from the TLV) of target buffer
to read in case of reset
2. If an error/assert happens read the address data from step 1.
3. Reset the HW and load the FW.
4. Send the data read in step 2.
5. Add station keys
6. Send notification to FW that reset flow is done.

The main use of the recovery flow is for support in PN/SN recovery
when offloaded

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 22463857 24-Apr-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: receive umac and lmac error table addresses from TLVs

TLV 54 holds umac debug related addresses.
TLV 55 holds lmac debug related addresses.
These TLVs aim to replace the alive notification data in the future.

Parse and keep error table addresses received from the TLVs
for both lmac and umac and use these addresses instead of the pointer
received from alive notification.

The feature supports only unified image.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# fc36ffda 05-Dec-2018 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: support FTM initiator

Add support for FTM initiator, i.e. peer measurements with FTM
if the firmware supports FTM.

Additionally, add two defines we depend on in
include/linux/ieee80211.h.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b73f9a4a 05-Dec-2018 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: support FTM responder

Add support for FTM responder for hardware/firmware combinations
that advertise support for it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 700b3799 12-Nov-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: Fix pre operational dumping flows

There are several dumping flows in the driver in case of a fail
prior to operational.

In some cases we get 2 dumps while in others we get none.

Fix this by uniting the different flows.
Add a different dump type to driver triggered dumps in case we want
a dump but did not got assert, and make all dumping go through
iwl_fw_dbg_collect_desc to avoid multiple dumps.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 15e28c78 26-Nov-2018 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: support new format for the beacon notification

The firmware is changing the format of the beacon
notification to remove the dependency on the Tx response
format.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 487ec49c 21-Nov-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: trigger dump on assert prior to setting the device up

In the regular flow, when we receive an assert, ieee80211_reconfig is
called which reconfig the driver using iwl_mvm_mac_start.
iwl_mvm_mac_start is clearing the restart bit and does dump collection.

Prior to setting the device up, ieee80211_reconfig does not call
iwl_mvm_mac_start since there is nothing to reconfig and we miss the
dump collection of the assert.

solve it by checking the restart bit before we stop the device
and trigger a dump collection in case it is set.

note that we don't need to do it in the fmac case since in fmac
assert flow in iwl_fmac_nic_error we call iwl_fw_dbg_collect_desc
so we can be sure that there will a dump collection in
iwl_fmac_stop_device.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 9bf13bee 20-Nov-2018 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: include configured sniffer AID in radiotap

In order to make more sense out of the captured radiotap data e.g.
when the configured AID changes, add the currently configured AID
to the radiotap data as a vendor extension field.

This is made race-free by updating the included value from inside
the RX path (using a notification wait) for the command response
from the firmware, which thus means it's serialized with frame RX.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# fdd6c941 13-Nov-2018 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: mvm: disable completely low latency mode with debugfs

We introduce a new state for latency, force mode, in force mode
you can enable always to be in low latency or always to be in non
low latency.

This is required for test mode in max TpT test.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 57e861d9 18-Nov-2018 David Spinadel <david.spinadel@intel.com>

iwlwifi: mvm: Change FW channel info API

Change iwl_fw_channel_info structure so it can have channel number
greater than 255. This is needed for 6 GHz channel numbers.
Change all relevant structs and member accesses accordingly.
The new API is indicated by a TLV capability bit.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# babea2d4 04-Nov-2018 Andrei Otcheretianski <andrei.otcheretianski@intel.com>

iwlwifi: mvm: Disconnect on large beacon loss

Some buggy APs stop sending beacons, but continue to ack our null data
packets or even run some traffic. It's better not to stick connected to
such an AP forever, so disconnect after some larger beacon loss
threshold is crossed.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 3a894a9f 30-Oct-2018 Johannes Berg <johannes.berg@intel.com>

iwlwifi: remove TOF implementation

This is an ancient (~2015) implementation that no longer matches
the firmware in any way, and most likely never worked. Remove all
of it so it can be reintroduced properly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# fba8248e 25-Oct-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: get rid of tx_path_lock

TX path lock was introduced in order to prevent out of order
invocations of TX.

This can happen in the following flow:

TX path invoked from net dev
Packet dequeued
TX path invoked from RX path
Packet dequeued
Packet TXed
Packet TXed

However, we don't really need a lock. If TX path is already
invoked from some location, other paths can simply abort their
execution, instead of waiting to the first path to finish, and
then discover queue is (likely) empty or stopped.

Replace the lock with an atomic variable to track TX ownership.
This simplifies the locking dependencies between RX and TX paths,
and should improve performance.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 698478c4 29-Oct-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: add an option to dereference vif by id

Currently whenever we get firmware notification with mac id,
we iterate over all the interfaces to find the ID. This is a
bit cumbersome. Instead, adding an array of RCU pointers, like
we have for station IDs. This is not expensive space wise
since we have only up to 4 active MACs, and not complicated
code wise, since we have a clear point to init and de-init it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0f8bf03c 13-Aug-2018 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: save and export regdb blob from the NVM

Sometimes we want to debug issues related to the regulatory blob in
the NVM. To make that easier, add a debugfs entry to export it
together with the other nvm blobs we export.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 438af969 28-Aug-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support mac80211 AMSDU

Support getting mac80211 building AMSDUs for us. Remove GSO
support from mvm - we don't need it anymore.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cfbc6c4c 21-Aug-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support mac80211 TXQs model

Move to use the new mac80211 TXQs implementation. This has
quite a few benefits for us. We can get rid of the awkward
mapping of DQA to mac80211 queues. We can stop buffering
traffic while waiting for the queue to be allocated. We can
also use mac80211 AMSDUs instead of building it ourselves.

The usage is pretty simple:
Each ieee80211_txq contains iwl_mvm_txq. There is such a
queue for each TID, and one for management frames. We keep
having static AP queues for probes and non-bufferable MMPDUs,
along with broadcast and multicast queues. Those are being
used from the "old" TX invocation path - iwl_mvm_mac_tx.

When there is a new frame in a TXQ, iwl_mvm_mac_wake_tx is
being called, and either invokes the TX path, or allocates
the queue if it does not exist.

Most of the TX path is left untouched, although we can consider
cleaning it up some more, for example get rid of the duplication
of txq_id in both iwl_mvm_txq and iwl_mvm_dqa_txq_info.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# bf9dfeda 23-Jul-2018 Shaul Triebitz <shaul.triebitz@intel.com>

iwlwifi: mvm: handle RX no data notification

Handle RX no data notification, which is used for advertising NDP to
radiotap.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 656fca00 05-Jul-2018 Avraham Stern <avraham.stern@intel.com>

iwlwifi: mvm: switch management tx antenna only on tx failure

Switch the antenna used for management tx only if previous tx failed.
If previous tx succeeded, there is no reason to switch antennas.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 47242744 02-Jul-2018 Tova Mussai <tova.mussai@intel.com>

iwlwifi: mvm: enable low latency for soft ap

Enable low latency for softAP in all modes (standalone, SCM
and DCM).
This is in order to minimize the time the softAP leaves the channel for
other operations

Signed-off-by: Tova Mussai <tova.mussai@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f3f240f9 04-Jul-2018 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: remove queue_info_lock

All the queue management code runs under mvm->mutex, so there are
only very few cases of accessing the data structures without it:
* TX path, which doesn't take any locks anyway
* iwl_mvm_wake_sw_queue() and iwl_mvm_stop_sw_queue() where we
just (atomically) read a bitmap, so the lock isn't needed.

Therefore, we can remove the spinlock. This enables some cleanup
in the ugly locking in iwl_mvm_inactivity_check().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 724fe771 04-Jul-2018 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: kill INACTIVE queue state

We don't really need this state: instead of having an inactive
state where we can awaken zombie queues again if needed, just
keep them in their normal state unless a new queue is actually
needed and there's no other way of getting one.

We do this here by making the inactivity check not free queues
unless instructed that we now really need to allocate one to a
specific station, and in that case it'll just free the queue
immediately, without doing any inactivity step inbetween.

The only downside is a little bit more processing in this case,
but the code complexity is lower.

Additionally, this fixes a corner case: due to the way the code
worked, we could only ever reuse an inactive queue if it was
the reserved queue for a station, as iwl_mvm_find_free_queue()
would never consider returning an inactive queue.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 90d2d94c 04-Jul-2018 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: remove RECONFIGURING queue state

We set the queue to this state, only to pretty much immediately
move it out of it again. However, we can't even hit any of the
code that checks if the queue is reconfiguring, because all of
this happens under mvm->mutex and we hold the all the way from
marking the queue as RECONFIGURING to marking it as READY again.

Additionally, the queue that became RECONFIGURING would've been
in SHARED state before, and it can safely stay in that state. In
case of errors, it previously would have stayed in RECONFIGURING
which it could never have left again.

Remove the state entirely and just track the queues that need to
be reconfigured in a separate, local, bitmap.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1c14089e 04-Jul-2018 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: remove per-queue hw refcount

There's no need to have a hw refcount if we just mark the
command queue with a (fake) TID; at that point, the refcount
becomes equivalent to the hweight() of the TID bitmap.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 99448a8c 04-Jul-2018 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: move queue management into sta.c

None of these functions really need to be separate, they're all
only used in sta.c, move them there and make them static.

Fix a small typo in related code while at it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 08c2af62 03-Jul-2018 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: give TX queue info struct a name

Make this a named struct rather than an anonymous one,
we'll want to refer to it by name later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4244e7fc 11-Jun-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dump debug data before stop device

Debug data dump is not working in flows that stop the device is used
in their error handling. During these flows the op mode mutex is
locked until the device stops. Because of that, any assert generated
from the firmware can be handled only after the device already
stopped.

Since dumping cannot occour after stopping the device, split the the
dump function to two parts, Part that handles locking, and the part
that starts the actual dumping and call the second part in the op mode
stop device function.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 6ff80f18 03-Jul-2018 Ayala Beker <ayala.beker@intel.com>

iwlwifi: mvm: introduce a new fragmented scan type: fast balance

Fast balance scan is similar to SCAN_TYPE_MILD, but this scan is
fragmented and has shorter out of operating channel time,
and therefore better match low latency scenarios.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d5367de2 28-May-2018 Erel Geron <erelx.geron@intel.com>

iwlwifi: mvm: TLC support for Coex Schema 2

The new coex schema requires setting the non-shared antenna
for the single_stream_ant_msk field in the TLC command.

Signed-off-by: Erel Geron <erelx.geron@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 337bfc98 04-Jun-2018 Avraham Stern <avraham.stern@intel.com>

iwlwifi: mvm: set wep key for all stations in soft ap mode

When operating as a soft ap with wep security, the key was not
configured to the fw for the stations, based on the fact that the
key will be specified in the tx command.

However, in the new tx api the tx command does not include the key,
which resulted in all data frames going out un-encrypted.

Fix it by configuring the key for all the stations as they are added.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 754f890a 24-Aug-2018 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: remove all occurrences of the FSF address paragraph

The Free Software Foundation address is superfluous and causes
checkpatch to issue a warning when present. Remove all paragraphs
with FSF's address to prevent that.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 3baf7528 03-May-2018 Avraham Stern <avraham.stern@intel.com>

iwlwifi: mvm: Send LQ command as async when necessary

The parameter that indicated whether the LQ command should be sent
as sync or async was removed, causing the LQ command to be sent as
sync from interrupt context (e.g. from the RX path). This resulted
in a kernel warning: "scheduling while atomic" and failing to send
the LQ command, which ultimately leads to a queue hang.

Fix it by adding back the required parameter to send the command as
sync only when it is allowed.

Fixes: d94c5a820d10 ("iwlwifi: mvm: open BA session only when sta is authorized")
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4c2f445c 07-Mar-2018 Ayala Beker <ayala.beker@intel.com>

iwlwifi: mvm: skip EBS in low latency mode while fragmented scan isn't supported

While associated in low latency mode, or when traffic load is high,
don't enable EBS in scan request if fragmented EBS is not supported
by the FW.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 86e177d8 21-Jan-2018 Gregory Greenman <gregory.greenman@intel.com>

iwlwifi: mvm: add NOA and CSA to a probe response

A probe response built by a P2P GO should contain:
1. CSA/eCSA IE when relevant
2. If the corresponding probe request had P2P IE, then
need to add P2P IE with NOA attributes.

However, the NOA attributes and the updated channel switch
counter are known only to the FW. The solution is that FW
will send a notification with the relevant probe response
data and the driver will save it and update the probe
response accordingly.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 2afa6a73 26-Mar-2018 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: support new WoWLAN status FW API

A new FW API has been added for WOWLAN_GET_STATUSES to support
multiple GTK keys and IGTK keys. Check the respective TLV and use the
new API when it is set.

Let most of the code use the new version (v7) and convert the old
version (v6) to the new one when needed.

Also refactor some functions a bit so that they can be reused more
easily. Particularly the part that calls WOWLAN_GET_STATUSES which is
reused in D3 and D0i3.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# a75b9b33 20-Aug-2018 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: protect D0i3 code behind CONFIG_PM

Runtime PM can only be used if CONFIG_PM is set. Move all the d0i3
code (which is essentially runtime PM) behind the CONFIG_PM flag.

This prevents undefined usage of some functions when CONFIG_PM is not
defined.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 514c3069 24-Jun-2018 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: add support for IEEE802.11ax

Add support for the HE in the iwlwifi driver conforming with
P802.11ax_D2.0.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 9c4f7d51 14-Jan-2018 Shaul Triebitz <shaul.triebitz@intel.com>

iwlwifi: move all NVM parsing code to the common files

Move all the NVM file handling code to iwl-nvm-parse.c where all this
stuff belongs. This cleans up the MVM specific code and allows easier
reuse by other opmodes if needed.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 622111a2 08-Jun-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: clean up scan capability checks

Introduce and use iwl_mvm_cdb_scan_api(), which checks the family.
Most of this will go away once the 22000 firmware supports adaptive
dwell, after which the V6 scan API won't be used, but the V3 scan
*config* API will still need to be distinguished.

In any case, this gets rid of the completely bogus has_new_tx_api()
checks.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b66b5817 31-Jan-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: detect low latency and traffic load per band

Detect low latency and traffic load per band. Add support for
deciding on scan type and timings per band.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b0ffe455 10-Nov-2014 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: detect U-APSD breaking aggregation

Try to detect that the AP is not using aggregation even when there's
enough traffic to make it worthwhile; if this is the case and U-APSD
is enabled then assume the AP is broken (like so many) and doesn't
enable aggregation when U-APSD is used. In this case, disconnect from
the AP and blacklist U-APSD for a potential new connection to it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7d9d0d56 12-Apr-2018 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: add traffic condition monitoring (TCM)

Traffic condition monitor gathers data about the traffic load and
other conditions and can be used to make decisions regarding latency,
throughput etc. This patch introduces the code and data structures to
collect this data for future use.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 9b137866 26-Dec-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: save low latency causes in an enum

Currently we have a boolean variable for each cause.

This costs space, and requires to check each separately
when determining low latency.

Since we have another cause incoming, convert it to an enum.

While at it, move the retrieval of the prev value and the
assignment of the new value to be inside iwl_mvm_update_low_latency
and save the need for each caller to do it separately.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 66fa2424 13-Dec-2017 Ayala Beker <ayala.beker@intel.com>

iwlwifi: fw api: support the new scan request FW API version

Remove fragmented_dwell_time and add num_of_fragments to support
the new API version.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8f691af9 11-May-2017 Zamir, Roee <roee.zamir@intel.com>

iwlwifi: mvm: add support for oce

Add support for Optimized Connectivity Experience (OCE). Get
capabilities from the fw, expose them with nl80211, and enable them in
UMAC scan if the relevant nl80211 flags are set by the userspace.

Signed-off-by: Roee Zamir <roee.zamir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 19125cb0 28-Feb-2018 Andrei Otcheretianski <andrei.otcheretianski@intel.com>

iwlwifi: mvm: Increase session protection time after CS

After switching to a new channel, driver schedules session protection
time event in order to hear the beacon on the new channel.
The duration of the protection is two beacon intervals.
However, since we start to switch slightly before beacon with count 1, in
case we don't hear (or AP doesn't transmit) the very first beacon on the
new channel the protection ends without hearing any beacon at all.
At this stage the switch is not complete, the queues are closed and the
interface doesn't have quota yet or TBTT events. As the result, we are
stuck forever waiting for iwl_mvm_post_channel_switch() to be called.

Fix this by increasing the protection time to be 3 beacon intervals and
in addition drop the connection if the time event ends before we got any
beacon.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4b7f7ee2 28-Dec-2017 Shaul Triebitz <shaul.triebitz@intel.com>

iwlwifi: align timestamp cancel with timestamp start

Canceling the periodic timestamp work should be
done in the opposite flow to where it was started.
This also prevents from sending the MARKER command
during the mac_stop flow - causing a false queue hang
(FW is no longer there to send a response).

Fixes: 93b167c13a3a ("iwlwifi: runtime: sync FW and host clocks for logs")
Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4243edb4 13-Dec-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: define and use if iwl_mvm_has_tlc_offload

This aligns the code with the existing pattern to check
if the firmware has a certain capability.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f6f046f0 26-Nov-2017 Gregory Greenman <gregory.greenman@intel.com>

iwlwifi: mvm: rs: add size checks when printing to a buffer

Replace sprintf by scnprintf throughout rs code.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 177a11cf 01-Nov-2017 Gregory Greenman <gregory.greenman@intel.com>

iwlwifi: mvm: rs: new rate scale API - add debugfs hooks

This patch adds basic debugfs hooks for rate scaling.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ecaf71de 31-Oct-2017 Gregory Greenman <gregory.greenman@intel.com>

iwlwifi: mvm: rs: introduce new API for rate scaling

New devices will have rate scaling algorithm running in the firmware.
With this feature, the driver's responsiblity is to provide an initial
configuration and to handle notifications regarding recent rates and
some other parameters. Debugfs hooks will be still available for
reading the current rate/statistics and setting a fixed rate.
The old API is supported so far, though both APIs cannot be used
simultaneously.

This is the first patch in the series. It adds a new TLV specifying
FW support for the new API and updates lq_sta to support two types
of rate scaling.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 6c2d49fd 13-Nov-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: flush queue before deleting ROC

Before deleting a time event (remain-on-channel instance), flush
the queue so that frames cannot get stuck on it. We already flush
the AUX STA queues, but a separate station is used for the P2P
Device queue.

Cc: stable@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 2f7a3863 15-Nov-2017 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: rename the temporary name of A000 to the official 22000

The family name A000 was just a place-holder when we didn't know what
the official name would be yet. Now we know that the family name is
22000, so rename all occurrences accordingly.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 357969c6 01-Nov-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: revert support new Coex firmware API

This new API will not be used, remove the code that
supports it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b13f43a4 19-Nov-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: fix packet injection

We need to have a station and a queue for the monitor
interface to be able to inject traffic. We used to have
this traffic routed to the auxiliary queue, but this queue
isn't scheduled for the station we had linked to the
monitor vif.

Allocate a new queue, link it to the monitor vif's station
and make that queue use the BE fifo.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=196715

Cc: stable@vger.kernel.org
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# dac4df1c 10-Nov-2017 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: support version 7 of the SCAN_REQ_UMAC FW command

Newer firmware versions (such as iwlwifi-8000C-34.ucode) have
introduced an API change in the SCAN_REQ_UMAC command that is not
backwards compatible. The driver needs to detect and use the new API
format when the firmware reports it, otherwise the scan command will
not work properly, causing a command timeout.

Fix this by adding a TLV that tells the driver that the new API is in
use and use the correct structures for it.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=197591

Fixes: d7a5b3e9e42e ("iwlwifi: mvm: bump API to 34 for 8000 and up")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8cef5344 24-Oct-2017 Kees Cook <keescook@chromium.org>

iwlwifi: mvm: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

The RCU lifetime on baid_data is unclear, so this adds a direct copy of the
rcu_ptr passed to the original callback. It may be possible to improve this
to just use baid_data->mvm->baid_map[baid_data->baid] instead.

Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Luca Coelho <luciano.coelho@intel.com>
Cc: Intel Linux Wireless <linuxwifi@intel.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: Sara Sharon <sara.sharon@intel.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# fb7eba71 17-Oct-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: remove dead code for internal devices only

We had a bunch of code that was relevant for internal
devices only. Those devices are now being depreceated.
Kill all the now unneeded code.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 3f1c4c58 01-Oct-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: remove duplicated fields in mvm reorder buffer

The reason station id and tid fields are both in baid data and
in the reorder buffer per queue is that we couldn't access the
baid_data in the reorder timer functions.
Now that we do some pointer math and access it anyway, those
fields can be removed.
This save some space and some code.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# dfdddd92 25-Sep-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: allocate reorder buffer according to need

Now that we may have up to 256 entries per reorder buffer, and possibly up
to 16 queues, we can use a LOT of memory for this (64k for each station).
Allocate it according to what we need, which is of course much less for HT
stations (only 16k at a max of 16 queues).

However, this comes at the expense of complicating the code a bit to
calculate the right entry structure to use for each frame.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d953cdb8 26-Sep-2017 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: acpi: remove a couple of unnecessary ifdefs

Some of the #ifdef CONFIG_ACPI are not needed anymore, so they can be
removed.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e7a3b8d8 21-Sep-2017 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: acpi: move ACPI-related definitions to acpi.h

The ACPI table size definitions were spread around the different files
that used them. Move them all to a common place.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7a20bcce 14-Sep-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: don't send identical PHY_CTXT_CMD

When we have an AP which supports HT and a single HT
station is connected, we change the min_width from
NL80211_CHAN_WIDTH_20_NOHT to NL80211_CHAN_WIDTH_20. This
of course has no implication on the channel width but still
sends a command to the firmware.
Remember the last width that was sent and refrain from
sending unnecessary commands to the firmware.

Sending a PHY_CTXT_CMD to the firmware has a cost since it
recalculates the presence on the medium and because of that
it closes the transmit queues for a short while.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 528a542a 31-Aug-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: support firmware debug trigger on frame reorder timeout

The trigger that collects data when a frame is released
because of the timer of the reordering buffer was not
implemented for 9000 devices.
Fix this.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d7b9bb69 30-Aug-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: remove support for Link Quality Measurements

This was never used by any product. Remove it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 72cbb73e 30-Aug-2017 David Spinadel <david.spinadel@intel.com>

iwlwifi: mvm: Add new quota command API

New quota command adds a field indicating low latency
direction per quota.

A TLV API bit was added to indicate the new API.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 44fd09da 04-Sep-2017 Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>

iwlwifi: nvm: set the correct offsets to 3168 series

The driver currently handles two NVM formats,
one for 7000 family and below, and one for 8000 family and above.
The 3168 series uses something in between,
so currently the driver uses incorrect offsets for it.
Fix the incorrect offsets.

Fixes: c4836b056d83 ("iwlwifi: Add PCI IDs for the new 3168 series")
Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# baf41bc3 13-Sep-2017 Shaul Triebitz <shaul.triebitz@intel.com>

iwlwifi: mvm: do not print security error in monitor mode

In monitor mode we are not expected to decrypt encrypted
packets (not having the keys).
Hence we are expected to get an unknown rx security status.
Keeping the print in monitor mode causes a print for each
captured packet flooding the dmesg.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 5bd1d2c1 15-Aug-2017 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: remove useless argument in iwl_nvm_init()

We always call iwl_nvm_init() with read_nvm_from_nic == true, so this
argument is useless. Remove it.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 18f1755d 26-Jul-2017 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: group all dummy SAR function declarations together

We have some of the SAR dummy functions when ACPI is not set declared
in mvm.h and some declared in fw.c. Group them all together in fw.c
for consistency and to avoid static/non-static issues.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# fbfe378f 23-Jul-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: support new Coex firmware API

The firmware now adds more information about time sharing
with the Bluetooth core.
Adapt the API structures and add the new fields in the
debugfs hooks.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 64511df4 16-Jul-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: remove the corunning support

The corunning block was supposed to help in coex scenarios.
It required the driver to configure the firmware based on
the coupling between the two antennas of the devices.
This was never in use and the configuration sent by the
driver has always been blank.
Remove all that code.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# c135cb56 22-Jun-2017 Shaul Triebitz <shaul.triebitz@intel.com>

iwlwifi: mvm: move a000 device NVM retrieval to a common place

Getting the NVM data in a000 devices should be shared
across operation mode.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 61d8c626 27-Jun-2017 Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>

iwlwifi: mvm: add debugfs to force CT-kill

CT-kill is a thermal-based "RF-kill", which disables the NIC
completely if the temperature gets too high, in order to avoid damage.

Add a debugfs entry to simulate high temperatures, in order to test
CT-kill flows in the driver without having to physically heat the
device up.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7089ae63 28-Jun-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: use firmware LED command where applicable

On devices starting from 8000 series, the host can no longer toggle
the LED through the CSR_LED_REG register, but must do it via the
firmware instead. Add support for this. Note that this means that
the LED cannot be turned on while the firmware is off, so using an
arbitrary LED trigger may not work as expected.

Fixes: 503ab8c56ca0 ("iwlwifi: Add 8000 HW family support")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# c8f54701 19-Jun-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: remove non-DQA mode

All the firmware versions the driver supports enable DQA, and thus
the only way to get non-DQA mode is to modify the source. Remove
this mode to simplify the code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cf6c6ea3 13-Jun-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: fix the FIFO numbers in A000 devices

The FIFO numbering is different in A000 devices. This
means that we routed BE packets to BK FIFO. Fix this.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7d6222e2 08-Jun-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: add and use iwl_mvm_has_unified_ucode()

This may need to be refined later, but for now using this,
even with the TODO, is better than checking "has new TX API".

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7174beb6 01-Jun-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: refactor firmware debug code

Split out the firmware debug code to be more general, so that it
can be used by different subdrivers.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 702e975d 02-Jun-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: track current firmware image in common code

Track the current firmware image in the common code instead
of in the opmode so that later patches can access it there
in a common way.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d0b813fc 01-Jun-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: refactor shared mem parsing

Refactor the shared memory command parsing into common code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 235acb18 31-May-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: refactor out paging code

Refactor the paging code from mvm to be used by different opmodes.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# bf8b286f 30-Jun-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: defer setting IWL_MVM_STATUS_IN_HW_RESTART

A hardware/firmware error may happen at any point in time. In
particular, it might happen while mac80211 is in the middle of
a flow. We observed the following situation:
* mac80211 is in authentication flow, in ieee80211_prep_connection()
* iwlwifi firmware crashes, but no error can be reported at this
precise point (mostly because the driver method is void, but even
if it wasn't we'd just shift to a race condition)
* mac80211 continues the flow, trying to add the AP station
* iwlwifi has already set its internal restart flag, and so thinks
that adding the station is part of the restart and already set up,
so it uses the information that's supposed to already be in the
struct

This can happen with any flow in mac80211 and with any information
we try to preserve across hardware restarts.

To fix this, only set a new HW_RESTART_REQUESTED flag and translate
that to IN_HW_RESTART once mac80211 actually starts the restart by
calling our start() method. As a consequence, any mac80211 flow in
progress at the time of the restart will properly finish (certainly
with errors), before the restart is attempted.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=195299.

Reported-by: djagoo <dev@djagoo.io>
Reported-by: Łukasz Siudut <lsiudut@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 678d9b6d 18-May-2017 Liad Kaufman <liad.kaufman@intel.com>

iwlwifi: mvm: update rx statistics cmd api

The API has changed - update the code.

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


# 37e474ac 19-Jun-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: fix mac80211 queue tracking

In the driver, we track which hardware queue is associated with
which mac80211 "hw_queue", in order to be able to stop and wake
it. When moving these bitmaps out of the queue_info structures,
the type of the bitmap was erroneously changed from u32 to u8,
presumably in order to save memory.

Turns out that u32 isn't needed, because the highest queue we
can ever tell mac80211 is always < 16, but a u16 definitely is
needed, queues >=8 do happen.

While at it, throw a BUILD_BUG_ON() into the place where we set
the limit (mvm->first_agg_queue) and a warning when it actually
gets put into the bitmap.

The consequence of this bug is that full HW queues associated
with such a too-high mac80211 number never stop higher layer
queues when full, and thus would simply drop all packets that
couldn't be enqueued to the hardware queue.

Fixes: 34e10860ae8d ("iwlwifi: mvm: remove references to queue_info in new TX path")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 9fca9d5c 01-Jun-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: move notification wait into fw/

Move the notification wait code into the new fw interaction directory.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d962f9b1 01-Jun-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: create new subdirectory for FW interaction

There's a lot of mvm code that really should be more generic
and part of the iwlwifi module. Start by making a place to
keep such code - in the new "fw" subdirectory - and already
move the firmware related header files there.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 3b37f4c9 30-May-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: unify external & internal modparam names

Where possible (all except for "11n_disable", which isn't valid in C)
rename the internal names for module parameters to be the same as the
externally visible names, to aid finding their use etc.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b3de3ef4 29-May-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: change when the BT_COEX is sent

The BT_COEX command should not be sent to the INIT
firmware image starting from 8000 family.
The firmware team also requested to send the BT_COEX
command after the PHY_DB_CMD and the PHY_CFG_CMD.

While at it:
s/iwl_send_bt_init_conf/iwl_mvm_send_bt_init_conf/

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7fe90e0e 30-Mar-2017 Haim Dreyfuss <haim.dreyfuss@intel.com>

iwlwifi: mvm: refactor geo init

We are going to add debugfs entry to retrieve the current geographic
profile being used in the FW. Currently the driver reads those tables
from the BIOS and passes them to the FW.
To prepare for this retrieving we want to store those
tables in the driver.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d167e81a 10-May-2017 Mordechai Goodstein <mordechay.goodstein@intel.com>

iwlwifi: mvm: support new flush API

This new API allows flushing queues based on station ID and TID in A000
devices. One reason for using this is that tfd_queue_mask is only good
for 32 queues, which is not enough for A000 devices.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Mordechai Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# dcfbd67b 07-May-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: add a W/A for a scheduler hardware bug

In case we need to move the scheduler write pointer by
steps of 0x40, 0x80 or 0xc0, the scheduler gets stuck.
This leads to hardware error interrupts with status:
0x5A5A5A5A or alike.

In order to work around this, detect in the transport
layer that we are going to hit this case and tell iwlmvm
to increment the sequence number of the packets. This
allows to keep the requirement that the WiFi sequence
number is in sync with the index in the scheduler Tx queue
and it also allows to avoid the problematic sequence.
This means that from time to time, we will start a queue
from ssn + 1, but that shouldn't be a problem since we
don't switch to new queues for AMPDU now that we have
DQA which allows to keep the same queue while toggling
the AMPDU state.

This bug has been fixed on 9000 devices and up.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# a6a62193 03-May-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: disentangle union in TX status struct

This improves documentation, since kernel-doc can't deal with the
union well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 87afe9b0 24-Apr-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: document status bits

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 2f0282db 20-Apr-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: track and report IBSS manager status to mac80211

Shaul reported that when iwlmvm was sending beacons, it didn't properly
also take ownership of the probe responses. This is because the whole
mac80211 callback (tx_last_beacon) wasn't implemented. Fix that to make
IBSS discovery work better.

Reported-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# a9c50726 19-Apr-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: avoid variable shadowing

Avoid one kind of symbol shadowing another in iwl_mvm_flush_sta()
by renaming the function parameter.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 65b280fe 22-Mar-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: convert ucode_loaded to a status bit

Convert ucode_loaded to a status bit called FIRMWARE_RUNNING.
This will make it easier to clear this earlier, to avoid any
spurious accesses while shutting down, for example through
debugfs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# aab6930d 22-Mar-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: add and use iwl_mvm_device_running()

This will help refactor this later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# de8ba41b 16-Mar-2017 Liad Kaufman <liad.kaufman@intel.com>

iwlwifi: mvm: support init flow debugging

In case an assert happens on init flow, the current
driver powers down the NIC, except if iwlmvm modparam
init_dbg=1, and only on very specific flows.

Extend this capability to cover most failure cases
by keeping track of what init configurations have been
completed. This way, we can allow NOT powering down
the NIC, while making sure that when the driver is
removed we don't try to free resources that haven't
been allocated. (This can result in a kernel panic.)

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


# 7042678d 21-Mar-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: cleanup references to 8000 family in NVM code

NVM code is tightly coupled with 8000 family, while
it really refers to extended NVM format introduced
back then. Separate it to a configuration dependent
boolean, and rename defines accordingly.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# addce854 29-Mar-2017 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: fix firmware debug restart recording

When we want to stop the recording of the firmware debug
and restart it later without reloading the firmware we
don't need to resend the configuration that comes with
host commands.
Sending those commands confused the hardware and led to
an NMI 0x66.

Change the flow as following:
* read the relevant registers (DBGC_IN_SAMPLE, DBGC_OUT_CTRL)
* clear those registers
* wait for the hardware to complete its write to the buffer
* get the data
* restore the value of those registers (to restart the
recording)

For early start (where the configuration is already
compiled in the firmware), we don't need to set those
registers after the firmware has been loaded, but only
when we want to restart the recording without having
restarted the firmware.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# c72c37b7 16-Mar-2017 Haim Dreyfuss <haim.dreyfuss@intel.com>

iwlwifi: mvm: Fix command queue number on d0i3 flow

During d0i3 flow we flush all the queue except from the command queue.
Currently, in this flow the command queue is hard coded to 9.
In DQA the command queue number has changed from 9 to 0.
Fix that.

This fixes a problem in runtime PM resume flow.

Fixes: 097129c9e625 ("iwlwifi: mvm: move cmd queue to be #0 in dqa mode")
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e9e1ba3d 08-Jan-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support getting nvm data from firmware

This API replaces the complex NVM parsing of the iwlwifi module.
Instead, we get all needed data from firmware.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d49394a1 05-Mar-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: flush per station for DQA mode

Avoid using the global flush and move to flush per
station whenever possible in DQA mode.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e982bc2c 23-Feb-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: move to 512 queues

Avoid using the old define since it will enlarge necessary
structs for previous HW.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 34e10860 23-Feb-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: remove references to queue_info in new TX path

Most of the fields aren't needed in new TX path.
Enlarging the struct to 512 queues will consume a lot of memory.
Remove all references to the struct in the new TX path.
Move mac80211 queue mapping outside, since it will be needed per
queue for TVQM mode.
Add warning in paths that shouldn't be hit.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 6862fcee 22-Feb-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: move internally to use bigger INVALID_TXQ

We can't use IEEE80211_INVAL_HW_QUEUE to mark a queue as
invalid since 255 will be a valid value for a TVQM queue
index.
Use IWL_MVM_INVALID_QUEUE instead for accessing txq_id.
reserved_queue can stay a u8 since reserved_queue is not
used when TVQM is enabled.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e2af3fab 22-Feb-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: map cab_queue to different txq_id

cab_queue can now get bigger than u8, since in TVQM we will support
512 queues..
Support it by maintaining internal mapping between the actual number
and mac80211 queue (IWL_MVM_DQA_GCAST_QUEUE).
For pre-a000 the internal queue will be the same as the mac80211
queue.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d4a7e708 02-Feb-2017 Haim Dreyfuss <haim.dreyfuss@intel.com>

iwlwifi: mvm: Ignore wifi mcc update in the driver while associated

Wifi mcc (mobile country code) update is forbidden while associated.
Currently, FW prevents these updates and the driver is unaware to
this logic. From now on, the FW sends every wifi mcc update to the
driver. The driver in his turn needs to decide whether to
ignore it or not, depends on the association state.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8c5f47b1 20-Feb-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: make iwl_run_unified_mvm_ucode() static

There's no need to have iwl_run_unified_mvm_ucode() be exposed
to other parts of the code since the logic to pick it over the
normal code in iwl_run_init_mvm_ucode() can just be done in
that function itself.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# a6bff3cb 18-Jan-2017 Haim Dreyfuss <haim.dreyfuss@intel.com>

iwlwifi: mvm: add GEO_TX_POWER_LIMIT cmd for geographic tx power table

To utilize the maximum allowed tx power, an additional table was added
to the BIOS. The table consists of up to seven different regions
(currently only three are in use). Each region contains per band:
1. Maximum allowed tx power on the band.
2. Tx power offset for chain A.
3. Tx power offset for chain B.
On init flow driver reads this table by means of ACPI and
passes it to the firmware with GEO_TX_POWER_LIMIT cmd.
The firmware will use this table to enhance tx power with
the offset in the relevant table as well as verifying it does not
violate the maximum allowed tx power.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# fa1f2b61 25-Jan-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support change to a000 smem API

API was changed once more to support 2 LMACs.
Adapt to change while preserving current functionality.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 5d43eab6 01-Feb-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: ignore BAID for SN smaller than SSN

When we get SN that is smaller than SSN of the aggregation,
we shouldn't apply any reordering on them.
Further more, HW NSSN will be zeroed, which can cause us
to make some invalid decisions.
Detect the situation and invalidate the BAID.

Fixes: b915c10174fb ("iwlwifi: mvm: add reorder buffer per queue")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 310181ec 17-Jan-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: move to TVQM mode

In TVQM firmware returns the value of the queue ID and code
should accept it.
The TX queue config API was changed. Move to new API.
This has to be done in parallel in mvm and pcie.
Do not move yet to 512 queues since there are some opens
with enabling it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 12db294c 17-Jan-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support new TX response for TVQM

In TVQM mode the TX responses were changed to include
queue number since legacy TX queue number retrieval cannot
be scaled up to 512 queues.
Support this change.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 69964905 11-Jan-2017 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: add support for EWRD (Dynamic SAR) ACPI table

Dynamic SAR allows changing TX power limits at runtime to comply with
SAR regulations on multiple form factors (e.g. tablet vs. clamshell
mode). To support this, a new table was added to ACPI, which is
called Extended Wireless Regulatory Descriptor (EWRD). This table
allows OEMs to define different TX power profiles for each form-factor
or usage mode.

Read this new table and store it in our SAR profiles table, in
preparation for Dynamic SAR support.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 42ce76d6 11-Jan-2017 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: spin off SAR profile selection function

For dynamic SAR, we will need to select the current profile from
different places. In preparation for that, spin the profile selection
code out of iwl_mvm_sar_init().

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# c386dacb 28-Dec-2016 Haim Dreyfuss <haim.dreyfuss@intel.com>

iwlwifi: mvm: refactor SAR init to prepare for dynamic SAR

We are adding support for dynamic TX power tables for SAR (specific
absorption rate) compliance. Currently, we only support a single
(static) TX power table, which is read from ACPI, and use it
statically.

To prepare for more tables that can be switched dynamically, refactor
the SAR init flow to allow reusage and add the current static table as
a single entry in an array of tables.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 30d23c3c 30-Oct-2016 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: remove call for paging in new init flow

Now that transport inits the paging in the context info -
remove the call in mvm.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# bdccdb85 15-Nov-2016 Golan Ben-Ami <golan.ben.ami@intel.com>

iwlwifi: mvm: support MFUART dump in case of MFUART assert

In case of a MFUART assert, get a notification from the fw
that consists of the assert id and debug data.

The notification may be divided to multiple chunks, depending
on the size of the debug data sent to the driver, which would
be up to 1KB.

Get the notification, and if the debug info flag is enabled,
print the debug data to the dmesg.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 49f71713 08-Jan-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: don't assume static queue numbers

In a000 devices FW will assign the queue number. Prepare for
that by getting rid of static defines and store them in variables.
Enlarge to u16 since we may have up to 512 queues.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 26d6c16b 02-Jan-2017 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: add multicast station

Currently multicast queue is associated with the broadcast
station.

This raises quite a few issues:

The multicast queue has a special treatment:
- It is sent in the MAC context command
- It is excluded from tfd_queue_mask

In DQA mode we end up enabling two queues - the probe response
queue and the multicast queue - with the same station (broadcast)
and TID while in DQA mode it should be unique RA-TID.
Firmware will enforce it for a000 devices, so this allocation
will fail.

In addition, in a000 devices the FW will set the FIFO and not
the driver. So there is a need for FW to know when we enable
the queue that it is multicast queue so it will be bound to
the multicast FIFO. There is no such way in current design.

In order to simplify driver and firmware handling of this queue
create a multicast station.
This solves the unique RA-TID issue in the short term and serves
as preparation for the long term.

In the long term we will also add a flag marking this station for
the FW as the multicast station.
Once we will do that the FW will know this is the multicast queue
immediately when it is added and bind it to the correct FIFO.
It will also enable removing the special treatment of the
queue in the MAC context command.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 9415af7f 17-Nov-2016 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support new binding API

For a000 devices the binding API needs to include relevant
lmac ID - support the new API.
The new API should be used regardless if the device had CDB or
not. If there is no actual CDB support the binding is bound
to first lmac regardless of the band.
There are some functionality changes in binding restrictions
and quota allocations that will be handled in future patches.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 5c228d63 24-Nov-2016 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support new alive notification

Support getting alive from two LMACs and dumping debug
data from both.
Deprecate older alive notifications no one is using.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0e7ac018 08-Sep-2016 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support new statistics APIs

For CDB arch there is another auxiliary mac.
Support statistics APIs that were changed to reflect that.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1f370650 31-Aug-2016 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support unification of INIT and RT images

For a000 devices the INIT and RT images are unified to one
image.
The changes in the flow are the following:
* Driver load only RT firmware - meaning that the nvm access
command will be done in the RT image load flow.
* A new command (NVM_ACCESS_COMPLETE) now signals to the FW that
the driver is done accessing the NVM and FW can proceed with phy
calibrations.
* Phy DB is no longer sent from INIT FW to be restored by driver
for the RT FW - all the phy DB is now internal to the FW.
INIT complete will now follow the NVM access command, without
phy DB calls before.
* Paging command is sent earlier in the flow before NVM access
to enable a complete load of FW.
* caution must be care when restart is called since we may have
not completed init flow even though we are in RT firmware.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cf90da35 07-Nov-2016 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: use mvm_disable_queue instead of sharing logic

When removing inactive queue - use the central disable queue
function. This is needed due to a000 changes to come, but is
a proper cleanup anyway.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7948b873 22-Sep-2016 Liad Kaufman <liad.kaufman@intel.com>

iwlwifi: mvm: enable dynamic queue allocation mode

New firmwares support dynamic queue allocation (DQA), which enables
on-demand allocation of queues per RA/TID, instead of allocating them
statically per vif. This allows an AP to send, for instance, BE
traffic to STA2 even if it also needs to send traffic to a sleeping
STA1, without being blocked by the sleeping station.

The implementation in the driver is now ready, so we can enable this
feature by default when running firmwares that support it.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
[reworded the commit message]
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 65e25482 13-Apr-2016 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: use firmware station PM notification for AP_LINK_PS

When using RSS on 9000 series devices, we can't rely on processing the
received frames for station powersave handling, since they could be
processed on different CPUs and out of order.

In order to still manage the powersave of stations, the firmware sends
a notification on sleep->wake, wake->sleep and - for U-APSD - frames
received with PM while already sleeping (with the TID.)

With this, the driver can set AP_LINK_PS, which is required for real
parallel RX. In addition, this requires checking for PS-Poll frames
and calling ieee80211_sta_pspoll() appropriately.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 3a732c65 09-Oct-2016 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: wake the wait queue when the RX sync counter is zero

When we sync the RX queues the driver waits to receive echo
notification on all the RX queues.
The wait queue is set with timeout until all queues have received
the notification.
However, iwl_mvm_rx_queue_notif() never woke up the wait queue,
with the result of the counter value being checked only when the
timeout expired.
This may cause a latency of up to 1 second.

Fixes: 0636b938214c ("iwlwifi: mvm: implement driver RX queues sync command")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4b87e5af 12-Sep-2016 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: remove support for fw older than -17 and -22

FW versions older than -17 for 3160 and 7260 and older than -22 for
newer NICs are not supported anymore. Don't load these versions
and remove code that handles them.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b3bee580 02-Aug-2016 Roee Zamir <roee.zamir@intel.com>

iwlwifi: mvm: Add debugfs function for clocks diff

New function, reveals the diff between gp2 and host time.

Signed-off-by: Roee Zamir <roee.zamir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# aacf8f18 19-Jul-2016 Avrahams Stern <avraham.stern@intel.com>

iwlwifi: mvm: Add support for RRM by scan

Implement support for RRM by adding an option to configure the scan
dwell time and reporting scan start time and BSS detection time, and
Advertise support for these features.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# db06f04d 05-Jul-2016 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support new shared memory config API

In a000 devices we have 15 fifos, so in the shared memory
config the number of tx fifos in the array was changed
accordingly.
As it is in the middle of the struct, the parsing code needs
to be duplicated.
To minimize the duplication, do not save variables we never
actually use.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# edbe961c 02-Feb-2016 Liad Kaufman <liad.kaufman@intel.com>

iwlwifi: mvm: keep track of tid associated with each queue

When sending the SCD_QUEUE_CONFIG command, the queue is
associated to a specific TID. If later there is a need to
use this TID on a different queue instead, it first needs to
be unassociated from the first queue.

Keep track for every queue what TID is associated with it.

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


# 9f9af3d7 23-Dec-2015 Liad Kaufman <liad.kaufman@intel.com>

iwlwifi: mvm: re-aggregate shared queue after unsharing

When a shared queue becomes unshared, aggregations should be
re-enabled if they've existed before. Make sure that they do
this, if required.

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


# d975d720 04-Jul-2016 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support new paging command format

For a000 devices there is a support of 64 bit DMA addressing.
The paging command was changed accordingly - support it.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8e160ab8 11-Apr-2016 Ayala Beker <ayala.beker@intel.com>

iwlwifi: mvm: support GMAC protocol

Add support for installing and removing GMAC key
for newer FW versions that support GCM and MFP.
GMAC provides authentication and integrity for multicast management
frames.

Firmware API was changed, update the driver accordingly.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# bdc98b13 25-Jul-2016 Sharon Dvir <sharon.dvir@intel.com>

iwlwifi: mvm: check if vif is NULL before using it

wdev_to_ieee80211_vif() might return NULL.
Check that vif != NULL before dereferencing it.

Signed-off-by: Sharon Dvir <sharon.dvir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 24ddddf3 20-Jun-2016 Johannes Berg <johannes.berg@intel.com>

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>


# 3aa4359f 13-Jun-2016 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

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>


# 2a53d166 07-Apr-2016 Ayala Beker <ayala.beker@intel.com>

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>


# 42db09c1 02-May-2016 Liad Kaufman <liad.kaufman@intel.com>

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>


# 69e04642 02-May-2016 Luca Coelho <luciano.coelho@intel.com>

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>


# 9794c64f 19-Aug-2015 Liad Kaufman <liad.kaufman@intel.com>

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>


# d3a108a4 28-Feb-2016 Andrei Otcheretianski <andrei.otcheretianski@intel.com>

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>


# fbe41127 04-Apr-2016 Sara Sharon <sara.sharon@intel.com>

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>


# 6d99c88f 03-Apr-2016 Sara Sharon <sara.sharon@intel.com>

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>


# c5241b0c 20-Apr-2016 Avraham Stern <avraham.stern@intel.com>

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>


# cf961e16 13-Aug-2015 Liad Kaufman <liad.kaufman@intel.com>

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>


# 16e4dd8f 30-Mar-2016 Luca Coelho <luciano.coelho@intel.com>

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>


# 71b1230c 10-Mar-2016 Luca Coelho <luciano.coelho@intel.com>

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>


# e9eb5e33 03-Apr-2016 Sara Sharon <sara.sharon@intel.com>

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>


# a338384b 28-Feb-2016 Sara Sharon <sara.sharon@intel.com>

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>


# 0690405f 28-Feb-2016 Sara Sharon <sara.sharon@intel.com>

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>


# b915c101 23-Mar-2016 Sara Sharon <sara.sharon@intel.com>

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>


# 10b2b201 20-Mar-2016 Sara Sharon <sara.sharon@intel.com>

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>


# d0ff5d22 23-Mar-2016 Sara Sharon <sara.sharon@intel.com>

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>


# 0636b938 18-Feb-2016 Sara Sharon <sara.sharon@intel.com>

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>


# 57fbcce3 12-Apr-2016 Johannes Berg <johannes.berg@intel.com>

cfg80211: remove enum ieee80211_band

This enum is already perfectly aliased to enum nl80211_band, and
the only reason for it is that we get IEEE80211_NUM_BANDS out of
it. There's no really good reason to not declare the number of
bands in nl80211 though, so do that and remove the cfg80211 one.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 728e825f 11-Mar-2016 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: add a scan timeout for regular scans

If something goes wrong with the firmware and we never get a scan
complete notification, we stay stuck forever. In order to avoid this
situation, add a timeout and trigger an NMI if it expires before
receiving the notification., so we can clean things up.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# f02669be 28-Feb-2016 Liad Kaufman <liad.kaufman@intel.com>

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.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 854d773e 22-Mar-2016 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: improve RSS configuration

Improve current RSS configuration:
* Use netdev_rss_key instead of keeping a local copy.
* Configure also UDP hashing to have UDP traffic spread across queues.
* Do not direct RSS traffic to our fallback queue.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 97f95c93 07-Mar-2016 Sara Sharon <sara.sharon@intel.com>

iwlwifi: remove support for fw older than -16.ucode

API version lower than 16 is not supported anymore - don't
load older ucode.
Remove code handling older versions.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 24afba76 28-Jul-2015 Liad Kaufman <liad.kaufman@intel.com>

iwlwifi: mvm: support bss dynamic alloc/dealloc of queues

"DQA" is shorthand for "dynamic queue allocation". This
enables on-demand allocation of queues per RA/TID rather than
statically allocating per vif, thus allowing a potential
benefit of various factors.

Please refer to the DOC section this patch adds to sta.h to
see a more in-depth explanation of this feature.

There are many things to take into consideration when working
in DQA mode, and this patch is only one in a series. Note that
default operation mode is non-DQA mode, unless the FW
indicates that it supports DQA mode.

This patch enables support of DQA for a station connected to
an AP, and works in a non-aggregated mode.

When a frame for an unused RA/TID arrives at the driver, it
isn't TXed immediately, but deferred first until a suitable
queue is first allocated for it, and then TXed by a worker
that both allocates the queues and TXes deferred traffic.

When a STA is removed, its queues goes back into the queue
pools for reuse as needed.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 11dee0b4 15-Mar-2016 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: make uapsd_disable module param a bitmap

This allows to disable uapsd for BSS only, or P2P client
separately. Remove the now unneeded
IWL_MVM_P2P_UAPSD_STANDALONE constant.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 6e2611f3 15-Mar-2016 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: modify the max SP to infinite

This makes u-APSD work with more peers.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 03098268 18-Feb-2016 Aviya Erenfeld <aviya.erenfeld@intel.com>

iwlwifi: mvm: add LQM vendor command and notification

LQM stands for Link Quality Measurement. The firmware
will collect a defined set of statitics (see the
notification for details) that allow to know how busy
the medium is. The driver issues a request to the firmware
that includes the duration of the measurement (the firmware
needs to be on channel for that amount of time) and the
timeout (in case the firmware has a lot of offchannel
activities). If the timeout elapses, the firmware will
send partial results which are still valuable.
In case of disassociation / channel switch and alike, the
driver is in charge of stopping the measurements and the
firmware will reply with partial results.

The user space API for now is debugfs only and will be
implmemented in an upcoming patch.

Signed-off-by: Aviya Erenfeld <aviya.erenfeld@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 5b086414 08-Feb-2016 Golan Ben-Ami <golan.ben.ami@intel.com>

iwlwifi: mvm: support dumping UMAC internal txfifos

In case of FW error, support dumping the UMAC internal txfifos.
To do so, support version 2 of shared memory cfg command, which
contains the sizes of the internal txfifos, and move the command
to the system group.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# b358993b 14-Feb-2016 Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>

iwlwifi: mvm: return the cooling state index instead of the budget

iwl_mvm_tcool_get_cur_state is the function that returns the
cooling state index to the sysfs handler. This function returns
mvm->cooling_dev.cur_state but that variable was set to the
budget and not the cooling state index. Fix that.
Add a missing blank line while at it.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 91f66a3c 28-Feb-2016 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: avoid panics with thermal device usage

Thermal zone device registration can fail, and in this case
we don't want to remove WiFi functionality. This is why the
thermal zone registration function is void, and the flows
continue even if the thermal zone device registration failed.
Same applies for the cooling device.

This means that we at least need to remember that the thermal
zone device didn't register properly and take the minimal
precautions to avoid panic'ing when we access it.

This was missing.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# b4f7a9d1 03-Feb-2016 Liad Kaufman <liad.kaufman@intel.com>

iwlwifi: mvm: support sw queue start/stop from mvm

Add a wrapper function to allow stopping SW queues from MVM
as well.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 280452c9 23-Feb-2016 Liad Kaufman <liad.kaufman@intel.com>

iwlwifi: mvm: disable DQA support

Do not allow entrance into DQA flows until feature is
completely ready and merged.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# fcb6b92a 22-Feb-2016 Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>

iwlwifi: mvm: update ucode status before stopping device

Leaving ucode_loaded to true after stop_device() has been called
is a recipe for problems. Flows that are not sync'ed with the
driver life cycle (like debugfs hooks and thermal hooks) must
check that the firmware is loaded before they interact with it.
Therefore we need to keep this variable updated with the real
status of the firmware.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# eea76c36 21-Feb-2016 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: kill iwl_mvm_enable_agg_txq

iwl_mvm_enable_agg_txq has only one user. Kill it and
adapt the call site.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# f92659a1 03-Feb-2016 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support VHT MU-MIMO notification

When the device is in d0i3/d3 we will not receive the VHT
MU-MIMO group id management frame. Instead, firmware will
notify us upon exit on the current status and we can in turn
update mac80211. Support this notification.
While at it, also check as a precaution that the vif is indeed
the VHT MU-MIMO owner before updating the firmware.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 94bb4481 16-Dec-2015 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: add RSS queues notification infrastructure

In multi rx queue HW, without execessive locking, there is no sync
between the ctrl path (default queue) and the rest of the rx queues.
This might cause issues on certain situations. For example, in case
a delBA was processed on a default queue but out of order packets
still wait for processing on the other queue.

The solution is to introduce internal messaging between the CTRL path
and the other rx queues.
The driver will send a message to the firmware, which will echo it to
all the requested queues. The message will be in order inside the queue.
This way we can avoid CTRL path and RSS queues races.

Add support for this messaging mechanism. As the firmware is agnostic to
the data sent, add internal representation of the data as well.
Although currently only delBA flow will use it, the internal representation
will enable generic use of this infrastructure for future uses.
Next patch will utilize this messaging mechanism for the reorder buffer
delBA flow.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 3af512d6 22-Jul-2015 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support filtered frames notification

During d0i3 frames might be filtered by the FW and this may
cause reordering buffer a delay - as the frames will not be
received and reorder will time out.

Introduce an API function to receive notification of filtered
frames and pass the information to the mac80211.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 9e7dce28 26-Oct-2015 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: allow to limit the A-MSDU from debugfs

in order to be able to tune the size of the desired A-MSDU
based on link condition, add a knob to modify the length
of the A-MSDU.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# a339e918 02-Feb-2016 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: handle pass all scan reporting

The firmware doesn't send match found notifications when no matchsets
are passed. This makes sense because if there are no matchsets,
nothing can be matched. But the nl80211 API should report when there
are results available, even if no matchsets were passed.

To handle this, we can use the firmware's ITERATION_COMPLETE
reporting, which will send us notifications every time it completed a
scheduled scan iteration. Then we can set a flag when we received
beacons and use that to report that results are available.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 5c89e7bc 05-Jan-2016 Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>

iwlwifi: mvm: add registration to cooling device

Register cooling device in order to have the Thermal
Manager handle the device's power budget according to the sent
notifications.
The interface adds a new thermal cooling device to
/sys/class/thermal/ folder.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# c221daf2 29-Dec-2015 Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>

iwlwifi: mvm: add registration to thermal zone

Register to thermal_zone interface and implement the
thermal ops.
The thermal handles the device throttling, and sets the
the temperature thresholds the Thermal Manager would be
notified of crossing.
The thermal interface adds a new thermal zone device sensor
under /sys/class/thermal/ folder.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 0a3b7119 16-Dec-2015 Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>

iwlwifi: mvm: add CT-KILL notification

Up to today the driver was notified of the temperature from the FW
and decided whether to enter CT-kill or not.
From now on, the FW will decide when to enter CT-kill and will notify
the driver.
Add support for this notification.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 905e36ae 14-Feb-2016 Matti Gottlieb <matti.gottlieb@intel.com>

iwlwifi: mvm: Fix paging memory leak

If the opmode is stopped and started again we did not free
the paging buffers. Fix that.
In addition when freeing the firmware's paging download
buffer, set the pointer to NULL.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# c89e333d 26-Jan-2016 Andrei Otcheretianski <andrei.otcheretianski@intel.com>

iwlwifi: mvm: allow to disable beacon filtering for AP/GO interface

When in AP mode we need to filter in beacons from other APs to update HT
operation mode. As a power optimization the beacons are filtered out when
there are no associated stations. As a result, when there are no
associated stations, we will not update the HT operation mode until a
station connects.
Add a debugfs parameter that allows to disable this optimization.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 43413a97 31-Dec-2015 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support rss queues configuration command

9000 series supports multi-queue rx. The hardware needs
to be configured with the hash functions to perform and
indirection table that maps hash results to the relevant
CPUs\queues.
Support this configuration.
Add debugfs hook to configure the indirection table in
order to enable performance analysis. The configuration
is stateless, receives a partial or full pattern and sends
the command to the firmware.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 81f02ba3 30-Dec-2015 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: add tlv for multi queue rx support

Previous patches enabled the multi-queue rx path based on
iwl_mvm_has_new_rx_api() which returned false by default.
Change it to return the actual value based on the firmware
TLV which is now defined.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# a80c1cf9 13-Jan-2016 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: support setting minimum quota from debugfs

For debug purposes, allow setting minimum quota (for a single
virtual interface) from debugfs. This is an absolute minimum,
so it can only be set up to 95%.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# b525d081 06-Jan-2016 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: track low-latency sources separately

To be able to test low-latency behaviour properly, split the
different low-latency sources so that setting any one of them,
for example from debugfs, is sufficient; this avoids getting
the debug setting overwritten by other sources.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 0db056d3 29-Dec-2015 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: support beacon storing

Currently firmware is configured to filter out beacons. In case
a beacon was changed - it is waking the host.
However, some vendors change their IEs frequently without any
significant change, and redundant wakeups are triggered as a
result.
As a solution disable beacon filtering when entering d0i3.
Instead, firmware will store the latest beacon and upon exiting
d0i3 it will send it up to the host, so the host can act upon
changes (if there were any).
This beacon will arrive as a dedicated notification - support it
as well.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 7869318e 27-Dec-2015 Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>

iwlwifi: mvm: add support for negative temperatures

The driver should support also negative temperatures.
So there is a need to separate between the return value and
temperature in order to be able to distinguish between
a negative temperature and error value.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# ee95ed37 25-Nov-2015 Avri Altman <avri.altman@intel.com>

iwlwifi: mvm: Add P2P client snoozing

Enable snoozing and U-APSD on P2P client. The firwmare will
support this only if the BSS vif is not associated.
Make this configurable by a constant variable and disable
it by default.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# a80c7a69 05-Jan-2016 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: mvm: constify the parameters of a few functions in fw-dbg.c

The debug functions of fw-dbg.c don't really need to modify
the trigger and the description they receive as a parameter.
Constify the pointers.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# a977a150 25-Nov-2015 Golan Ben-Ami <golan.ben.ami@intel.com>

iwlwifi: mvm: add a non-trigger window to fw dbg triggers

Allow the user to configure a non-trigger session - a window
between triggers in which the driver won't collect fw debug data.
This can be useful when the frequent collection of fw data
has an impact on the performance, such as debugging
tx flows.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# a3f7ba5c 11-Nov-2015 Eliad Peller <eliad@wizery.com>

iwlwifi: update key params on d0i3 entrance/exit

In order to let the fw do offloading properly, we need
to provide various key data (e.g. PN).

Configure the params on d0i3 entrance, and update them
back on d0i3 exit.

Since d3 code is now called in d0i3 which requires runtime
pm only, make d3.0 depend on CONFIG_PM (rather than
CONFIG_PM_SLEEP), and add required #ifdefs and wrappers
where needed, so both CONFIG_PM=n and CONFIG_PM_RUNTIME=n
configurations will build correctly.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 585a6fcc 01-Dec-2015 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: infrastructure for frame-release message

Incoming hardware will send frame release notifications to
the reorder buffer in order to update with the BA session
status and up to date NSSN.
This patch enables the API.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 780e87c2 03-Sep-2015 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: add 9000 series RX processing

Convert the convert the new infrastructure added by previous
patches to actually use the new RX descriptor layout.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 0e39eb03 03-Dec-2015 Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>

iwlwifi: mvm: Add a station in monitor mode

Currently when creating a new vif in monitor mode the driver doesn't
allocate a specific station. This causes that in the situation that
tx traffic is injected, the tx queues are not scheduled,
with the result of a TFD queue hang.
Fix that by allocating a station and ensuring its tx queues
are scheduled.

This fixes https://bugzilla.kernel.org/show_bug.cgi?id=104591

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# cb2f8277 17-Nov-2015 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: change the Intel Wireless email address

ilw@linux.intel.com is not available anymore.
linuxwifi@intel.com should be used instead.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# c97dab40 19-Nov-2015 Sara Sharon <sara.sharon@intel.com>

iwlwifi: mvm: change protocol offload flows

RFC4862 states that "In all cases, a node MUST NOT respond to
a Neighbor Solicitation for a tentative address".
Currently the driver configures the NS offload and does not wait
for address to become permanent, thus violating the RFC.
Just removing the address from the address list is not good enough
for all cases, since the NS messages are needed for the duplicate
address detection and should not be discarded.

For d0i3 disable NS offload. Put tentative address in the address
list so the NS packet will not be filtered out by ucode.
For D3 the platform will not wake from NS packets - so enable
NS offload while removing the tentative address from the list.

Given that now NS offload might be disabled, and that the ucode
uses the IP data for other puroposes (L3 filtering) add two
independent flags indicating if IPv4\IPv6 data is valid.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# b7282643 17-Sep-2015 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: replace d0i3_mode and wowlan_d0i3 with more generic variables

The d0i3_mode variable is used to distinguish between transports that
handle d0i3 entry during suspend by themselves (i.e. the slave
transports) and those which rely on the op_mode layer to do it. The
reason why the former do it by themselves is that they need to
transition from d0i3 in runtime_suspend into d0i3 in system-wide
suspend and this transition needs to happen before the op_mode's
suspend flow is called.

The wowlan_d0i3 element is also a bit confusing, because it just
reflects the wowlan->any value for the trans to understand. This is a
bit unclear in the code and not generic enough for future use.

To make it clearer and to generalize the platform power mode settings,
introduce two variables to indicate the platform power management
modes used by the transport.

Additionally, in order not to take too big a step in one patch, treat
this new variables semantically in the same way as the old d0i3_mode
element, introducing a iwl_mvm_enter_d0i3_on_suspend() function to
help with that.

This commit also adds the foundation for a new concept where the
firmware configuration state (i.e. D0, D3 or D0i3) is abstracted from
the platform PM mode we are in (i.e. runtime suspend or system-wide
suspend).

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 08f0d23d 10-Dec-2015 Eliad Peller <eliad@wizery.com>

iwlwifi: avoid d0i3 commands when no/init ucode is loaded

d0i3 commands are not supported in the init image, so take
a reference to ensure we don't enter d0i3 during init image,
and additional checks to prevent d0i3 commands when no
fw image is loaded.

Add a few WARN_ON_ONCE to the d0i3 enter/exit commands
to ensure we send d0i3 commands only when the normal
ucode is loaded.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 355346ba 26-Nov-2015 Avraham Stern <avraham.stern@intel.com>

iwlwifi: mvm: configure scheduled scan according to traffic conditions

Change scan configuration (dwell time, suspend time etc.) according
to traffic conditions. This is useful for scans that are managed by
the FW (e.g. scheduled scan).

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# ac8ef0ce 12-Nov-2015 Eliad Peller <eliad@wizery.com>

iwlwifi: mvm: refactor d3 key update functions

We need to reuse the key update logic for d0i3
as well.

Add some parameters to deal with the constraints
implied by the d0i3 flow (specifically, support
non-SYNC commands, and don't take mutexes that
might deadlock).

Change some commands to be ASYNC, in order
to simplify locking a bit.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 2f89a5d7 27-Oct-2015 Golan Ben-Ami <golan.ben.ami@intel.com>

iwlwifi: mvm: move fw-dbg code to separate file

The fw debug functionality is big enough to warrant
a separate file. Move existing related functions to the new file.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 6f730662 26-Oct-2015 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: remove unnecessary check in iwl_mvm_is_d0i3_supported()

The d0i3_mode element is never set to IWL_D0I3_OFF, so it's not
necessary to check it in iwl_mvm_is_d0i3_supported().

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# eb3908d3 02-Oct-2015 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: flush all used TX queues before suspending

There is a potential race condition when entering suspend with d0i3 in
PCIe. If there is a frame queued just before we suspend, it won't
complete and we will never clear the queue stuck timer. To solve
this, call TX_PATH_FLUSH to flush all queues (except the command
queue) as part of the d0i3 entry process. Add a new function that
returns all the flushable queues.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 1412ee39 22-Oct-2015 Eyal Shapira <eyal@wizery.com>

iwlwifi: mvm: drop low_latency_agg_frame_cnt_limit

This was an old workaround for solving latency issues with
certain Miracast adapters like ActionTec. However this isn't
needed anymore and furthermore it hurts throughput in other
use cases.

Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 566f165d 25-Oct-2015 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: remove stray nd_config element

When the netdetect debugfs entry was removed, the nd_config element
was accidentally left in the iwl_mvm structure. Remove it.

Fixes: dbb04b0d29f8 ("iwlwifi: mvm: remove netdetect debugfs entry")
Reported-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 5053e299 17-Sep-2015 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: mvm: remove redundant d0i3 flag from the config struct

The d0i3 flag in the device configuration structure is redundant,
because the same information can be determined by checking the
firmware capability flag.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# 4707fde5 21-Sep-2015 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: use build-time assertion for fw trigger ID

The firmware debug trigger ID is always a compile-time constant,
so we can use a build-time assertion to validate that it is in
fact a valid constant.

To make that really guaranteed to work, convert this and the
inline function iwl_fw_dbg_trigger_simple_stop() to macros.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# e7c2e1fd 29-Oct-2015 Avri Altman <avri.altman@intel.com>

iwlwifi: mvm: Enable MPLUT only on supported hw

When there's a bt-wifi contention that requires arbitration,
we use a priority-based mechanism to decide which comm wins.
Over time, use cases become more and more complex, with multiple
concurrent active links with different traffic types and different QoS
requirements, on both WiFi and BT sides.
This, in turn, requires us to elaborate our prioritization mechanism.
However, our legacy products included hw that does not supports this,
so selectively enable this on specific hw - as signaled by the firmware.

Signed-off-by: Avri Altman <avri.altman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# f9d71644 10-Nov-2015 Avraham Stern <avraham.stern@intel.com>

iwlwifi: mvm: Configure fragmented scan for scheduled scan

Configure the FW to use fragmented scan when the traffic load is high
or low latency traffic is on. This is useful for scans that are
managed by the FW (e.g. scheduled scan).

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>


# e705c121 17-Nov-2015 Kalle Valo <kvalo@codeaurora.org>

iwlwifi: move under intel vendor directory

Part of reorganising wireless drivers directory and Kconfig.

Signed-off-by: Kalle Valo <kvalo@codeaurora.org>