linux-block.git
3 months agowifi: iwlwifi: remove mld/roc.c
Johannes Berg [Tue, 4 Mar 2025 12:47:59 +0000 (13:47 +0100)]
wifi: iwlwifi: remove mld/roc.c

This file should never have been part of the commit, remove it.

Fixes: af3be9088404 ("wifi: iwlwifi: support ROC version 6")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: refactor populating mesh related fields in sinfo
Sarika Sharma [Thu, 13 Feb 2025 17:16:22 +0000 (22:46 +0530)]
wifi: mac80211: refactor populating mesh related fields in sinfo

Introduce the sta_set_mesh_sinfo() to populate mesh related
fields in sinfo structure for station statistics.
This will allow for the simplified population of other fields in the
sinfo structure for link level in a subsequent patch to add support
for MLO station statistics.
No functionality changes added.

Signed-off-by: Sarika Sharma <quic_sarishar@quicinc.com>
Link: https://patch.msgid.link/20250213171632.1646538-3-quic_sarishar@quicinc.com
[reword since it's just an internal thing]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: cfg80211: reorg sinfo structure elements for mesh
Sarika Sharma [Thu, 13 Feb 2025 17:16:21 +0000 (22:46 +0530)]
wifi: cfg80211: reorg sinfo structure elements for mesh

Currently, as multi-link operation(MLO) is not supported for mesh,
reorganize the sinfo structure for mesh-specific fields and embed
mesh related NL attributes together in organized view.
This will allow for the simplified reorganization of sinfo structure
for link level in a subsequent patch to add support for MLO station
statistics.
No functionality changes added.

Pahole summary before the reorg of sinfo structure:
 - size: 256, cachelines: 4, members: 50
 - sum members: 239, holes: 4, sum holes: 17
 - paddings: 2, sum paddings: 2
 - forced alignments: 1, forced holes: 1, sum forced holes: 1

Pahole summary after the reorg of sinfo structure:
 - size: 248, cachelines: 4, members: 50
 - sum members: 239, holes: 4, sum holes: 9
 - paddings: 2, sum paddings: 2
 - forced alignments: 1, last cacheline: 56 bytes

Signed-off-by: Sarika Sharma <quic_sarishar@quicinc.com>
Link: https://patch.msgid.link/20250213171632.1646538-2-quic_sarishar@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: Fix spelling mistake "Increate" -> "Increase"
Colin Ian King [Thu, 27 Feb 2025 22:19:17 +0000 (22:19 +0000)]
wifi: iwlwifi: Fix spelling mistake "Increate" -> "Increase"

There is a spelling mistake in a IWL_DEBUG_RATE message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://patch.msgid.link/20250227221917.658401-1-colin.i.king@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: add Debug Host Command APIs
Miri Korenblit [Wed, 12 Feb 2025 05:43:33 +0000 (07:43 +0200)]
wifi: iwlwifi: add Debug Host Command APIs

Add the defintition of those APIs, those will be used in a later patch.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212073923.d842253ee55d.I2e8d65f22d5acde70ed6be16f913160a93d06852@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: add IWL_MAX_NUM_IGTKS macro
Miri Korenblit [Wed, 12 Feb 2025 05:43:32 +0000 (07:43 +0200)]
wifi: iwlwifi: add IWL_MAX_NUM_IGTKS macro

This macro represents the number of IGTKS the FW can support.
Will be used in a later patch.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212073923.a8e3c7461f13.If63cbc73eaf328b2c1d7c8e57627eb93c35b0c70@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: add OMI bandwidth reduction APIs
Johannes Berg [Wed, 12 Feb 2025 05:43:31 +0000 (07:43 +0200)]
wifi: iwlwifi: add OMI bandwidth reduction APIs

This adds the API definitions needed for OMI bandwidth reduction.
Will be used in a later patches.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212073923.4d34e8f5a3df.Idd6185cdb8d8a133f92032db9278c1510961cbdc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: remove mvm prefix from iwl_mvm_d3_end_notif
Miri Korenblit [Wed, 12 Feb 2025 05:43:30 +0000 (07:43 +0200)]
wifi: iwlwifi: remove mvm prefix from iwl_mvm_d3_end_notif

This is not op mode specific.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212073923.c99748f63511.I5c8dcc46e992e76c82fdf7dbee65957cbdca1b43@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: remember if the UATS table was read successfully
Emmanuel Grumbach [Wed, 12 Feb 2025 05:43:29 +0000 (07:43 +0200)]
wifi: iwlwifi: remember if the UATS table was read successfully

This will allow to read the table once, and not any time the command is
sent. The actual use of this will be in a later patch.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212073923.61801b78a2cb.I710a766888f370a75b47116fec29d41c106b13ed@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: export iwl_get_lari_config_bitmap
Emmanuel Grumbach [Wed, 12 Feb 2025 05:43:28 +0000 (07:43 +0200)]
wifi: iwlwifi: export iwl_get_lari_config_bitmap

This will now be called from another opmode we are writing.
iwl_fill_lari_config will only be used for the older ones.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212073923.9bb7fbc592a6.I8850691eac7c8471257f3031e8c05905afc72f70@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: add support for external 32 KHz clock
Emmanuel Grumbach [Wed, 12 Feb 2025 05:43:27 +0000 (07:43 +0200)]
wifi: iwlwifi: add support for external 32 KHz clock

In case the BIOS allows it, instruct the firmware to use the external 32
KHz clock.
The op mode specific implementation (i.e. reading the BIOS table) will
come in a later patch.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212073923.9aae3f74fee0.I25ae45ef02b9ea387b512f974c1f3e5367a537e5@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: mld: add a debug level for EHT prints
Miri Korenblit [Wed, 12 Feb 2025 05:43:26 +0000 (07:43 +0200)]
wifi: iwlwifi: mld: add a debug level for EHT prints

This is required for EHT related debug prints.
As there are no more available debug levels, delete IWL_DL_EXTERNAL,
which is not used, and replace it with IWL_DL_EHT.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212073923.9b1e0d87e7e4.Iea6c1329f7b6312a73896f9a9d9bce72bd6548e2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: mld: add a debug level for PTP prints
Miri Korenblit [Wed, 12 Feb 2025 05:43:25 +0000 (07:43 +0200)]
wifi: iwlwifi: mld: add a debug level for PTP prints

This is required for PTP related debug prints.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212073923.866f8f66b1d7.I764abcb845d992d058c753ce8fa9d45fed2ff4ec@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: remove mvm prefix from iwl_mvm_esr_mode_notif
Miri Korenblit [Wed, 12 Feb 2025 05:43:24 +0000 (07:43 +0200)]
wifi: iwlwifi: remove mvm prefix from iwl_mvm_esr_mode_notif

This is not specific to mvm.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212073923.c536eeaae129.I848307be6df21913c0ce3eb6baef715cd401db1a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: use 0xff instead of 0xffffffff for invalid
Emmanuel Grumbach [Wed, 12 Feb 2025 05:43:23 +0000 (07:43 +0200)]
wifi: iwlwifi: use 0xff instead of 0xffffffff for invalid

The firmware is now able to understand 0xff and that is more widely
used.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212073923.c6719e6dc0a6.Ifd149101fa886730602dbbb02f980be8e554fe84@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: location api cleanup
Avraham Stern [Wed, 12 Feb 2025 05:43:22 +0000 (07:43 +0200)]
wifi: iwlwifi: location api cleanup

Remove the version suffix from the latest version of the range
request command structs and the range response notification structs.
In addition, don't use MVM in the API file as it is not MVM specific.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212073923.294b7109e0be.I229ceef5933e825815d84c33855cadd62687ee04@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: cfg80211: expose update timestamp to drivers
Benjamin Berg [Wed, 12 Feb 2025 06:22:58 +0000 (08:22 +0200)]
wifi: cfg80211: expose update timestamp to drivers

This information is exposed to userspace but not drivers. Make this
field public so that drivers are also able to access it. The information
is for example useful for link selection to determine whether the BSS
corresponding to an MLO link has been seen in a recent scan.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212082137.b682ee7aebc8.I0f7cca9effa2b1cee79f4f2eb8b549c99b4e0571@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: add ieee80211_iter_chan_contexts_mtx
Miri Korenblit [Wed, 12 Feb 2025 06:22:57 +0000 (08:22 +0200)]
wifi: mac80211: add ieee80211_iter_chan_contexts_mtx

Add a chanctx iterator that can be called from a wiphy-locked context.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250212082137.d85eef3024de.Icda0616416c5fd4b2cbf892bdab2476f26e644ec@changeid
[fix kernel-doc]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: fix integer overflow in hwmp_route_info_get()
Gavrilov Ilia [Wed, 12 Feb 2025 08:21:25 +0000 (08:21 +0000)]
wifi: mac80211: fix integer overflow in hwmp_route_info_get()

Since the new_metric and last_hop_metric variables can reach
the MAX_METRIC(0xffffffff) value, an integer overflow may occur
when multiplying them by 10/9. It can lead to incorrect behavior.

Found by InfoTeCS on behalf of Linux Verification Center
(linuxtesting.org) with SVACE.

Fixes: a8d418d9ac25 ("mac80211: mesh: only switch path when new metric is at least 10% better")
Cc: stable@vger.kernel.org
Signed-off-by: Ilia Gavrilov <Ilia.Gavrilov@infotecs.ru>
Link: https://patch.msgid.link/20250212082124.4078236-1-Ilia.Gavrilov@infotecs.ru
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: Fix possible integer promotion issue
Ilan Peer [Fri, 14 Feb 2025 07:47:21 +0000 (09:47 +0200)]
wifi: mac80211: Fix possible integer promotion issue

Fix a possible integer promotion issue in mac80211 in ieee80211_ml_epcs()

Fixes: de86c5f60839 ("wifi: mac80211: Add support for EPCS configuration")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://patch.msgid.link/20250214074721.1613549-1-ilan.peer@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: cfg80211: convert timeouts to secs_to_jiffies()
Easwar Hariharan [Wed, 19 Feb 2025 20:32:40 +0000 (20:32 +0000)]
wifi: cfg80211: convert timeouts to secs_to_jiffies()

Commit b35108a51cf7 ("jiffies: Define secs_to_jiffies()") introduced
secs_to_jiffies().  As the value here is a multiple of 1000, use
secs_to_jiffies() instead of msecs_to_jiffies to avoid the multiplication.

This is converted using scripts/coccinelle/misc/secs_to_jiffies.cocci with
the following Coccinelle rules:

@depends on patch@
expression E;
@@

-msecs_to_jiffies(E * 1000)
+secs_to_jiffies(E)

-msecs_to_jiffies(E * MSEC_PER_SEC)
+secs_to_jiffies(E)

Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
Reviewed-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Link: https://patch.msgid.link/20250219203240.141272-1-eahariha@linux.microsoft.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: Add counter for all monitor interfaces
Alexander Wetzel [Thu, 20 Feb 2025 09:41:39 +0000 (10:41 +0100)]
wifi: mac80211: Add counter for all monitor interfaces

Count open monitor interfaces regardless of the monitor interface type.
The new counter virt_monitors takes over counting interfaces depending
on the virtual monitor interface while monitors is used for all active
monitor interfaces.

This fixes monitor packet mirroring when using MONITOR_FLAG_ACTIVE or
NO_VIRTUAL_MONITOR interfaces.

Fixes: 286e69677065 ("wifi: mac80211: Drop cooked monitor support")
Reported-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Closes: https://lore.kernel.org/r/cc715114-4e3b-619a-49dc-a4878075e1dc@quicinc.com
Signed-off-by: Alexander Wetzel <Alexander@wetzel-home.de>
Tested-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Link: https://patch.msgid.link/20250220094139.61459-1-Alexander@wetzel-home.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlegacy: don't warn for unused variables with DEBUG_FS=n
Arnd Bergmann [Tue, 25 Feb 2025 14:53:53 +0000 (15:53 +0100)]
wifi: iwlegacy: don't warn for unused variables with DEBUG_FS=n

The reference to il_rate_mcs is inside of an #ifdef, causing a W=1 warning:

drivers/net/wireless/intel/iwlegacy/4965-rs.c:189:38: error: unused variable 'il_rate_mcs' [-Werror,-Wunused-const-variable]
static const struct il_rate_mcs_info il_rate_mcs[RATE_COUNT] = {

Replace the #ifdef with a PTR_IF() for better compile time analysis.
The dead code will still get eliminated, but the warning goes away.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20250225145359.1126786-1-arnd@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agoMerge tag 'rtw-next-2025-02-10-v2' of https://github.com/pkshih/rtw
Johannes Berg [Tue, 11 Feb 2025 14:55:48 +0000 (15:55 +0100)]
Merge tag 'rtw-next-2025-02-10-v2' of https://github.com/pkshih/rtw

Ping-Ke says:

====================
rtw-next patches for v6.15

Major changes are listed below:

rtw88:

 * preparation to support RTL8814AU

rtw89:

 * switch using wiphy_lock and wiphy_work

 * add BB context to manipulate two PHY as preparation of MLO

 * improve BT-coexistence mechanism to play A2DP smoothly

 * firmware file can contain regd table
====================

Link: https://lore.kernel.org/linux-wireless/b65fae15-79bf-40fa-8acc-63d87ae35e19@RTEXMBS04.realtek.com.tw/
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: implement dump region split
Johannes Berg [Wed, 5 Feb 2025 12:55:48 +0000 (14:55 +0200)]
wifi: iwlwifi: implement dump region split

Due to hardware design constraints, a reset handshake may be
necessary even when the firmware has already crashed, with
the dump descriptions indicating which parts should be done
before/after the handshake, if needed. Implement that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.9296e3113d42.Ifb32703fd06a644d08a86b7af1b990738e3c8134@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: add twt operation cmd
Shaul Triebitz [Wed, 5 Feb 2025 12:55:47 +0000 (14:55 +0200)]
wifi: iwlwifi: add twt operation cmd

Add the firmware API.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.50a9f7bebe4c.I15ac1361fdab547dbf680a6fa6e88fdc5b177082@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: use correct IMR dump variable
Johannes Berg [Wed, 5 Feb 2025 12:55:46 +0000 (14:55 +0200)]
wifi: iwlwifi: use correct IMR dump variable

We shouldn't dump the reg_data here which dumps the last
entry again, it should use the imr_reg_data.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.3313b18667d1.Iaa9ab66b1d397912a573525e060d39ea01b29d19@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: support ROC version 6
Shaul Triebitz [Wed, 5 Feb 2025 12:55:45 +0000 (14:55 +0200)]
wifi: iwlwifi: support ROC version 6

Version 6 added ROC with multi repetitions.
We don't use it, but need to update the command
length.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.956c33729d48.I609835c08f0003c084a13a1e1e505cb7bc8ecbc6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: clarify the meaning of IWL_INIT_PHY
Emmanuel Grumbach [Wed, 5 Feb 2025 12:55:44 +0000 (14:55 +0200)]
wifi: iwlwifi: clarify the meaning of IWL_INIT_PHY

This is a bit that tells the firmware to wait for the
PHY_CONFIGURATION_CMD before completing its init sequence.
Clarify this in the comment.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.097510347ae2.Ica00b4b30163a21bf993fa968dd406ee4023fc9e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: properly set the names for SC devices
Emmanuel Grumbach [Wed, 5 Feb 2025 12:55:43 +0000 (14:55 +0200)]
wifi: iwlwifi: properly set the names for SC devices

Sc devices can come with several CRFs. Use the CRF to determine the name
of the device.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.5bf5d931204e.I5eb435db1b8df46687c43ebae6488c0c4430d530@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: make no_160 more generic
Emmanuel Grumbach [Wed, 5 Feb 2025 12:55:42 +0000 (14:55 +0200)]
wifi: iwlwifi: make no_160 more generic

We'll have devices that are EHT capable but don't support 320 MHz and
those devices look like the 320 MHz capable devices, but have distinct
subsystem ID.
We already had the same type of differentiation for HE devices that
support 160 MHz or not.
Enhance that mechanism and now the _IWL_DEV_INFO macro gets an
indication whether the bandwidth should be limited for that specific
device.
The subsystem ID gives a binary answer about the bandwidth limitation
and iwl_pci_find_dev_info() compares this to the list of _IWL_DEV_INFO
entries.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.1ba406c538a5.I6e24123f60a764aedfeaaac8768c26e136c320cf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: be less aggressive with re-probe
Emmanuel Grumbach [Wed, 5 Feb 2025 12:55:41 +0000 (14:55 +0200)]
wifi: iwlwifi: be less aggressive with re-probe

Re-probing if we had 2 firmware crash within 3 minutes is really too
aggressive. Drastically reduce the threshold to 7 seconds.
After 7 seconds, a new firmware crash will be considered "new" and not
cause a PCI re-probe.
This allows to pass tests that cause a firmware crash every 10 seconds
and expect to see no impact on the traffic.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.38f912b047f4.I03f0c10ae9e7ecea639431f3e089b757cc8a4347@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: fw: make iwl_send_dbg_dump_complete_cmd() static
Johannes Berg [Wed, 5 Feb 2025 12:55:40 +0000 (14:55 +0200)]
wifi: iwlwifi: fw: make iwl_send_dbg_dump_complete_cmd() static

It's only used in the same file, so can be static.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.319b66c00676.I3c06d6c2ee5850a5a89feff7d770e557fd625a6d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: mvm: Indicate support link reconfiguration
Ilan Peer [Wed, 5 Feb 2025 12:55:39 +0000 (14:55 +0200)]
wifi: iwlwifi: mvm: Indicate support link reconfiguration

As MLO link configuration is supported by mac80211, indicate
support for MLO link reconfiguration in station mode.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
----------------
depends on "wifi: ieee80211: Add some missing MLO related definitions"
Link: https://patch.msgid.link/20250205145347.92d19705d2b9.Id07fa3ebad6bc23ecf6e91868f67150ce70f47b0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: Indicate support for EPCS
Ilan Peer [Wed, 5 Feb 2025 12:55:38 +0000 (14:55 +0200)]
wifi: iwlwifi: Indicate support for EPCS

Indicate support for EPCS and unsolicited EPCS in the EHT MAC
capabilities.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.6b1c7cc8a958.Idd72ea53f70eb452d43d99e6c45ff21f891100bd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: cfg: separate 22000/BZ family HT params
Johannes Berg [Wed, 5 Feb 2025 12:55:37 +0000 (14:55 +0200)]
wifi: iwlwifi: cfg: separate 22000/BZ family HT params

We're adding a new IWLMLD opmode for just BZ and later
devices. If that's enabled but IWLMVM isn't, the build
fails because 22000 family configs aren't built but BZ
and later refer to it. Rather than trying to make some
new file to build it in all cases, just copy the small
struct.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.1d6186c23bee.I3c61a6c9e0db3ba6eea4dac63e1547945ad01703@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: enable 320 MHz on slow PCIe links
Johannes Berg [Wed, 5 Feb 2025 12:55:36 +0000 (14:55 +0200)]
wifi: iwlwifi: enable 320 MHz on slow PCIe links

Despite not being able to sustain the full 320 MHz throughput
even at MCS 9, enable 320 MHz on slow PCIe links. This may in
some cases result in frames being dropped (on the air) by the
firmware if they cannot be delivered to the host, but it can
still be better to use 320 MHz.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.1e5356a3b124.I1224023721aaeff8ebcaa47dff88613c7fd0533a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: don't warn during reprobe
Miri Korenblit [Wed, 5 Feb 2025 12:55:35 +0000 (14:55 +0200)]
wifi: iwlwifi: don't warn during reprobe

During reprobe, the sw state is being destroyd, and so is the
connection. When the peer STA is being removed, the opmode sends a
command to flush the TXQs of the STA and uses iwl_trans_wait_txq_empty.

This one warns if the FW is not alive, but it really shouldn't if
there is a FW error - and return silently instead, just like we do when
sending a hcmd.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20250205145347.76425b10e5a0.I3bf0de2eb090a8b94c4e36d93dd91df61fadb808@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: Unify TAS block list handling in regulatory.c
Anjaneyulu [Wed, 5 Feb 2025 12:55:34 +0000 (14:55 +0200)]
wifi: iwlwifi: Unify TAS block list handling in regulatory.c

Created a common function iwl_add_mcc_to_tas_block_list() to handle the
operations previously performed by iwl_mld_add_to_tas_block_list() and
iwl_mvm_add_to_tas_block_list(). moved this new function to regulatory.c
to better reflect its purpose and improve code organization.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.157d26fb7f02.I87e20e967835bc895be390daf1c6637e20b52aae@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: mvm: rename and move iwl_mvm_eval_dsm_rfi() to iwl_rfi_is_enabled_in_b...
Anjaneyulu [Wed, 5 Feb 2025 12:55:33 +0000 (14:55 +0200)]
wifi: iwlwifi: mvm: rename and move iwl_mvm_eval_dsm_rfi() to iwl_rfi_is_enabled_in_bios()

Renamed iwl_mvm_eval_dsm_rfi() to iwl_rfi_is_enabled_in_bios() to better
reflect the function's operation. Additionally, moved the function to the
regulatory.c file for better organization. optimize local variable
usage in it.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205145347.b7ac9d05234e.Ieb623d7e8dca6bb6a5733682b31e4ff1e39373f0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: b43: Replace outdated firmware URL
Salvatore Bonaccorso [Wed, 5 Feb 2025 11:06:14 +0000 (12:06 +0100)]
wifi: b43: Replace outdated firmware URL

https://wireless.wiki.kernel.org site now redirects to
https://wireless.docs.kernel.org/en/latest/ making the reference
information for the b43 firmware inaccessible. Update the URL to the
current location.

Link: https://bugs.debian.org/1095062
Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
Acked-by: Michael Büsch <m@bues.ch>
Link: https://patch.msgid.link/20250205110614.216958-1-carnil@debian.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: rework the Tx of the deauth in ieee80211_set_disassoc()
Emmanuel Grumbach [Wed, 5 Feb 2025 09:39:27 +0000 (11:39 +0200)]
wifi: mac80211: rework the Tx of the deauth in ieee80211_set_disassoc()

When we disassociate we may need to send a deauth frame.
Regardless of this decision, we need to flush the queues to drop all the
packets on the Tx queues.

The flow looks like this:

1) Flush packets waiting on the queues (drop=true)
2) Prepare Tx to send the deauth
3) Build the deauth header
4) send the deauth
5) Flush the deauth packet (drop=false)
6) Complete_tx

