platform/kernel/linux-rpi.git
16 months agowifi: iwlwifi: mvm: use min_t() for agg_size
Johannes Berg [Tue, 20 Jun 2023 10:03:54 +0000 (13:03 +0300)]
wifi: iwlwifi: mvm: use min_t() for agg_size

We can use min_t() for the agg_size and avoid
spelling out the (firmware) limit twice.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.211768036c1f.I78b7eea32eaae20cc9f32869aa3f42814634ce9a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: use EHT maximum MPDU length on 2.4 GHz
Johannes Berg [Tue, 20 Jun 2023 10:03:53 +0000 (13:03 +0300)]
wifi: iwlwifi: mvm: use EHT maximum MPDU length on 2.4 GHz

On 2.4 GHz there's no VHT, so EHT defines its own bits for
the maximum MPDU length. Use them when telling firmware
about the maximum.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.fd5322bb48a4.Ic471045f83229ceaacce25edcf992d3ce2c75de5@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: nvm: handle EHT/320 MHz regulatory flag
Johannes Berg [Tue, 20 Jun 2023 10:03:52 +0000 (13:03 +0300)]
wifi: iwlwifi: nvm: handle EHT/320 MHz regulatory flag

Handle the regulatory EHT/320 MHz flags from firmware just
like any other flags before it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.2c5e886c08f3.Ibc5c27d973d0590e2dea1f50435f9cf3ba8c2c09@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: make iwl_mvm_set_fw_mu_edca_params mld aware
Emmanuel Grumbach [Tue, 20 Jun 2023 10:03:51 +0000 (13:03 +0300)]
wifi: iwlwifi: mvm: make iwl_mvm_set_fw_mu_edca_params mld aware

We need to work on the right link there.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.8762a90e8857.Ic5b8e96140a449fd1ed7008907d67fc36fe98506@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: fw: send marker cmd before suspend cmd
Miri Korenblit [Tue, 20 Jun 2023 10:03:50 +0000 (13:03 +0300)]
wifi: iwlwifi: fw: send marker cmd before suspend cmd

This is needed to sync the times in the FW and driver logs

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.9c84322c41b5.Id13816b3ece103f88514a7523b22bb2b9dcc8ab7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: check the right csa_active
Emmanuel Grumbach [Tue, 20 Jun 2023 10:03:49 +0000 (13:03 +0300)]
wifi: iwlwifi: mvm: check the right csa_active

When the firmware says that the channel switch is happening, we check
that we know about that switch by checking the csa_active bit.

Until now, we checked the bss_conf from the vif instead of taking the
bss_conf of the link.
Fix that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.63f835a4f578.I0bb2a231e4da506b7c751dc23a428558f9ecfa75@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: pcie: add size assertions
Johannes Berg [Tue, 20 Jun 2023 10:03:48 +0000 (13:03 +0300)]
wifi: iwlwifi: pcie: add size assertions

Ensure that the TX command scratch fits into the buffer
provided by the first TB. It does, of course, but add
some build-time validations in case we touch this code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.8f54f2990b92.If19a038dfd633d4601e3d44dd0ff678bc0a851e9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: pcie: refactor RB status size calculation
Johannes Berg [Tue, 20 Jun 2023 10:03:47 +0000 (13:03 +0300)]
wifi: iwlwifi: pcie: refactor RB status size calculation

We have three places doing this check, and even in
slightly different ways (with/without an intermediate).
Refactor that to a new small inline function.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.f3e87ddd5bce.Ifefba753043b68c394590a35bc6914a0f6497fd3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: nl80211/reg: add no-EHT regulatory flag
Johannes Berg [Mon, 19 Jun 2023 13:26:53 +0000 (16:26 +0300)]
wifi: nl80211/reg: add no-EHT regulatory flag

This just propagates to the channel flags, like no-HE and
similar other flags before it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230619161906.74ce2983aed8.Ifa343ba89c11760491daad5aee5a81209d5735a7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: Retrieve PSD information from RNR AP information
Ilan Peer [Mon, 19 Jun 2023 13:26:52 +0000 (16:26 +0300)]
wifi: cfg80211: Retrieve PSD information from RNR AP information

Retrieve the Power Spectral Density (PSD) value from RNR AP
information entry and store it so it could be used by the drivers.

PSD value is explained in Section 9.4.2.170 of Draft
P802.11Revme_D2.0.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230619161906.067ded2b8fc3.I9f407ab5800cbb07045a0537a513012960ced740@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: fix CRC calculation for extended elems
Johannes Berg [Mon, 19 Jun 2023 13:26:51 +0000 (16:26 +0300)]
wifi: mac80211: fix CRC calculation for extended elems

For extended elements, we currently only calculate the CRC
for some of them, but really we should do it also for the
rest that we care about, such as EHT operation and multi-
link.

Also, while at it, it seems we should do it even if they
aren't well-formed, so we notice if that changes.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230619161906.93235d5c8651.I6615cb3c1244bc9618066baa2bdad7982e9abd1f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: avoid lockdep checking when removing deflink
Benjamin Berg [Mon, 19 Jun 2023 13:26:50 +0000 (16:26 +0300)]
wifi: mac80211: avoid lockdep checking when removing deflink

struct sta_info may be removed without holding sta_mtx if it has not
yet been inserted. To support this, only assert that the lock is held
for links other than the deflink.

This fixes lockdep issues that may be triggered in error cases.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230619161906.cdd81377dea0.If5a6734b4b85608a2275a09b4f99b5564d82997f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: always hold sdata lock in chanctx assign/unassign
Johannes Berg [Mon, 19 Jun 2023 13:26:49 +0000 (16:26 +0300)]
wifi: mac80211: always hold sdata lock in chanctx assign/unassign

Due to all the multi-link handling, we now expose the fact that
the sdata/vif is locked to drivers, e.g. when the driver uses
ieee80211_set_monitor_channel(). This was true when a chanctx
is added to or removed from a link, _except_ in monitor mode
with the virtual sdata/vif. Change that, so that drivers can
make that assumption.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230619161906.a5cf7534beda.I5b51664231abee27e02f222083df7ccf88722929@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: store BSS param change count from assoc response
Johannes Berg [Mon, 19 Jun 2023 13:26:48 +0000 (16:26 +0300)]
wifi: mac80211: store BSS param change count from assoc response

When receiving a multi-link association response, make sure to
track the BSS parameter change count for each link, including
the assoc link.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230619161906.1799c164e7e9.I8e2c1f5eec6eec3fab525ae2dead9f6f099a2427@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: drop some unprotected action frames
Johannes Berg [Mon, 19 Jun 2023 13:26:47 +0000 (16:26 +0300)]
wifi: mac80211: drop some unprotected action frames

