linux-2.6-microblaze.git
19 months agowifi: rtw89: coex: Update RTL8852B LNA2 hardware parameter
Ching-Te Ku [Tue, 14 Mar 2023 02:06:15 +0000 (10:06 +0800)]
wifi: rtw89: coex: Update RTL8852B LNA2 hardware parameter

The LNA gain didn't set before, it will lead some WiFi RX issue.
And the setting can increase both of WiFi & BT performance while
they are both RX.

Signed-off-by: Ching-Te Ku <ku920601@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/20230314020617.28193-4-pkshih@realtek.com
19 months agowifi: rtw89: coex: Not to enable firmware report when WiFi is power saving
Ching-Te Ku [Tue, 14 Mar 2023 02:06:14 +0000 (10:06 +0800)]
wifi: rtw89: coex: Not to enable firmware report when WiFi is power saving

If driver enable firmware report during WiFi power saving, the
firmware timer will lead to some power saving issue like,
fail to enter LPS, can not leave LPS or some unexpected issue.

Signed-off-by: Ching-Te Ku <ku920601@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/20230314020617.28193-3-pkshih@realtek.com
19 months agowifi: rtw89: coex: Add LPS protocol radio state for RTL8852B
Ching-Te Ku [Tue, 14 Mar 2023 02:06:13 +0000 (10:06 +0800)]
wifi: rtw89: coex: Add LPS protocol radio state for RTL8852B

This LPS state will not turn off RF, and it can still do some basic
traffic, only RTL8852B has the state. Coexistence need let Bluetooth
know WiFi is still alive to prevent some Bluetooth performance issue.

Signed-off-by: Ching-Te Ku <ku920601@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/20230314020617.28193-2-pkshih@realtek.com
19 months agobcma: remove unused mips_read32 function
Tom Rix [Fri, 24 Mar 2023 19:06:47 +0000 (15:06 -0400)]
bcma: remove unused mips_read32 function

clang with W=1 reports
drivers/bcma/driver_mips.c:49:19: error: unused function
  'mips_read32' [-Werror,-Wunused-function]
