platform/kernel/linux-rpi.git
2 years agoiwlwifi: fix small doc mistake for iwl_fw_ini_addr_val
Luca Coelho [Sat, 5 Feb 2022 09:21:40 +0000 (11:21 +0200)]
iwlwifi: fix small doc mistake for iwl_fw_ini_addr_val

There was a small copy and paste mistake in the doc declaration of
iwl_fw_ini_addr_val.  Fix it.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220205112029.aeec71c397b3.I0ba3234419eb8c8c7512a2ca531a6dbb55046cf7@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: add additional info for boot info failures
Mordechay Goodstein [Sat, 5 Feb 2022 09:21:39 +0000 (11:21 +0200)]
iwlwifi: mvm: add additional info for boot info failures

This info helps for additional info in case we have issues
with HPM state at boot time.

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.20220205112029.e3530bf30f1f.Ib354675937352f6e4a992f1d5d49f2f38acfe2e5@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: always remove the session protection after association
Emmanuel Grumbach [Sat, 5 Feb 2022 09:21:38 +0000 (11:21 +0200)]
iwlwifi: mvm: always remove the session protection after association

The firmware will soon stop removing the session protection for us after
association. While this was convenient, it was not symmetric.
Always remove the session protection after association, even for devices
that support the new API.

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.20220205112029.9fd32da15220.Ia88357dcf9f7ec7860f6111e41411868739cc9aa@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: make iwl_mvm_reconfig_scd() static
Johannes Berg [Sat, 5 Feb 2022 09:21:37 +0000 (11:21 +0200)]
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>
2 years agoiwlwifi: mvm: refactor setting PPE thresholds in STA_HE_CTXT_CMD
Miri Korenblit [Sat, 5 Feb 2022 09:21:36 +0000 (11:21 +0200)]
iwlwifi: mvm: refactor setting PPE thresholds in STA_HE_CTXT_CMD

We are setting the PPE Thresholds in STA_HE_CTXT_CMD according
to HE PHY Capabilities IE. As EHT is introduced, we will have to
set this thresholds according to EHT PHY Capabilities IE if we're
in an EHT connection. Some parts of the code can be used for both
HE and EHT. Put this parts in functions which will be used in the
patch which adds support for EHT PPE.

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.20220205112029.48a508dfffef.If392e44d88f96ebed7fadf827e327194d4bd97b1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: Disable WiFi bands selectively with BIOS
Ayala Barazani [Sat, 5 Feb 2022 09:21:35 +0000 (11:21 +0200)]
iwlwifi: mvm: Disable WiFi bands selectively with BIOS

The BIOS can contain data about sets of disabled channels.
Pass the bitmap to the firmware if present.

Signed-off-by: Ayala Barazani <ayala.barazani@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220205112029.9e6d9209293d.If5b22a9afe5f9dac9c7c45e68e494ffce4df8910@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: add additional info for boot info failures
Mordechay Goodstein [Sat, 5 Feb 2022 09:21:34 +0000 (11:21 +0200)]
iwlwifi: mvm: add additional info for boot info failures

This info helps for additional info in case we have issues
with OTP at boot time.

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.20220205112029.7971a6d70653.Icb3ee1e5d52e5437531dadeda63e32719b44b645@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: don't send BAID removal to the FW during hw_restart
Luca Coelho [Sat, 5 Feb 2022 09:21:33 +0000 (11:21 +0200)]
iwlwifi: mvm: don't send BAID removal to the FW during hw_restart

With the new ML API, we can't send the BAID removal command to
firmware during hw_restart because it will cause an assertion failure
0x350D because the BAID doesn't exist at that point.

So avoid sending the command if we are performing a hw_restart.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220205112029.7b363457e1aa.Ie4634222e6a33451b88e1042c83e9ea28775bd9f@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: don't dump_stack() when we get an unexpected interrupt
Emmanuel Grumbach [Sat, 5 Feb 2022 09:21:32 +0000 (11:21 +0200)]
iwlwifi: don't dump_stack() when we get an unexpected interrupt

It is yet unclear if the WARNING really points to a real problem,
but for sure the stack dump doesn't help fixing it.
Just use a regular error print instead.

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.20220205112029.a79e733a12f7.I8189344294222be0589fa43cc70fdf38e3057045@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: rfi: handle deactivation notification
Gregory Greenman [Sat, 5 Feb 2022 09:21:31 +0000 (11:21 +0200)]
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>
2 years agoiwlwifi: mvm: Consider P2P GO operation during scan
Ilan Peer [Sat, 5 Feb 2022 09:21:30 +0000 (11:21 +0200)]
iwlwifi: mvm: Consider P2P GO operation during scan

A scan during active P2P GO operation, i.e., data traffic with
clients, can impact the throughput and latency of such traffic.
Thus, when scan is requested while there is an active P2P GO
and low latency is asserted:

- Ask the FW scan logic to respect the P2P GO activity during the
  scheduling of the scan operation to minimize the impact on the
  throughput and latency.
- Force scan to perform EBS before starting the scan to reduce the
  number of scanned channels.

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.20220205112029.4412036f4889.Ied677fdd31765437e19905787708bd05f62663ba@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: bump FW API to 70 for AX devices
Golan Ben Ami [Sat, 5 Feb 2022 09:21:29 +0000 (11:21 +0200)]
iwlwifi: bump FW API to 70 for AX devices

Start supporting API version 70 for AX devices.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220205112029.a861ff3e5541.I77447cab0e944ec9e9e72e25bfd9cd59b9111f73@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: Unify the scan iteration functions
Ilan Peer [Fri, 4 Feb 2022 10:25:11 +0000 (12:25 +0200)]
iwlwifi: mvm: Unify the scan iteration functions

As there is not real need to iterate the active interfaces
twice.

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.20220204122220.940e45167283.I99ddfeda3d4a50d21cb18b826ccf84b21a76c487@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mei: use C99 initializer for device IDs
Johannes Berg [Fri, 4 Feb 2022 10:25:10 +0000 (12:25 +0200)]
iwlwifi: mei: use C99 initializer for device IDs

