Kees Cook [Mon, 10 Mar 2025 22:22:58 +0000 (15:22 -0700)]
wifi: rtw88: Add __nonstring annotations for unterminated strings
When a character array without a terminating NUL character has a static
initializer, GCC 15's -Wunterminated-string-initialization will only
warn if the array lacks the "nonstring" attribute[1]. Mark the arrays
with __nonstring to and correctly identify the char array as "not a C
string" and thereby eliminate the warning.
Bitterblue Smith [Fri, 7 Mar 2025 00:26:25 +0000 (02:26 +0200)]
wifi: rtw88: Enable the new RTL8814AE/RTL8814AU drivers
RTL8814A is a wifi 5 chip with 4 RF paths (chains), 3 spatial streams,
and probably no Bluetooth.
The USB-based RTL8814AU can reach 800 Mbps in the 5 GHz band in USB 3
mode. In USB 2 mode it only uses 2 spatial streams.
The PCI-based RTL8814AE is not as popular and didn't get as much
testing so it's unclear how fast it goes. It's more like a bonus on top
of the RTL8814AU support.
Ching-Te Ku [Sat, 8 Mar 2025 02:58:30 +0000 (10:58 +0800)]
wifi: rtw89: coex: Fix coexistence report not show as expected
This report will feedback some basic information from firmware(PTA counter,
report counter, mailbox counter etc). And the report version need to match
driver & firmware both side. The original logic break the switch case logic
before driver update the report version. It made the report can not be
parsed correctly. Delete the break at the version 7 and 8.
Add logic to count C2H event report.
Dian-Syuan Yang [Thu, 6 Mar 2025 02:11:44 +0000 (10:11 +0800)]
wifi: rtw89: set force HE TB mode when connecting to 11ax AP
Some of 11ax AP set the UL HE-SIG-A2 reserved subfield to all 0s, which
will cause the 11be chip to recognize trigger frame as EHT. We propose
a method to bypass the "UL HE-SIG-A2 reserved subfield" and always uses
HE TB in response to the AP's trigger frame.
Kuan-Chung Chen [Thu, 6 Mar 2025 02:11:43 +0000 (10:11 +0800)]
wifi: rtw89: 8922a: enable dynamic antenna gain
The 8922A now supports dynamic antenna gain. However, in firmware
before v0.35.64.0, different transmit powers cannot be applied to
each RF path. To comply with regulatory limits in these older
firmware, the lower of the two requested transmit powers will
be used for both paths when they differ.
Kuan-Chung Chen [Thu, 6 Mar 2025 02:11:41 +0000 (10:11 +0800)]
wifi: rtw89: refine mechanism of TAS
TAS state switching mechanism now incorporates the TX ratio as a
decision parameter. The average power calculation has been improved
by using a higher resolution conversion from dBm to linear. During
scan or MCC operations, TAS state is forced to static SAR and
suspend the average power calculation. Additionally, TAS window
size depends on the regulatory domain and band to ensure compliance.
TAS is enabled when permitted by the regulatory domain and is
currently supported on the 8852CE.
For debugging, add a flag to disable_dm that can stop TAS mechanism.
Co-developed-by: Zong-Zhe Yang <kevin_yang@realtek.com> Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com> Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20250306021144.12854-3-pkshih@realtek.com
Ping-Ke Shih [Thu, 27 Feb 2025 13:19:07 +0000 (21:19 +0800)]
wifi: rtw89: pci: correct ISR RDU bit for 8922AE
The interrupt status (ISR) bits of RX desc unavailable (RDU) for 8922AE
are B_BE_RDU_CH1_INT_V1 and B_BE_RDU_CH0_INT_V1. With wrong bits, if it
happens, driver can't recognize the situation and prompt a message.
Fix the definition accordingly.
Ping-Ke Shih [Thu, 27 Feb 2025 13:12:28 +0000 (21:12 +0800)]
wifi: rtw89: fw: don't reject firmware in blacklist to prevent breaking users
Once update driver blacklist of firmware, users' firmware might be in
the list, and then driver stops working. Since breaking users is not
expected, report a significant message instead of stopping.
Chih-Kang Chang [Thu, 20 Feb 2025 06:43:57 +0000 (14:43 +0800)]
wifi: rtw89: Parse channel from IE to correct invalid hardware reports during scanning
For some packets, we could not get channel information from PPDU status.
And this causes wrong frequencies being reported. Parse the channel
information from IE if provided by AP to fix this.
Kuan-Chung Chen [Thu, 20 Feb 2025 06:23:44 +0000 (14:23 +0800)]
wifi: rtw89: add support for HW TKIP crypto
For 8852BTE, 8852CE, and 8922AE, TKIP encryption and decryption
will be handled by hardware. All other chips will retain their
existing software-based encryption and decryption.
Bitterblue Smith [Mon, 17 Feb 2025 23:29:52 +0000 (01:29 +0200)]
wifi: rtw88: Fix rtw_desc_to_mcsrate() to handle MCS16-31
This function translates the rate number reported by the hardware into
something mac80211 can understand. It was ignoring the 3SS and 4SS HT
rates. Translate them too.
Also set *nss to 0 for the HT rates, just to make sure it's
initialised.
Bitterblue Smith [Mon, 17 Feb 2025 23:28:59 +0000 (01:28 +0200)]
wifi: rtw88: Fix rtw_mac_power_switch() for RTL8814AU
rtw_mac_power_switch() checks bit 8 of REG_SYS_STATUS1 to see if the
chip is powered on. This bit appears to be always on in the RTL8814AU,
so ignore it.
Ping-Ke Shih [Mon, 17 Feb 2025 06:43:08 +0000 (14:43 +0800)]
wifi: rtw89: fw: safely cast mfw_hdr pointer from firmware->data
Check size of struct mfw_hdr within firmware->size before type casting
to ensure to validly dereference fields from mfm_hdr pointer. Then,
check if signature field is equal to RTW89_MFW_SIG to assert current
is multi-firmware.
Ping-Ke Shih [Mon, 17 Feb 2025 06:43:05 +0000 (14:43 +0800)]
wifi: rtw89: fw: get sb_sel_ver via get_unaligned_le32()
The sb_sel_ver is selection version for secure boot recorded in firmware
binary data, and its size is 4 and offset is 58 (not natural alignment).
Use get_unaligned_le32() to get this value safely. Find this by reviewing.
Ping-Ke Shih [Mon, 17 Feb 2025 06:30:53 +0000 (14:30 +0800)]
wifi: rtw89: add H2C command of TX time for WiFi 7 chips
BT-coexistence configure WiFi TX time to share time slots with Bluetooth
devices. Since the format is different from WiFi 6 chips, add the new
format accordingly.
Ping-Ke Shih [Mon, 17 Feb 2025 06:30:52 +0000 (14:30 +0800)]
wifi: rtw89: mac: define registers of agg_limit and txcnt_limit to share common flow
The agg_limit and txcnt_limit are used by BT-coexistence to reduce
WiFi TX time at once to share time with Bluetooth devices. Since
these registers address are different from WiFi 6 and 7 chips, define
them accordingly.
Kuan-Chung Chen [Mon, 17 Feb 2025 06:12:35 +0000 (14:12 +0800)]
wifi: rtw89: 8922a: fix incorrect STA-ID in EHT MU PPDU
EHT MU PPDU contains user field of EHT-SIG field with STA-ID that
must match AID subfield in the Associate Response. Add a necessary
setting to prevent these from being inconsistent.
Since the vendor driver is claimed to measure 'tssi_alimk_time' of
'struct rtw89_tssi_info' in microseconds, adjust rtw8852b{t}-specific
'_tssi_alimentk()' to not mess the former with nanoseconds and print
both per-call and accumulated times. Compile tested only.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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().
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.
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.
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.
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.
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.
-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]
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.
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.
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.
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")
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().
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.
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
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.