Commit Graph

14 Commits

Author SHA1 Message Date
Johannes Berg
68eb1b791a wifi: mac80211: pass frame type to element parsing
This will be needed for UHR operation parsing, and we
already pass whether or not the frame is an action
frame, replace that by the full type. Note this fixes
a few cases where 'false' was erroneously passed (mesh
and TDLS) and removes ieee802_11_parse_elems_crc() as
it's unused.

Link: https://patch.msgid.link/20251105160810.a476d20a6e01.Ie659535f9357f2f9a3c73f8c059ccfc96bf93b54@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-11-10 10:39:02 +01:00
Jakub Kicinski
d103f26a5c Merge tag 'wireless-next-2025-09-11' of https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next
Johannes Berg says:

====================
Plenty of things going on, notably:
 - iwlwifi: major cleanups/rework
 - brcmfmac: gets AP isolation support
 - mac80211: gets more S1G support

* tag 'wireless-next-2025-09-11' of https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (94 commits)
  wifi: mwifiex: fix endianness handling in mwifiex_send_rgpower_table
  wifi: cfg80211: Remove the redundant wiphy_dev
  wifi: mac80211: fix incorrect comment
  wifi: cfg80211: update the time stamps in hidden ssid
  wifi: mac80211: Fix HE capabilities element check
  wifi: mac80211: add tx_handlers_drop statistics to ethtool
  wifi: mac80211: fix reporting of all valid links in sta_set_sinfo()
  wifi: iwlwifi: mld: CHANNEL_SURVEY_NOTIF is always supported
  wifi: iwlwifi: mld: remove support of iwl_esr_mode_notif version 1
  wifi: iwlwifi: mld: remove support from of sta cmd version 1
  wifi: iwlwifi: mld: remove support of roc cmd version 5
  wifi: iwlwifi: mld: remove support of mac cmd ver 2
  wifi: iwlwifi: mld: don't consider phy cmd version 5
  wifi: iwlwifi: implement wowlan status notification API update
  wifi: iwlwifi: fw: Add ASUS to PPAG and TAS list
  wifi: iwlwifi: add kunit tests for nvm parse
  wifi: iwlwifi: api: add a flag to iwl_link_ctx_modify_flags
  wifi: iwlwifi: pcie: move ltr_enabled to the specific transport
  wifi: iwlwifi: pcie: move pm_support to the specific transport
  wifi: iwlwifi: rename iwl_finish_nic_init
  ...
====================

Link: https://patch.msgid.link/20250911100854.20445-3-johannes@sipsolutions.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-09-11 17:50:46 -07:00
Lachlan Hodges
1860b1a825 wifi: mac80211: kunit: add kunit tests for S1G PVB decoding
Add support for testing the 6 examples mentioned in IEEE80211-2024
Annex L. These tests cover the 3 mandatory decoding modes being
block bitmap, single AID and OLB alongside their equivalent
inverses.

Test output:

1..6
 s1g_tim_block_test: Block 0 (ENC=BLOCK, blk_off=0, inverse=0)
 s1g_tim_block_test:   octet  1 (ctrl)    : 00000000 (0x00)
 s1g_tim_block_test:   octet  2 (blk-map) : 00000101 (0x05)
 s1g_tim_block_test:   octet  3 (SB  0)   : 01000010 (0x42)
 s1g_tim_block_test:   octet  4 (SB  2)   : 10100000 (0xa0)
ok 1 s1g_tim_block_test
 s1g_tim_single_test: Block 0 (ENC=SINGLE, blk_off=0, inverse=0)
 s1g_tim_single_test:   octet  1 (ctrl)    : 00000001 (0x01)
 s1g_tim_single_test:   octet  2 (single)  : 00011111 (0x1f)
ok 2 s1g_tim_single_test
 s1g_tim_olb_test: Block 0 (ENC=OLB, blk_off=0, inverse=0)
 s1g_tim_olb_test:   octet  1 (ctrl)    : 00000010 (0x02)
 s1g_tim_olb_test:   octet  2 (len= 9)  : 00001001 (0x09)
 s1g_tim_olb_test:   octet  3 (SB  0)   : 01000010 (0x42)
 s1g_tim_olb_test:   octet  4 (SB  1)   : 10100000 (0xa0)
 s1g_tim_olb_test:   octet  5 (SB  2)   : 01000010 (0x42)
 s1g_tim_olb_test:   octet  6 (SB  3)   : 10100000 (0xa0)
 s1g_tim_olb_test:   octet  7 (SB  4)   : 01000010 (0x42)
 s1g_tim_olb_test:   octet  8 (SB  5)   : 10100000 (0xa0)
 s1g_tim_olb_test:   octet  9 (SB  6)   : 01000010 (0x42)
 s1g_tim_olb_test:   octet 10 (SB  7)   : 10100000 (0xa0)
 s1g_tim_olb_test:   octet 11 (SB  8)   : 01000010 (0x42)