We should not receive/handle unicast protected dual
or public action frames that aren't protected, so
drop them - in the latter case of course only if MFP
is used.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230619161906.eb4461108129.I3c2223cf29d8a3586dfc74b2dda3f6fa2a4eea7c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: move action length check up
Johannes Berg [Mon, 19 Jun 2023 13:26:46 +0000 (16:26 +0300)]
wifi: mac80211: move action length check up

We'd like to add more checks to the function here for
action frames, so move up the length check from the
action processing.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230619161906.e799254e923f.I0a1de5f6bbdc1b2ef5efaa0ac80c7c3f39415538@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: drop unprotected robust mgmt before 4-way-HS
Alon Giladi [Mon, 19 Jun 2023 15:37:38 +0000 (18:37 +0300)]
wifi: mac80211: drop unprotected robust mgmt before 4-way-HS

When MFP is used, drop unprotected robust management frames also
before the 4-way handshake has been completed, i.e. no key has
been installed yet.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230619183718.cfbefddccd0c.Ife369dbb61c87e311ce15739d5b2b4763bfdfbae@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: p54: Add missing MODULE_FIRMWARE macro
Juerg Haefliger [Fri, 16 Jun 2023 12:19:17 +0000 (14:19 +0200)]
wifi: p54: Add missing MODULE_FIRMWARE macro

Add the missing MODULE_FIRMWARE macro for "3826.eeprom".

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230616121917.1034761-1-juerg.haefliger@canonical.com
16 months agoMAINTAINERS: ath11k: add wiki and bugreport page
Kalle Valo [Wed, 14 Jun 2023 14:47:04 +0000 (17:47 +0300)]
MAINTAINERS: ath11k: add wiki and bugreport page

ath11k has a wiki and a separate page about reporting bugs, add those so
hopefully people find them easier.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230614144704.505553-3-kvalo@kernel.org
16 months agoMAINTAINERS: ath9k: add git tree
Kalle Valo [Wed, 14 Jun 2023 14:47:03 +0000 (17:47 +0300)]
MAINTAINERS: ath9k: add git tree

ath9k patches go to my ath.git tree, document that.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230614144704.505553-2-kvalo@kernel.org
16 months agoMAINTAINERS: mt76: add git tree
Kalle Valo [Wed, 14 Jun 2023 14:47:02 +0000 (17:47 +0300)]
MAINTAINERS: mt76: add git tree

Felix has a git tree for mt76 patches, document that.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230614144704.505553-1-kvalo@kernel.org
16 months agowifi: rtw89: use struct to parse firmware header
Ping-Ke Shih [Fri, 16 Jun 2023 06:06:01 +0000 (14:06 +0800)]
wifi: rtw89: use struct to parse firmware header

A firmware contains basic header, sections and optional dynamic header.
Define them by a struct, so it will be easier to understand the layout,
and also simply access these elements.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230616060601.28460-1-pkshih@realtek.com
16 months agowifi: rtw89: TX power stuffs replace confusing naming of _max with _num
Zong-Zhe Yang [Fri, 16 Jun 2023 06:05:23 +0000 (14:05 +0800)]
wifi: rtw89: TX power stuffs replace confusing naming of _max with _num

Some old declarations about TX power stuffs were named with confusing
`_max`. But, they mean "the number of". So we change them to be named
with `_num`.

(No logic is changed.)

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230616060523.28396-1-pkshih@realtek.com
16 months agowifi: rtw89: 8851b: configure to force 1 TX power value
Ping-Ke Shih [Thu, 15 Jun 2023 13:04:42 +0000 (21:04 +0800)]
wifi: rtw89: 8851b: configure to force 1 TX power value

RTL8851B is a chip with only single RF path, and it must use 1 TX power
value for transmission, so force 1 TX power value to prevent hardware
logic gets wrong TX power values randomly in certain samples.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230615130442.18116-6-pkshih@realtek.com
16 months agowifi: rtw89: 8851b: rfk: update IQK to version 0x8
Ping-Ke Shih [Thu, 15 Jun 2023 13:04:41 +0000 (21:04 +0800)]
wifi: rtw89: 8851b: rfk: update IQK to version 0x8

The main change is to adjust RX calibration groups from {0,1,2,3} to {0,2}
in 5 GHz, so reduce elements from 4 to 2, and use index to iterate them.
Meanwhile, always do RX narrowband calibration (ID_NBRXK) for each group.
NCTL is used to assist IQK, so also update NCTL to 0x6 along with internal
tag HALRF_029_00_103.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230615130442.18116-5-pkshih@realtek.com
16 months agowifi: rtw89: 8851b: rfk: add LCK track
Ping-Ke Shih [Thu, 15 Jun 2023 13:04:40 +0000 (21:04 +0800)]
wifi: rtw89: 8851b: rfk: add LCK track

LCK is short for LC Tank calibration. To keep RF performance, do this
calibration if difference of thermal value is over a threshold.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230615130442.18116-4-pkshih@realtek.com
16 months agowifi: rtw89: 8851b: update TX power tables to R28
Zong-Zhe Yang [Thu, 15 Jun 2023 13:04:39 +0000 (21:04 +0800)]
wifi: rtw89: 8851b: update TX power tables to R28

Update 8851B TX power tables to RF version R28.

TX power tables' changes:
* TX power limit and TX power shape:
update 5 GHz configurations for FCC and IC

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230615130442.18116-3-pkshih@realtek.com
16 months agowifi: rtw89: 8851b: update RF radio A parameters to R28
Ping-Ke Shih [Thu, 15 Jun 2023 13:04:38 +0000 (21:04 +0800)]
wifi: rtw89: 8851b: update RF radio A parameters to R28

Update 8851b radio A parameters to R28 along with internal HALRF_029_00_103

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230615130442.18116-2-pkshih@realtek.com
16 months agowifi: rtw88: fix not entering PS mode after AP stops
Po-Hao Huang [Fri, 16 Jun 2023 12:55:40 +0000 (20:55 +0800)]
wifi: rtw88: fix not entering PS mode after AP stops

Without this patch, firmware only track beacons for port 0 and since
we will always start AP on port 0, this results in misbehavior of
power saving mode on other ports after AP stops.

The "default port" H2C command is used to notify which port should
firmware track. Update the correct settings to firmware so power
saving mode can work properly.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230616125540.36877-7-pkshih@realtek.com
16 months agowifi: rtw88: refine register based H2C command
Po-Hao Huang [Fri, 16 Jun 2023 12:55:39 +0000 (20:55 +0800)]
wifi: rtw88: refine register based H2C command