Step 3 and 4 are done in ieee80211_send_deauth_disassoc() and that
function  must be called even if we decide not to send the deauth
frame because we need step 3 for cfg80211.

This means that if we want to send the deauth frame, we need all the
steps, but if we don't want to send the deauth frame we still want step
1 and 3.

Change the code to do that.

Also, prevent sending the deauth frame if we are in the middle of a CSA
with mode=1 in which case we won't be able to send the frame anyway.
This caused issues in iwlwifi at step 5 since the firmware wouldn't
send the frame and we'd be stuck flushing with drop=false.
Implement this in ieee80211_set_disassoc() which has many callers.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.480bfea605e0.I91131eed942e49b9885d73f4180a3c9c26691c62@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: ensure sdata->work is canceled before initialized.
Miri Korenblit [Wed, 5 Feb 2025 09:39:26 +0000 (11:39 +0200)]
wifi: mac80211: ensure sdata->work is canceled before initialized.

This wiphy work is canceled when the iface is stopped,
and shouldn't be queued for a non-running iface.
If it happens to be queued for a non-running iface (due to a bug)
it can cause a corruption of wiphy_work_list when ieee80211_setup_sdata
is called. Make sure to cancel it in this case and warn on.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20250205110958.99204c767c10.I84ce27a239059f6009cee197b252549a11426046@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: enable removing assoc link
Johannes Berg [Wed, 5 Feb 2025 09:39:25 +0000 (11:39 +0200)]
wifi: mac80211: enable removing assoc link