ok 3 s1g_tim_olb_test
 s1g_tim_inverse_block_test: Block 0 (ENC=BLOCK, blk_off=0, inverse=1)
 s1g_tim_inverse_block_test:   octet  1 (ctrl)    : 00000100 (0x04)
 s1g_tim_inverse_block_test:   octet  2 (blk-map) : 00000101 (0x05)
 s1g_tim_inverse_block_test:   octet  3 (SB  0)   : 01000010 (0x42)
 s1g_tim_inverse_block_test:   octet  4 (SB  2)   : 10100000 (0xa0)
ok 4 s1g_tim_inverse_block_test
 s1g_tim_inverse_single_test: Block 0 (ENC=SINGLE, blk_off=0, inverse=1)
 s1g_tim_inverse_single_test:   octet  1 (ctrl)    : 00000101 (0x05)
 s1g_tim_inverse_single_test:   octet  2 (single)  : 00011111 (0x1f)
ok 5 s1g_tim_inverse_single_test
 s1g_tim_inverse_olb_test: Block 0 (ENC=OLB, blk_off=0, inverse=1)
 s1g_tim_inverse_olb_test:   octet  1 (ctrl)    : 00000110 (0x06)
 s1g_tim_inverse_olb_test:   octet  2 (len= 9)  : 00001001 (0x09)
 s1g_tim_inverse_olb_test:   octet  3 (SB  0)   : 01000010 (0x42)
 s1g_tim_inverse_olb_test:   octet  4 (SB  1)   : 10100000 (0xa0)
 s1g_tim_inverse_olb_test:   octet  5 (SB  2)   : 01000010 (0x42)
 s1g_tim_inverse_olb_test:   octet  6 (SB  3)   : 10100000 (0xa0)
 s1g_tim_inverse_olb_test:   octet  7 (SB  4)   : 01000010 (0x42)
 s1g_tim_inverse_olb_test:   octet  8 (SB  5)   : 10100000 (0xa0)
 s1g_tim_inverse_olb_test:   octet  9 (SB  6)   : 01000010 (0x42)
 s1g_tim_inverse_olb_test:   octet 10 (SB  7)   : 10100000 (0xa0)
 s1g_tim_inverse_olb_test:   octet 11 (SB  8)   : 01000010 (0x42)
ok 6 s1g_tim_inverse_olb_test
 mac80211-s1g-tim: pass:6 fail:0 skip:0 total:6
 Totals: pass:6 fail:0 skip:0 total:6

Signed-off-by: Lachlan Hodges <lachlan.hodges@morsemicro.com>
Link: https://patch.msgid.link/20250725132221.258217-4-lachlan.hodges@morsemicro.com
[make tim_push() void, non-inline]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-09-04 11:19:01 +02:00
Benjamin Berg
75575e2d25 wifi: mac80211: do not permit 40 MHz EHT operation on 5/6 GHz
The EHT PHY requirements state that 80 MHz must be supported on the 5
and 6 GHz bands unless the STA is 20 MHz only. So if the channel width
is limited to 40 MHz on a band other than 2.4 GHz, then disable EHT and
downgrade to HE.

The primary case where this can happen is if the hardware disables
puncturing using IEEE80211_HW_DISALLOW_PUNCTURING.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250826202553.a6582f3abf57.Ic670429dc7127f68c818b4290d950ebfb5a0b9e1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-08-28 13:39:16 +02:00
Benjamin Berg
b46524b57a wifi: mac80211: tests: add tests for ieee80211_determine_chan_mode
Add a few tests for ieee80211_determine_chan_mode that check that
mac80211 will not try to connect to an AP if an advertised basic rate is
not supported.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250205110958.530c81eb7fdc.Ia77f5efdf9efb70d2766a3d6bf425553bcb308e8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-02-11 11:59:07 +01:00
Benjamin Berg
11cc69abb0 wifi: mac80211: tests: add utility to create sdata skeleton
Some functions that should be tested may expect an sdata object that is
configured to a basic degree. Add setup code to create such an object
for use by tests.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250101070249.12eeefd3c98b.I6e8c2b8374d4305f16675524ca30621e089b6fb0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-01-13 15:26:45 +01:00
Peter Zijlstra
cdd30ebb1b module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498f ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.