Since register based H2C commands don't need endian conversion.
Introduce a new API that don't do conversion and send it directly.
New caller are expected to encode with cpu order and gradually
replace the old ones.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230616125540.36877-6-pkshih@realtek.com
16 months agowifi: rtw88: Stop high queue during scan
Po-Hao Huang [Fri, 16 Jun 2023 12:55:38 +0000 (20:55 +0800)]
wifi: rtw88: Stop high queue during scan

When traversing channel list, TX in high queue should be disabled
along with beacon function, so packets won't be sent to incorrect
channels.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230616125540.36877-5-pkshih@realtek.com
16 months agowifi: rtw88: Skip high queue in hci_flush
Po-Hao Huang [Fri, 16 Jun 2023 12:55:37 +0000 (20:55 +0800)]
wifi: rtw88: Skip high queue in hci_flush

The flush period may not always intersect with DTIM and when that
happens, an error log "timed out to flush pci TX ring[6]" is shown.
Bypass this since hardware will do proper transmission on the next
DTIM period for broadcast/multicast packets in high queue.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230616125540.36877-4-pkshih@realtek.com
16 months agowifi: rtw88: Fix AP mode incorrect DTIM behavior
Po-Hao Huang [Fri, 16 Jun 2023 12:55:36 +0000 (20:55 +0800)]
wifi: rtw88: Fix AP mode incorrect DTIM behavior

Broadcast and multicast packets in high queue should be transmitted
all at once during DTIM. But without proper settings, hardware fails
to recognize that there are multiple packets and fetches only one.
Fix this by signaling hardware with more data bit set when there are
packets in the high queue.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230616125540.36877-3-pkshih@realtek.com
16 months agowifi: rtw88: use struct instead of macros to set TX desc
Po-Hao Huang [Fri, 16 Jun 2023 12:55:35 +0000 (20:55 +0800)]
wifi: rtw88: use struct instead of macros to set TX desc

Remove macros that set TX descriptors. Use struct and
le32_encode_bits() with mask definitions.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230616125540.36877-2-pkshih@realtek.com
16 months agowifi: rtw88: process VO packets without workqueue to avoid PTK rekey failed
Chih-Kang Chang [Fri, 16 Jun 2023 03:17:13 +0000 (11:17 +0800)]
wifi: rtw88: process VO packets without workqueue to avoid PTK rekey failed

In the wpa_supplicant rekey flow, it sends an EAPOL packet 4/4 through
nl80211_tx_control_port() and triggers wake_tx_queue() in the driver.
Then, it sends nl80211_new_key() to configure a new key in mac80211.
However, in wake_tx_queue(), a workqueue is used to process the tx packet,
which might cause the driver to process the EAPOL packet later than
nl80211_new_key(). As a result, the EAPOL 4/4 packet is dropped by mac80211
due to the rekey configuration being finished. The EAPOL packets belongs to
VO packets that need high priority. Therefore, we process VO packets
directly without workqueue to ensure that packets can process immediately.

VO is normally used by voice application that is low traffic load and low
latency, that doesn't affect user experience.
We test iperf with VO packets(iperf3 -P4 -u -b 10000M -S 0xdf)
                          before       after
TX throughput             162M         162M
ping RTT                  3.8ms        3.7ms

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230616031713.16769-1-pkshih@realtek.com
16 months agowifi: rtw88: Fix action frame transmission fail before association
Po-Hao Huang [Thu, 15 Jun 2023 11:43:48 +0000 (19:43 +0800)]
wifi: rtw88: Fix action frame transmission fail before association

For combo chips, antennas were controlled by bluetooth only during
power on. If WiFi wish to do transmission, notification to the coexistence
module are required. Previously we only do this before authentication.
To allow transmission before auth, such as management TX, now we start
the initiation of coexistence earlier so antennas are shared between
WiFi and bluetooth after set_channel(), and frames could then be sent.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230615114348.7193-1-pkshih@realtek.com
16 months agowifi: mac80211: fix documentation config reference
Johannes Berg [Wed, 21 Jun 2023 07:16:26 +0000 (09:16 +0200)]
wifi: mac80211: fix documentation config reference

We shouldn't refer to CPTCFG_, that's for backports, in
mainline that's just CONFIG_. Fix it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: add eht_capa debugfs field
Ben Greear [Wed, 17 May 2023 18:44:28 +0000 (11:44 -0700)]
wifi: mac80211: add eht_capa debugfs field

Output looks like this:

[root@ct523c-0b29 ~]# cat /debug/ieee80211/wiphy6/netdev\:wlan6/stations/50\:28\:4a\:bd\:f4\:a7/eht_capa
EHT supported
MAC-CAP: 0x82 0x00
PHY-CAP: 0x0c 0x00 0x00 0x00 0x00 0x48 0x00 0x00 0x00
OM-CONTROL
MAX-MPDU-LEN: 11454
242-TONE-RU-GT20MHZ
NDP-4-EHT-LFT-32-GI
BEAMFORMEE-80-NSS: 0
BEAMFORMEE-160-NSS: 0
BEAMFORMEE-320-NSS: 0
SOUNDING-DIM-80-NSS: 0
SOUNDING-DIM-160-NSS: 0
SOUNDING-DIM-320-NSS: 0
MAX_NC: 0
PPE_THRESHOLD_PRESENT
NOMINAL_PKT_PAD: 0us
MAX-NUM-SUPP-EHT-LTF: 1
SUPP-EXTRA-EHT-LTF
MCS15-SUPP-MASK: 0

EHT bw <= 80 MHz, max NSS for MCS 8-9: Rx=2, Tx=2
EHT bw <= 80 MHz, max NSS for MCS 10-11: Rx=2, Tx=2
EHT bw <= 80 MHz, max NSS for MCS 12-13: Rx=2, Tx=2
EHT bw <= 160 MHz, max NSS for MCS 8-9: Rx=0, Tx=0
EHT bw <= 160 MHz, max NSS for MCS 10-11: Rx=0, Tx=0
EHT bw <= 160 MHz, max NSS for MCS 12-13: Rx=0, Tx=0
EHT bw <= 320 MHz, max NSS for MCS 8-9: Rx=0, Tx=0
EHT bw <= 320 MHz, max NSS for MCS 10-11: Rx=0, Tx=0
EHT bw <= 320 MHz, max NSS for MCS 12-13: Rx=0, Tx=0
EHT PPE Thresholds: 0xc1 0x0e 0xe0 0x00 0x00

Signed-off-by: Ben Greear <greearb@candelatech.com>
Link: https://lore.kernel.org/r/20230517184428.999384-1-greearb@candelatech.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: dvm: fix -Wunused-const-variable gcc warning
Dmitry Antipov [Mon, 19 Jun 2023 10:38:56 +0000 (13:38 +0300)]
wifi: iwlwifi: dvm: fix -Wunused-const-variable gcc warning