With the previous patch to no longer access deflink for aggregation
it seems we no longer access the deflink for MLO stations (MLDs) so
we can allow removing the assoc link.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.05bc2175cea2.I8f62609a682fdf3f703872d0fce63ab6a4780a7e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: aggregation: remove deflink accesses for MLO
Johannes Berg [Wed, 5 Feb 2025 09:39:24 +0000 (11:39 +0200)]
wifi: mac80211: aggregation: remove deflink accesses for MLO

If a station has connected with MLO (as indicated by valid_links
being non-zero, even if that may have just a single bit set), it
necessarily supports EHT/aggregation, so we don't need to check
the deflink for those cases.

Add conditions so we can support removing the link it/we used to
associate on.

Note that we still use the statistics in the deflink, but that's
a whole different story we will need to address separately.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.daf2a9e367f2.Id2c2dfbbe7451cc900ed88c5a81b33c55b4ab1cf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: always send max agg subframe num in strict mode
Johannes Berg [Wed, 5 Feb 2025 09:39:23 +0000 (11:39 +0200)]
wifi: mac80211: always send max agg subframe num in strict mode

Instead of only sending the correct number for EHT and up,
always send the correct number as it should be in strict
mode.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.5910263db6da.Icd1f93fabc9705e4e760d834095c29b60b934d9e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: don't unconditionally call drv_mgd_complete_tx()
Johannes Berg [Wed, 5 Feb 2025 09:39:22 +0000 (11:39 +0200)]
wifi: mac80211: don't unconditionally call drv_mgd_complete_tx()