There's another field and so W=2 warns about this code, but
in general it's nicer to use C99 initializers anyway to make
the code easier to read.

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.20220204122220.b5efbbd83c9c.I908128aa8249565ff1c5496ca5c5597efea7cb39@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: debugfs: remove useless double condition
Johannes Berg [Fri, 4 Feb 2022 10:25:09 +0000 (12:25 +0200)]
iwlwifi: debugfs: remove useless double condition

There's no point spelling out the same condition twice,
so remove the second one.

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.20220204122220.321a7e67209b.Iafb75006eab971ca6982d6efd76347d3f47bd023@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: remove unused macros
Johannes Berg [Fri, 4 Feb 2022 10:25:08 +0000 (12:25 +0200)]
iwlwifi: remove unused macros

Found with W=2, remove unused macros in C files. In one case
move the macro under the corresponding ifdef.

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.20220204122220.068c6052689b.Idbb7a87c2fd93619c1765c7f4ed15190c3fef2a7@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: eeprom: clean up macros
Johannes Berg [Fri, 4 Feb 2022 10:25:07 +0000 (12:25 +0200)]
iwlwifi: eeprom: clean up macros

There are two versions of the same definitions, with and without
IWL_ prefix. Use the ones with IWL_ prefix, keeping the correct
comment (microseconds).

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.20220204122220.2150362427bd.I47a47d0f795dc08361958833b8235ab5de75d154@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: drv: load tlv debug data earlier
Johannes Berg [Fri, 4 Feb 2022 10:25:06 +0000 (12:25 +0200)]
iwlwifi: drv: load tlv debug data earlier

There's no good reason to pick the opmode first and load this
under the mutex, so just load it before continuing. This will
let us load it asynchronously more easily later.

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.20220204122220.a28df852f70d.Icaf6556d81bc137a459aabf0511d46c3861b0413@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: pcie: Adapt rx queue write pointer for Bz family
Matti Gottlieb [Fri, 4 Feb 2022 10:25:05 +0000 (12:25 +0200)]
iwlwifi: pcie: Adapt rx queue write pointer for Bz family

Adapt rx queue write pointer for Bz family.
The register has moved to the same one as Tx.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220204122220.57bd62a4365c.I873aa9b3d13abf5633a4963c55c3a09a833254f0@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: pcie: adjust to Bz completion descriptor
Johannes Berg [Fri, 4 Feb 2022 10:25:04 +0000 (12:25 +0200)]
iwlwifi: pcie: adjust to Bz completion descriptor

The Bz devices got a new completion descriptor again since
we only ever really used 4 out of 32 bytes anyway. Adjust
the code to deal with that. Note that the intention was to
reduce the size, but the hardware was implemented wrongly.

While at it, do some cleanups and remove the union to simplify
the code, clean up iwl_pcie_free_bd_size() to no longer need
an argument and add iwl_pcie_used_bd_size() with the logic to
selct completion descriptor size.

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.20220204122220.bef461a04110.I90c8885550fa54eb0aaa4363d322f50e301175a6@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: Passively scan non PSC channels only when requested so
Ilan Peer [Fri, 4 Feb 2022 10:25:03 +0000 (12:25 +0200)]
iwlwifi: mvm: Passively scan non PSC channels only when requested so

Non PSC channels should generally be scanned based on information about
collocated APs obtained during scan on legacy bands, and otherwise
should not be scanned unless specifically requested so (as there are
relatively many non PSC channels, scanning them passively is time consuming
and interferes with regular data traffic).

Thus, modify the scan logic to avoid passively scanning PSC channels
if there is no information about collocated APs and the scan is not
a 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.20220204122220.457da4cc95eb.Ic98472bab5f5475f1e102547644caaae89ce4c4a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: scan: Modify return value of a function
Ilan Peer [Fri, 4 Feb 2022 10:25:02 +0000 (12:25 +0200)]
iwlwifi: scan: Modify return value of a function

The function iwl_mvm_umac_scan_fill_6g_chan_list() always returns 0.
Change its return value to 'void'.

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.20220204122220.caef72dc255c.I186b787c7f190ca00c2800e1035f2503360f58a8@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: yoyo: Avoid using dram data if allocation failed
Mukesh Sisodiya [Fri, 4 Feb 2022 10:25:01 +0000 (12:25 +0200)]
iwlwifi: yoyo: Avoid using dram data if allocation failed

The config set TLV setting depend on dram allocation
and if allocation failed the data used in config set tlv
should not set this.
Adding the check if dram fragment is available or not.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Fixes: 1a5daead217c ("iwlwifi: yoyo: support for ROM usniffer")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220204122220.44835d181528.I3e78ba29c13bbeada017fcb2a620f3552c1dfa30@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: Correctly set fragmented EBS
Ilan Peer [Fri, 4 Feb 2022 10:25:00 +0000 (12:25 +0200)]
iwlwifi: mvm: Correctly set fragmented EBS

Currently, fragmented EBS was set for a channel only if the 'hb_type'
was set to fragmented or balanced scan. However, 'hb_type' is set only
in case of CDB, and thus fragmented EBS is never set for a channel for
non-CDB devices. Fix it.

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.20220204122220.a6165ac9b9d5.I654eafa62fd647030ae6d4f07f32c96c3171decb@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: nvm: Correct HE capability
Abhishek Naik [Sun, 30 Jan 2022 09:53:06 +0000 (11:53 +0200)]
iwlwifi: nvm: Correct HE capability

The HE PHY capability - Tx 1024-QAM < 242-tone RU support
was not handled for Ms RFs, add the relevant code for it.

Signed-off-by: Abhishek Naik <abhishek.naik@intel.com>
Fixes: 1381eb5c8ed5 ("iwlwifi: correct HE capabilities")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220130115024.01e232ce98ca.I765d26e9eb6ae9424542ccb7dd7f7ba61b1b6449@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mei: avoid -Wpointer-arith and -Wcast-qual warnings
Johannes Berg [Sun, 30 Jan 2022 09:53:05 +0000 (11:53 +0200)]
iwlwifi: mei: avoid -Wpointer-arith and -Wcast-qual warnings

These cause extra warnings (at least with W=3), avoid them.

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.20220130115024.59d00c6e5f09.I331bf18af0b80b5cc41b379ff0cc1b26a89dd915@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: make some functions friendly to sparse
Johannes Berg [Sun, 30 Jan 2022 09:53:04 +0000 (11:53 +0200)]
iwlwifi: make some functions friendly to sparse