Fix the following gcc 13.1 warning observed with W=1:

drivers/net/wireless/intel/iwlwifi/dvm/rs.c:207:39: warning:
‘iwl_rate_mcs’ defined but not used [-Wunused-const-variable=]

This table is actually used in 'rs_sta_dbgfs_scale_table_read()'
only if CONFIG_MAC80211_DEBUGFS is enabled, so the whole thing
may be moved close to its actual use.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://lore.kernel.org/r/20230619103900.300628-1-dmantipov@yandex.ru
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: check EHT basic MCS/NSS set
Johannes Berg [Sun, 18 Jun 2023 18:50:02 +0000 (21:50 +0300)]
wifi: mac80211: check EHT basic MCS/NSS set

Check that all the NSS in the EHT basic MCS/NSS set
are actually supported, otherwise disable EHT for the
connection.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.737827c906c9.I0c11a3cd46ab4dcb774c11a5bbc30aecfb6fce11@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: search all RNR elements for colocated APs
Benjamin Berg [Sun, 18 Jun 2023 18:50:01 +0000 (21:50 +0300)]
wifi: cfg80211: search all RNR elements for colocated APs

An AP reporting colocated APs may send more than one reduced neighbor
report element. As such, iterate all elements instead of only parsing
the first one when looking for colocated APs.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.ffe2c014f478.I372a4f96c88f7ea28ac39e94e0abfc465b5330d4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: stop parsing after allocation failure
Benjamin Berg [Sun, 18 Jun 2023 18:50:00 +0000 (21:50 +0300)]
wifi: cfg80211: stop parsing after allocation failure

The error handling code would break out of the loop incorrectly,
causing the rest of the message to be misinterpreted. Fix this by
also jumping out of the surrounding while loop, which will trigger
the error detection code.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.0ffac98475cf.I6f5c08a09f5c9fced01497b95a9841ffd1b039f8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: update multi-link element STA reconfig
Johannes Berg [Sun, 18 Jun 2023 18:49:59 +0000 (21:49 +0300)]
wifi: update multi-link element STA reconfig

Update the MLE STA reconfig sub-type to 802.11be D3.0
format, which includes the operation update field.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.2e1383b31f07.I8055a111c8fcf22e833e60f5587a4d8d21caca5b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: agg-tx: prevent start/stop race
Johannes Berg [Sun, 18 Jun 2023 18:49:58 +0000 (21:49 +0300)]
wifi: mac80211: agg-tx: prevent start/stop race

There were crashes reported in this code, and the timer_shutdown()
warning in one of the previous patches indicates that the timeout
timer for the AP response (addba_resp_timer) is still armed while
we're stopping the aggregation session.

After a very long deliberation of the code, so far the only way I
could find that might cause this would be the following sequence:
 - session start requested
 - session start indicated to driver, but driver returns
   IEEE80211_AMPDU_TX_START_DELAY_ADDBA
 - session stop requested, sets HT_AGG_STATE_WANT_STOP
 - session stop worker runs ___ieee80211_stop_tx_ba_session(),
   sets HT_AGG_STATE_STOPPING

From here on, the order doesn't matter exactly, but:

 1. driver calls ieee80211_start_tx_ba_cb_irqsafe(),
    setting HT_AGG_STATE_START_CB
 2. driver calls ieee80211_stop_tx_ba_cb_irqsafe(),
    setting HT_AGG_STATE_STOP_CB
 3. the worker will run ieee80211_start_tx_ba_cb() for
    HT_AGG_STATE_START_CB
 4. the worker will run ieee80211_stop_tx_ba_cb() for
    HT_AGG_STATE_STOP_CB

(the order could also be 1./3./2./4.)

This will cause ieee80211_start_tx_ba_cb() to send out the AddBA
request frame to the AP and arm the timer, but we're already in
the middle of stopping and so the ieee80211_stop_tx_ba_cb() will
no longer assume it needs to stop anything.

Prevent this by checking for WANT_STOP/STOPPING in the start CB,
and warn if we're sending a frame on a stopping session.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.e5b52777462a.I0b2ed6658e81804279f5d7c9c1918cb1f6626bf2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: agg-tx: add a few locking assertions
Johannes Berg [Sun, 18 Jun 2023 18:49:57 +0000 (21:49 +0300)]
wifi: mac80211: agg-tx: add a few locking assertions

This is all true today, but difficult to understand since
the callers are in other files etc. Add two new lockdep
assertions to make things easier to read.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.7f03dec6a90b.I762c11e95da005b80fa0184cb1173b99ec362acf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: ieee80211: reorder presence checks in MLE per-STA profile
Johannes Berg [Sun, 18 Jun 2023 18:49:56 +0000 (21:49 +0300)]
wifi: ieee80211: reorder presence checks in MLE per-STA profile

In ieee80211_mle_sta_prof_size_ok(), the presence
checks aren't ordered by field order, so that's a
bit confusing. Reorder them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.fdbf17320a37.I517cf27fdc3f6e5d6a2615182da47ba4bdf14039@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: Support link removal using Reconfiguration ML element
Ilan Peer [Sun, 18 Jun 2023 18:49:55 +0000 (21:49 +0300)]
wifi: mac80211: Support link removal using Reconfiguration ML element

Add support for handling link removal indicated by the
Reconfiguration Multi-Link element.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.d8a046dc0c1a.I4dcf794da2a2d9f4e5f63a4b32158075d27c0660@changeid
[use cfg80211_links_removed() API instead]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: add set_active_links variant not locking sdata
Benjamin Berg [Thu, 11 May 2023 11:13:21 +0000 (13:13 +0200)]
wifi: mac80211: add set_active_links variant not locking sdata

There are cases where keeping sdata locked for an operation. Add a
variant that does not take sdata lock to permit these usecases.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: add ___ieee80211_disconnect variant not locking sdata
Benjamin Berg [Tue, 6 Jun 2023 15:43:26 +0000 (17:43 +0200)]
wifi: mac80211: add ___ieee80211_disconnect variant not locking sdata

There are cases where keeping sdata locked for an operation. Add a
variant that does not take sdata lock to permit these usecases.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211/nl80211: Add support to indicate STA MLD setup links removal
Veerendranath Jakkam [Fri, 17 Mar 2023 14:21:53 +0000 (19:51 +0530)]
wifi: cfg80211/nl80211: Add support to indicate STA MLD setup links removal

STA MLD setup links may get removed if AP MLD remove the corresponding
affiliated APs with Multi-Link reconfiguration as described in
P802.11be_D3.0, section 35.3.6.2.2 Removing affiliated APs. Currently,
there is no support to notify such operation to cfg80211 and userspace.