We might not have called drv_mgd_prepare_tx(), so only call
drv_mgd_complete_tx() under the same conditions.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.e091fc39a351.Ie6a3cdca070612a0aa4b3c6914ab9ed602d1f456@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: remove misplaced drv_mgd_complete_tx() call
Johannes Berg [Wed, 5 Feb 2025 09:39:21 +0000 (11:39 +0200)]
wifi: mac80211: remove misplaced drv_mgd_complete_tx() call

In the original commit 15fae3410f1d ("mac80211: notify driver on
mgd TX completion") I evidently made a mistake and placed the
call in the "associated" if, rather than the "assoc_data". Later
I noticed the missing call and placed it in commit c042600c17d8
("wifi: mac80211: adding missing drv_mgd_complete_tx() call"),
but didn't remove the wrong one. Remove it now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.6ed954179bbf.Id8ef8835b7e6da3bf913c76f77d201017dc8a3c9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: set ieee80211_prep_tx_info::link_id upon Auth Rx
Emmanuel Grumbach [Wed, 5 Feb 2025 09:39:20 +0000 (11:39 +0200)]
wifi: mac80211: set ieee80211_prep_tx_info::link_id upon Auth Rx

This will be used by the low level driver.
Note that link_id  will be 0 in case of a non-MLO authentication.
Also fix a call-site of mgd_prepare_tx() where the link_id was not
populated.

Update the documentation to reflect the current state
ieee80211_prep_tx_info::link_id is also available in mgd_complete_tx().

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.6a590f189ce5.I1fc5c0da26b143f5b07191eb592f01f7083d55ae@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: tests: add tests for ieee80211_determine_chan_mode
Benjamin Berg [Wed, 5 Feb 2025 09:39:19 +0000 (11:39 +0200)]
wifi: mac80211: tests: add tests for ieee80211_determine_chan_mode

Add a few tests for ieee80211_determine_chan_mode that check that
mac80211 will not try to connect to an AP if an advertised basic rate is
not supported.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.530c81eb7fdc.Ia77f5efdf9efb70d2766a3d6bf425553bcb308e8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: add HT and VHT basic set verification
Benjamin Berg [Wed, 5 Feb 2025 09:39:18 +0000 (11:39 +0200)]
wifi: mac80211: add HT and VHT basic set verification

So far we did not verify the HT and VHT basic MCS set. However, in
P802.11REVme/D7.0 (6.5.4.2.4) says that the MLME-JOIN.request shall
return an error if the VHT and HT basic set requirements are not met.

Given broken APs, apply VHT basic MCS/NSS set checks only in
strict mode.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.e2d8d4095f6b.I66bcf6c2de3b9d3325e4ffd9f573f4cd26ce5685@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211_hwsim: enable strict mode
Johannes Berg [Wed, 5 Feb 2025 09:39:17 +0000 (11:39 +0200)]
wifi: mac80211_hwsim: enable strict mode

Since we use hwsim for testing e.g. the hostapd implementation,
enable strict mode to catch errors that would otherwise not be
caught.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.85bee694f09c.I61ec37d20fe97699d47fce252dc4ae2e4475fc51@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: add strict mode disabling workarounds
Johannes Berg [Wed, 5 Feb 2025 09:39:16 +0000 (11:39 +0200)]
wifi: mac80211: add strict mode disabling workarounds

Add a strict mode where we disable certain workarounds and have
additional checks such as, for now, that VHT capabilities from
association response match those from beacon/probe response. We
can extend the checks in the future.

Make it an opt-in setting by the driver so it can be set there
in some driver-specific way, for example. Also allow setting
this one hw flag through the hwflags debugfs, by writing a new
strict=0 or strict=1 value.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.5cecb0469479.I4a69617dc60ba0d6308416ffbc3102cfd08ba068@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: Add processing of TTLM teardown frame
Ilan Peer [Wed, 5 Feb 2025 09:39:15 +0000 (11:39 +0200)]
wifi: mac80211: Add processing of TTLM teardown frame

Add processing of negotiated TTLM tear down frame.
Handle this frame similar to the way a locally initiated
tear down is handled.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.860691076786.I32df71182c25c5f84e4534f40efe1316926b8249@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: ieee80211: Add missing EHT MAC capabilities
Ilan Peer [Wed, 5 Feb 2025 09:39:14 +0000 (11:39 +0200)]
wifi: ieee80211: Add missing EHT MAC capabilities

Add missing EHT MAC capabilities definitions.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.6c1643c345a1.I7405b9c35cb39ae97a52c3fbcc36b0bd81e495dc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: Add support for EPCS configuration
Ilan Peer [Wed, 5 Feb 2025 09:39:13 +0000 (11:39 +0200)]
wifi: mac80211: Add support for EPCS configuration

Add support for configuring EPCS state:

- When EPCS is enabled, send an EPCS enable request action frame
  to the AP. When the AP replies with EPCS enable response, enable
  EPCS by applying the QoS parameters provided by the AP. Do so for
  all the valid MLD links. Once EPCS is enabled, support processing
  of unsolicited EPCS enable response frames.
- When EPCS is disabled, send an EPCS teardown request to the AP
  and apply the QoS parameters as obtained from the last received
  beacons. Do so for all the valid links.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.7a90afd7e140.I3f602d65f5c1fd849d6c70b12307dda33aa91ccb@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: Refactor ieee80211_sta_wmm_params()
Ilan Peer [Wed, 5 Feb 2025 09:39:12 +0000 (11:39 +0200)]
wifi: mac80211: Refactor ieee80211_sta_wmm_params()

The function first updates the link configuration and then
calls the driver to set the link parameters. Since the call
to the driver might sleep, split the function such that
the link configuration could be done without calling the
driver. This would be useful in cases that WMM parameters
need to be configured, but the current locking doesn't allow
to call the driver.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.b1cedcf93763.I65783c102d44127035838f97fab64ec4df5c40f3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: cfg80211: Fix trace print for removed links
Ilan Peer [Wed, 5 Feb 2025 09:39:11 +0000 (11:39 +0200)]
wifi: cfg80211: Fix trace print for removed links

Print the mask of removed links in hexadecimal.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.1dd2831cab5f.Ib9f5e82286f0352cd057b4bf76737223e9de8274@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: qtnfmac: Avoid multiple -Wflex-array-member-not-at-end warnings
Gustavo A. R. Silva [Wed, 5 Feb 2025 00:43:33 +0000 (11:13 +1030)]
wifi: qtnfmac: Avoid multiple -Wflex-array-member-not-at-end warnings

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

So, in order to avoid ending up with a flexible-array member in the
middle of other structs, we use the `__struct_group()` helper to
create a new tagged `struct qlink_tlv_hdr_fixed`. This structure
groups together all the members of the flexible `struct qlink_tlv_hdr`
except the flexible array.

As a result, the array is effectively separated from the rest of the
members without modifying the memory layout of the flexible structure.
We then change the type of the middle struct member currently causing
trouble from `struct qlink_tlv_hdr` to `struct qlink_tlv_hdr_fixed`.

We also want to ensure that when new members need to be added to the
flexible structure, they are always included within the newly created
tagged struct. For this, we use `static_assert()`. This ensures that
the memory layout for both the flexible structure and the new tagged
struct is the same after any changes.

This approach avoids having to implement `struct qlink_tlv_hdr_fixed`
as a completely separate structure, thus preventing having to maintain
two independent but basically identical structures, closing the door
to potential bugs in the future.

So, with this changes, fix 66 of the following warnings:
drivers/net/wireless/quantenna/qtnfmac/qlink.h:1681:30: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/quantenna/qtnfmac/qlink.h:1660:30: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/quantenna/qtnfmac/qlink.h:1646:30: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/quantenna/qtnfmac/qlink.h:1621:30: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/quantenna/qtnfmac/qlink.h:1609:30: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/quantenna/qtnfmac/qlink.h:1570:30: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://patch.msgid.link/Z6K0Nd_IprrhS6pn@kspp
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mac80211: Drop cooked monitor support
Alexander Wetzel [Tue, 4 Feb 2025 11:13:52 +0000 (12:13 +0100)]
wifi: mac80211: Drop cooked monitor support

Hostapd switched from cooked monitor interfaces to nl80211 Dec 2011.
Drop support for the outdated cooked monitor interfaces and fix
creating the virtual monitor interfaces in the following cases:

 1) We have one non-monitor and one monitor interface with
    %MONITOR_FLAG_ACTIVE enabled and then delete the non-monitor
    interface.

 2) We only have monitor interfaces enabled on resume while at least one
    has %MONITOR_FLAG_ACTIVE set.