Somehow, sparse cannot track the cond_lock() here properly,
but if we return directly from the inner basic block then
it doesn't complain. Refactor the code a bit to make it not
complain.

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.20220130115024.3f9de2d59929.Ib6324e93951ee877754538c89f3ab2a84998bd40@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: avoid variable shadowing
Johannes Berg [Sun, 30 Jan 2022 09:53:03 +0000 (11:53 +0200)]
iwlwifi: avoid variable shadowing

Change a few places to not shadow variables.

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.20220130115024.d53f2a7a9614.I7441559451d54b39dc0daeb4c31e5dce19d4d83e@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: remove unused DC2DC_CONFIG_CMD definitions
Luca Coelho [Sun, 30 Jan 2022 09:53:02 +0000 (11:53 +0200)]
iwlwifi: remove unused DC2DC_CONFIG_CMD definitions

We haven't used this command for a long time, if ever, so we can
remove all related definitions.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220130115024.26c0044110cc.Ie0d215a22618e7a3ecc39eca349914981b608b4d@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: dbg-tlv: clean up iwl_dbg_tlv_update_drams()
Johannes Berg [Sun, 30 Jan 2022 09:53:01 +0000 (11:53 +0200)]
iwlwifi: dbg-tlv: clean up iwl_dbg_tlv_update_drams()

This function puts a fairly large structure unnecessarily
on the stack, and also has a few other very strange things,
clean it up a bit.

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.20220130115024.9f2c282a3104.If6b868c96c0d089579ca72fd270387de81359d5b@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: move symbols into a separate namespace
Johannes Berg [Sun, 30 Jan 2022 09:53:00 +0000 (11:53 +0200)]
iwlwifi: move symbols into a separate namespace

Nobody other than iwlwifi itself should be accessing the symbols
that it exports, so make that clear by moving them into a separate
new namespace ("IWLWIFI").

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.20220130115024.67eba0b9867d.I6291815892746956c36489081f24f4f95b5160e4@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: fw: make dump_start callback void
Johannes Berg [Sun, 30 Jan 2022 09:52:59 +0000 (11:52 +0200)]
iwlwifi: fw: make dump_start callback void

We never return errors there, so just make it void.

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.20220130115024.375b3a28d89e.Ia76e9bf13e26eb148abfebdaf859eab1b81d2af1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: pcie: make sure iwl_rx_packet_payload_len() will not underflow
Andrei Otcheretianski [Sun, 30 Jan 2022 09:52:58 +0000 (11:52 +0200)]
iwlwifi: pcie: make sure iwl_rx_packet_payload_len() will not underflow

If the device is malfunctioning and reports too short rx descriptor
length, iwl_rx_packet_payload_len() will underflow, eventually resulting
in accessing memory out of bounds and other bad things. Prevent this.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220130115024.ea00b52c6f25.I8b79b14f1af8b6f2f579f97b397b9e005fe446b1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: use debug print instead of WARN_ON()
Miri Korenblit [Sun, 30 Jan 2022 09:52:57 +0000 (11:52 +0200)]
iwlwifi: mvm: use debug print instead of WARN_ON()

In MCC_UPDATE_CMD we get from the FW the number of entries in the
channel info array. We used to WARN_ON if this parameter is greater
than we expected. Since this is not really a driver bug, and since it
might happen in some valid cases too, we shouldn't use a warning here.

Fix this by replacing the WARN_ON with a debug print.

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.20220130115024.3cb9828df280.I14abe7c71b45bbae3d3cd503e6e13fa2cd372ed4@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: read and print OTP minor version
Luca Coelho [Sun, 30 Jan 2022 09:52:56 +0000 (11:52 +0200)]
iwlwifi: read and print OTP minor version

Sometimes it can be useful to know the OTP minor version, so read it
from the register and print it out.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220130115024.a90a1363558e.Ifc08db91cdc7d2e8353af55afaf899e10b2ef875@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: add support for BZ-U and BZ-L HW
Mike Golant [Sun, 30 Jan 2022 09:52:55 +0000 (11:52 +0200)]
iwlwifi: add support for BZ-U and BZ-L HW

Add support for BZ-U and BZ-L HW
with GF, GF4, MR, FM and FM4 RF modules

Signed-off-by: Mike Golant <michael.golant@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220130115024.da218b81e88d.I5aa958baef1691d443b9f6e42f7b68514e89f0dc@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: add support for CT-KILL notification version 2
Miri Korenblit [Sat, 29 Jan 2022 11:16:22 +0000 (13:16 +0200)]
iwlwifi: mvm: add support for CT-KILL notification version 2

A new version was added to the CT-KILL notification API.
Add support for it.

In addition, print the two fields that was added in this 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.20220129105618.b79be7a134e9.I7f5c67d79dd97bf5170492aab356ec983622d3b2@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: yoyo: remove DBGI_SRAM address reset writing
Rotem Saado [Sat, 29 Jan 2022 11:16:21 +0000 (13:16 +0200)]
iwlwifi: yoyo: remove DBGI_SRAM address reset writing

Due to preg protection we cannot write to this register
while FW is running (when FW in Halt it is ok).
since we have some cases that we need to dump this
region while FW is running remove this writing from DRV.
FW will do this writing.

Signed-off-by: Rotem Saado <rotem.saado@intel.com>
Fixes: 89639e06d0f3 ("iwlwifi: yoyo: support for new DBGI_SRAM region")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220129105618.209f3078bc74.I463530bd2f40daedb39f6d9df987bb7cee209033@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: support v3 of station HE context command
Johannes Berg [Sat, 29 Jan 2022 11:16:20 +0000 (13:16 +0200)]
iwlwifi: mvm: support v3 of station HE context command

This now includes 320 MHz and some other data for EHT, support
it, but don't fill in the additional EHT data for now.

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.20220129105618.6054f8028102.I07d7f406c29c9725d8cd9e979c0070332bbfc64b@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: yoyo: add IMR DRAM dump support
Mukesh Sisodiya [Sat, 29 Jan 2022 11:16:19 +0000 (13:16 +0200)]
iwlwifi: yoyo: add IMR DRAM dump support

