linux-2.6-microblaze.git
22 months agowifi: mac80211: tx: use AP address in some places for MLO
Johannes Berg [Fri, 15 Jul 2022 13:37:23 +0000 (15:37 +0200)]
wifi: mac80211: tx: use AP address in some places for MLO

In a few places we need to use the AP (MLD) address, not the
deflink BSSID, the link address translation will happen later.

To make that work properly for fast-xmit, set up the ap_addr
in the vif.cfg earlier.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: wl1251: fix repeated words in comments
Jilin Yuan [Sun, 10 Jul 2022 04:34:05 +0000 (12:34 +0800)]
wifi: wl1251: fix repeated words in comments

Delete the redundant word 'the'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220710043405.38304-1-yuanjilin@cdjrlc.com
23 months agowifi: rsi: fix repeated words in comments
Jilin Yuan [Sun, 10 Jul 2022 04:30:07 +0000 (12:30 +0800)]
wifi: rsi: fix repeated words in comments

Delete the redundant word 'the'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220710043007.33288-1-yuanjilin@cdjrlc.com
23 months agowifi: rtl8192se: fix repeated words in comments
Jilin Yuan [Sun, 10 Jul 2022 04:25:46 +0000 (12:25 +0800)]
wifi: rtl8192se: fix repeated words in comments

Delete the redundant word 'not'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220710042546.28504-1-yuanjilin@cdjrlc.com
23 months agowifi: rtlwifi: fix repeated words in comments
Jilin Yuan [Sun, 10 Jul 2022 04:20:40 +0000 (12:20 +0800)]
wifi: rtlwifi: fix repeated words in comments

Delete the redundant words 'in' and 'scan'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220710042040.22456-1-yuanjilin@cdjrlc.com
23 months agowifi: rt2x00: fix repeated words in comments
Jilin Yuan [Sun, 10 Jul 2022 04:14:42 +0000 (12:14 +0800)]
wifi: rt2x00: fix repeated words in comments

Delete the redundant words 'is' and 'with'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220710041442.16177-1-yuanjilin@cdjrlc.com
23 months agowifi: qtnfmac: fix repeated words in comments
Jilin Yuan [Sun, 10 Jul 2022 04:10:05 +0000 (12:10 +0800)]
wifi: qtnfmac: fix repeated words in comments

Delete the redundant word 'the'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220710041005.10950-1-yuanjilin@cdjrlc.com
23 months agowifi: iwlegacy: fix repeated words in comments
Jilin Yuan [Sat, 9 Jul 2022 13:53:16 +0000 (21:53 +0800)]
wifi: iwlegacy: fix repeated words in comments

Delete the redundant words 'to' and 'if'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220709135316.41425-1-yuanjilin@cdjrlc.com
23 months agowifi: ipw2x00: fix repeated words in comments
Jilin Yuan [Sat, 9 Jul 2022 13:47:01 +0000 (21:47 +0800)]
wifi: ipw2x00: fix repeated words in comments

Delete the redundant word 'the'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220709134701.36081-1-yuanjilin@cdjrlc.com
23 months agowifi: brcmsmac: fix repeated words in comments
Jilin Yuan [Sat, 9 Jul 2022 13:42:07 +0000 (21:42 +0800)]
wifi: brcmsmac: fix repeated words in comments

Delete the redundant word 'the'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220709134207.30856-1-yuanjilin@cdjrlc.com
23 months agowifi: brcmfmac: fix repeated words in comments
Jilin Yuan [Sat, 9 Jul 2022 13:36:18 +0000 (21:36 +0800)]
wifi: brcmfmac: fix repeated words in comments

Delete the redundant words 'this' and 'and'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220709133618.25958-1-yuanjilin@cdjrlc.com
23 months agowifi: b43: fix repeated words in comments
Jilin Yuan [Sat, 9 Jul 2022 13:31:19 +0000 (21:31 +0800)]
wifi: b43: fix repeated words in comments

Delete the redundant word 'early'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220709133119.21076-1-yuanjilin@cdjrlc.com
23 months agowifi: atmel: fix repeated words in comments
Jilin Yuan [Sat, 9 Jul 2022 13:26:37 +0000 (21:26 +0800)]
wifi: atmel: fix repeated words in comments

Delete the redundant word 'long'.

Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220709132637.16717-1-yuanjilin@cdjrlc.com
23 months agowifi: mac80211: do not abuse fq.lock in ieee80211_do_stop()
Tetsuo Handa [Sun, 17 Jul 2022 12:21:52 +0000 (21:21 +0900)]
wifi: mac80211: do not abuse fq.lock in ieee80211_do_stop()