Signed-off-by: Alexander Wetzel <Alexander@wetzel-home.de>
Link: https://patch.msgid.link/20250204111352.7004-2-Alexander@wetzel-home.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: nl80211/cfg80211: Stop supporting cooked monitor
Alexander Wetzel [Tue, 4 Feb 2025 11:13:51 +0000 (12:13 +0100)]
wifi: nl80211/cfg80211: Stop supporting cooked monitor

Unconditionally start to refuse creating cooked monitor interfaces to
phase them out.

There is no feature flag for drivers to opt-in for cooked monitor and
all known users are using/preferring the modern API since the hostapd
release 1.0 in May 2012.

Signed-off-by: Alexander Wetzel <Alexander@wetzel-home.de>
Link: https://patch.msgid.link/20250204111352.7004-1-Alexander@wetzel-home.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: mwifiex: Remove unused mwifiex_uap_del_sta_data
Dr. David Alan Gilbert [Tue, 4 Feb 2025 01:25:12 +0000 (01:25 +0000)]
wifi: mwifiex: Remove unused mwifiex_uap_del_sta_data

The last use of mwifiex_uap_del_sta_data() was removed in 2014 by
commit dda9ddeb2638 ("mwifiex: do not delete station entries in del_sta
handler")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://patch.msgid.link/20250204012512.390209-1-linux@treblig.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: ipw2x00: Fix spelling mistake "stablization" -> "stabilization"
Colin Ian King [Sun, 2 Feb 2025 22:06:59 +0000 (22:06 +0000)]
wifi: ipw2x00: Fix spelling mistake "stablization" -> "stabilization"

There is a spelling mistake in a IPW_DEBUG_INFO message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://patch.msgid.link/20250202220659.199341-1-colin.i.king@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: remove the mvm prefix from iwl_mvm_aux_sta_cmd
Emmanuel Grumbach [Sun, 19 Jan 2025 19:03:15 +0000 (21:03 +0200)]
wifi: iwlwifi: remove the mvm prefix from iwl_mvm_aux_sta_cmd

This is a firmware command and is not specific to the iwlmvm op_mode

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250119210104.276658439163.I70641851f9e5210ec3a7033db38a45d24814083b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: remove the version number from iwl_dts_measurement_notif_v2
Emmanuel Grumbach [Sun, 19 Jan 2025 19:03:14 +0000 (21:03 +0200)]
wifi: iwlwifi: remove the version number from iwl_dts_measurement_notif_v2

No need to carry the version number in the structure name if this is the
latest version available.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250119210104.9d218a5c4f6b.I9de3e424be48d66994cde3684ce7e9e99456067d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: remove the mvm prefix from iwl_mvm_ctdp_cmd
Emmanuel Grumbach [Sun, 19 Jan 2025 19:03:13 +0000 (21:03 +0200)]
wifi: iwlwifi: remove the mvm prefix from iwl_mvm_ctdp_cmd

This command is not specific to iwlmvm.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250119210104.04f3afcf9c77.Ic2b6f265d0b4aea25ccc7114d6f48afa621871be@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agonet: rfkill: gpio: allow booting in blocked state
Catalin Popescu [Thu, 16 Jan 2025 08:47:02 +0000 (09:47 +0100)]
net: rfkill: gpio: allow booting in blocked state

By default, rfkill state is unblocked and this behavior is not
configurable. Add support for booting in blocked state based on the
presence of a devicetree property.

Signed-off-by: Catalin Popescu <catalin.popescu@leica-geosystems.com>
Link: https://patch.msgid.link/20250116084702.3473176-2-catalin.popescu@leica-geosystems.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agodt-bindings: net: rfkill-gpio: enable booting in blocked state
Catalin Popescu [Thu, 16 Jan 2025 08:47:01 +0000 (09:47 +0100)]
dt-bindings: net: rfkill-gpio: enable booting in blocked state

By default, rfkill state is set to unblocked. Sometimes, we want to boot
in blocked state and let the application unblock the rfkill.

Signed-off-by: Catalin Popescu <catalin.popescu@leica-geosystems.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20250116084702.3473176-1-catalin.popescu@leica-geosystems.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
4 months agowifi: iwlwifi: Remove old device data
Dr. David Alan Gilbert [Mon, 23 Dec 2024 01:32:02 +0000 (01:32 +0000)]
wifi: iwlwifi: Remove old device data

The last use of iwl_ax204_name[], iwl_ax221_name[] and iwl_cfg_so_a0_ms_a0
was removed by
commit f473a7fd6d60 ("wifi: iwlwifi: remove devices that never came out")

Remove them.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20241223013202.340180-7-linux@treblig.org
4 months agowifi: iwlwifi: Remove unused iwl_bz_name
Dr. David Alan Gilbert [Mon, 23 Dec 2024 01:32:01 +0000 (01:32 +0000)]
wifi: iwlwifi: Remove unused iwl_bz_name

iwl_bz_name[] has been unused since the resent
commit 6795a37161fb ("wifi: iwlwifi: Print a specific device name.")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20241223013202.340180-6-linux@treblig.org
4 months agowifi: iwlwifi: mvm: Remove unused iwl_mvm_ftm_add_pasn_sta
Dr. David Alan Gilbert [Mon, 23 Dec 2024 01:32:00 +0000 (01:32 +0000)]
wifi: iwlwifi: mvm: Remove unused iwl_mvm_ftm_add_pasn_sta

iwl_mvm_ftm_add_pasn_sta() was added in 2020 by
commit 0739a7d70e00 ("iwlwifi: mvm: initiator: add option for adding a
PASN responder")
but hasn't been used.

Remove it.

That was the only caller of iwl_mvm_ftm_remove_pasn_sta().

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20241223013202.340180-5-linux@treblig.org
4 months agowifi: iwlwifi: mvm: Remove unused iwl_mvm_ftm_*_add_pasn_sta functions
Dr. David Alan Gilbert [Mon, 23 Dec 2024 01:31:59 +0000 (01:31 +0000)]
wifi: iwlwifi: mvm: Remove unused iwl_mvm_ftm_*_add_pasn_sta functions

iwl_mvm_ftm_respoder_add_pasn_sta() and
iwl_mvm_ftm_resp_remove_pasn_sta() were added in 2020 by
commit be82ecd3a5c8 ("iwlwifi: mvm: add an option to add PASN station")
but have remained unused.

Remove them.

After that removal iwl_mvm_add_pasn_sta() is now unused.
Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20241223013202.340180-4-linux@treblig.org
4 months agowifi: iwlwifi: mvm: Remove unused iwl_mvm_rx_missed_vap_notif
Dr. David Alan Gilbert [Mon, 23 Dec 2024 01:31:58 +0000 (01:31 +0000)]
wifi: iwlwifi: mvm: Remove unused iwl_mvm_rx_missed_vap_notif

iwl_mvm_rx_missed_vap_notif() was added in 2019 by
commit 449a29d0fead ("iwlwifi: mvm: add notification for missed VAP")

but hasn't been used.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20241223013202.340180-3-linux@treblig.org
4 months agowifi: iwlwifi: dvm: Remove unused iwl_rx_ant_restriction
Dr. David Alan Gilbert [Mon, 23 Dec 2024 01:31:57 +0000 (01:31 +0000)]
wifi: iwlwifi: dvm: Remove unused iwl_rx_ant_restriction

iwl_rx_ant_restriction() was added in 2009 by
commit 46f9381aa3fb ("iwlwifi: Thermal Throttling Management - part 2")
but never used.

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20241223013202.340180-2-linux@treblig.org
4 months agowifi: rtw89: debugfs depends on CFG80211's one
Ping-Ke Shih [Mon, 10 Feb 2025 12:31:05 +0000 (20:31 +0800)]
wifi: rtw89: debugfs depends on CFG80211's one

The wiphy_locked_debugfs_read() and wiphy_locked_debugfs_write() used
by rtw89 are defined if CFG80211_DEBUGFS enabled. Add the dependency
accordingly.

Fixes: 8fdf78f3cd5f ("wifi: rtw89: debugfs: use wiphy_locked_debugfs_{read,write}() if needed")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202502101810.3CUpUL7p-lkp@intel.com/
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250210123105.10466-1-pkshih@realtek.com
4 months agowifi: rtlwifi: rtl8192de: Fix typos of debug message of phy setting
Andrew Kreimer [Thu, 6 Feb 2025 08:24:12 +0000 (10:24 +0200)]
wifi: rtlwifi: rtl8192de: Fix typos of debug message of phy setting

There are some typos in comments/messages:
 - althougth -> although
 - asume -> assume

Fix them via codespell.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250206082457.9148-1-algonell@gmail.com
4 months agowifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU
Bitterblue Smith [Tue, 4 Feb 2025 18:42:08 +0000 (20:42 +0200)]
wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU

This function tells the firmware what rates it can use.

Put the 3SS and 4SS HT rates supported by the other station into the
rate mask.

Remove the 3SS and 4SS rates from the rate mask if the hardware only has
2 spatial streams.

And finally, select the right rate ID (a parameter for the firmware)
when the hardware has 3 spatial streams.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/48d1d90f-2aeb-4ec5-9a24-0980e10eae1e@gmail.com
4 months agowifi: rtw88: Extend TX power stuff for 3-4 spatial streams
Bitterblue Smith [Tue, 4 Feb 2025 18:41:43 +0000 (20:41 +0200)]
wifi: rtw88: Extend TX power stuff for 3-4 spatial streams

Although the RTL8814AU only has 3 spatial streams, maybe some other chip
has 4.

Correct the TX power index and TX power limit calculations for 3SS and
4SS HT/VHT rates.

With this the RTL8814AU can set the TX power correctly.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/d0c0e126-0794-4c4e-9203-ea39a707b673@gmail.com
4 months agowifi: rtw88: Rename RTW_RATE_SECTION_MAX to RTW_RATE_SECTION_NUM
Bitterblue Smith [Tue, 4 Feb 2025 18:40:58 +0000 (20:40 +0200)]
wifi: rtw88: Rename RTW_RATE_SECTION_MAX to RTW_RATE_SECTION_NUM

It fits the meaning of the enum better.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/5a1c5a46-8ebb-43b0-9ab1-b78e2a22b3d2@gmail.com
4 months agowifi: rtw88: Constify some more structs and arrays
Bitterblue Smith [Tue, 4 Feb 2025 18:40:22 +0000 (20:40 +0200)]
wifi: rtw88: Constify some more structs and arrays

These structs and arrays are never modified, so make them const:

rtw_band_2ghz
rtw_band_5ghz
rtw_pci_tx_queue_idx_addr
rtw_pci_ops
rtw_cck_rates
rtw_ofdm_rates
rtw_ht_1s_rates
rtw_ht_2s_rates
rtw_vht_1s_rates
rtw_vht_2s_rates
rtw_rate_section
rtw_rate_size
rtw_sdio_ops
rtw_usb_ops

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/502f124e-ccf3-4c09-80a4-1e5c5304822b@gmail.com
4 months agowifi: rtw88: Extend rtw_fw_send_ra_info() for RTL8814AU
Bitterblue Smith [Tue, 4 Feb 2025 18:39:29 +0000 (20:39 +0200)]
wifi: rtw88: Extend rtw_fw_send_ra_info() for RTL8814AU

The existing code is suitable for chips with up to 2 spatial streams.
Inform the firmware about the rates it's allowed to use when
transmitting 3 spatial streams.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/08e2f328-1aab-4e50-93ac-c1e5dd9541ac@gmail.com
4 months agowifi: rtw88: Extend rf_base_addr and rf_sipi_addr for RTL8814AU
Bitterblue Smith [Tue, 4 Feb 2025 18:38:43 +0000 (20:38 +0200)]
wifi: rtw88: Extend rf_base_addr and rf_sipi_addr for RTL8814AU

These members of struct rtw_chip_info each have a size of 2. Increase
their size to 4, which is the number of RF paths the RTL8814AU has.

This is required to read and write the RF registers of the RTL8814AU.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/7a4d8209-b8af-4943-b5de-f53d6edf591a@gmail.com
4 months agowifi: rtw88: Extend struct rtw_pwr_track_tbl for RTL8814AU
Bitterblue Smith [Tue, 4 Feb 2025 18:38:17 +0000 (20:38 +0200)]
wifi: rtw88: Extend struct rtw_pwr_track_tbl for RTL8814AU

Currently this struct has the members required for chips with 2 RF
paths. Add more members to support chips with 4 RF paths, like the
RTL8814AU.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/be5a73f4-a0fe-43d6-9457-930cde199284@gmail.com
4 months agowifi: rtw88: Fix download_firmware_validate() for RTL8814AU
Bitterblue Smith [Tue, 4 Feb 2025 18:37:36 +0000 (20:37 +0200)]
wifi: rtw88: Fix download_firmware_validate() for RTL8814AU

After the firmware is uploaded, download_firmware_validate() checks some
bits in REG_MCUFW_CTRL to see if everything went okay. The
RTL8814AU power on sequence sets bits 13 and 12 to 2, which this
function does not expect, so it thinks the firmware upload failed.

Make download_firmware_validate() ignore bits 13 and 12.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/049d2887-22fc-47b7-9e59-62627cb525f8@gmail.com
4 months agowifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU
Bitterblue Smith [Tue, 4 Feb 2025 18:36:56 +0000 (20:36 +0200)]
wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU

Don't call ltecoex_read_reg() and ltecoex_reg_write() when the
ltecoex_addr member of struct rtw_chip_info is NULL. The RTL8814AU
doesn't have this feature.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/55b5641f-094e-4f94-9f79-ac053733f2cf@gmail.com
4 months agowifi: rtw88: Fix a typo of debug message in rtw8723d_iqk_check_tx_failed()
Andrew Kreimer [Mon, 3 Feb 2025 18:08:27 +0000 (20:08 +0200)]
wifi: rtw88: Fix a typo of debug message in rtw8723d_iqk_check_tx_failed()

There is a typo in debug messages:
 - afer -> after

Fix it via codespell.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250203180913.5435-1-algonell@gmail.com
4 months agowifi: rtw89: regd: avoid using BITMAP_FROM_U64() to assign function bitmap
Ping-Ke Shih [Wed, 5 Feb 2025 01:40:51 +0000 (09:40 +0800)]
wifi: rtw89: regd: avoid using BITMAP_FROM_U64() to assign function bitmap

Since there are two function features for now, func_bitmap[] has single
one element, which BITMAP_FROM_U64() generating two elements is exceeded.
Change to assign function bitmap barely.

With i386-allmodconfig (a 32 bit system), it throws

 >> include/linux/bitmap.h:736:33: warning: excess elements in array initializer
      736 |                                 ((unsigned long) ((u64)(n) >> 32))
          |                                 ^
    drivers/net/wireless/realtek/rtw89/regd.c:16:34: note: in expansion of macro 'BITMAP_FROM_U64'
       16 |                 .func_bitmap = { BITMAP_FROM_U64(_fmap), },     \
          |                                  ^~~~~~~~~~~~~~~
    drivers/net/wireless/realtek/rtw89/regd.c:20:9: note: in expansion of macro 'COUNTRY_REGD'
       20 |         COUNTRY_REGD("00", RTW89_WW, RTW89_WW, RTW89_WW, 0x0);
          |         ^~~~~~~~~~~~

Fixes: 79a36fc56bea ("wifi: rtw89: regd: handle supported regulatory functions by country")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202502031932.BMQ4lhJT-lkp@intel.com/
Cc: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250205014051.13765-1-pkshih@realtek.com
4 months agowifi: rtw89: coex: Update Wi-Fi/Bluetooth coexistence version to 7.0.3
Ching-Te Ku [Wed, 5 Feb 2025 01:32:33 +0000 (09:32 +0800)]
wifi: rtw89: coex: Update Wi-Fi/Bluetooth coexistence version to 7.0.3

Refine the TWS Bluetooth related coexistence mechanism.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250205013233.10945-4-pkshih@realtek.com
4 months agowifi: rtw89: coex: To avoid TWS serials A2DP lag, adjust slot arrangement
Ching-Te Ku [Wed, 5 Feb 2025 01:32:32 +0000 (09:32 +0800)]
wifi: rtw89: coex: To avoid TWS serials A2DP lag, adjust slot arrangement

The TWS(True wireless stereo) serials Bluetooth audio device need to keep
packet traffic not only with DUT, it also need to synchronize packet with
its assistant earbud. And all the BR/EDR Bluetooth device need to do page
scan to keep re-connect event sensitively between different DUT.
These behavior will make TWS Bluetooth device cost more time slot to keep
the good audio performance. This patch decrease half of Wi-Fi slot(from
40ms to 20ms) in a single cycle. Make the slot more flexible to prevent
audio lag. The single cycle will be shorter, then it will bring some slot
protection cost make Wi-Fi throughput decrease about 5%.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250205013233.10945-3-pkshih@realtek.com
4 months agowifi: rtw89: coex: Assign value over than 0 to avoid firmware timer hang
Ching-Te Ku [Wed, 5 Feb 2025 01:32:31 +0000 (09:32 +0800)]
wifi: rtw89: coex: Assign value over than 0 to avoid firmware timer hang

If the slot duration is 0, the firmware timer will trigger timer hang at
the timer initializing state in a low rate due to hardware algorithm.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250205013233.10945-2-pkshih@realtek.com
4 months agowifi: rtw89: fw: validate multi-firmware header before getting its size
Ping-Ke Shih [Mon, 3 Feb 2025 07:29:11 +0000 (15:29 +0800)]
wifi: rtw89: fw: validate multi-firmware header before getting its size

To access firmware elements appended after multi-firmware, add its size
as offset to get start address of firmware elements.

         +-----+-------+------+---------+--------------+ --
         | sig | fw_nr | rsvd | version | reserved     |   \
         +---------------------------------------------+   |
 fw 0    | cv | type | mp | rsvd | shift | size | rsvd |   |
         +---------------------------------------------+   |
 fw 1    | cv | type | mp | rsvd | shift | size | rsvd |   |
         +---------------------------------------------+   |
 fw N-1  |                  ...                        |   |
         +=============================================+   | mfw size
         |               fw 0 content                  |   |
         +=============================================+   |
         |               fw 1 content                  |   |
         +=============================================+   |
         |                  ...                        |   |
         +=============================================+   |
         |               fw N -1 content               |   |
         +=============================================+ --/
         |             fw element TLV X                |
         +=============================================+
         |             fw element TLV Y                |
         +=============================================+
         |             fw element TLV Z                |
         +=============================================+

To avoid Coverity warning when getting mfw size, validate it header ahead.

Addresses-Coverity-ID: 1544385 ("Untrusted array index read")

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250203072911.47313-5-pkshih@realtek.com
4 months agowifi: rtw89: fw: validate multi-firmware header before accessing
Ping-Ke Shih [Mon, 3 Feb 2025 07:29:10 +0000 (15:29 +0800)]
wifi: rtw89: fw: validate multi-firmware header before accessing

A firmeware file contains multi-firmware with a header to represent
contents. The mfw_hdr->fw_nr is to define number of firmware in file.

         +-----+-------+------+---------+--------------+
         | sig | fw_nr | rsvd | version | reserved     |
         +---------------------------------------------+ --
 fw 0    | cv | type | mp | rsvd | shift | size | rsvd |   \
         +---------------------------------------------+   |
 fw 1    | cv | type | mp | rsvd | shift | size | rsvd |   | mfw_hdr->fw_nr
         +---------------------------------------------+   |
 fw N-1  |                  ...                        |   /
         +=============================================+ --
         |               fw 0 content                  |
         |       (pointed by fw0 shift/size)           |
         +=============================================+

To avoid Coverity warning, validate header is in range of firmware size,
and also validate the range of actual firmware content is in range.

Addresses-Coverity-ID: 1494046 ("Untrusted loop bound")

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250203072911.47313-4-pkshih@realtek.com
4 months agowifi: rtw89: ps: update H2C command with more info for PS
Eric Huang [Mon, 3 Feb 2025 07:29:09 +0000 (15:29 +0800)]
wifi: rtw89: ps: update H2C command with more info for PS

Adding beacon BW offset, OP1dB table and rfe_type to lps_ml_cmn_info.
These information will help FW to configure RX more accurately.

Signed-off-by: Eric Huang <echuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250203072911.47313-3-pkshih@realtek.com
4 months agowifi: rtw89: call power_on ahead before selecting firmware
Ping-Ke Shih [Mon, 3 Feb 2025 07:29:08 +0000 (15:29 +0800)]
wifi: rtw89: call power_on ahead before selecting firmware

Driver selects firmware by hardware version, which normally can be read
from registers before selecting firmware. However, certain chips such as
RTL8851B, it needs to read hardware version from efuse while doing
power_on, but do power_on after selecting firmware in current flow.

To resolve this flow problem, move power_on out from
rtw89_mac_partial_init(), and call rtw89_mac_pwr_on() separately at
proper places to have expected flow.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250203072911.47313-2-pkshih@realtek.com
4 months agowifi: rtl8xxxu: retry firmware download on error
Soeren Moch [Mon, 27 Jan 2025 19:48:28 +0000 (20:48 +0100)]
wifi: rtl8xxxu: retry firmware download on error

Occasionally there is an EPROTO error during firmware download.
This error is converted to EAGAIN in the download function.
But nobody tries again and so device probe fails.

Implement download retry to fix this.

This error was observed (and fix tested) on a tbs2910 board [1]
with an embedded RTL8188EU (0bda:8179) device behind a USB hub.

[1] arch/arm/boot/dts/nxp/imx/imx6q-tbs2910.dts

Signed-off-by: Soeren Moch <smoch@web.de>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250127194828.599379-1-smoch@web.de
4 months agowifi: rtw88: Don't use static local variable in rtw8821c_set_tx_power_index_by_rate
Bitterblue Smith [Sun, 26 Jan 2025 14:04:21 +0000 (16:04 +0200)]
wifi: rtw88: Don't use static local variable in rtw8821c_set_tx_power_index_by_rate

Some users want to plug two identical USB devices at the same time.
This static variable could theoretically cause them to use incorrect
TX power values.

Move the variable to the caller and pass a pointer to it to
rtw8821c_set_tx_power_index_by_rate().

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/fe42858c-9b9f-4f03-9aaa-737472c2cd90@gmail.com
4 months agowifi: rtw88: Don't use static local variable in rtw8822b_set_tx_power_index_by_rate
Bitterblue Smith [Sun, 26 Jan 2025 14:03:11 +0000 (16:03 +0200)]
wifi: rtw88: Don't use static local variable in rtw8822b_set_tx_power_index_by_rate

Some users want to plug two identical USB devices at the same time.
This static variable could theoretically cause them to use incorrect
TX power values.

Move the variable to the caller and pass a pointer to it to
rtw8822b_set_tx_power_index_by_rate().

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/8a60f581-0ab5-4d98-a97d-dd83b605008f@gmail.com
4 months agowifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS)
Ezra Buehler [Wed, 22 Jan 2025 07:15:11 +0000 (15:15 +0800)]
wifi: rtl8xxxu: Enable AP mode for RTL8192CU (RTL8188CUS)

This allows the driver to be used in wireless access point mode on the
AT91SAM9G25-based GARDENA smart Gateway.

Unfortunately, the data throughput in AP mode appears to be lower than
with the vendor driver (or in STA mode). Especially when sending, the
data rate is significantly lower. My measurements performed with iperf3
and an Edimax EW-7811Un (VID: 7392, PID: 7811) showed a maximum TX rate
of about 4 Mbits/sec compared to the ~24 Mbits/sec measured with the
rtl8192cu driver.

Although the performance might be good enough for our use case, this is
something that should be further looked into.

Signed-off-by: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250122071512.10165-1-ezra@easyb.ch
4 months agowifi: rtw89: pci: not assert wiphy_lock to free early_h2c for PCI probe/remove
Ping-Ke Shih [Wed, 22 Jan 2025 06:03:10 +0000 (14:03 +0800)]
wifi: rtw89: pci: not assert wiphy_lock to free early_h2c for PCI probe/remove

Except probe/remove flow, the consumers of early_h2c list are interface
start and debugfs. There must be no race between probe/remove flow and
interface start. The failed probe flow is to free early_h2c list as well
as remove flow, at these two moments debugfs doesn't present. Thus, it is
safe to free early_h2c list without held wiphy_lock in these situations.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250122060310.31976-11-pkshih@realtek.com
4 months agowifi: rtw89: remove definition of driver mutex
Ping-Ke Shih [Wed, 22 Jan 2025 06:03:09 +0000 (14:03 +0800)]
wifi: rtw89: remove definition of driver mutex

No consumers of driver mutex now, so remove definition eventually.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250122060310.31976-10-pkshih@realtek.com