Support debug collection of the platform IMR memory region,
where data is copied by FW during d3 state

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220129105618.715f04ecc635.Ib89a6caa06c1324c1c0dd3f9f4cf7407f2857155@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: yoyo: fix DBGC allocation flow
Rotem Saado [Sat, 29 Jan 2022 11:16:18 +0000 (13:16 +0200)]
iwlwifi: yoyo: fix DBGC allocation flow

number of DBGCs and number of fragments per DBGC
is hw family dependency and not capability.

Signed-off-by: Rotem Saado <rotem.saado@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220129105618.209c6fe4364a.I5b21769d297d6fcfafc58ddf1db87d88349fe06f@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: pcie: add support for MS devices
Yaara Baruch [Sat, 29 Jan 2022 11:16:17 +0000 (13:16 +0200)]
iwlwifi: pcie: add support for MS devices

Add MS devices to the driver. For now we are using the same FW image as MR
(since they differ only in rfid), but it should change in the future.

Signed-off-by: Yaara Baruch <yaara.baruch@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220129105618.a82ca9207ace.I38aa0acfb7846b179027b6f87f5f88f8e4177f63@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: align locking in D3 test debugfs
Johannes Berg [Sat, 29 Jan 2022 11:16:16 +0000 (13:16 +0200)]
iwlwifi: mvm: align locking in D3 test debugfs