Add support for the drivers to indicate STA MLD setup links removal to
cfg80211 and notify the same to userspace. Upon receiving such
indication from the driver, clear the MLO links information of the
removed links in the WDEV.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/20230317142153.237900-1-quic_vjakkam@quicinc.com
[rename function and attribute, fix kernel-doc]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: do not scan disabled links on 6GHz
Benjamin Berg [Sun, 18 Jun 2023 18:49:54 +0000 (21:49 +0300)]
wifi: cfg80211: do not scan disabled links on 6GHz

If a link is disabled on 6GHz, we should not send a probe request on the
channel to resolve it. Simply skip such RNR entries so that the link is
ignored.

Userspace can still see the link in the RNR and may generate an ML probe
request in order to associate to the (currently) disabled link.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.4f7384006471.Iff8f1081e76a298bd25f9468abb3a586372cddaa@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: handle BSS data contained in ML probe responses
Benjamin Berg [Sun, 18 Jun 2023 18:49:53 +0000 (21:49 +0300)]
wifi: cfg80211: handle BSS data contained in ML probe responses

The basic multi-link element within an multi-link probe response will
contain full information about BSSes that are part of an MLD AP. This
BSS information may be used to associate with a link of an MLD AP
without having received a beacon from the BSS itself.

This patch adds parsing of the data and adding/updating the BSS using
the received elements. Doing this means that userspace can discover the
BSSes using an ML probe request and request association on these links.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.29593bd0ae1f.Ic9a67b8f022360aa202b870a932897a389171b14@changeid
[swap loop conditions smatch complained about]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: use structs for TBTT information access
Benjamin Berg [Sun, 18 Jun 2023 18:49:52 +0000 (21:49 +0300)]
wifi: cfg80211: use structs for TBTT information access

Make the data access a bit nicer overall by using structs. There is a
small change here to also accept a TBTT information length of eight
bytes as we do not require the 20 MHz PSD information.

This also fixes a bug reading the short SSID on big endian machines.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.4c3f8901c1bc.Ic3e94fd6e1bccff7948a252ad3bb87e322690a17@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: ieee80211: add structs for TBTT information access
Benjamin Berg [Sun, 18 Jun 2023 18:49:51 +0000 (21:49 +0300)]
wifi: ieee80211: add structs for TBTT information access

The TBTT information can have various lengths with different elements
thare are present. Add definitions for the two types that we are
interested in (i.e. the ones that contain the BSSID).

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.2a6f8766a3ec.Ic962e28492212cc8ee1eb602b8f07a4ea172fc4a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: use a struct for inform_single_bss data
Benjamin Berg [Sun, 18 Jun 2023 18:49:50 +0000 (21:49 +0300)]
wifi: cfg80211: use a struct for inform_single_bss data

The argument is getting quite large, so use a struct internally to pass
around the information.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.831ab8a87b6f.I3bcc83d90f41d6f8a47b39528575dad0a9ec3564@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: ieee80211: add definitions for RNR MLD params
Benjamin Berg [Sun, 18 Jun 2023 18:49:49 +0000 (21:49 +0300)]
wifi: ieee80211: add definitions for RNR MLD params

Add the definitions necessary to parse the MLD parameters
included in an RNR element.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214436.9999842237c0.I80f00a90cb4e43071432b4158f206c73ba799618@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: Always ignore ML element
Benjamin Berg [Sun, 18 Jun 2023 18:49:48 +0000 (21:49 +0300)]
wifi: cfg80211: Always ignore ML element

The element should never be inherited, so always exclude it.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214435.c0e17989b4ed.I7cecb5ab7cd6919e61839b50ce5156904b41d7d8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: ieee80211: use default for medium synchronization delay
Benjamin Berg [Sun, 18 Jun 2023 18:49:47 +0000 (21:49 +0300)]
wifi: ieee80211: use default for medium synchronization delay

Default values are defined for the information included in the Medium
Synchronization Delay Information subfield. The spec says to
initialize the values to these defaults and only change them when
included.

Return the default value instead of zero so that the defaults are
used when the field is not included in the association response.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214435.a7725bef3795.I2d3528cf4af021c5b37f97fbe64ae9116ce9bef1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: ieee80211: add helper to validate ML element type and size
Benjamin Berg [Sun, 18 Jun 2023 18:49:46 +0000 (21:49 +0300)]
wifi: ieee80211: add helper to validate ML element type and size

The helper functions to retrieve the EML capabilities and medium
synchronization delay both assume that the type is correct. Instead of
assuming the length is correct and still checking the type, add a new
helper to check both and don't do any verification.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214435.1b50e7a3b3cf.I9385514d8eb6d6d3c82479a6fa732ef65313e554@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: ieee80211: Fix the common size calculation for reconfiguration ML
Ilan Peer [Sun, 18 Jun 2023 18:49:45 +0000 (21:49 +0300)]
wifi: ieee80211: Fix the common size calculation for reconfiguration ML

The common information length is found in the first octet of the common
information.

Fixes: 0f48b8b88aa9 ("wifi: ieee80211: add definitions for multi-link element")
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214435.3c7ed4817338.I42ef706cb827b4dade6e4ffbb6e7f341eaccd398@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: Include Multi-Link in CRC calculation
Ilan Peer [Sun, 18 Jun 2023 18:49:44 +0000 (21:49 +0300)]
wifi: mac80211: Include Multi-Link in CRC calculation

Include the Multi-Link elements found in beacon frames
in the CRC calculation, as these elements are intended
to reflect changes in the AP MLD state.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230618214435.ae8246b93d85.Ia64b45198de90ff7f70abcc997841157f148ea40@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: fix regulatory disconnect with OCB/NAN
Johannes Berg [Fri, 16 Jun 2023 20:28:45 +0000 (22:28 +0200)]
wifi: cfg80211: fix regulatory disconnect with OCB/NAN