lockdep complains use of uninitialized spinlock at ieee80211_do_stop() [1],
for commit f856373e2f31ffd3 ("wifi: mac80211: do not wake queues on a vif
that is being stopped") guards clear_bit() using fq.lock even before
fq_init() from ieee80211_txq_setup_flows() initializes this spinlock.

According to discussion [2], Toke was not happy with expanding usage of
fq.lock. Since __ieee80211_wake_txqs() is called under RCU read lock, we
can instead use synchronize_rcu() for flushing ieee80211_wake_txqs().

Link: https://syzkaller.appspot.com/bug?extid=eceab52db7c4b961e9d6
Link: https://lkml.kernel.org/r/874k0zowh2.fsf@toke.dk
Reported-by: syzbot <syzbot+eceab52db7c4b961e9d6@syzkaller.appspotmail.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: f856373e2f31ffd3 ("wifi: mac80211: do not wake queues on a vif that is being stopped")
Tested-by: syzbot <syzbot+eceab52db7c4b961e9d6@syzkaller.appspotmail.com>
Acked-by: Toke Høiland-Jørgensen <toke@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/9cc9b81d-75a3-3925-b612-9d0ad3cab82b@I-love.SAKURA.ne.jp
23 months agowifi: p54: add missing parentheses in p54_flush()
Rustam Subkhankulov [Thu, 14 Jul 2022 13:48:31 +0000 (16:48 +0300)]
wifi: p54: add missing parentheses in p54_flush()

The assignment of the value to the variable total in the loop
condition must be enclosed in additional parentheses, since otherwise,
in accordance with the precedence of the operators, the conjunction
will be performed first, and only then the assignment.

Due to this error, a warning later in the function after the loop may
not occur in the situation when it should.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Rustam Subkhankulov <subkhankulov@ispras.ru>
Fixes: 0d4171e2153b ("p54: implement flush callback")
Acked-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220714134831.106004-1-subkhankulov@ispras.ru
23 months agowifi: mt7601u: fix clang -Wformat warning
Justin Stitt [Mon, 11 Jul 2022 21:29:32 +0000 (14:29 -0700)]
wifi: mt7601u: fix clang -Wformat warning

When building with Clang we encounter this warning:
| drivers/net/wireless/mediatek/mt7601u/debugfs.c:92:6: error: format
| specifies type 'unsigned char' but the argument has type 'int'
| [-Werror,-Wformat] dev->ee->reg.start + dev->ee->reg.num - 1);

The format specifier used is `%hhu` which describes a u8. Both
`dev->ee->reg.start` and `.num` are u8 as well. However, the expression
as a whole is promoted to an int as you cannot get smaller-than-int from
addition. Therefore, to fix the warning, use the promoted-to-type's
format specifier -- in this case `%d`.

example:
```
uint8_t a = 4, b = 7;
int size = sizeof(a + b - 1);
printf("%d\n", size);
// output: 4
```

See more:
(https://wiki.sei.cmu.edu/confluence/display/c/INT02-C.+Understand+integer+conversion+rules)
"Integer types smaller than int are promoted when an operation is
performed on them. If all values of the original type can be represented
as an int, the value of the smaller type is converted to an int;
otherwise, it is converted to an unsigned int."

Signed-off-by: Justin Stitt <justinstitt@google.com>
Acked-by: Jakub Kicinski <kubakici@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220711212932.1501592-1-justinstitt@google.com
23 months agowifi: mt7601u: eeprom: fix clang -Wformat warning
Justin Stitt [Sat, 9 Jul 2022 00:15:27 +0000 (17:15 -0700)]
wifi: mt7601u: eeprom: fix clang -Wformat warning

When building with Clang we encounter the following warning:
| drivers/net/wireless/mediatek/mt7601u/eeprom.c:193:5: error: format
| specifies type 'char' but the argument has type 'int' [-Werror,-Wformat]
| chan_bounds[idx].start + chan_bounds[idx].num - 1);

Variadic functions (printf-like) undergo default argument promotion.
Documentation/core-api/printk-formats.rst specifically recommends using
the promoted-to-type's format flag.

Moreover, C11 6.3.1.1 states:
(https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf) `If an int
can represent all values of the original type ..., the value is
converted to an int; otherwise, it is converted to an unsigned int.
These are called the integer promotions.`

With this information in hand, we really should stop using `%hh[dxu]` or
`%h[dxu]` as they usually prompt Clang -Wformat warnings as well as go
against documented standard recommendations.

Link: https://github.com/ClangBuiltLinux/linux/issues/378
Signed-off-by: Justin Stitt <justinstitt@google.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220709001527.618593-1-justinstitt@google.com
23 months agowifi: p54: Use the bitmap API to allocate bitmaps
Christophe JAILLET [Mon, 4 Jul 2022 13:02:55 +0000 (15:02 +0200)]
wifi: p54: Use the bitmap API to allocate bitmaps

Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.

It is less verbose and it improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/2755b8b7d85a2db0663d39ea6df823f94f3401b3.1656939750.git.christophe.jaillet@wanadoo.fr
23 months agowifi: p54: Fix an error handling path in p54spi_probe()
Christophe JAILLET [Sun, 12 Jun 2022 21:12:20 +0000 (23:12 +0200)]
wifi: p54: Fix an error handling path in p54spi_probe()

If an error occurs after a successful call to p54spi_request_firmware(), it
must be undone by a corresponding release_firmware() as already done in
the error handling path of p54spi_request_firmware() and in the .remove()
function.

Add the missing call in the error handling path and remove it from
p54spi_request_firmware() now that it is the responsibility of the caller
to release the firmware