Since commit a05829a7222e ("cfg80211: avoid holding the RTNL when
calling the driver") we're not only holding the RTNL when going
in and out of suspend, but also the wiphy->mtx. Add that to the
D3 test debugfs in iwlwifi since it's required for various calls
to mac80211.

Fixes: a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Fixes: a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220129105618.fcec0204e162.Ib73bf787ab4d83581de20eb89b1f8dbfcaaad0e3@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: don't iterate unadded vifs when handling FW SMPS req
Luca Coelho [Sat, 29 Jan 2022 11:16:15 +0000 (13:16 +0200)]
iwlwifi: mvm: don't iterate unadded vifs when handling FW SMPS req

We may not have all the interfaces added to the driver when we get the
THERMAL_DUAL_CHAIN_REQUEST notification from the FW, so instead of
iterating all vifs to update SMPS, iterate only the ones that are
already assigned.  The interfaces that were not assigned yet, will be
updated accordingly when we start using them.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Fixes: 2a7ce54ccc23 ("iwlwifi: mvm: honour firmware SMPS requests")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220129105618.9416aade2ba0.I0b71142f89e3f158aa058a1dfb2517c8c1fa3726@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: advertise support for HE - DCM BPSK RX/TX
Mordechay Goodstein [Sat, 29 Jan 2022 11:16:14 +0000 (13:16 +0200)]
iwlwifi: advertise support for HE - DCM BPSK RX/TX

Our HE capable HW also supports DCM mode, so broadcast this capability
in the HE PHY capabilities.

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.20220129105618.f7f1b31a8c75.Id349f61dfd9d3514c08ad0917b1607d35ab73dfa@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: only enable HE DCM if we also support TX
Mordechay Goodstein [Sat, 29 Jan 2022 11:16:13 +0000 (13:16 +0200)]
iwlwifi: mvm: only enable HE DCM if we also support TX

Currently we enable DCM if the peer supports RX without checking whether
we advertised that we support TX.  Fix this by also checking that our TX
side is set.

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.20220129105618.6865266c8a34.If1de7849f25337bb14ba2f27896e9715ae5975df@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: yoyo: fix DBGI_SRAM ini dump header.
Rotem Saado [Sat, 29 Jan 2022 11:16:12 +0000 (13:16 +0200)]
iwlwifi: yoyo: fix DBGI_SRAM ini dump header.

DBGI SRAM is new type of monitor, therefore it should be
dump as monitor type with ini dump monitor header.

Signed-off-by: Rotem Saado <rotem.saado@intel.com>
Fixes: 89639e06d0f3 ("iwlwifi: yoyo: support for new DBGI_SRAM region")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220129105618.6c31f6a2dcfc.If311c1d548bc5f7157a449e848ea01f71f5592eb@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: dbg: add infra for tracking free buffer size
Mordechay Goodstein [Sat, 29 Jan 2022 11:16:11 +0000 (13:16 +0200)]
iwlwifi: dbg: add infra for tracking free buffer size

Until now function just got a pointer to some buffer and used it as if
it's good to use with no boundaries about size left in the buffer.

This infra helps for internal functions ops to make sure buffer usage
is in bound of allocation.

We also add external checks with warnings to verify every internal
function didn't exceed usage of the free buffer size.

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.20220129105618.25c90fb14968.Ic8f05581a745d08011ca29b3f42767402643e8c5@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: starting from 22000 we have 32 Rx AMPDU sessions
Emmanuel Grumbach [Fri, 28 Jan 2022 13:34:33 +0000 (15:34 +0200)]
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>
2 years agoiwlwifi: mvm: support new BAID allocation command
Johannes Berg [Fri, 28 Jan 2022 13:34:32 +0000 (15:34 +0200)]
iwlwifi: mvm: support new BAID allocation command

Due to some rearchitecting inside the firmware, a new BAID
allocation command is being introduced. Support it. Note
that with it the firmware no longer returns "no space" but
will crash instead, so check for that before sending the
command to the firmware.

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.a89fa3bd9d91.Ibe58c5d9e882dad43aa857aa1c8f54f3358c667b@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: refactor iwl_mvm_sta_rx_agg()
Johannes Berg [Fri, 28 Jan 2022 13:34:31 +0000 (15:34 +0200)]
iwlwifi: mvm: refactor iwl_mvm_sta_rx_agg()

Refactor the firmware call in iwl_mvm_sta_rx_agg() out into
its own function to be able to change it more easily in the
next patch.

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.8ec17e282b24.I37c008a9141a2868ee4560e6de303e8bfbb93502@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: cfg: add support for 1K BA queue
Mordechay Goodstein [Fri, 28 Jan 2022 13:34:30 +0000 (15:34 +0200)]
iwlwifi: cfg: add support for 1K BA queue

In order to support 1K aggregations start ba queue with at least double
the size, also allocate based on the connecting type to save memory
usage.

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.20220128153014.16b43fe3e92f.I853c57648feee4b69ccb01ef4c75354377d60be2@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: avoid void pointer arithmetic
Johannes Berg [Fri, 28 Jan 2022 13:34:29 +0000 (15:34 +0200)]
iwlwifi: avoid void pointer arithmetic

Avoid void pointer arithmetic since it's technically
undefined and causes warnings in some places that use
our code.

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.e349104ecd94.Iadc937f475158b9437becdfefb361a97e7eaa934@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: fix various more -Wcast-qual warnings
Johannes Berg [Fri, 28 Jan 2022 13:34:28 +0000 (15:34 +0200)]
iwlwifi: fix various more -Wcast-qual warnings

When enabling W=3 that gets us -Wcast-qual, fix those warnings
in the code and propagate constness properly, or cast it away
via (uintptr_t) where really needed.

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.4ac2f19c121e.Ied9469d93f8199206242bfba96e4e8d1949e3a08@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: propagate (const) type qualifier
Bjoern A. Zeeb [Fri, 28 Jan 2022 13:34:27 +0000 (15:34 +0200)]
iwlwifi: propagate (const) type qualifier

Most of this change is a continuation of commit 403ea939ea6a
("iwlwifi: dbg: Mark ucode tlv data as const") propagating the
(const) type qualifier for ucode based tlv data to avoid having
the impression that it is writeable.
The other part of the change preserves the (const) type qualifier
over casts and function calls where it was previously lost.
Both changes are needed to avoid compile time errors on system with
more strict error settings, in this case found with clang on FreeBSD.

Sponsored by:  The FreeBSD Foundation
Signed-off-by: Bjoern A. Zeeb <bz@FreeBSD.ORG>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
[fix double word in commit 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.20220128153014.3230c41312fc.I0032c597984834258d5a79b97052ed83dbe53b80@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: de-const properly where needed
Bjoern A. Zeeb [Fri, 28 Jan 2022 13:34:26 +0000 (15:34 +0200)]
iwlwifi: de-const properly where needed

In order to de-const variables simply casting through (void *) is
not enough: "cast from 'const .. *' to 'void *' drops const qualifier".
Cast through (uintptr_t) as well [1] to make this compile on systems
with more strict requirements.
In addition passing const void *data to dma_map_single() also
drops the (const) qualifier.  De-constify on variable on assignment
which may be overwritten later.  In either case the (void *) cast
to dma_map_single() is not needed (anymore) either.

[1] See __DECONST() in sys/sys/cdefs.h in FreeBSD

Sponsored by:  The FreeBSD Foundation
Signed-off-by: Bjoern A. Zeeb <bz@FreeBSD.ORG>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220128153014.eb696eb56bf6.Ide1dd041f9b908c5154a600286a7453750b0704a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: make iwl_fw_lookup_cmd_ver() take a cmd_id
Johannes Berg [Fri, 28 Jan 2022 13:34:25 +0000 (15:34 +0200)]
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>
2 years agoiwlwifi: mvm: fw: clean up hcmd struct creation
Johannes Berg [Fri, 28 Jan 2022 13:34:24 +0000 (15:34 +0200)]
iwlwifi: mvm: fw: clean up hcmd struct creation

This is valid, but pretty uncommon in the driver, clean up
the code here a bit to use an initializer.

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.1717817392df.I75add2a50a69d28eaebfd67e5a0524bf43119a81@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: prefer WIDE_ID() over iwl_cmd_id()
Johannes Berg [Fri, 28 Jan 2022 13:34:23 +0000 (15:34 +0200)]
iwlwifi: prefer WIDE_ID() over iwl_cmd_id()

The order of arguments for iwl_cmd_id() is confusing, and the
version is always 0 and thus a useless argument. Prefer the
WIDE_ID() macro (which needs to be a macro due to use in switch
cases etc.) over the iwl_cmd_id() function.

Obviously done with spatch:

  @@
  expression G, C;
  @@
  -iwl_cmd_id(C, G, 0)
  +WIDE_ID(G, 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.20220128153014.cc4f9d1a2e9b.Ieb023cd773ea22e819d1ef1c37ae857ecc1a839d@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: allow enabling UHB TAS in the USA via ACPI setting
Ayala Barazani [Fri, 28 Jan 2022 13:34:22 +0000 (15:34 +0200)]
iwlwifi: mvm: allow enabling UHB TAS in the USA via ACPI setting

Read a new bit defined in ACPI WTAS that allows OEMs to specify whether
TAS is allowed in UHB (6-7GHz) in the USA.  This can be used by OEMs
that got certified to use this feature.

Signed-off-by: Ayala Barazani <ayala.barazani@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220128153014.1d2ae1e6bcdb.I177929ed01ed7bf4614ea0f6db2af9e52de13316@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agoiwlwifi: mvm: offload channel switch timing to FW
Nathan Errera [Fri, 28 Jan 2022 13:34:21 +0000 (15:34 +0200)]
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>
2 years agoiwlwifi: mvm: Don't call iwl_mvm_sta_from_mac80211() with NULL sta
Takashi Iwai [Fri, 21 Jan 2022 11:40:24 +0000 (12:40 +0100)]
iwlwifi: mvm: Don't call iwl_mvm_sta_from_mac80211() with NULL sta

The recent fix for NULL sta in iwl_mvm_get_tx_rate() still has a call
of iwl_mvm_sta_from_mac80211() that may be called with NULL sta.
Although this practically only points to the address and the actual
access doesn't happen due to the conditional evaluation at a later
point, it looks a bit flaky.

This patch drops the temporary variable above and evaluates
iwm_mvm_sta_from_mac80211() directly for avoiding confusions.

Fixes: d599f714b73e ("iwlwifi: mvm: don't crash on invalid rate w/o STA")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20220121114024.10454-1-tiwai@suse.de
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2 years agomac80211_hwsim: Advertise support for EHT capabilities
Ilan Peer [Mon, 14 Feb 2022 16:30:06 +0000 (17:30 +0100)]
mac80211_hwsim: Advertise support for EHT capabilities

Add EHT capabilities to bands.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://lore.kernel.org/r/20220214173004.1b710f8e04ce.I11d6911dafc01deb8ceb7828e363e8554701790a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: parse AddBA request with extended AddBA element
Mordechay Goodstein [Mon, 14 Feb 2022 16:30:05 +0000 (17:30 +0100)]
mac80211: parse AddBA request with extended AddBA element

In EHT requesting aggregation with 1K needs the use of extended
the AddBA element for the buffer size, so add the logic to parse
it and make sure it's in limits of the EHT aggregation size.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Link: https://lore.kernel.org/r/20220214173004.8209cae9d9e4.I434f5588602f83b4e658c660120040913b3a2e3d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: calculate max RX NSS for EHT mode
Mordechay Goodstein [Mon, 14 Feb 2022 16:30:04 +0000 (17:30 +0100)]
mac80211: calculate max RX NSS for EHT mode

If the station supports EHT mode, calculate the maximum RX NSS
from EHT station capabilities.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Link: https://lore.kernel.org/r/20220214173004.cf61972c8919.I54f5a416f0789bf4eefad04703d941b6755f6dd6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: Add support for storing station EHT capabilities
Ilan Peer [Mon, 14 Feb 2022 16:30:03 +0000 (17:30 +0100)]
mac80211: Add support for storing station EHT capabilities

When a station configuration is updated, also update the station
EHT capabilities.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://lore.kernel.org/r/20220214173004.47213ffb23a8.I15c6c8430e1a0184b1322e40f1727ed4f17b04e2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: Handle station association response with EHT
Ilan Peer [Mon, 14 Feb 2022 16:30:02 +0000 (17:30 +0100)]
mac80211: Handle station association response with EHT

When the association is an EHT association, parse the EHT
element from the association response and update the
station's EHT capabilities accordingly.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://lore.kernel.org/r/20220214173004.f33574718755.I21182234c5303d9423eabd5eb997e7cf75f8e0c8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: Add EHT capabilities to association/probe request
Ilan Peer [Mon, 14 Feb 2022 16:30:01 +0000 (17:30 +0100)]
mac80211: Add EHT capabilities to association/probe request

Add the EHT capabilities element to both probe request and
association request frames, if advertised by the driver.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://lore.kernel.org/r/20220214173004.2ec94388acee.I40d2ef06099cb091e9c2c01f8ef521b993a3d559@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: Add initial support for EHT and 320 MHz channels
Ilan Peer [Mon, 14 Feb 2022 16:30:00 +0000 (17:30 +0100)]
mac80211: Add initial support for EHT and 320 MHz channels

Add initial support for EHT and 320 MHz bandwidth in mac80211.

As a new IEEE80211_STA_RX_BW_320 is added to
enum ieee80211_sta_rx_bandwidth, update the drivers to avoid
compilation warnings.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://lore.kernel.org/r/20220214173004.0f144cc0bba6.Iad18111264da87eed5fd7b017f0cc6e58c604e07@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: Support parsing EHT elements
Ilan Peer [Mon, 14 Feb 2022 16:29:59 +0000 (17:29 +0100)]
mac80211: Support parsing EHT elements

Parse the new EHT elements in the element parsing utilities.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://lore.kernel.org/r/20220214173004.4d52ddaf1af4.Ib6beb1aa85e25b71ce40d3260b2e5b117cc42308@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agocfg80211: Support configuration of station EHT capabilities
Ilan Peer [Mon, 14 Feb 2022 16:29:58 +0000 (17:29 +0100)]
cfg80211: Support configuration of station EHT capabilities

Add attributes and some code bits to support userspace passing
in EHT capabilities of stations.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://lore.kernel.org/r/20220214173004.ecf0b3ff9627.Icb4a5f2ec7b41d9008ac4cfc16c59baeb84793d3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agocfg80211: add NO-EHT flag to regulatory
Ilan Peer [Mon, 14 Feb 2022 16:29:57 +0000 (17:29 +0100)]
cfg80211: add NO-EHT flag to regulatory

This may be necessary in some cases, add a flag and propagate
it, just like the NO-HE that already exists.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
[split off from a combined 320/no-EHT patch]
Link: https://lore.kernel.org/r/20220214173004.dbb85a7b86bb.Ifc1e2daac51c1cc5f895ccfb79faf5eaec3950ec@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agonl80211: add support for 320MHz channel limitation
Sriram R [Mon, 14 Feb 2022 16:29:56 +0000 (17:29 +0100)]
nl80211: add support for 320MHz channel limitation

Add support to advertise drivers or regulatory limitations on 320 MHz
channels to userspace.

Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
Co-authored-by: Karthikeyan Periyasamy <quic_periyasia@quicinc.com>
Signed-off-by: Karthikeyan Periyasamy <quic_periyasia@quicinc.com>
Co-authored-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/1640163883-12696-6-git-send-email-quic_vjakkam@quicinc.com
Link: https://lore.kernel.org/r/20220214163009.175289-3-johannes@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agonl80211: add EHT MCS support
Veerendranath Jakkam [Mon, 14 Feb 2022 16:29:55 +0000 (17:29 +0100)]
nl80211: add EHT MCS support

Add support for reporting and calculating EHT bitrates.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/1640163883-12696-7-git-send-email-quic_vjakkam@quicinc.com
Link: https://lore.kernel.org/r/20220214163009.175289-2-johannes@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agocfg80211: Add support for EHT 320 MHz channel width
Jia Ding [Mon, 14 Feb 2022 16:29:54 +0000 (17:29 +0100)]
cfg80211: Add support for EHT 320 MHz channel width

Add 320 MHz support in the channel def and center frequency validation
with compatible check.

Signed-off-by: Jia Ding <quic_jiad@quicinc.com>
Co-authored-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Co-authored-by: Muna Sinada <quic_msinada@quicinc.com>
Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
Co-authored-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/1640163883-12696-5-git-send-email-quic_vjakkam@quicinc.com
Link: https://lore.kernel.org/r/20220214163009.175289-1-johannes@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agocfg80211: Add data structures to capture EHT capabilities
Ilan Peer [Mon, 14 Feb 2022 16:29:53 +0000 (17:29 +0100)]
cfg80211: Add data structures to capture EHT capabilities

And advertise EHT capabilities to user space when supported.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://lore.kernel.org/r/20220214173004.6fb70658529f.I2413a37c8f7d2d6d638038a3d95360a3fce0114d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoieee80211: add EHT 1K aggregation definitions
Mordechay Goodstein [Mon, 14 Feb 2022 16:29:52 +0000 (17:29 +0100)]
ieee80211: add EHT 1K aggregation definitions

We add the fields for parsing extended ADDBA request/respond,
and new max 1K aggregation for limit ADDBA request/respond.

Adjust drivers to use the proper macro, IEEE80211_MAX_AMPDU_BUF ->
IEEE80211_MAX_AMPDU_BUF_HE.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Link: https://lore.kernel.org/r/20220214173004.b8b447ce95b7.I0ee2554c94e89abc7a752b0f7cc7fd79c273efea@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoieee80211: Add EHT (802.11be) definitions
Ilan Peer [Mon, 14 Feb 2022 16:29:51 +0000 (17:29 +0100)]
ieee80211: Add EHT (802.11be) definitions

Based on Draft P802.11be_D1.4.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://lore.kernel.org/r/20220214173004.928e23cacb2b.Id30a3ef2844b296efbd5486fe1da9ca36a95c5cf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211_hwsim: Add custom regulatory for 6GHz
Ilan Peer [Mon, 14 Feb 2022 16:29:50 +0000 (17:29 +0100)]
mac80211_hwsim: Add custom regulatory for 6GHz

Add a custom regulatory domain for testing 6 GHz, including
320 MHz bandwidth. This can be used before the regulatory
databases are all updated etc.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://lore.kernel.org/r/20220214173004.e3d6faf1f35f.I9507395b64496d96a2276ba8c1e1323e54407aa7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211_hwsim: don't shadow a global variable
Johannes Berg [Mon, 14 Feb 2022 16:29:49 +0000 (17:29 +0100)]
mac80211_hwsim: don't shadow a global variable

The argument to hwsim_init_s1g_channels() shadows a global,
change that to be clearer.

Link: https://lore.kernel.org/r/20220214173004.66bac90d64a8.I3e878e42bf2feecbb0a6ca38a68c236c23a8c9e6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211_hwsim: check TX and STA bandwidth
Johannes Berg [Mon, 14 Feb 2022 16:29:48 +0000 (17:29 +0100)]
mac80211_hwsim: check TX and STA bandwidth

Add checks to hwsim to validate that neither TX nor any
station's configured bandwidth can exceed the channel
(context) configuration previously requested.

Link: https://lore.kernel.org/r/20220214173004.9fd154d2c3c2.Ia0cd152357a373149bab017d479ab7d5ded289c0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agonl80211: accept only HE capability elements with valid size
Johannes Berg [Mon, 14 Feb 2022 16:29:23 +0000 (17:29 +0100)]
nl80211: accept only HE capability elements with valid size

The kernel (driver code) should be able to assume that a station's
HE capabilities are not badly sized, so reject them if they are.

Link: https://lore.kernel.org/r/20220214172921.80b710d45cb7.Id57ce32f9538a40e36c620fabedbd2c73346ef56@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: parse only HE capability elements with valid size
Johannes Berg [Mon, 14 Feb 2022 16:29:22 +0000 (17:29 +0100)]
mac80211: parse only HE capability elements with valid size

The code validates the HE capability element size later,
but slightly wrong, so use the new helper to do it right
and only accept it if it has a good size.

Link: https://lore.kernel.org/r/20220214172920.b5b06f264a61.I645ac1e2dc0ace223ef3e551cd5a71c88bd55e04@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoieee80211: add helper to check HE capability element size
Johannes Berg [Mon, 14 Feb 2022 16:29:21 +0000 (17:29 +0100)]
ieee80211: add helper to check HE capability element size

This element has a very dynamic structure, create a small helper
function to validate its size. We're currently checking it in
mac80211 in a conversion function, but that's actually slightly
buggy.

Link: https://lore.kernel.org/r/20220214172920.750bee9eaf37.Ie18359bd38143b7dc949078f10752413e6d36854@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agonl80211: use RCU to read regdom in reg get/dump
Johannes Berg [Mon, 14 Feb 2022 09:18:20 +0000 (10:18 +0100)]
nl80211: use RCU to read regdom in reg get/dump

Use RCU here to read the regdomain, this will allow us
to remove the RTNL locking from the setter.

Note in nl80211_get_reg_do() we still need the RTNL to
do the wiphy lookup.

Link: https://lore.kernel.org/r/20220214101820.5d4acbcf2a46.Ibfc91980439862125e983d9adeebaba73fe38e2d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211_hwsim: Add debugfs to control rx status RSSI
Beni Lev [Thu, 10 Feb 2022 19:16:50 +0000 (20:16 +0100)]
mac80211_hwsim: Add debugfs to control rx status RSSI

Set the base RSSI of a TX frame. The final RSSI of the frame will be
the base RSSI + the radio's TX power

Signed-off-by: Beni Lev <beni.lev@intel.com>
Link: https://lore.kernel.org/r/20220210201649.dddebbb55a7f.I6c0607694587b577070339078829fcc20dfcfe2c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoieee80211: use tab to indent struct ieee80211_neighbor_ap_info
Johannes Berg [Thu, 10 Feb 2022 19:12:43 +0000 (20:12 +0100)]
ieee80211: use tab to indent struct ieee80211_neighbor_ap_info

Somehow spaces were used here, use tab instead.

Link: https://lore.kernel.org/r/20220210201242.da8fa2e5ae8d.Ia452db01876e52e815f6337fef437049df0d8bd9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agortw89: handle TX/RX 160M bandwidth
Ping-Ke Shih [Fri, 11 Feb 2022 07:59:53 +0000 (15:59 +0800)]
rtw89: handle TX/RX 160M bandwidth

Apply 160M bandwidth to RA (rate adaptive) mechanism, so it can transmit
packets with this bandwidth. On the other hand, convert 160M bandwidth
from RX desc to rx_info_bw.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220211075953.40421-7-pkshih@realtek.com
2 years agortw89: declare if chip support 160M bandwidth
Ping-Ke Shih [Fri, 11 Feb 2022 07:59:52 +0000 (15:59 +0800)]
rtw89: declare if chip support 160M bandwidth

The new chip can support 160M, so add a chip attribute to indicate the
chip support it.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220211075953.40421-6-pkshih@realtek.com
2 years agortw89: add 6G support to rate adaptive mechanism
Ping-Ke Shih [Fri, 11 Feb 2022 07:59:51 +0000 (15:59 +0800)]
rtw89: add 6G support to rate adaptive mechanism

Construct rate mask of 6G band, and rate adaptive mechanism can work well
on this band.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220211075953.40421-5-pkshih@realtek.com
2 years agortw89: extend subband for 6G band
Zong-Zhe Yang [Fri, 11 Feb 2022 07:59:50 +0000 (15:59 +0800)]
rtw89: extend subband for 6G band

Split 6G band into 8 sub-bands where indexes are from 0 to 7,
i.e. RTW89_CH_6G_BAND_IDX[0-7]. Then, decide subband by both
band and channel instead of just channel because conflicts
between 5G channels and 6G channels.

Moreover, add default case to the existing use of switch (subband).

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220211075953.40421-4-pkshih@realtek.com
2 years agortw89: refine naming of rfk helpers with prefix
Zong-Zhe Yang [Fri, 11 Feb 2022 07:59:49 +0000 (15:59 +0800)]
rtw89: refine naming of rfk helpers with prefix

Since these macro in rfk helpers are common now, a common naming
should be better. So, apply RTW89_ as prefix to them, and modify
the use correspondly. No logic is changed at all.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220211075953.40421-3-pkshih@realtek.com
2 years agortw89: make rfk helpers common across chips
Zong-Zhe Yang [Fri, 11 Feb 2022 07:59:48 +0000 (15:59 +0800)]
rtw89: make rfk helpers common across chips

These rfk helpers are also useful for the chip which is under planning.
So, move them to common code to avoid duplicate stuff in the future.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220211075953.40421-2-pkshih@realtek.com
2 years agobrcmfmac: Add BCM43454/6 support
Zhao, Jiaqing [Wed, 9 Feb 2022 15:46:50 +0000 (15:46 +0000)]
brcmfmac: Add BCM43454/6 support

BCM43454/6 is a variant of BCM4345 which is exactly identical to
BCM4345/6, except the chip id is 0xa9be. This patch adds support
for BCM43454/6 by handing it in the same way as BCM4345.

Note: when loading some specific version of BCM4345 firmware, the
chip id may become 0x4345. This is an expected behavior, and it will
restore to 0xa9be after power cycle.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/CO1PR11MB47859B51BCA88613D1582EB88E2E9@CO1PR11MB4785.namprd11.prod.outlook.com
2 years agoMerge tag 'wireless-next-2022-02-11' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Fri, 11 Feb 2022 14:19:23 +0000 (14:19 +0000)]
Merge tag 'wireless-next-2022-02-11' of git://git./linux/kernel/git/wireless/wireless-next

wireless-next patches for v5.18

First set of patches for v5.18, with both wireless and stack patches.
rtw89 now has AP mode support and wcn36xx has survey support. But
otherwise pretty normal.

Major changes:

ath11k

* add LDPC FEC type in 802.11 radiotap header

* enable RX PPDU stats in monitor co-exist mode

wcn36xx

* implement survey reporting

brcmfmac

* add CYW43570 PCIE device

rtw88

* rtw8821c: enable RFE 6 devices

rtw89

* AP mode support

mt76

* mt7916 support

* background radar detection support

2 years agoMerge branch 'ipv6-loopback'
David S. Miller [Fri, 11 Feb 2022 11:44:27 +0000 (11:44 +0000)]
Merge branch 'ipv6-loopback'

Eric Dumazet says:

====================
ipv6: remove addrconf reliance on loopback

Second patch in this series removes IPv6 requirement about the netns
loopback device being the last device being dismantled.

This was needed because rt6_uncached_list_flush_dev()
and ip6_dst_ifdown() had to switch dst dev to a known
device (loopback).

Instead of loopback, we can use the (hidden) blackhole_netdev
which is also always there.

This will allow future simplfications of netdev_run_to()
and other parts of the stack like default_device_exit_batch().

Last two patches are optimizations for both IP families.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoipv4: add (struct uncached_list)->quarantine list
Eric Dumazet [Thu, 10 Feb 2022 21:42:31 +0000 (13:42 -0800)]
ipv4: add (struct uncached_list)->quarantine list

This is an optimization to keep the per-cpu lists as short as possible:

Whenever rt_flush_dev() changes one rtable dst.dev
matching the disappearing device, it can can transfer the object
to a quarantine list, waiting for a final rt_del_uncached_list().

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoipv6: add (struct uncached_list)->quarantine list
Eric Dumazet [Thu, 10 Feb 2022 21:42:30 +0000 (13:42 -0800)]
ipv6: add (struct uncached_list)->quarantine list

This is an optimization to keep the per-cpu lists as short as possible:

Whenever rt6_uncached_list_flush_dev() changes one rt6_info
matching the disappearing device, it can can transfer the object
to a quarantine list, waiting for a final rt6_uncached_list_del().

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoipv6: give an IPv6 dev to blackhole_netdev
Eric Dumazet [Thu, 10 Feb 2022 21:42:29 +0000 (13:42 -0800)]
ipv6: give an IPv6 dev to blackhole_netdev

IPv6 addrconf notifiers wants the loopback device to
be the last device being dismantled at netns deletion.

This caused many limitations and work arounds.

Back in linux-5.3, Mahesh added a per host blackhole_netdev
that can be used whenever we need to make sure objects no longer
refer to a disappearing device.

If we attach to blackhole_netdev an ip6_ptr (allocate an idev),
then we can use this special device (which is never freed)
in place of the loopback_dev (which can be freed).

This will permit improvements in netdev_run_todo() and other parts
of the stack where had steps to make sure loopback_dev was
the last device to disappear.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Mahesh Bandewar <maheshb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoipv6: get rid of net->ipv6.rt6_stats->fib_rt_uncache
Eric Dumazet [Thu, 10 Feb 2022 21:42:28 +0000 (13:42 -0800)]
ipv6: get rid of net->ipv6.rt6_stats->fib_rt_uncache

This counter has never been visible, there is little point
trying to maintain it.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>