Since regulatory disconnect was added, OCB and NAN interface
types were added, which made it completely unusable for any
driver that allowed OCB/NAN. Add OCB/NAN (though NAN doesn't
do anything, we don't have any info) and also remove all the
logic that opts out, so it won't be broken again if/when new
interface types are added.

Fixes: 6e0bd6c35b02 ("cfg80211: 802.11p OCB mode handling")
Fixes: cb3b7d87652a ("cfg80211: add start / stop NAN commands")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20230616222844.2794d1625a26.I8e78a3789a29e6149447b3139df724a6f1b46fc3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: fix regulatory disconnect for non-MLO
Johannes Berg [Fri, 16 Jun 2023 20:28:44 +0000 (22:28 +0200)]
wifi: cfg80211: fix regulatory disconnect for non-MLO

The multi-link loop here broke disconnect when multi-link
operation (MLO) isn't active for a given interface, since
in that case valid_links is 0 (indicating no links, i.e.
no MLO.)

Fix this by taking that into account properly and skipping
the link only if there are valid_links in the first place.

Cc: stable@vger.kernel.org
Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20230616222844.eb073d650c75.I72739923ef80919889ea9b50de9e4ba4baa836ae@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: Rename ieee80211_mle_sta_prof_size_ok()
Ilan Peer [Fri, 16 Jun 2023 06:54:09 +0000 (09:54 +0300)]
wifi: mac80211: Rename ieee80211_mle_sta_prof_size_ok()

Rename it to ieee80211_mle_basic_sta_prof_size_ok() as it
validates the size of the station profile included in
Basic Multi-Link element.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094949.9bdfd263974f.I7bebd26894f33716e93cc7da576ef3215e0ba727@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: Add support for parsing Reconfiguration Multi Link element
Ilan Peer [Fri, 16 Jun 2023 06:54:08 +0000 (09:54 +0300)]
wifi: mac80211: Add support for parsing Reconfiguration Multi Link element

Parse Reconfiguration Multi Link IE.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094949.6eeb6c9a4a6e.I1cb137da9b3c712fc7c7949a6dec9e314b5d7f63@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: Rename multi_link
Ilan Peer [Fri, 16 Jun 2023 06:54:07 +0000 (09:54 +0300)]
wifi: mac80211: Rename multi_link

As a preparation to support Reconfiguration Multi Link
element, rename 'multi_link' and 'multi_link_len' fields
in 'struct ieee802_11_elems' to 'ml_basic' and 'ml_basic_len'.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094949.b11370d3066a.I34280ae3728597056a6a2f313063962206c0d581@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: use cfg80211 defragmentation helper
Benjamin Berg [Fri, 16 Jun 2023 06:54:06 +0000 (09:54 +0300)]
wifi: mac80211: use cfg80211 defragmentation helper

Use the shared functionality rather than copying it into mac80211.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094949.7dcbf82baade.Ic68d1f547cb75d66037abdbb0f066db20ff41ba3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: add element defragmentation helper
Benjamin Berg [Fri, 16 Jun 2023 06:54:05 +0000 (09:54 +0300)]
wifi: cfg80211: add element defragmentation helper

This is already needed within mac80211 and support is also needed by
cfg80211 to parse ML elements.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094949.29c3ebeed10d.I009c049289dd0162c2e858ed8b68d2875a672ed6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: drop incorrect nontransmitted BSS update code
Benjamin Berg [Fri, 16 Jun 2023 06:54:04 +0000 (09:54 +0300)]
wifi: cfg80211: drop incorrect nontransmitted BSS update code

The removed code ran for any BSS that was not included in the MBSSID
element in order to update it. However, instead of using the correct
inheritance rules, it would simply copy the elements from the
transmitting AP. The result is that we would report incorrect elements
in this case.

After some discussions, it seems that there are likely not even APs
actually using this feature. Either way, removing the code decreases
complexity and makes the cfg80211 behaviour more correct.

Fixes: 0b8fb8235be8 ("cfg80211: Parsing of Multiple BSSID information in scanning")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094949.cfd6d8db1f26.Ia1044902b86cd7d366400a4bfb93691b8f05d68c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: rewrite merging of inherited elements
Benjamin Berg [Fri, 16 Jun 2023 06:54:03 +0000 (09:54 +0300)]
wifi: cfg80211: rewrite merging of inherited elements

The cfg80211_gen_new_ie function merges the IEs using inheritance rules.
Rewrite this function to fix issues around inheritance rules. In
particular, vendor elements do not require any special handling, as they
are either all inherited or overridden by the subprofile.
Also, add fragmentation handling as this may be needed in some cases.

This also changes the function to not require making a copy. The new
version could be optimized a bit by explicitly tracking which IEs have
been handled already rather than looking that up again every time.

Note that a small behavioural change is the removal of the SSID special
handling. This should be fine for the MBSSID element, as the SSID must
be included in the subelement.

Fixes: 0b8fb8235be8 ("cfg80211: Parsing of Multiple BSSID information in scanning")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094949.bc6152e146db.I2b5f3bc45085e1901e5b5192a674436adaf94748@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: ignore invalid TBTT info field types
Benjamin Berg [Fri, 16 Jun 2023 06:54:02 +0000 (09:54 +0300)]
wifi: cfg80211: ignore invalid TBTT info field types

The TBTT information field type must be zero. This is only changed in
the 802.11be draft specification where the value 1 is used to indicate
that only the MLD parameters are included.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094949.7865606ffe94.I7ff28afb875d1b4c39acd497df8490a7d3628e3f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: use new inform_bss callback
Benjamin Berg [Fri, 16 Jun 2023 06:54:01 +0000 (09:54 +0300)]
wifi: mac80211: use new inform_bss callback

Doing this simplifies the code somewhat, as iteration over the
nontransmitted BSSs is not required anymore. Also, mac80211 should
not be iterating over the nontrans_list as it should only be accessed
while the bss_lock is held.

It also simplifies parsing of the IEs somewhat, as cfg80211 already
extracts the IEs and passes them to the callback.

Note that the only user left requiring parsing a specific BSS is the
association code if a beacon is required by the hardware.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094949.39ebfe2f9e59.Ia012b08e0feed8ec431b666888b459f6366f7bd1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: add inform_bss op to update BSS
Benjamin Berg [Fri, 16 Jun 2023 06:54:00 +0000 (09:54 +0300)]
wifi: cfg80211: add inform_bss op to update BSS

This new function is called from within the inform_bss(_frame)_data
functions in order for the driver to update data that it is tracking.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094949.8d7781b0f965.I80041183072b75c081996a1a5a230b34aff5c668@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: keep bss_lock held when informing
Benjamin Berg [Fri, 16 Jun 2023 06:53:59 +0000 (09:53 +0300)]
wifi: cfg80211: keep bss_lock held when informing

It is reasonable to hold bss_lock for a little bit longer after
cfg80211_bss_update is done. Right now, this does not make any big
difference, but doing so in preparation for the next patch which adds
a call to the driver.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094948.61701884ff0d.I3358228209eb6766202aff04d1bae0b8fdff611f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: move regulatory_hint_found_beacon to be earlier
Benjamin Berg [Fri, 16 Jun 2023 06:53:58 +0000 (09:53 +0300)]
wifi: cfg80211: move regulatory_hint_found_beacon to be earlier

These calls do not require any locking, so move them in preparation for
the next patches.

A minor change/bugfix is to not hint a beacon for nontransmitted BSSes

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094948.a5bf3558eae9.I33c7465d983c8bef19deb7a533ee475a16f91774@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: feed the link_id to cfg80211_ch_switch_started_notify
Emmanuel Grumbach [Fri, 16 Jun 2023 06:53:57 +0000 (09:53 +0300)]
wifi: mac80211: feed the link_id to cfg80211_ch_switch_started_notify

For now, fix this only in station mode. We'll need to fix
the AP mode later.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094948.41e662ba1d68.I8faae5acb45c58cfeeb6bc6247aedbdaf9249d32@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: add consistency check for compat chandef
Anjaneyulu [Fri, 16 Jun 2023 06:53:56 +0000 (09:53 +0300)]
wifi: mac80211: add consistency check for compat chandef

Add NULL check for compat variable to avoid crash in
cfg80211_chandef_compatible() if it got called with
some mixed up channel context where not all the users
compatible with each other, which shouldn't happen.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094948.ae0f10dfd36b.Iea98c74aeb87bf6ef49f6d0c8687bba0dbea2abd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: stop passing cbss to parser
Benjamin Berg [Fri, 16 Jun 2023 06:53:55 +0000 (09:53 +0300)]
wifi: mac80211: stop passing cbss to parser

In both of these cases (config_link, prep_channel) it is not needed
to parse the MBSSID data for a nontransmitted BSS. In the config_link
case the frame does not contain any MBSSID element and inheritance
rules are only needed for the ML STA profile. While in the
prep_channel case the IEs have already been processed by cfg80211 and
are already exploded.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094948.66d2605ff0ad.I7cdd1d390e7b0735c46204231a9e636d45b7f1e4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: Extend AID element addition for TDLS frames
Mukesh Sisodiya [Fri, 16 Jun 2023 06:53:54 +0000 (09:53 +0300)]
wifi: mac80211: Extend AID element addition for TDLS frames

Extend AID element addition in TDLS setup request and response
frames to add it when HE or EHT capabilities are supported.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094948.483bf44ce684.Ia2387eb24c06fa41febc213923160bedafce2085@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: Add HE and EHT capa elements in TDLS frames
Abhishek Naik [Fri, 16 Jun 2023 06:53:53 +0000 (09:53 +0300)]
wifi: mac80211: Add HE and EHT capa elements in TDLS frames

Add HE and EHT capabilities IE in TDLS setup request,
response, confirm and discovery response frames.

Signed-off-by: Abhishek Naik <abhishek.naik@intel.com>
Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094948.c77128828b0d.Ied2d8800847c759718c2c35e8f6c0902afd6bca1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: handle TDLS data frames with MLO
Abhishek Naik [Fri, 16 Jun 2023 06:53:52 +0000 (09:53 +0300)]
wifi: mac80211: handle TDLS data frames with MLO

If the device is associated with an AP MLD, then TDLS data frames
should have
 - A1 = peer address,
 - A2 = own MLD address (since the peer may now know about MLO), and
 - A3 = BSSID.

Change the code to do that.

Signed-off-by: Abhishek Naik <abhishek.naik@intel.com>
Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094948.4bf648b63dfd.I98ef1dabd14b74a92120750f7746a7a512011701@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: handle TDLS negotiation with MLO
Mukesh Sisodiya [Fri, 16 Jun 2023 06:53:51 +0000 (09:53 +0300)]
wifi: mac80211: handle TDLS negotiation with MLO

Userspace can now select the link to use for TDLS management
frames (indicating e.g. which BSSID should be used), use the
link_id received from cfg80211 to build the frames.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094948.ce1fc230b505.Ie773c5679805001f5a52680d68d9ce0232c57648@changeid
[Benjamin fixed some locking]
Co-developed-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
[fix sta mutex locking too]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: cfg80211: make TDLS management link-aware
Mukesh Sisodiya [Fri, 16 Jun 2023 06:53:50 +0000 (09:53 +0300)]
wifi: cfg80211: make TDLS management link-aware

For multi-link operation(MLO) TDLS management
frames need to be transmitted on a specific link.
The TDLS setup request will add BSSID along with
peer address and userspace will pass the link-id
based on BSSID value to the driver(or mac80211).

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230616094948.cb3d87c22812.Ia3d15ac4a9a182145bf2d418bcb3ddf4539cd0a7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: wext-core: Fix -Wstringop-overflow warning in ioctl_standard_iw_point()
Gustavo A. R. Silva [Thu, 15 Jun 2023 18:04:07 +0000 (12:04 -0600)]
wifi: wext-core: Fix -Wstringop-overflow warning in ioctl_standard_iw_point()

-Wstringop-overflow is legitimately warning us about extra_size
pontentially being zero at some point, hence potenially ending
up _allocating_ zero bytes of memory for extra pointer and then
trying to access such object in a call to copy_from_user().

Fix this by adding a sanity check to ensure we never end up
trying to allocate zero bytes of data for extra pointer, before
continue executing the rest of the code in the function.

Address the following -Wstringop-overflow warning seen when built
m68k architecture with allyesconfig configuration:
                 from net/wireless/wext-core.c:11:
In function '_copy_from_user',
    inlined from 'copy_from_user' at include/linux/uaccess.h:183:7,
    inlined from 'ioctl_standard_iw_point' at net/wireless/wext-core.c:825:7:
arch/m68k/include/asm/string.h:48:25: warning: '__builtin_memset' writing 1 or more bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
   48 | #define memset(d, c, n) __builtin_memset(d, c, n)
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/uaccess.h:153:17: note: in expansion of macro 'memset'
  153 |                 memset(to + (n - res), 0, res);
      |                 ^~~~~~
In function 'kmalloc',
    inlined from 'kzalloc' at include/linux/slab.h:694:9,
    inlined from 'ioctl_standard_iw_point' at net/wireless/wext-core.c:819:10:
include/linux/slab.h:577:16: note: at offset 1 into destination object of size 0 allocated by '__kmalloc'
  577 |         return __kmalloc(size, flags);
      |                ^~~~~~~~~~~~~~~~~~~~~~

This help with the ongoing efforts to globally enable
-Wstringop-overflow.

Link: https://github.com/KSPP/linux/issues/315
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/ZItSlzvIpjdjNfd8@work
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: bump FW API to 81 for AX devices
Gregory Greenman [Thu, 15 Jun 2023 06:47:20 +0000 (09:47 +0300)]
wifi: iwlwifi: bump FW API to 81 for AX devices

Start supporting API version 81 for AX devices.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230615094410.e61fdc474d89.I3d9823231fa7fc47158b8aa3561b43822c8c86cd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: Add support for SCAN API version 16
Ilan Peer [Thu, 15 Jun 2023 06:47:19 +0000 (09:47 +0300)]
wifi: iwlwifi: mvm: Add support for SCAN API version 16

Scan API version 16 use link ID for reporting the TSF of
scan results (instead of MAC ID used in previous versions).

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230615094410.05bf3e612297.Ie3075f7068af38c335d26778ab7d0ec4b1c026c3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: Don't access vif valid links directly
Ilan Peer [Thu, 15 Jun 2023 06:47:18 +0000 (09:47 +0300)]
wifi: iwlwifi: mvm: Don't access vif valid links directly

And instead use the vif getter functions, as a preparation for
supporting disabled/dormant links.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230615094410.61ca688cbbf1.Ic1b4049cf156238ff16e6c57959004da911cb5c8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: handle eSR transitions
Miri Korenblit [Thu, 15 Jun 2023 06:47:17 +0000 (09:47 +0300)]
wifi: iwlwifi: handle eSR transitions

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

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230615094410.fb6409f44aca.I502460dec15e0b76035ad3cd809afa4ac16e9fe1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: fix max number of fw active links
Miri Korenblit [Thu, 15 Jun 2023 06:47:16 +0000 (09:47 +0300)]
wifi: iwlwifi: fix max number of fw active links

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

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

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230615094410.e78ad74c6715.I68b26911c0a312d72eaf25344b448d03b1c61f4e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: mac80211: Remove "Missing iftype sband data/EHT cap" spam
Nicolas Cavallari [Wed, 14 Jun 2023 13:26:48 +0000 (15:26 +0200)]
wifi: mac80211: Remove "Missing iftype sband data/EHT cap" spam

In mesh mode, ieee80211_chandef_he_6ghz_oper() is called by
mesh_matches_local() for every received mesh beacon.

On a 6 GHz mesh of a HE-only phy, this spams that the hardware does not
have EHT capabilities, even if the received mesh beacon does not have an
EHT element.

Unlike HE, not supporting EHT in the 6 GHz band is not an error so do
not print anything in this case.

Fixes: 5dca295dd767 ("mac80211: Add initial support for EHT and 320 MHz channels")

Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230614132648.28995-1-nicolas.cavallari@green-communications.fr
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: add a few rate index validity checks
Anjaneyulu [Wed, 14 Jun 2023 09:41:37 +0000 (12:41 +0300)]
wifi: iwlwifi: add a few rate index validity checks

Validate index before access iwl_rate_mcs to keep rate->index
inside the valid boundaries. Use MCS_0_INDEX if index is less
than MCS_0_INDEX and MCS_9_INDEX if index is greater then
MCS_9_INDEX.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123447.79f16b3aef32.If1137f894775d6d07b78cbf3a6163ffce6399507@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: Validate slots_num before allocating memory
Anjaneyulu [Wed, 14 Jun 2023 09:41:36 +0000 (12:41 +0300)]
wifi: iwlwifi: Validate slots_num before allocating memory

Verify slots_num is valid in iwl_txq_alloc()

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123447.90be48017c1b.I880e451e137c5cd688d5f38b573b0dbf352762b3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: Validate tid is in valid range before using it
Anjaneyulu [Wed, 14 Jun 2023 09:41:35 +0000 (12:41 +0300)]
wifi: iwlwifi: mvm: Validate tid is in valid range before using it

Validate tid is less then MAX TID when it is used to access
corresponding arrays.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123447.cea75e1f57e7.I03bc0a81d2c1bdbf4784c12c4c62b8538892ccba@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: track u-APSD misbehaving AP by AP address
Johannes Berg [Wed, 14 Jun 2023 09:41:34 +0000 (12:41 +0300)]
wifi: iwlwifi: mvm: track u-APSD misbehaving AP by AP address

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

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123447.b6a4f7edd10c.Ie5a8029ed686b9441620ba06596d430432f65559@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: implement WPFC ACPI table loading
Johannes Berg [Wed, 14 Jun 2023 09:41:33 +0000 (12:41 +0300)]
wifi: iwlwifi: implement WPFC ACPI table loading

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

Remove the useless hardcoded zeroes while at it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123447.035026ea3169.I3a1fc1fe644fefa0d818ee1926c5fc331d68e8a3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: pcie: fix NULL pointer dereference in iwl_pcie_irq_rx_msix_handler()
Anjaneyulu [Wed, 14 Jun 2023 09:41:32 +0000 (12:41 +0300)]
wifi: iwlwifi: pcie: fix NULL pointer dereference in iwl_pcie_irq_rx_msix_handler()

rxq can be NULL only when trans_pcie->rxq is NULL and entry->entry
is zero. For the case when entry->entry is not equal to 0, rxq
won't be NULL even if trans_pcie->rxq is NULL. Modify checker to
check for trans_pcie->rxq.

Fixes: abc599efa67b ("iwlwifi: pcie: don't crash when rx queues aren't allocated in interrupt")
Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.5a5eb3889a4a.I375a1d58f16b48cd2044e7b7caddae512d7c86fd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: add some FW misbehaviour check infrastructure
Johannes Berg [Wed, 14 Jun 2023 09:41:31 +0000 (12:41 +0300)]
wifi: iwlwifi: add some FW misbehaviour check infrastructure

When the firmware misbehaves (according to the driver), we
often either ignore that, or WARN_ON, which is very noisy
but doesn't really help.

Add a little helper macro IWL_FW_CHECK() that can be used
in place of WARN_ON() in conditions, and make it take a
message that's printed in this case. We can also add more
behaviour to this in the future.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.2e12ac670cea.Ia0198036b7a626876d836bd41a4b2d2b1e65c5ca@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: always send spec link ID in link commands
Johannes Berg [Wed, 14 Jun 2023 09:41:30 +0000 (12:41 +0300)]
wifi: iwlwifi: mvm: always send spec link ID in link commands

The firmware technically only needs this when the link is
newly added, but it's much easier for debugging if it's
always available, so include it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.daecd0e626f7.I0f8a16a6d80a283c9f947c9bb0fc50a7c6853948@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: use array as array argument
Johannes Berg [Wed, 14 Jun 2023 09:41:29 +0000 (12:41 +0300)]
wifi: iwlwifi: use array as array argument

When calling iwl_mvm_set_fw_qos_params() we explicitly pass
a pointer to the first array element, but the function will
treat it as an array. Simplify and clarify the code and pass
the array instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.6fb4a9743b1b.I801007d207f6539a9e0996366ec593e2038b1f90@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
16 months agowifi: iwlwifi: mvm: store WMM params per link
Johannes Berg [Wed, 14 Jun 2023 09:41:28 +0000 (12:41 +0300)]
wifi: iwlwifi: mvm: store WMM params per link

We have the data structure set up to store the parameters
per link, but weren't using them. Fix that and store them
in the right link.

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