Scripted using

  git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
  do
    awk -i inplace '
      /^#define EXPORT_SYMBOL_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /^#define MODULE_IMPORT_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /MODULE_IMPORT_NS/ {
        $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
      }
      /EXPORT_SYMBOL_NS/ {
        if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
  	if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
  	    $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
  	    $0 !~ /^my/) {
  	  getline line;
  	  gsub(/[[:space:]]*\\$/, "");
  	  gsub(/[[:space:]]/, "", line);
  	  $0 = $0 " " line;
  	}

  	$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
  		    "\\1(\\2, \"\\3\")", "g");
        }
      }
      { print }' $file;
  done

Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 11:34:44 -08:00
Johannes Berg
39dc8b8ea3 wifi: mac80211: pass parsed TPE data to drivers
Instead of passing the full TPE elements, in all their glory
and mixed up data formats for HE backward compatibility, parse
them fully into the right values, and pass that to the drivers.

Also introduce proper validation already in mac80211, so that
drivers don't need to do it, and parse the EHT portions.

The code now passes the values in the right order according to
the channel used by an interface, which could also be a subset
of the data advertised by the AP, if we couldn't connect with
the full bandwidth (for whatever reason.)

Also add kunit tests for the more complicated bits of it.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Acked-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240506214536.2aa839969b60.I265b28209e0b29772b2f125f7f83de44a4da877b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-05-23 10:35:04 +02:00
Johannes Berg
5a21f0eae1 wifi: mac80211: hide element parsing internals
Rework the data structures to hide element parsing internals
from the users.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240228094902.19c610b529e2.Ie7ea2dcb6713911590ace6583a4748f32dc37df2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-03-04 14:33:03 +01:00
Johannes Berg
310c8387c6 wifi: mac80211: clean up connection process
Rewrite the station-side connection handling. The connection
flags (IEEE80211_DISABLE_*) are rather confusing, and they're
not always maintained well. Additionally, for wider-bandwidth
OFDMA support we need to know the precise bandwidth of the AP,
which is currently somewhat difficult.

Rewrite this to have a 'mode' (S1G/legacy/HT/...) and a limit
on the bandwidth. This is not entirely clean because some of
those modes aren't completely sequenced (as this assumes in
some places), e.g. VHT doesn't exist on 2.4 GHz, but HE does.
However, it still simplifies things and gives us a good idea
what we're operating as, so we can parse elements accordingly
etc.

This leaves a FIXME for puncturing, this is addressed in a
later patch.

Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240129194108.9451722c0110.I3e61f4cfe9da89008e1854160093c76a1e69dc2a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-02-08 12:58:26 +01:00
Johannes Berg
bbd97bbed0 wifi: mac80211: kunit: extend MFP tests
Extend the MFP tests to handle the case of deauth/disassoc
and robust action frames (that are not protected dual of
public action frames).

Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20231220151952.415232-6-benjamin@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-01-03 15:35:19 +01:00
Johannes Berg
951c4684a3 wifi: mac80211: kunit: generalize public action test
Generalize the test to be able to handle arbitrary
action categories and non-action frames, for further
test expansion.

Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20231220151952.415232-5-benjamin@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-01-03 15:35:13 +01:00
Johannes Berg
0738e55c38 wifi: mac80211: add kunit tests for public action handling
Check the logic in ieee80211_drop_unencrypted_mgmt()
according to a list of test cases derived from the
spec.

Reviewed-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://msgid.link/20231220151952.415232-4-benjamin@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-01-03 15:35:09 +01:00
Johannes Berg
ffbd0c8c1e wifi: mac80211: add an element parsing unit test
Add a unit test for the parsing of a fragmented sta profile
sub-element inside a fragmented multi-link element.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230827135854.333bc75df13f.I0ddfeb6a88a4d89e7c7850e8ef45a4b19b5a061a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-09-11 12:32:16 +02:00