Fixes: cd8d3d321285 ("p54spi: p54spi driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/297d2547ff2ee627731662abceeab9dbdaf23231.1655068321.git.christophe.jaillet@wanadoo.fr
23 months agoMerge tag 'mt76-for-kvalo-2022-07-11' of https://github.com/nbd168/wireless
Kalle Valo [Mon, 18 Jul 2022 11:31:59 +0000 (14:31 +0300)]
Merge tag 'mt76-for-kvalo-2022-07-11' of https://github.com/nbd168/wireless

mt76 patches for 5.20

- preparation for new chipset support
- fixes
- VHT/HE related improvements
- ACPI SAR support

[kvalo@kernel.org: fix mac80211 API changes in start_ap() and stop_ap()]

23 months agowifi: mac80211: mlme: set sta.mlo correctly
Johannes Berg [Fri, 15 Jul 2022 13:11:50 +0000 (15:11 +0200)]
wifi: mac80211: mlme: set sta.mlo correctly

Due to some changes and rebasing between different patches
this fell through the cracks; we need to set sta.mlo if the
connection is using MLO.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: remove stray printk
Johannes Berg [Fri, 15 Jul 2022 13:04:41 +0000 (15:04 +0200)]
wifi: mac80211: remove stray printk

Unfortunately, a printk snuck into a previous patch,
remove it.

Fixes: 81151ce462e5 ("wifi: mac80211: support MLO authentication/association with one link")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: support MLO authentication/association with one link
Johannes Berg [Wed, 1 Jun 2022 19:17:34 +0000 (21:17 +0200)]
wifi: mac80211: support MLO authentication/association with one link

It might seem a bit pointless to do a multi-link operation
connection with just a single link, but this is already a
big change, so for now, limit MLO connections to a single
link.

Extending that to multiple links will require
 * work on parsing the multi-link element with STA profile
   properly, including element fragmentation;
 * checking the per-link status in the multi-link element
 * implementing logic to have active/inactive links to let
   drivers decide which links should be active;
 * implementing multicast RX deduplication;
 * and likely more.

For now this is still useful since it lets us do multi-link
connections for the purposes of testing APIs and the higher
layers such as wpa_supplicant.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: add API to parse multi-link element
Johannes Berg [Thu, 30 Jun 2022 11:48:22 +0000 (13:48 +0200)]
wifi: mac80211: add API to parse multi-link element

Add the necessary API to parse the multi-link element in
the future. For now, link only to the element when found
so we can use it in the client-side code later.

Later, we'll need to fill this in to deal with element
fragmentation, parse the STA profile, etc.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211_hwsim: fix TX link selection
Johannes Berg [Thu, 14 Jul 2022 19:58:00 +0000 (21:58 +0200)]
wifi: mac80211_hwsim: fix TX link selection

Now that we have a pointer to the TX STA even when it's
not authenticated/... yet, fix the TX link selection in
hwsim to select only among the valid links for the STA,
requiring a STA pointer here. Also implement a simple
round-robin between links to make life more interesting.

While at it, also consider A3 when translating to link
addresses.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211_hwsim: use MLO link ID for TX
Andrei Otcheretianski [Tue, 14 Jun 2022 14:17:20 +0000 (17:17 +0300)]
wifi: mac80211_hwsim: use MLO link ID for TX

Use the link ID provided in TX frame metadata to select the correct
channel. For now, always select the link with the lowest link ID and
do some address translation.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211_hwsim: do rc update per link
Andrei Otcheretianski [Wed, 22 Jun 2022 13:11:43 +0000 (16:11 +0300)]
wifi: mac80211_hwsim: do rc update per link

Make mac80211_hwsim_sta_rc_update() iterate over all the STA links.

This is somewhat temporary, we really should add the link to the
API, but then hwsim still calls it internally and would need this.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: do link->MLD address translation on RX
Johannes Berg [Thu, 14 Jul 2022 21:47:32 +0000 (23:47 +0200)]
wifi: mac80211: do link->MLD address translation on RX

In some cases, e.g. with Qualcomm devices and management
frames, or in hwsim, frames may be reported from the driver
with link addresses, but for decryption and matching needs
we really want to have them with MLD addresses. Support the
translation on RX.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: select link when transmitting to non-MLO stations
Andrei Otcheretianski [Wed, 13 Jul 2022 09:05:27 +0000 (12:05 +0300)]
wifi: mac80211: select link when transmitting to non-MLO stations

When an MLO AP is transmitting to a non-MLO station, addr2 should be set
to a link address. This should be done before the frame is encrypted as
otherwise aad verification would fail. In case of software encryption
this can't be left for the device to handle, and should be done by
mac80211 when building the frame hdr.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: fix up link station creation/insertion
Johannes Berg [Thu, 14 Jul 2022 21:40:47 +0000 (23:40 +0200)]
wifi: mac80211: fix up link station creation/insertion

When we create a station with a non-default link, then
we should have a link address, and we definitely need
to insert it into the link hash table on insertion.

Split the API into with and without link creation and
if it has a link, insert the link into the link hash
table on sta_info_insert().

Fixes: ba6ddab94fc6 ("wifi: mac80211: maintain link-sta hash table")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211_hwsim: implement sta_state for MLO
Johannes Berg [Thu, 14 Jul 2022 20:23:02 +0000 (22:23 +0200)]
wifi: mac80211_hwsim: implement sta_state for MLO

In MLO, we need to transmit to another MLD and select
the link to it, which requires knowing the station.
But in TX, mac80211 will not give us a station that's
not added to the driver, which in the older add/remove
API is only done later.

Implement the new API in MLO so we know about the STA
at all times and get a pointer during TX as well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: limit A-MSDU subframes for client too
Johannes Berg [Wed, 13 Jul 2022 16:08:03 +0000 (18:08 +0200)]
wifi: mac80211: limit A-MSDU subframes for client too

In AP/mesh where the stations are added by userspace, we
limit the number of A-MSDU subframes according to the
extended capabilities.

Refactor the code and extend that also to client-side.

Fixes: 506bcfa8abeb ("mac80211: limit the A-MSDU Tx based on peer's capabilities")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: refactor ieee80211_set_associated()
Johannes Berg [Tue, 12 Jul 2022 20:18:24 +0000 (22:18 +0200)]
wifi: mac80211: mlme: refactor ieee80211_set_associated()

Split out much of the code in ieee80211_set_associated()
into a new ieee80211_link_set_associated() which can be
called per link later for MLO.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: cfg80211: add cfg80211_get_iftype_ext_capa()
Johannes Berg [Tue, 12 Jul 2022 16:32:49 +0000 (18:32 +0200)]
wifi: cfg80211: add cfg80211_get_iftype_ext_capa()

Add a helper function cfg80211_get_iftype_ext_capa() to
look up interface type-specific (extended) capabilities.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: look up beacon elems only if needed
Johannes Berg [Tue, 12 Jul 2022 15:21:22 +0000 (17:21 +0200)]
wifi: mac80211: mlme: look up beacon elems only if needed

If NEED_DTIM_BEFORE_ASSOC isn't set, then we don't need
to enter an RCU critical section and look up the beacon
elements.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: refactor assoc link setup
Johannes Berg [Tue, 12 Jul 2022 13:21:23 +0000 (15:21 +0200)]
wifi: mac80211: mlme: refactor assoc link setup

Factor out the code to set up the assoc link into a
new function ieee80211_setup_assoc_link().

While at it, also modify the 'override' handling to
just take into account whether or not the conn_flags
were changed, which is what we need to setup again
the channel later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: remove address arg to ieee80211_mark_sta_auth()
Johannes Berg [Tue, 12 Jul 2022 13:13:23 +0000 (15:13 +0200)]
wifi: mac80211: mlme: remove address arg to ieee80211_mark_sta_auth()

There's no need to pass the address, we can look at the auth_data
inside the function rather than outside.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: refactor assoc success handling
Johannes Berg [Tue, 12 Jul 2022 12:59:22 +0000 (14:59 +0200)]
wifi: mac80211: mlme: refactor assoc success handling

Refactor the per-link setup out of ieee80211_assoc_success()
into a new function ieee80211_assoc_config_link().

It looks useless for now to parse the elements again inside
ieee80211_assoc_config_link(), but that will be done with
the link ID in the future.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: refactor ieee80211_prep_channel() a bit
Johannes Berg [Tue, 12 Jul 2022 12:48:55 +0000 (14:48 +0200)]
wifi: mac80211: mlme: refactor ieee80211_prep_channel() a bit

Refactor ieee80211_prep_channel() to make the link argument
optional and add a conn_flags pointer argument instead, so
that we can later use this for links that don't exist yet
to build the right information for MLO.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: refactor assoc req element building
Johannes Berg [Tue, 12 Jul 2022 12:38:02 +0000 (14:38 +0200)]
wifi: mac80211: mlme: refactor assoc req element building

For MLO, we will need to build these elements per link, so
factor out the code that does this, returning the capability,
to simplify building the multi-link element in the future.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: switch some things back to deflink
Johannes Berg [Tue, 12 Jul 2022 11:46:19 +0000 (13:46 +0200)]
wifi: mac80211: mlme: switch some things back to deflink

With MLO, when we'll disconnect from an AP MLD, we'll just
destroy all the links. Therefore, the only thing we (may)
need to reset is the deflink data, so switch back to that
and adjust the comments accordingly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: change flags in ieee80211_determine_chantype()
Johannes Berg [Tue, 12 Jul 2022 09:33:57 +0000 (11:33 +0200)]
wifi: mac80211: mlme: change flags in ieee80211_determine_chantype()

For MLO we'll need to read flags not directly from the link as
it may not even exist yet if we're just setting up flags for
a secondary link before sending the association request, so
pass the incoming conn_flags separately. Also, while at it,
pass the sdata/link separately as for non-tracking now the
link may be NULL.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: shift some code around
Johannes Berg [Tue, 12 Jul 2022 09:13:56 +0000 (11:13 +0200)]
wifi: mac80211: mlme: shift some code around

We'll need ieee80211_prep_channel() in other code for MLO
later, so move the code up - unchanged for now - to avoid
forward declarations in the future.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: refactor link station setup
Johannes Berg [Tue, 12 Jul 2022 09:06:33 +0000 (11:06 +0200)]
wifi: mac80211: mlme: refactor link station setup

Refactor the code here since we need to have it also for each
link station after association in MLO later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: move IEEE80211_SDATA_OPERATING_GMODE to link
Johannes Berg [Tue, 12 Jul 2022 08:49:23 +0000 (10:49 +0200)]
wifi: mac80211: move IEEE80211_SDATA_OPERATING_GMODE to link

The flag here is currently per interface, but the way we
set and clear it means it should be per link, so change
it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: make ieee80211_check_rate_mask() link-aware
Johannes Berg [Mon, 11 Jul 2022 13:13:20 +0000 (15:13 +0200)]
wifi: mac80211: make ieee80211_check_rate_mask() link-aware

Change ieee80211_check_rate_mask() to use a link rather than
the sdata and deflink/bss_conf.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: add multi-link element to AUTH frames
Johannes Berg [Tue, 12 Jul 2022 11:38:07 +0000 (13:38 +0200)]
wifi: mac80211: add multi-link element to AUTH frames

When sending an authentication frame from an MLD, include
the multi-link element with the MLD address and use the
link address for transmission.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: clean up supported channels element code
Johannes Berg [Tue, 12 Jul 2022 11:40:02 +0000 (13:40 +0200)]
wifi: mac80211: mlme: clean up supported channels element code

Clean up the code building the supported channels element
a little bit by using a local variable instead of the long
line.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: release channel context on link stop
Johannes Berg [Tue, 12 Jul 2022 11:36:37 +0000 (13:36 +0200)]
wifi: mac80211: release channel context on link stop

When a link is stopped for removal, release the channel
context it may have.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: prohibit DEAUTH_NEED_MGD_TX_PREP in MLO
Johannes Berg [Tue, 12 Jul 2022 11:35:54 +0000 (13:35 +0200)]
wifi: mac80211: prohibit DEAUTH_NEED_MGD_TX_PREP in MLO

For now, prohibit DEAUTH_NEED_MGD_TX_PREP since we can't
really transmit this on a specific link yet as we don't
know which links are active.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: nl80211: fix some attribute policy entries
Johannes Berg [Tue, 12 Jul 2022 15:33:13 +0000 (17:33 +0200)]
wifi: nl80211: fix some attribute policy entries

The new NL80211_CMD_ADD_LINK_STA and NL80211_CMD_MODIFY_LINK_STA
commands have strict policy validation, so fix the policy so it
can be validated correctly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: nl80211: reject fragmented and non-inheritance elements
Johannes Berg [Mon, 11 Jul 2022 12:18:18 +0000 (14:18 +0200)]
wifi: nl80211: reject fragmented and non-inheritance elements

The underlying mac80211 code cannot deal with fragmented
elements for purposes of sorting the elements into the
association frame, so reject those inside the link. We
might want to reject them inside the assoc frame, but
they're used today for FILS, so cannot do that.

The non-inheritance element inside the links similarly
cannot be handled by mac80211, and outside the links it
makes no sense.

Reject both since using them could lead to an incorrect
implementation.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: nl80211: reject link specific elements on assoc link
Johannes Berg [Mon, 11 Jul 2022 09:53:20 +0000 (11:53 +0200)]
wifi: nl80211: reject link specific elements on assoc link

When we associate, we'll include all the elements for the
link we're sending the association request on in the frame
and the specific ones for other links in the multi-link
element container. Prohibit adding link-specific elements
for the association link.

Fixes: d648c23024bd ("wifi: nl80211: support MLO in auth/assoc")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: cfg80211: set country_elem to NULL
Johannes Berg [Wed, 13 Jul 2022 08:24:23 +0000 (10:24 +0200)]
wifi: cfg80211: set country_elem to NULL

The link loop will always have a valid link so that
it's always set, but static checkers don't always
see that, so set it to NULL explicitly.

Fixes: efbabc116500 ("cfg80211: Indicate MLO connection info in connect and roam callbacks")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: remove link_id parameter from link_info_changed()
Gregory Greenman [Sun, 3 Jul 2022 21:38:22 +0000 (00:38 +0300)]
wifi: mac80211: remove link_id parameter from link_info_changed()

Since struct ieee80211_bss_conf already contains link_id,
passing link_id is not necessary.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: replace link_id with link_conf in switch/(un)assign_vif_chanctx()
Gregory Greenman [Sun, 3 Jul 2022 15:04:15 +0000 (18:04 +0300)]
wifi: mac80211: replace link_id with link_conf in switch/(un)assign_vif_chanctx()

Since mac80211 already has a protected pointer to link_conf,
pass it to the driver to avoid additional RCU locking.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: nl80211: advertise MLO support
Johannes Berg [Mon, 11 Jul 2022 08:08:11 +0000 (10:08 +0200)]
wifi: nl80211: advertise MLO support

At least while we don't have any more specific interface
combinations support, add a simple flag for MLO support,
we can keep this later based on something other than the
wiphy flag.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: Support multi link in ieee80211_recalc_min_chandef()
Andrei Otcheretianski [Wed, 22 Jun 2022 13:15:56 +0000 (16:15 +0300)]
wifi: mac80211: Support multi link in ieee80211_recalc_min_chandef()

Recalculate min channel context for the given or all interface
links, depending on the caller. For a station state change, we
need to recalculate all of them since we don't know which link
(or multiple) it might be on.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: don't check carrier in chanctx code
Andrei Otcheretianski [Tue, 14 Jun 2022 07:16:26 +0000 (10:16 +0300)]
wifi: mac80211: don't check carrier in chanctx code

We check here that we don't enable TX (netif_carrier_ok())
before we actually start using some channel context, but to
our knowledge this check has never triggered, and with MLO
it's just wrong since links can be added and removed much
more dynamically than before.

Simply remove the checks, there's no really good way to do
anything that would replace them.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: nl80211: allow link ID in set_wiphy with frequency
Ilan Peer [Sun, 12 Jun 2022 13:49:45 +0000 (16:49 +0300)]
wifi: nl80211: allow link ID in set_wiphy with frequency

This simplifies hostapd implementation, since it didn't
switch to NL80211_CMD_SET_CHANNEL.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: Allow EAPOL tx from specific link
Andrei Otcheretianski [Thu, 30 Jun 2022 13:43:44 +0000 (16:43 +0300)]
wifi: mac80211: Allow EAPOL tx from specific link

Allow link source address on TX.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: Allow EAPOL frames from link addresses
Andrei Otcheretianski [Thu, 30 Jun 2022 12:37:37 +0000 (15:37 +0300)]
wifi: mac80211: Allow EAPOL frames from link addresses

Allow transmitting EAPOL frames not only from the interface
address (which is the MLD address) but also any link addresses,
in order to support non-MLO stations on AP interfaces.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: cfg80211/mac80211: Support control port TX from specific link
Andrei Otcheretianski [Thu, 30 Jun 2022 12:27:59 +0000 (15:27 +0300)]
wifi: cfg80211/mac80211: Support control port TX from specific link

In case of authentication with a legacy station, link addressed EAPOL
frames should be sent. Support it.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: nl80211: Support MLD parameters in nl80211_set_station()
Andrei Otcheretianski [Sun, 26 Jun 2022 07:35:48 +0000 (10:35 +0300)]
wifi: nl80211: Support MLD parameters in nl80211_set_station()

Set the MLD parameters in NL80211_CMD_SET_STATION handling
to be able to change an MLD station.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: nl80211: check MLO support in authenticate
Johannes Berg [Thu, 7 Jul 2022 16:19:27 +0000 (18:19 +0200)]
wifi: nl80211: check MLO support in authenticate

We should check that MLO connections are supported before
attempting to authenticate with MLO parameters, check that.

Fixes: d648c23024bd ("wifi: nl80211: support MLO in auth/assoc")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: add a helper to fragment an element
Johannes Berg [Thu, 7 Jul 2022 13:28:14 +0000 (15:28 +0200)]
wifi: mac80211: add a helper to fragment an element

The way this works is that you add all the element data,
keeping a pointer to the length field of the element.
Then call this helper function, which will fragment the
element if there was more than 255 bytes in the element,
memmove()ing the data back if needed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: skip rate statistics for MLD STAs
Johannes Berg [Thu, 7 Jul 2022 13:11:54 +0000 (15:11 +0200)]
wifi: mac80211: skip rate statistics for MLD STAs

For now, skip rate statistics here to avoid warnings in
the called code, we'll need to adjust this to have all
the statistics for link stations.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: nl80211: set BSS to NULL if IS_ERR()
Johannes Berg [Thu, 7 Jul 2022 13:03:51 +0000 (15:03 +0200)]
wifi: nl80211: set BSS to NULL if IS_ERR()

If the BSS lookup returned an error, set it to NULL so we
don't try to free it.

Fixes: d648c23024bd ("wifi: nl80211: support MLO in auth/assoc")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: nl80211: add EML/MLD capabilities to per-iftype capabilities
Johannes Berg [Mon, 4 Jul 2022 13:02:33 +0000 (15:02 +0200)]
wifi: nl80211: add EML/MLD capabilities to per-iftype capabilities

We have the per-interface type capabilities, currently for
extended capabilities, add the EML/MLD capabilities there
to have this advertised by the driver.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: nl80211: better validate link ID for stations
Johannes Berg [Wed, 6 Jul 2022 13:31:55 +0000 (15:31 +0200)]
wifi: nl80211: better validate link ID for stations

If we add a station on an MLD, we need a link ID to see
where it lives (by default). Validate the link ID against
the valid_links.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: fix link manipulation
Johannes Berg [Wed, 6 Jul 2022 12:03:07 +0000 (14:03 +0200)]
wifi: mac80211: fix link manipulation

When we add non-deflink pointers, we need to remove the
link[0] pointer to deflink in case link[0] is not valid
afterwards. Also, we need to add that back when there
are no more valid links. Reorg the code to fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: tighten locking check
Johannes Berg [Wed, 6 Jul 2022 08:09:57 +0000 (10:09 +0200)]
wifi: mac80211: tighten locking check

When we remove a link that doesn't have a channel context,
we don't really need the local->mtx locking. Tighten the
check here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: cfg80211: clean up links appropriately
Johannes Berg [Wed, 6 Jul 2022 07:57:42 +0000 (09:57 +0200)]
wifi: cfg80211: clean up links appropriately

This was missing earlier, we need to remove links when
interfaces are being destroyed, and we also need to
stop (AP) operations when a link is being destroyed.
Address these issues to remove many warnings that will
otherwise appear in mac80211.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: consider EHT element size in assoc request
Johannes Berg [Fri, 1 Jul 2022 14:22:29 +0000 (16:22 +0200)]
wifi: mac80211: consider EHT element size in assoc request

We need to consider the (maximum) size of the EHT element
we'll add for the association request, otherwise we may run
out of space.

Fixes: 820acc810fb6 ("mac80211: Add EHT capabilities to association/probe request")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: simplify adding ht/vht/he/eht elements
Johannes Berg [Fri, 1 Jul 2022 14:14:33 +0000 (16:14 +0200)]
wifi: mac80211: mlme: simplify adding ht/vht/he/eht elements

The functions currently take a link and check data
from it, but this needs to change for MLO. Simplify
the prototypes by passing only the needed arguments.

Remove the regulatory checks, the warnings shouldn't
trigger, and haven't as far as I know.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: refactor adding custom elements
Johannes Berg [Fri, 1 Jul 2022 13:38:57 +0000 (15:38 +0200)]
wifi: mac80211: refactor adding custom elements

Rework the sorting of custom elements into the association
request by moving the elements before HT/VHT/HE to each
their own function. While at it, fix the placement of the
ones that should be between VHT and HE.

This doesn't fix the placement of elements that should be
between HE and EHT yet, a similar change might be needed
in the future.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: refactor adding rates to assoc request
Johannes Berg [Fri, 1 Jul 2022 12:08:25 +0000 (14:08 +0200)]
wifi: mac80211: refactor adding rates to assoc request

There's some awkward code that really only exists
because we want to optimize the allocation size,
but that's not really all that necessary.

Refactor the code that adds rates to the association
request frame to have a separate function, removing
the goto.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: use only channel width in ieee80211_parse_bitrates()
Johannes Berg [Fri, 1 Jul 2022 12:01:59 +0000 (14:01 +0200)]
wifi: mac80211: use only channel width in ieee80211_parse_bitrates()

For MLO, we may not have a full chandef here later, so change
the API to pass only the width.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: cfg80211: add ieee80211_chanwidth_rate_flags()
Johannes Berg [Fri, 1 Jul 2022 12:01:29 +0000 (14:01 +0200)]
wifi: cfg80211: add ieee80211_chanwidth_rate_flags()

To simplify things when we don't have a full chandef,
add ieee80211_chanwidth_rate_flags().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: remove redundant condition
Johannes Berg [Fri, 1 Jul 2022 11:40:19 +0000 (13:40 +0200)]
wifi: mac80211: remove redundant condition

Here, ext_capa is checked and can only be non-NULL if
assoc_data->ie_len was set before, so the check here
is redundant.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: don't set link address for station
Johannes Berg [Thu, 30 Jun 2022 12:20:54 +0000 (14:20 +0200)]
wifi: mac80211: don't set link address for station

We need to handle the link addresses for station differently,
they will be determined by the association code, stored, and
then applied when the links are actually created on success,
cfg80211 will fill in the right addresses per the data we're
sending back to it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: fix multi-BSSID element parsing
Johannes Berg [Wed, 29 Jun 2022 11:29:05 +0000 (13:29 +0200)]
wifi: mac80211: fix multi-BSSID element parsing

When parsing a frame containing a multi-BSSID element, we
need to know both the transmitted and non-transmitted BSSID
so we can parse it correctly.

Unfortunately, in quite a number of cases, we got this wrong
and were passing the wrong BSSID or useless information:
 * the mgmt->bssid from a frame is only the transmitted
   BSSID if the frame is a beacon
 * passing just one of the parameters as non-NULL isn't
   useful and ignored

In those case where we need to parse for a specific BSS we
always have a BSS structure pointer, representing the BSS
we need, whether transmitted or not. Thus, pass that pointer
to the parsing function instead of the two BSSIDs.

Also fix two bugs:
 * we need to re-parse all the elements for the other BSS
   when iterating the non-transmitted BSSes in scan
 * we need to parse for the correct BSS when setting up
   the channel data in client code

Fixes: 78ac51f81532 ("mac80211: support multi-bssid")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: move tdls_chan_switch_prohibited to link data
Johannes Berg [Wed, 29 Jun 2022 10:01:41 +0000 (12:01 +0200)]
wifi: mac80211: move tdls_chan_switch_prohibited to link data

This value should be per link, since a TDLS connection is
only established on a given link.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: don't re-parse elems in ieee80211_assoc_success()
Johannes Berg [Wed, 29 Jun 2022 09:52:49 +0000 (11:52 +0200)]
wifi: mac80211: don't re-parse elems in ieee80211_assoc_success()

We're already passing the elems pointer, and have parsed
them from the same frame with exactly the same parameters,
so don't need to do that again.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: replace link_id with link_conf in start/stop_ap()
Gregory Greenman [Wed, 29 Jun 2022 09:22:24 +0000 (12:22 +0300)]
wifi: mac80211: replace link_id with link_conf in start/stop_ap()

When calling start/stop_ap(), mac80211 already has a protected
link_conf pointer. Pass it to the driver, so it shouldn't
handle RCU protection.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: refactor elements parsing with parameter struct
Johannes Berg [Tue, 28 Jun 2022 15:49:12 +0000 (17:49 +0200)]
wifi: mac80211: refactor elements parsing with parameter struct

Refactor the element parsing into a version that has
a parameter struct so we can add more parameters more
easily in the future.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: cfg80211: extend cfg80211_rx_assoc_resp() for MLO
Johannes Berg [Tue, 28 Jun 2022 15:17:05 +0000 (17:17 +0200)]
wifi: cfg80211: extend cfg80211_rx_assoc_resp() for MLO

Extend the cfg80211_rx_assoc_resp() to cover multiple
BSSes, the AP MLD address and local link addresses
for MLO.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: cfg80211: put cfg80211_rx_assoc_resp() arguments into a struct
Johannes Berg [Tue, 28 Jun 2022 14:25:37 +0000 (16:25 +0200)]
wifi: cfg80211: put cfg80211_rx_assoc_resp() arguments into a struct

For MLO we'll need a lot more arguments, including all the
BSS pointers and link addresses, so move the data to a struct
to be able to extend it more easily later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: cfg80211: adjust assoc comeback for MLO
Johannes Berg [Tue, 28 Jun 2022 09:25:38 +0000 (11:25 +0200)]
wifi: cfg80211: adjust assoc comeback for MLO

We only report the BSSID to userspace, so change the
argument from BSS struct pointer to AP address, which
we'll use to carry either the BSSID or AP MLD address.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: unify assoc data event sending
Johannes Berg [Mon, 27 Jun 2022 20:23:42 +0000 (22:23 +0200)]
wifi: mac80211: mlme: unify assoc data event sending

There are a few cases where we send an event to cfg80211
manually, but ieee80211_destroy_assoc_data() also handles
the case of abandoning; some cases don't need an event
and success is handled yet differently.

Unify this by providing a single status argument to the
ieee80211_destroy_assoc_data() function and then handling
all the different cases of events (or no events) there.

This will help simplify the code when MLO support is
added.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: cfg80211: prepare association failure APIs for MLO
Johannes Berg [Mon, 27 Jun 2022 20:09:50 +0000 (22:09 +0200)]
wifi: cfg80211: prepare association failure APIs for MLO

For MLO, we need the ability to report back multiple BSS
structures to release, as well as the AP MLD address (if
attempting to make an MLO connection).

Unify cfg80211_assoc_timeout() and cfg80211_abandon_assoc()
into a new cfg80211_assoc_failure() that gets a structure
parameter with the necessary data.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: cfg80211: remove BSS pointer from cfg80211_disassoc_request
Johannes Berg [Mon, 27 Jun 2022 14:19:18 +0000 (16:19 +0200)]
wifi: cfg80211: remove BSS pointer from cfg80211_disassoc_request

The race described by the comment in mac80211 hasn't existed
since the locking rework to use the same lock and for MLO we
need to pass the AP MLD address, so just pass the BSSID or
AP MLD address instead of the BSS struct pointer, and adjust
all the code accordingly.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: use correct link_sta
Johannes Berg [Mon, 27 Jun 2022 12:17:28 +0000 (14:17 +0200)]
wifi: mac80211: mlme: use correct link_sta

For station capabilities, e.g. TWT, we need to use the correct
link station instead of deflink. Switch the code to do that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: remove sta argument from ieee80211_config_bw
Johannes Berg [Mon, 27 Jun 2022 12:15:09 +0000 (14:15 +0200)]
wifi: mac80211: mlme: remove sta argument from ieee80211_config_bw

The argument is unused except for NULL checking, but we already
do that anyway, so it's not needed. Remove the argument.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: use ieee80211_get_link_sband()
Johannes Berg [Mon, 27 Jun 2022 12:10:18 +0000 (14:10 +0200)]
wifi: mac80211: mlme: use ieee80211_get_link_sband()

This requires a few more changes.

While at it, also add a warning to ieee80211_get_sband()
to avoid it being used when there are multiple links.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: split IEEE80211_STA_DISABLE_WMM to link data
Johannes Berg [Mon, 27 Jun 2022 11:13:04 +0000 (13:13 +0200)]
wifi: mac80211: split IEEE80211_STA_DISABLE_WMM to link data

If we decide to stop tracking QoS/WMM parameters, then
this should be a per-link decision. Move the flag to
the link instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: first adjustments for MLO
Johannes Berg [Fri, 24 Jun 2022 14:18:56 +0000 (16:18 +0200)]
wifi: mac80211: mlme: first adjustments for MLO

Do the first adjustments in the client-side code to pass
the link pointer (instead of sdata) to most places etc.

This is just preparation, so the real MLO patches become
smaller.

Note that this isn't complete, notably there are still
quite a few references to sta->deflink and sta->sta.deflink.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: do IEEE80211_STA_RESET_SIGNAL_AVE per link
Johannes Berg [Fri, 24 Jun 2022 14:28:33 +0000 (16:28 +0200)]
wifi: mac80211: mlme: do IEEE80211_STA_RESET_SIGNAL_AVE per link

Remove the IEEE80211_STA_RESET_SIGNAL_AVE flag and use
a bool instead, but invert the polarity (now calling it
tracking_signal_avg) so we don't have to initialize it,
and put that into the link instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: mlme: track AP (MLD) address separately
Johannes Berg [Fri, 24 Jun 2022 14:08:39 +0000 (16:08 +0200)]
wifi: mac80211: mlme: track AP (MLD) address separately

To prepare a bit more for MLO in the client code,
track the AP's address (for now only the BSSID, but
will track the AP MLD's address later) separately
from the per-link BSSID.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
23 months agowifi: mac80211: remove unused bssid variable
Johannes Berg [Fri, 24 Jun 2022 13:54:38 +0000 (15:54 +0200)]
wifi: mac80211: remove unused bssid variable

This variable is only written to, remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>