static inline u32 mips_read32(struct bcma_drv_mips *mcore,
                  ^
This function is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230324190647.2654293-1-trix@redhat.com
19 months agobcma: Use of_address_to_resource()
Rob Herring [Sun, 19 Mar 2023 16:31:59 +0000 (11:31 -0500)]
bcma: Use of_address_to_resource()

Replace of_get_address() and of_translate_address() calls with single
call to of_address_to_resource().

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230319163159.225773-1-robh@kernel.org
19 months agowifi: mwifiex: remove unused evt_buf variable
Tom Rix [Wed, 29 Mar 2023 13:14:44 +0000 (09:14 -0400)]
wifi: mwifiex: remove unused evt_buf variable

clang with W=1 reports
drivers/net/wireless/marvell/mwifiex/11h.c:198:6: error: variable
  'evt_buf' set but not used [-Werror,-Wunused-but-set-variable]
        u8 *evt_buf;
            ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230329131444.1809018-1-trix@redhat.com
19 months agowifi: brcmsmac: ampdu: remove unused suc_mpdu variable
Tom Rix [Mon, 27 Mar 2023 15:11:51 +0000 (11:11 -0400)]
wifi: brcmsmac: ampdu: remove unused suc_mpdu variable

clang with W=1 reports
drivers/net/wireless/broadcom/brcm80211/brcmsmac/ampdu.c:848:5: error: variable
  'suc_mpdu' set but not used [-Werror,-Wunused-but-set-variable]
        u8 suc_mpdu = 0, tot_mpdu = 0;
           ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230327151151.1771350-1-trix@redhat.com
19 months agowifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_reg()
Wei Chen [Sun, 26 Mar 2023 05:42:17 +0000 (05:42 +0000)]
wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_reg()

If there is a failure during copy_from_user or user-provided data buffer is
invalid, rtl_debugfs_set_write_reg should return negative error code instead
of a positive value count.

Fix this bug by returning correct error code. Moreover, the check of buffer
against null is removed since it will be handled by copy_from_user.

Fixes: 610247f46feb ("rtlwifi: Improve debugging by using debugfs")
Signed-off-by: Wei Chen <harperchen1110@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230326054217.93492-1-harperchen1110@gmail.com
19 months agowifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_rfreg()
Wei Chen [Sun, 26 Mar 2023 05:31:38 +0000 (05:31 +0000)]
wifi: rtlwifi: fix incorrect error codes in rtl_debugfs_set_write_rfreg()

If there is a failure during copy_from_user or user-provided data buffer
is invalid, rtl_debugfs_set_write_rfreg should return negative error code
instead of a positive value count.

Fix this bug by returning correct error code. Moreover, the check of buffer
against null is removed since it will be handled by copy_from_user.

Fixes: 610247f46feb ("rtlwifi: Improve debugging by using debugfs")
Signed-off-by: Wei Chen <harperchen1110@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230326053138.91338-1-harperchen1110@gmail.com
19 months agowifi: brcmsmac: remove unused has_5g variable
Tom Rix [Sat, 25 Mar 2023 13:03:43 +0000 (09:03 -0400)]
wifi: brcmsmac: remove unused has_5g variable

clang with W=1 reports
drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c:1051:6: error:
  variable 'has_5g' set but not used [-Werror,-Wunused-but-set-variable]
        int has_5g = 0;
            ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230325130343.1334209-1-trix@redhat.com
19 months agowifi: b43legacy: remove unused freq_r3A_value function
Tom Rix [Fri, 24 Mar 2023 13:50:22 +0000 (09:50 -0400)]
wifi: b43legacy: remove unused freq_r3A_value function

clang with W=1 reports
drivers/net/wireless/broadcom/b43legacy/radio.c:1713:5: error:
  unused function 'freq_r3A_value' [-Werror,-Wunused-function]
u16 freq_r3A_value(u16 frequency)
    ^
This function is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230324135022.2649735-1-trix@redhat.com
19 months agowifi: rtlwifi: Replace fake flex-array with flex-array member
Gustavo A. R. Silva [Fri, 24 Mar 2023 01:11:35 +0000 (19:11 -0600)]
wifi: rtlwifi: Replace fake flex-array with flex-array member

Zero-length arrays as fake flexible arrays are deprecated and we are
moving towards adopting C99 flexible-array members instead.

Address the following warning found with GCC-13 and
-fstrict-flex-arrays=3 enabled:
In function ‘fortify_memset_chk’,
    inlined from ‘rtl_usb_probe’ at drivers/net/wireless/realtek/rtlwifi/usb.c:1044:2:
./include/linux/fortify-string.h:430:25: warning: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
  430 |                         __write_overflow_field(p_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
routines on memcpy() and help us make progress towards globally
enabling -fstrict-flex-arrays=3 [1].

Link: https://github.com/KSPP/linux/issues/21
Link: https://github.com/KSPP/linux/issues/277
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/ZBz4x+MWoI/f65o1@work
19 months agowifi: rtw88: Remove redundant pci_clear_master
Cai Huoqing [Thu, 23 Mar 2023 11:26:12 +0000 (19:26 +0800)]
wifi: rtw88: Remove redundant pci_clear_master

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device,
like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)
{
u16 pci_command;

pci_read_config_word(dev, PCI_COMMAND, &pci_command);
if (pci_command & PCI_COMMAND_MASTER) {
pci_command &= ~PCI_COMMAND_MASTER;
pci_write_config_word(dev, PCI_COMMAND, pci_command);
}

pcibios_disable_device(dev);
}.
And dev->is_busmaster is set to 0 in pci_disable_device.

Signed-off-by: Cai Huoqing <cai.huoqing@linux.dev>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230323112613.7550-4-cai.huoqing@linux.dev
19 months agowifi: rndis_wlan: Replace fake flex-array with flexible-array member
Gustavo A. R. Silva [Wed, 22 Mar 2023 18:26:53 +0000 (12:26 -0600)]
wifi: rndis_wlan: Replace fake flex-array with flexible-array member

Zero-length arrays as fake flexible arrays are deprecated and we are
moving towards adopting C99 flexible-array members instead.

Address the following warning found with GCC-13 and
-fstrict-flex-array=3 enabled:
drivers/net/wireless/rndis_wlan.c:2902:23: warning: array subscript 0 is outside array bounds of ‘struct ndis_80211_auth_request[0]’ [-Warray-bounds=]

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
routines on memcpy() and help us make progress towards globally
enabling -fstrict-flex-arrays=3 [1].

Link: https://github.com/KSPP/linux/issues/21
Link: https://github.com/KSPP/linux/issues/274
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/ZBtIbU77L9eXqa4j@work
19 months agowifi: rndis_wlan: clean up a type issue
Dan Carpenter [Wed, 22 Mar 2023 09:07:31 +0000 (12:07 +0300)]
wifi: rndis_wlan: clean up a type issue

The rndis_bss_info_update() returns type bool.  Change the NULL
returns to false.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/d1f250a3-653a-497d-9c92-12dd628b7927@kili.mountain
19 months agowifi: rtw88: remove unused rtw_pci_get_tx_desc function
Tom Rix [Mon, 20 Mar 2023 23:34:48 +0000 (19:34 -0400)]
wifi: rtw88: remove unused rtw_pci_get_tx_desc function

clang with W=1 reports
drivers/net/wireless/realtek/rtw88/pci.c:92:21: error:
  unused function 'rtw_pci_get_tx_desc' [-Werror,-Wunused-function]
static inline void *rtw_pci_get_tx_desc(struct rtw_pci_tx_ring *tx_ring, u8 idx)
                    ^
This function is not used, so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230320233448.1729899-1-trix@redhat.com
19 months agowifi: rsi: Slightly simplify rsi_set_channel()
Christophe JAILLET [Mon, 20 Mar 2023 16:13:42 +0000 (17:13 +0100)]
wifi: rsi: Slightly simplify rsi_set_channel()

There is no point in allocating 'skb' and then freeing it if !channel.

Make the sanity check first to slightly simplify the code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/29bf0296bd939e3f6952272bfdcc73b22edbc374.1679328588.git.christophe.jaillet@wanadoo.fr
19 months agowifi: ipw2x00: remove unused _ipw_read16 function
Tom Rix [Sun, 19 Mar 2023 13:54:18 +0000 (09:54 -0400)]
wifi: ipw2x00: remove unused _ipw_read16 function

clang with W=1 reports
drivers/net/wireless/intel/ipw2x00/ipw2200.c:381:19: error:
  unused function '_ipw_read16' [-Werror,-Wunused-function]
static inline u16 _ipw_read16(struct ipw_priv *ipw, unsigned long ofs)
                  ^
This function and its wrapping marco are not used, so remove them.

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230319135418.1703380-1-trix@redhat.com
19 months agowifi: mac80211: enable EHT mesh support
Ryder Lee [Mon, 27 Mar 2023 17:07:42 +0000 (01:07 +0800)]
wifi: mac80211: enable EHT mesh support

Similar to AP beacon, this enables the basic mesh EHT mode, including
EHT operation IE and the fixed field of EHT operation information IE.
As for the optional part (i.e. preamble puncturing bitmap) will be
added in future patch.

Tested-by: Lian Chen <lian.chen@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Link: https://lore.kernel.org/r/1e0ddb9001312451c3e99c4eed2072caf8075f61.1679935259.git.ryder.lee@mediatek.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agoMerge wireless/main into wireless-next/main
Johannes Berg [Fri, 31 Mar 2023 08:51:45 +0000 (10:51 +0200)]
Merge wireless/main into wireless-next/main

There are a few merge conflicts due to overlapping
fixes and changes, merge wireless/main to fix them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: clean up erroneously introduced file
Johannes Berg [Thu, 30 Mar 2023 20:48:45 +0000 (22:48 +0200)]
wifi: clean up erroneously introduced file

Evidently Gregory sent this file but I (apparently every else) missed
it entirely, remove that.

Fixes: cf85123a210f ("wifi: iwlwifi: mvm: support enabling and disabling HW timestamping")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: correctly use link in iwl_mvm_sta_del()
Johannes Berg [Wed, 29 Mar 2023 07:05:40 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: correctly use link in iwl_mvm_sta_del()

This function can be invoked for both MLO and non-MLO, so
it must deal with multi-link correctly. Notable, on auth
timeout, we'd otherwise get a warning due to the erroneous
deflink usage in MLO cases.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.b85f6052d51a.Iedfef4b4c4f3ca557aebc0093fdc3f5cfb49b507@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: separate AP link management queues
Johannes Berg [Wed, 29 Mar 2023 07:05:39 +0000 (10:05 +0300)]
wifi: iwlwifi: separate AP link management queues

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

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.0671fa976832.Id5aa9856fd5984e447f247e6d0c3979d9794a21a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: free probe_resp_data later
Johannes Berg [Wed, 29 Mar 2023 07:05:38 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: free probe_resp_data later

In the MLD code, we free probe_resp_data before we remove
the MAC from the firmware, so we might receive another one
from the device after freeing, and thus might leak it. Fix
that by moving the free later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.152b1715fc13.Ibd37fed1b24cd25012923ad9170d1fe33ab35c5c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: bump FW API to 75 for AX devices
Gregory Greenman [Wed, 29 Mar 2023 07:05:37 +0000 (10:05 +0300)]
wifi: iwlwifi: bump FW API to 75 for AX devices

Start supporting API version 75 for AX devices.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.f08a27944fc6.Iafe3a2db2b91072a559038b85eca7b6b322be3ff@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: move max_agg_bufsize into host TLC lq_sta
Gregory Greenman [Wed, 29 Mar 2023 07:05:36 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: move max_agg_bufsize into host TLC lq_sta

This field is used only for host TLC, so it can reside inside
the corresponding lq_sta struct. Also, TLC lq_sta is cleared
in iwl_mvm_rs_rate_init() upon association, but max_agg_bufsize
is set earlier in iwl_mvm_sta_init(). Thus, place this field
in the persistent part of lq_sta to retain its value.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.d55361064e39.Ib79d30f27d94607d097f0192af2aacd455a17958@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: send full STA during HW restart
Johannes Berg [Wed, 29 Mar 2023 07:05:35 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: send full STA during HW restart

By using the internal station add the station is installed in
firmware with zeroed MAC addresses, which is wrong. Use the
full installation function instead, to fill all data.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.62d5371bb3c7.Ie25b62125a3a022f76a36bae5fed9796c18698aa@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: rework active links counting
Gregory Greenman [Wed, 29 Mar 2023 07:05:34 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: rework active links counting

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

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.1ecfb27b6b84.I3a5e0bc32b3728e4caae8a231bc3f04ea1d89cad@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: update mac config when assigning chanctx
Gregory Greenman [Wed, 29 Mar 2023 07:05:33 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: update mac config when assigning chanctx

Some mac parameters, such as HE support, can change at this stage.
Update mac config before updating links.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.d7882a0d6e04.Ie38cd854a237c46cf85fd7143dc757326f30da6e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: use the correct link queue
Shaul Triebitz [Wed, 29 Mar 2023 07:05:32 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: use the correct link queue

For bcase/mcast tx frames use the link queue.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.ccd7218e4be2.I40f608a0441190cc26137b039f7cb7b065fd4e0c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: clean up mac_id vs. link_id in MLD sta
Johannes Berg [Wed, 29 Mar 2023 07:05:31 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: clean up mac_id vs. link_id in MLD sta

Here we always have a link ID, not MAC ID, so clean up the
naming.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100040.3def62de34b5.I10c9cf5dbfd1fc1e9c9c7d6d4cefcf0c08f1f2da@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: fix station link data leak
Johannes Berg [Wed, 29 Mar 2023 07:05:30 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: fix station link data leak

When we remove the station, we call iwl_mvm_sta_del() which
returns true if we cannot remove it from the firmware yet,
which happens if this is the station ID for the AP station
that's still used because the MAC is still associated.

However, we still must free the link data as the station is
only kept alive in the firmware, in mac80211 and driver the
data structures are destroyed.

To fix that, we need to make iwl_mvm_mld_free_sta_link()
track whether or not the station is still alive in FW, as
otherwise we might reuse the station ID in the meantime and
iwl_mvm_mld_rm_sta_from_fw() would reject the later delete
from the firmware. Add an argument to it for that. Then we
can use the return value of iwl_mvm_sta_del() for that to
fix the issue, and call iwl_mvm_mld_rm_sta_from_fw() only
if we need to not keep the station in FW.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.1d81d4c71f35.I8fc60ac28ffc1147e9b1250e5e6237b3cb5516ac@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: initialize max_rc_amsdu_len per-link
Benjamin Berg [Wed, 29 Mar 2023 07:05:29 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: initialize max_rc_amsdu_len per-link

Initialize max_rc_amsdu_len per-link both on state change and when a new
link is added.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.5bf521fe58b8.I73fe585f0ff75d41b5afd32077e3d6e48c90db2a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: use appropriate link for rate selection
Benjamin Berg [Wed, 29 Mar 2023 07:05:28 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: use appropriate link for rate selection

We were still using the deflink in most cases, update the code to use
the appropriate 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/20230329100039.fa1025502fb4.Iaba0c64740fdcf04a521e2f213bd3f3e27862472@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: use the new lockdep-checking macros
Johannes Berg [Wed, 29 Mar 2023 07:05:27 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: use the new lockdep-checking macros

Use the new macros from mac80211 that do lockdep checking
on the RCU dereferences, instead of hard-coding 1 as the
argument to rcu_dereference_protected().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.112df5c8dec2.I1a1008f5566e509953d988f254d15c9e58630418@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: remove chanctx WARN_ON
Johannes Berg [Wed, 29 Mar 2023 07:05:26 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: remove chanctx WARN_ON

During link switching there might be a link that's marked
active but has no chanctx assigned (so it's not active from
our driver's POV), skip such links in power recalculation
without any warning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.c629090bd5d2.If7a680d5e349d454f2122f936c21522b9528a55f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: avoid sending MAC context for idle
Johannes Berg [Wed, 29 Mar 2023 07:05:25 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: avoid sending MAC context for idle

If we change only idle, avoid sending the MAC context
command since it doesn't depend on idle state. This
also fixes an issue with the firmware because without
this we send the command during link switching, as we
just deactivated the first link, and we cannot send
this command when there's no active 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/20230329100039.f5218f8453ec.I1325ff14ec07a27dd7ea2c1c210a1721d969839f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: remove only link-specific AP keys
Johannes Berg [Wed, 29 Mar 2023 07:05:24 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: remove only link-specific AP keys

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

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.e724878f502e.I66870d4629244b4b309be79e11cbbd384bdf93be@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: skip inactive links
Johannes Berg [Wed, 29 Mar 2023 07:05:23 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: skip inactive links

When iterating station links, skip the links that are not
yet active by checking for mvmvif->link[] existence.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.bd9b4e64c478.Ie21422c3bf2589d22942c3c57d26e6330d2e3afc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: adjust iwl_mvm_scan_respect_p2p_go_iter() for MLO
Avraham Stern [Wed, 29 Mar 2023 07:05:22 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: adjust iwl_mvm_scan_respect_p2p_go_iter() for MLO

When looking for a GO on for setting the scan parameters, iterate
over all the available links.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.4eb25d5655d0.Ie69f7313e4337f78c262a835aea3f707273a4209@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: rxmq: report link ID to mac80211
Johannes Berg [Wed, 29 Mar 2023 07:05:21 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: rxmq: report link ID to mac80211

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

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

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.c7dd3ec18077.I12ef9eb4a5b8b5c2b9d6bcaa1fda73b59eba39d8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: use bcast/mcast link station id
Shaul Triebitz [Wed, 29 Mar 2023 07:05:20 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: use bcast/mcast link station id

For an MLD AP, use the correct link mcast or bcast station id.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.0cffa6c45242.I342e17e7bca87b7f05939eb2ebd36fc2aff0b49f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: translate management frame address
Shaul Triebitz [Wed, 29 Mar 2023 07:05:19 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: translate management frame address

For management frames sent by an AP interface, translate
the MLD addresses to LINK addresses (for an MLD AP).
AP (non-bufferable) management frames are sent via
the broadcast station so the translation cannot be
done by the firmware.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.3cb4292f51e8.Ia662c00ff271c70eda927c12ed49b045b1eb8489@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: implement mac80211 callback change_sta_links
Shaul Triebitz [Wed, 29 Mar 2023 07:05:18 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: implement mac80211 callback change_sta_links

Add/removed from iwl driver and firmware station links.
Update the station queues accordingly (which station links
are connected to the station queues).

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.156d1aae5de1.I32973141be1190222169879f8caf7038c1a8f769@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: use the link sta address
Shaul Triebitz [Wed, 29 Mar 2023 07:05:17 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: use the link sta address

Replace the deflink.addr with the proper link address
for setting the peer_link_address in the station command.
For a non-MLD station, it will be the deflink.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.03ab287da0ae.I88fb5ab4e3ea9c886a3fac7ce09c4791469c3c8e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: adjust rs init to MLO
Gregory Greenman [Wed, 29 Mar 2023 07:05:16 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: adjust rs init to MLO

Rate scale initialization needs some parameters stored
separately for each link. Pass link_conf and link_sta
pointers and adjust the relevant code accordingly.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.e2f458198844.I98bf3ea807dd8ae8d703915ce9c01e7b7d5ccb42@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: adjust radar detection to MLO
Gregory Greenman [Wed, 29 Mar 2023 07:05:15 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: adjust radar detection to MLO

Make the decision about radar detection status depending
on each active MLO link.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.a61b1d3f681a.I27bb8726d8806ad725c22bc7256856b1b6636745@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: adjust iwl_mvm_sec_key_remove_ap to MLO
Gregory Greenman [Wed, 29 Mar 2023 07:05:14 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: adjust iwl_mvm_sec_key_remove_ap to MLO

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

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.19d729cc4654.I4ebe8e3eb5fc00a994761f7c0ad40107382705ca@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: make a few warnings only trigger once
Johannes Berg [Wed, 29 Mar 2023 07:05:13 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: make a few warnings only trigger once

We're hitting these while starting to enable MLO in the
driver, but getting them each and every time isn't very
useful one way or the other. Make these warnings trigger
only once.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.f333741d3dcf.If063d4cfe8a583f0f980a1b0ae4e63e17ba4ddc9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: coex: start handling multiple links
Johannes Berg [Wed, 29 Mar 2023 07:05:12 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: coex: start handling multiple links

Iterate all the links here and check which ones are active,
then adjust them accordingly.

This is still wrong as far as the RSSI event is concerned
(calling iwl_mvm_bt_coex_enable_rssi_event) since we call
that now multiple times, which could overwrite the data;
we need to either make that per link or call it only once,
but need to sort out first what the firmware will be doing
for beacon filtering/beacon abort in MLO.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.fe813fd8de5d.I216236717876510e51e4c21c7fac7691925443f1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: rs-fw: don't crash on missing channel
Johannes Berg [Wed, 29 Mar 2023 07:05:11 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: rs-fw: don't crash on missing channel

This is more of a workaround, with MLO we can get here with
the deflink not assigned. It's not critical right now that
we have this right, so WARN_ON_ONCE() and don't crash until
we can fix this area of the 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/20230329100039.2b0d31bdb60b.I39d23c76eec16ac49f6ae3a6d5f7652041bde855@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: use STA link address
Johannes Berg [Wed, 29 Mar 2023 07:05:10 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: use STA link address

For now we only support a single link, so just use the
deflink's address for the link address, instead of the
STA's (MLD) address, but use the link address anyway
in order to facilitate MLO connections.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.c853c8ced3ba.I2e1915d1090c526e6a4c718440b45a7192bbbb03@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: skip MEI update for MLO
Johannes Berg [Wed, 29 Mar 2023 07:05:09 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: skip MEI update for MLO

For now, if using MLO, skip the MEI update. It probably
needs new API for multiple channels.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.aeaa746b14e7.I42b084f3cdc20bb52cf867700a3c2e1f5e7b4ecb@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: fix narrow RU check for MLO
Johannes Berg [Wed, 29 Mar 2023 07:05:08 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: fix narrow RU check for MLO

This needs to apply to the link, not deflink.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.0347fa77d522.Ibdf7a40cbe86e64ce086f243330fc27f43aeb3aa@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: make some HW flags conditional
Johannes Berg [Wed, 29 Mar 2023 07:05:07 +0000 (10:05 +0300)]
wifi: iwlwifi: mvm: make some HW flags conditional

With newer MLD firmware API we no longer need beacon timing
information from the host, so disable TIMING_BEACON_ONLY.

If MLO is enabled (currently only for testing), then we must
not have DEAUTH_NEED_MGD_TX_PREP because mac80211 doesn't
support it yet, we'll have to fix that later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230329100039.28ec631487bf.I6eb27c3d4c0289a5ec3682f573aae3424f45619f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: implement link change ops
Johannes Berg [Tue, 28 Mar 2023 07:59:11 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: implement link change ops

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

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.6186c5a37e99.Ifd00d3ee93356ddef273aa18f1e081cd8f2c84ae@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: adjust some cleanup functions to MLO
Gregory Greenman [Tue, 28 Mar 2023 07:59:10 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: adjust some cleanup functions to MLO

Clean up data for all allocated links of a vif.
Invalidate all link sta pointers.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.948a7bee8b09.Ic6b202959c158258d391ccce77f66e1281879690@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: refactor iwl_mvm_mac_sta_state_common()
Gregory Greenman [Tue, 28 Mar 2023 07:59:09 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: refactor iwl_mvm_mac_sta_state_common()

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

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.5a3f8a849723.I0670d20436858a1cd3c055e03c7528db81292811@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: update iwl_mvm_tx_reclaim() for MLO
Gregory Greenman [Tue, 28 Mar 2023 07:59:08 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: update iwl_mvm_tx_reclaim() for MLO

vif->bss_conf is used in this function only when TLC is not offloaded,
so not in MLO flow. Simplify the related "if" condition and call
iwl_mvm_hwrate_to_tx_status() only for driver rate scale.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.c6826d5b5477.Ib56ec6025c0da3a381aaf88e71085ce9b96a9e65@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: adjust to MLO assign/unassign/switch_vif_chanctx()
Gregory Greenman [Tue, 28 Mar 2023 07:59:07 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: adjust to MLO assign/unassign/switch_vif_chanctx()

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

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.dc1074239c5b.I30db722af9009f1b274fa929f276fd2b78520dea@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: add fw link id allocation
Gregory Greenman [Tue, 28 Mar 2023 07:59:06 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: add fw link id allocation

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

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.a53e5df49c33.I02b25648d2d5ca370c0697bf19d0d34724eae8a1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: adjust internal stations to MLO
Gregory Greenman [Tue, 28 Mar 2023 07:59:05 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: adjust internal stations to MLO

Internal stations are mcast/bcast and sniffer. They need some link
specific data like bss id/phy id. Add link_conf as a parameter.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.25b013fd30de.I7f9f5906123acae05040cceec470c9acb07b9d42@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: replace bss_info_changed() with vif_cfg/link_info_changed()
Gregory Greenman [Tue, 28 Mar 2023 07:59:04 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: replace bss_info_changed() with vif_cfg/link_info_changed()

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

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.7b238cae0895.Ieb87f204787fb1c7cb7562e1cbf54ef518d87123@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: add link_conf parameter for add/remove/change link
Gregory Greenman [Tue, 28 Mar 2023 07:59:03 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: add link_conf parameter for add/remove/change link

Add link_conf parameter and change all the relevant calls accordingly.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.374015eed2e3.Icbf15a18e2599b53f4fa1c92fe3db64b551b84b1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: don't check dtim_period in new API
Johannes Berg [Tue, 28 Mar 2023 07:59:02 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: don't check dtim_period in new API

In newer firmware APIs the firmware is responsible for tracking
the DTIM period and other beacon timing, so we don't need to
wait with setting associated. In real MLO operation, mac80211
isn't tracking this anyway, and connections wouldn't work.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.02354241fede.Id957bed3851fdf1fe902d79a1b0338c6d80bc0e1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: adjust SMPS for MLO
Gregory Greenman [Tue, 28 Mar 2023 07:59:01 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: adjust SMPS for MLO

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

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.da6a19db562c.Ic88b02338c8973f2934439ac3ee77c7451bc0054@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: add set_hw_timestamp to mld ops
Avraham Stern [Tue, 28 Mar 2023 07:59:00 +0000 (10:59 +0300)]
wifi: iwlwifi: mvm: add set_hw_timestamp to mld ops

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

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.7b24a582b763.Ieb3139d41f1a01b2b566adecd32450da1bcdd5fa@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: add link to firmware earlier
Johannes Berg [Tue, 28 Mar 2023 07:58:59 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add link to firmware earlier

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

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.097e5008b637.I4e75c6c11e21c08d28ff6a066be36629d3975db6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: adjust some PS and PM methods to MLD
Gregory Greenman [Tue, 28 Mar 2023 07:58:58 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: adjust some PS and PM methods to MLD

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

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.8d9e18f7d74b.I048fc17405ecdddc1f6fe72859013cc4878b2a3b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: adjust mld_mac_ctxt_/beacon_changed() for MLO
Gregory Greenman [Tue, 28 Mar 2023 07:58:57 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: adjust mld_mac_ctxt_/beacon_changed() for MLO

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

Co-developed-by: Johannes Berg <johannes.berg@intel.com>
Co-developed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.5ef4efeda2dd.I6ebda2b71c964b9aa63240c9fa1ee0d28099fe6e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: adjust smart fifo configuration to MLO
Gregory Greenman [Tue, 28 Mar 2023 07:58:56 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: adjust smart fifo configuration to MLO

Consider properties of all available links for smart FIFO
configuration.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104949.870ff175b82c.Iada56a474a0770ae5469b31d635cc05405dbfb87@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: align to the LINK cmd update in the FW
Miri Korenblit [Tue, 28 Mar 2023 07:58:55 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: align to the LINK cmd update in the FW

The LINK cmd host api has been updated. Align the driver to the
new changes. Also, temporary use mac_id for link_id.
Using the phy_id as the link_id is wrong since we might have 2 macs
operating on the same phy - in this case we will have 2 different
links (one for each mac) with the same link_id. On the other hand,
since we don't have MLO implemented yet, we won't have 2 different
links of the same mac. Therefore, we can use the mac_id as the
link_id.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.78ae716884fe.Icfeb2794d9652baaccf9b0cdddbd751d0db4f952@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: always use the sta->addr as the peers addr
Miri Korenblit [Tue, 28 Mar 2023 07:58:54 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: always use the sta->addr as the peers addr

Currently we're setting the sta->addr as the peers address only if
the iftype is NL80211_IFTYPE_AP, otherwise we are setting the bssid to
be the addr. This causes bugs in TDLS. Fix this by always using the
sta->addr.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.4c104c3074c4.I78912bb85251033e60db99a65165890779203612@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: modify link instead of removing it during csa
Miri Korenblit [Tue, 28 Mar 2023 07:58:53 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: modify link instead of removing it during csa

During CSA the PHY used by the link is changing, So the driver
needs to modify the links phy to the FW. Currently the driver is doing
it by removing the link and adding a new one with the new phy_id, but the
FW expects the link only to be modified. Fix this by modifying the links
phy_id instead of removing it and adding a new one

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.c07ca7aace29.I4ed5c77f4afe1b5da19322734e2f84d51aa541ad@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: fix crash on queue removal for MLD API too
Miri Korenblit [Tue, 28 Mar 2023 07:58:52 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: fix crash on queue removal for MLD API too

The patch linked below fixes the crash on queue removal bug only
for the non-MLD API. Do the same for the MLD API.

Fixes: c5a976cf6a75 ("wifi: iwlwifi: modify new queue allocation command")
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.527dace26147.Ia215df5833634f95688a979f39fae70c1ac4e027@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: fix "modify_mask" value in the link cmd.
Miri Korenblit [Tue, 28 Mar 2023 07:58:51 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: fix "modify_mask" value in the link cmd.

This bitmap indicates what fields of the cmd got changed.
A field will be ignored by the FW if the corresponding flag wasn't set.
There are a few cases in which we currently set the wrong bits when
sending this cmd, which caused FW asserts. Fix this by setting the
correct bits in each case.

Fixes: 1ab26632332e ("wifi: iwlwifi: mvm: Add an add_interface() callback for mld mode")
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.19ddbee0c98d.I595abb79d0419c9a21e5234303c2c3fd5290a52a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: add all missing ops to iwl_mvm_mld_ops
Miri Korenblit [Tue, 28 Mar 2023 07:58:50 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add all missing ops to iwl_mvm_mld_ops

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

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.a2f724342522.I5d1d6a8f5f14e6275da56ea704c3c0063fee5226@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: add support for post_channel_switch in MLD mode
Miri Korenblit [Tue, 28 Mar 2023 07:58:49 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add support for post_channel_switch in MLD mode

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

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.fa3992f7dfd2.Ie298a9b1522e956d7b699f0432795548bc6e47f9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: unite sta_modify_disable_tx flows
Miri Korenblit [Tue, 28 Mar 2023 07:58:48 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: unite sta_modify_disable_tx flows

These flows are the same in both MLD API and the current API,
except for the commands that are being sent during this flows.
Instead of checking each time before calling these floews
what API we use and then call the correct function, call always the old
one, which in turn will call the new one in case we're using the MLD
API.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.5692d8dea9be.Ib1882b2c2f0b0603abc4b7d4a0ecc45cd1fbf9a7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: add cancel/remain_on_channel for MLD mode
Miri Korenblit [Tue, 28 Mar 2023 07:58:47 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add cancel/remain_on_channel for MLD mode

Add an MLD version of the remain_on_channel and
cancel_remain_on_channel callbacks.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.b51813dbebd4.Ia25bbd63d3138e4759237ce2be0cd0436fe01c0a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: refactor iwl_mvm_roc()
Miri Korenblit [Tue, 28 Mar 2023 07:58:46 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: refactor iwl_mvm_roc()

This flow is almost the same for both MLD and non-MLD modes,
except for some function calls. Therefore there is no reason to
add an MLD version of this flow. Instead - put the parts that are unique
for each mode in helper functions, and in the next patch each version of
this flow will call the common part with pointers to its specific
helper functions.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.61bc077a7f3c.Ia3aa81d3293792bf8f80528dbc67a711ce334b32@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: add some new MLD ops
Miri Korenblit [Tue, 28 Mar 2023 07:58:45 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add some new MLD ops

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

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.9c83c253d610.Ibf2006be9ece87896c17cb43dfe3654ac73d81ff@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: add sta handling flows for MLD mode
Miri Korenblit [Tue, 28 Mar 2023 07:58:44 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add sta handling flows for MLD mode

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

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.b5548cfd8fe3.I70f9c8f3c95e18d5c9af0a5681e0830893509531@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: add an indication that the new MLD API is used
Miri Korenblit [Tue, 28 Mar 2023 07:58:43 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: add an indication that the new MLD API is used

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

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.5756b0907403.I0adce36d1783cce23d0e080e3c4a8953db33b515@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: sta preparation for MLO
Gregory Greenman [Tue, 28 Mar 2023 07:58:42 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: sta preparation for MLO

Split iwl_mvm_sta into general and link specific parts. As a first
step, all link dependent parameters reside in deflink.

The change was done mostly using the spatch below with some manual
adjustments.

@iwl_mvm_sta@
struct iwl_mvm_sta *s;
identifier var = {sta_id, lq_sta, avg_energy};
@@

(
  s->
-    var
+    deflink.var
)

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.34eace06d583.I1f8c5e919a71b21030460fbdd220d42401b688b1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: vif preparation for MLO
Gregory Greenman [Tue, 28 Mar 2023 07:58:41 +0000 (10:58 +0300)]
wifi: iwlwifi: mvm: vif preparation for MLO

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

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

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

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

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

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230328104948.4896576f0a9f.Ifaf0187c96b9fe52b24bd629331165831a877691@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: nl80211: support advertising S1G capabilities
Kieran Frewen [Thu, 23 Feb 2023 21:29:17 +0000 (10:29 +1300)]
wifi: nl80211: support advertising S1G capabilities

Include S1G capabilities in netlink band info messages.

Signed-off-by: Kieran Frewen <kieran.frewen@morsemicro.com>
Co-developed-by: Gilad Itzkovitch <gilad.itzkovitch@morsemicro.com>
Signed-off-by: Gilad Itzkovitch <gilad.itzkovitch@morsemicro.com>
Link: https://lore.kernel.org/r/20230223212917.4010246-1-gilad.itzkovitch@virscient.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: mac80211: S1G capabilities information element in probe request
Kieran Frewen [Thu, 23 Feb 2023 03:25:12 +0000 (16:25 +1300)]
wifi: mac80211: S1G capabilities information element in probe request

Add the missing S1G capabilities information element to probe requests.

Signed-off-by: Kieran Frewen <kieran.frewen@morsemicro.com>
Co-developed-by: Gilad Itzkovitch <gilad.itzkovitch@morsemicro.com>
Signed-off-by: Gilad Itzkovitch <gilad.itzkovitch@morsemicro.com>
Link: https://lore.kernel.org/r/20230223032512.3848105-1-gilad.itzkovitch@virscient.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agomac80211: minstrel_ht: remove unused n_supported variable
Tom Rix [Sat, 25 Mar 2023 13:26:10 +0000 (09:26 -0400)]
mac80211: minstrel_ht: remove unused n_supported variable

clang with W=1 reports
net/mac80211/rc80211_minstrel_ht.c:1711:6: error: variable
  'n_supported' set but not used [-Werror,-Wunused-but-set-variable]
        int n_supported = 0;
            ^
This variable is not used so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230325132610.1334820-1-trix@redhat.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: mac80211: fix invalid drv_sta_pre_rcu_remove calls for non-uploaded sta
Felix Fietkau [Fri, 24 Mar 2023 12:09:24 +0000 (13:09 +0100)]
wifi: mac80211: fix invalid drv_sta_pre_rcu_remove calls for non-uploaded sta

Avoid potential data corruption issues caused by uninitialized driver
private data structures.

Reported-by: Brian Coverstone <brian@mainsequence.net>
Fixes: 6a9d1b91f34d ("mac80211: add pre-RCU-sync sta removal driver operation")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20230324120924.38412-3-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: mac80211: fix flow dissection for forwarded packets
Felix Fietkau [Fri, 24 Mar 2023 12:09:23 +0000 (13:09 +0100)]
wifi: mac80211: fix flow dissection for forwarded packets

Adjust the network header to point at the correct payload offset

Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20230324120924.38412-2-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: mac80211: fix mesh forwarding
Felix Fietkau [Fri, 24 Mar 2023 12:09:22 +0000 (13:09 +0100)]
wifi: mac80211: fix mesh forwarding

Linearize packets (needed for forwarding A-MSDU subframes).

Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20230324120924.38412-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: mac80211: fix receiving mesh packets in forwarding=0 networks
Felix Fietkau [Sun, 26 Mar 2023 15:17:09 +0000 (17:17 +0200)]
wifi: mac80211: fix receiving mesh packets in forwarding=0 networks

When forwarding is set to 0, frames are typically sent with ttl=1.
Move the ttl decrement check below the check for local receive in order to
fix packet drops.

Reported-by: Thomas Hühn <thomas.huehn@hs-nordhausen.de>
Reported-by: Nick Hainke <vincent@systemli.org>
Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20230326151709.17743-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: mac80211: fix the size calculation of ieee80211_ie_len_eht_cap()
Ryder Lee [Mon, 27 Mar 2023 17:07:41 +0000 (01:07 +0800)]
wifi: mac80211: fix the size calculation of ieee80211_ie_len_eht_cap()

Here should return the size of ieee80211_eht_cap_elem_fixed, so fix it.

Fixes: 820acc810fb6 ("mac80211: Add EHT capabilities to association/probe request")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Link: https://lore.kernel.org/r/06c13635fc03bcff58a647b8e03e9f01a74294bd.1679935259.git.ryder.lee@mediatek.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: iwlwifi: mvm: Use 64-bit division helper in iwl_mvm_get_crosstimestamp_fw()
Nathan Chancellor [Wed, 29 Mar 2023 17:32:46 +0000 (10:32 -0700)]
wifi: iwlwifi: mvm: Use 64-bit division helper in iwl_mvm_get_crosstimestamp_fw()

There is a 64-bit division in iwl_mvm_get_crosstimestamp_fw(), which
results in a link failure when building 32-bit architectures with clang:

  ld.lld: error: undefined symbol: __udivdi3
  >>> referenced by ptp.c
  >>>               drivers/net/wireless/intel/iwlwifi/mvm/ptp.o:(iwl_mvm_phc_get_crosstimestamp) in archive vmlinux.a

GCC has optimizations for division by a constant that clang does not
implement, so this issue is not visible when building with GCC.

Use the 64-bit division helper div_u64(), which takes a u64 dividend and
u32 divisor, which matches this situation and prevents the emission of a
libcall for the division.

Fixes: 21fb8da6ebe4 ("wifi: iwlwifi: mvm: read synced time from firmware if supported")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Link: https://github.com/ClangBuiltLinux/linux/issues/1826
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Link: https://lore.kernel.org/6423173a.620a0220.3d5cc.6358@mx.google.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: mac80211: fix potential null pointer dereference
Felix Fietkau [Thu, 30 Mar 2023 09:00:01 +0000 (11:00 +0200)]
wifi: mac80211: fix potential null pointer dereference

rx->sta->amsdu_mesh_control is being passed to ieee80211_amsdu_to_8023s
without checking rx->sta. Since it doesn't make sense to accept A-MSDU
packets without a sta, simply add a check earlier.

Fixes: 6e4c0d0460bd ("wifi: mac80211: add a workaround for receiving non-standard mesh A-MSDU")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20230330090001.60750-2-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agowifi: mac80211: drop bogus static keywords in A-MSDU rx
Felix Fietkau [Thu, 30 Mar 2023 09:00:00 +0000 (11:00 +0200)]
wifi: mac80211: drop bogus static keywords in A-MSDU rx

These were unintentional copy&paste mistakes.

Cc: stable@vger.kernel.org
Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20230330090001.60750-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agomac80211_hwsim: add PMSR report support via virtio
Jaewan Kim [Wed, 22 Mar 2023 13:16:37 +0000 (13:16 +0000)]
mac80211_hwsim: add PMSR report support via virtio

PMSR (a.k.a. peer measurement) is generalized measurement between two
devices with Wi-Fi support. And currently FTM (a.k.a. fine time measurement
or flight time measurement) is the one and only measurement.

Add the necessary functionality to allow mac80211_hwsim to report PMSR
result. The result would come from the wmediumd, where other Wi-Fi
devices' information are kept. mac80211_hwsim only need to deliver the
result to the userspace.

In detail, add new mac80211_hwsim attributes HWSIM_CMD_REPORT_PMSR, and
HWSIM_ATTR_PMSR_RESULT. When mac80211_hwsim receives the PMSR result with
command HWSIM_CMD_REPORT_PMSR and detail with attribute
HWSIM_ATTR_PMSR_RESULT, received data is parsed to cfg80211_pmsr_result and
resent to the userspace by cfg80211_pmsr_report().

To help receive the details of PMSR result, hwsim_rate_info_attributes is
added to receive rate_info without complex bitrate calculation. (i.e. send
rate_info without adding inverse of nl80211_put_sta_rate()).

Signed-off-by: Jaewan Kim <jaewan@google.com>
Link: https://lore.kernel.org/r/20230322131637.2633968-6-jaewan@google.com
[fix uninitialized return value when there are no reports]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agomac80211_hwsim: add PMSR abort support via virtio
Jaewan Kim [Wed, 22 Mar 2023 13:16:36 +0000 (13:16 +0000)]
mac80211_hwsim: add PMSR abort support via virtio

PMSR (a.k.a. peer measurement) is generalized measurement between two
devices with Wi-Fi support. And currently FTM (a.k.a. fine time
measurement or flight time measurement) is the one and only measurement.

Add necessary functionalities for mac80211_hwsim to abort previous PMSR
request. The abortion request is sent to the wmedium where the PMSR request
is actually handled.

In detail, add new mac80211_hwsim command HWSIM_CMD_ABORT_PMSR. When
mac80211_hwsim receives the PMSR abortion request via
ieee80211_ops.abort_pmsr, the received cfg80211_pmsr_request is resent to
the wmediumd with command HWSIM_CMD_ABORT_PMSR and attribute
HWSIM_ATTR_PMSR_REQUEST. The attribute is formatted as the same way as
nl80211_pmsr_start() expects.

Signed-off-by: Jaewan Kim <jaewan@google.com>
Link: https://lore.kernel.org/r/20230322131637.2633968-5-jaewan@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 months agomac80211_hwsim: add PMSR request support via virtio
Jaewan Kim [Wed, 22 Mar 2023 13:16:35 +0000 (13:16 +0000)]
mac80211_hwsim: add PMSR request support via virtio

PMSR (a.k.a. peer measurement) is generalized measurement between two
Wi-Fi devices. And currently FTM (a.k.a. fine time measurement or flight
time measurement) is the one and only measurement. FTM is measured by
RTT (a.k.a. round trip time) of packets between two Wi-Fi devices.

Add necessary functionalities for mac80211_hwsim to start PMSR request by
passthrough the request to wmediumd via virtio. mac80211_hwsim can't
measure RTT for real because mac80211_hwsim the software simulator and
packets are sent almost immediately for real. This change expect wmediumd
to have all the location information of devices, so passthrough requests
to wmediumd.

In detail, add new mac80211_hwsim command HWSIM_CMD_ABORT_PMSR. When
mac80211_hwsim receives the PMSR start request via
ieee80211_ops.start_pmsr, the received cfg80211_pmsr_request is resent to
the wmediumd with command HWSIM_CMD_START_PMSR and attribute
HWSIM_ATTR_PMSR_REQUEST. The attribute is formatted as the same way as
nl80211_pmsr_start() expects.

Signed-off-by: Jaewan Kim <jaewan@google.com>
Link: https://lore.kernel.org/r/20230322131637.2633968-4-jaewan@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>