linux-2.6-block.git
2 months agonet: rfkill: Correct return value in invalid parameter case
Zijun Hu [Thu, 13 Jun 2024 14:04:36 +0000 (22:04 +0800)]
net: rfkill: Correct return value in invalid parameter case

rfkill_set_hw_state_reason() does not return current combined
block state when its parameter @reason is invalid, that is
wrong according to its comments, fix it by correcting the
value returned.

Also reformat the WARN while at it.

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://patch.msgid.link/1718287476-28227-1-git-send-email-quic_zijuhu@quicinc.com
[edit/reformat commit message, remove unneeded variable]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: mac80211: fix NULL dereference at band check in starting tx ba session
Zong-Zhe Yang [Mon, 17 Jun 2024 11:52:17 +0000 (19:52 +0800)]
wifi: mac80211: fix NULL dereference at band check in starting tx ba session

In MLD connection, link_data/link_conf are dynamically allocated. They
don't point to vif->bss_conf. So, there will be no chanreq assigned to
vif->bss_conf and then the chan will be NULL. Tweak the code to check
ht_supported/vht_supported/has_he/has_eht on sta deflink.

Crash log (with rtw89 version under MLO development):
[ 9890.526087] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ 9890.526102] #PF: supervisor read access in kernel mode
[ 9890.526105] #PF: error_code(0x0000) - not-present page
[ 9890.526109] PGD 0 P4D 0
[ 9890.526114] Oops: 0000 [#1] PREEMPT SMP PTI
[ 9890.526119] CPU: 2 PID: 6367 Comm: kworker/u16:2 Kdump: loaded Tainted: G           OE      6.9.0 #1
[ 9890.526123] Hardware name: LENOVO 2356AD1/2356AD1, BIOS G7ETB3WW (2.73 ) 11/28/2018
[ 9890.526126] Workqueue: phy2 rtw89_core_ba_work [rtw89_core]
[ 9890.526203] RIP: 0010:ieee80211_start_tx_ba_session (net/mac80211/agg-tx.c:618 (discriminator 1)) mac80211
[ 9890.526279] Code: f7 e8 d5 93 3e ea 48 83 c4 28 89 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc 49 8b 84 24 e0 f1 ff ff 48 8b 80 90 1b 00 00 <83> 38 03 0f 84 37 fe ff ff bb ea ff ff ff eb cc 49 8b 84 24 10 f3
All code
========
   0: f7 e8                 imul   %eax
   2: d5                    (bad)
   3: 93                    xchg   %eax,%ebx
   4: 3e ea                 ds (bad)
   6: 48 83 c4 28           add    $0x28,%rsp
   a: 89 d8                 mov    %ebx,%eax
   c: 5b                    pop    %rbx
   d: 41 5c                 pop    %r12
   f: 41 5d                 pop    %r13
  11: 41 5e                 pop    %r14
  13: 41 5f                 pop    %r15
  15: 5d                    pop    %rbp
  16: c3                    retq
  17: cc                    int3
  18: cc                    int3
  19: cc                    int3
  1a: cc                    int3
  1b: 49 8b 84 24 e0 f1 ff  mov    -0xe20(%r12),%rax
  22: ff
  23: 48 8b 80 90 1b 00 00  mov    0x1b90(%rax),%rax
  2a:* 83 38 03              cmpl   $0x3,(%rax) <-- trapping instruction
  2d: 0f 84 37 fe ff ff     je     0xfffffffffffffe6a
  33: bb ea ff ff ff        mov    $0xffffffea,%ebx
  38: eb cc                 jmp    0x6
  3a: 49                    rex.WB
  3b: 8b                    .byte 0x8b
  3c: 84 24 10              test   %ah,(%rax,%rdx,1)
  3f: f3                    repz

Code starting with the faulting instruction
===========================================
   0: 83 38 03              cmpl   $0x3,(%rax)
   3: 0f 84 37 fe ff ff     je     0xfffffffffffffe40
   9: bb ea ff ff ff        mov    $0xffffffea,%ebx
   e: eb cc                 jmp    0xffffffffffffffdc
  10: 49                    rex.WB
  11: 8b                    .byte 0x8b
  12: 84 24 10              test   %ah,(%rax,%rdx,1)
  15: f3                    repz
[ 9890.526285] RSP: 0018:ffffb8db09013d68 EFLAGS: 00010246
[ 9890.526291] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff9308e0d656c8
[ 9890.526295] RDX: 0000000000000000 RSI: ffffffffab99460b RDI: ffffffffab9a7685
[ 9890.526300] RBP: ffffb8db09013db8 R08: 0000000000000000 R09: 0000000000000873
[ 9890.526304] R10: ffff9308e0d64800 R11: 0000000000000002 R12: ffff9308e5ff6e70
[ 9890.526308] R13: ffff930952500e20 R14: ffff9309192a8c00 R15: 0000000000000000
[ 9890.526313] FS:  0000000000000000(0000) GS:ffff930b4e700000(0000) knlGS:0000000000000000
[ 9890.526316] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 9890.526318] CR2: 0000000000000000 CR3: 0000000391c58005 CR4: 00000000001706f0
[ 9890.526321] Call Trace:
[ 9890.526324]  <TASK>
[ 9890.526327] ? show_regs (arch/x86/kernel/dumpstack.c:479)
[ 9890.526335] ? __die (arch/x86/kernel/dumpstack.c:421 arch/x86/kernel/dumpstack.c:434)
[ 9890.526340] ? page_fault_oops (arch/x86/mm/fault.c:713)
[ 9890.526347] ? search_module_extables (kernel/module/main.c:3256 (discriminator 3))
[ 9890.526353] ? ieee80211_start_tx_ba_session (net/mac80211/agg-tx.c:618 (discriminator 1)) mac80211

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Link: https://patch.msgid.link/20240617115217.22344-1-kevin_yang@realtek.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: fix rs.h kernel-doc
Johannes Berg [Tue, 25 Jun 2024 16:51:23 +0000 (19:51 +0300)]
wifi: iwlwifi: mvm: fix rs.h kernel-doc

Some things are mislabeled here, fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.baa3bd60c8f8.Ibc4886f7fe696d57991689cc2885cde5cecc8f90@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: fw: api: datapath: fix kernel-doc
Johannes Berg [Tue, 25 Jun 2024 16:51:22 +0000 (19:51 +0300)]
wifi: iwlwifi: fw: api: datapath: fix kernel-doc

Fix kernel-doc warnings in datapath.h.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.1a644d4c38f4.I6060819da2bfc948bee089a91626ff474300a896@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: fix remaining mistagged kernel-doc comments
Johannes Berg [Tue, 25 Jun 2024 16:51:21 +0000 (19:51 +0300)]
wifi: iwlwifi: fix remaining mistagged kernel-doc comments

There are some comments left that aren't really kernel-doc,
remove the extra * that tags them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.98119856de4b.I9ca0cee675b166c4a7d58d619ce3278494398ea2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: fix prototype mismatch kernel-doc warnings
Johannes Berg [Tue, 25 Jun 2024 16:51:20 +0000 (19:51 +0300)]
wifi: iwlwifi: fix prototype mismatch kernel-doc warnings

Fix all the prototype mismatch and "wrong kernel-doc identifier"
warnings, due to typos in or misformatting of the kernel-doc.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.6ec65cf9b88c.I7804114d7369f352e80a0e8430f7119af8e210de@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: fix kernel-doc in iwl-fh.h
Johannes Berg [Tue, 25 Jun 2024 16:51:19 +0000 (19:51 +0300)]
wifi: iwlwifi: fix kernel-doc in iwl-fh.h

Some blocks aren't really kernel-doc, and some are misformatted
or with mismatched names. Fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.16865e5503ac.I5401edbf9ecbc25e07aad929bb56255410173711@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: fix kernel-doc in iwl-trans.h
Johannes Berg [Tue, 25 Jun 2024 16:51:18 +0000 (19:51 +0300)]
wifi: iwlwifi: fix kernel-doc in iwl-trans.h

One mismatched enum name, and some missing docs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.4846bf27dec1.I31fdfad01abc82b1340c59e51ece3db2242c8816@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: pcie: fix kernel-doc
Johannes Berg [Tue, 25 Jun 2024 16:51:17 +0000 (19:51 +0300)]
wifi: iwlwifi: pcie: fix kernel-doc

One typo, and a few things were missing. Fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.c667bc035757.Iae0e5903a35f8e42f86deb27429131f22329b8dd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: dvm: fix kernel-doc warnings
Johannes Berg [Tue, 25 Jun 2024 16:51:16 +0000 (19:51 +0300)]
wifi: iwlwifi: dvm: fix kernel-doc warnings

Mostly the docs just aren't kernel-doc anyway, and one is a typo.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.8b12f56bf8c0.I64fa9df72ca0e862b96647c062b8c9464318e649@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: don't log error for failed UATS table read
Benjamin Berg [Tue, 25 Jun 2024 16:51:15 +0000 (19:51 +0300)]
wifi: iwlwifi: mvm: don't log error for failed UATS table read

This causes unnecessary error level kernel messages if the platform
does not have any UATS table.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.306b7eed8671.I6e9294335378dab38ef957866a0d39ec1a2df7f8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: trans: make bad state warnings
Johannes Berg [Tue, 25 Jun 2024 16:51:14 +0000 (19:51 +0300)]
wifi: iwlwifi: trans: make bad state warnings

Kalle reported that this triggers very occasionally, but
we don't even know which place, except that it wasn't one
with a warning. Make all of them warnings since this is
really not meant to happen and indicates driver bugs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.be7a3a95afae.Ie8606d36783818c043c971bf0bc6f4df6a6e8f5b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: fw: api: fix some kernel-doc
Johannes Berg [Tue, 25 Jun 2024 16:51:13 +0000 (19:51 +0300)]
wifi: iwlwifi: fw: api: fix some kernel-doc

There are naming issues of structs vs. kernel-doc,
fix some that I noticed now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.4c530804b4ff.I68b894b9cdbd9560d86b92646e9b6b17a6d5117e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: remove init_dbg module parameter
Miri Korenblit [Tue, 25 Jun 2024 16:51:12 +0000 (19:51 +0300)]
wifi: iwlwifi: mvm: remove init_dbg module parameter

This is no longer used

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20240625194805.17a1484f2485.I095c7482ac517111081f8ff40312b48ffdd7ff94@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: update the BA notification API
Emmanuel Grumbach [Tue, 25 Jun 2024 16:51:11 +0000 (19:51 +0300)]
wifi: iwlwifi: update the BA notification API

We don't use the new field, but at least, document the change.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.3d7887e2e374.I37bf709969d069ff0392e0976e62e06fb7a87bc9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: always unblock EMLSR on ROC end
Johannes Berg [Tue, 25 Jun 2024 16:51:10 +0000 (19:51 +0300)]
wifi: iwlwifi: mvm: always unblock EMLSR on ROC end

Since we always block EMLSR for ROC, we also need to always
unblock it, even if we don't have a P2P device interface.
Fix this.

Fixes: a1efeb823084 ("wifi: iwlwifi: mvm: Block EMLSR when a p2p/softAP vif is active")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.96bbf98b716d.Id5a36954f8ebaa95142fd3d3a7a52bab5363b0bd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: use IWL_FW_CHECK for link ID check
Johannes Berg [Tue, 25 Jun 2024 16:51:09 +0000 (19:51 +0300)]
wifi: iwlwifi: mvm: use IWL_FW_CHECK for link ID check

The lookup function iwl_mvm_rcu_fw_link_id_to_link_conf() is
normally called with input from the firmware, so it should use
IWL_FW_CHECK() instead of WARN_ON().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.4ea8fb7c47d4.I1c22af213f97f69bfc14674502511c1bc504adfb@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: don't flush BSSes on restart with MLD API
Johannes Berg [Tue, 25 Jun 2024 16:51:08 +0000 (19:51 +0300)]
wifi: iwlwifi: mvm: don't flush BSSes on restart with MLD API

If the firmware has MLD APIs, it will handle all timing and we
don't need to give it timestamps. Therefore, we don't care about
the timestamps stored in the BSS table, so there's no need to
flush the BSS table.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.c6d86dc2377e.I246d0fae0d23ed34b7cd9c3400edb004eb5ac1d0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: remove MVM prefix from scan API
Daniel Gabay [Tue, 25 Jun 2024 16:51:07 +0000 (19:51 +0300)]
wifi: iwlwifi: remove MVM prefix from scan API

These are not MVM specific.

Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240625194805.09f672318944.Idffeab6a4dfc12effebd1c50815ae5c540afca74@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: remove AX101, AX201 and AX203 support from LNL
Golan Ben Ami [Thu, 13 Jun 2024 14:11:23 +0000 (17:11 +0300)]
wifi: iwlwifi: remove AX101, AX201 and AX203 support from LNL

LNL is the codename for the upcoming Series 2 Core Ultra
processors designed by Intel. AX101, AX201 and AX203 devices
are not shiped on LNL platforms, so don't support them.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240613171043.f24a228dfd96.I989a2d3f1513211bc49ac8143ee4e9e341e1ee67@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: don't limit VLP/AFC to UATS-enabled
Johannes Berg [Tue, 18 Jun 2024 16:59:45 +0000 (19:59 +0300)]
wifi: iwlwifi: mvm: don't limit VLP/AFC to UATS-enabled

When UATS isn't enabled (no VLP/AFC AP support), we need to still
set the right bits in the channel/regulatory flags, so remove the
uats_enabled argument to the parsing etc.

Also, firmware deals just fine with getting the UATS table if it
supports the command even if the bits aren't set, so always send
it, since it's also needed if BIT(31) is set, but the driver need
not have any knowledge of that. Remove 'uats_enabled' entirely.

Fixes: 0d2fc8821a7d ("wifi: iwlwifi: nvm: parse the VLP/AFC bit from regulatory")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618195731.a81e7234c4f6.Ic0131180d38e0f1ead2f7fa0e7583407ceaa0bd1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: enable VLP AP on VLP channels
Johannes Berg [Tue, 18 Jun 2024 16:44:13 +0000 (19:44 +0300)]
wifi: iwlwifi: mvm: enable VLP AP on VLP channels

If channels are marked VLP, then we're actually also
allowed to be VLP AP/GO. Enable this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618194245.e15f24fc6bc8.I33ed7d141fec731e79370ba6c7cfbe28776944a0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mei: clarify iwl_mei_pldr_req() docs
Johannes Berg [Tue, 18 Jun 2024 16:44:12 +0000 (19:44 +0300)]
wifi: iwlwifi: mei: clarify iwl_mei_pldr_req() docs

This isn't related to whether or not "fw can be loaded",
but rather requesting that ME go into a state where doing
a product reset is safe. This is related to FW load only
in the specific case of where it's used today in iwlmvm,
notably when it's known that the firmware itself will (or
at least may) do a product reset during load.

Clarify the documentation.

I was tempted to rename things too, but on the ME side it
really is also called PLDR (which is a Windows term and
may not even match the complete behaviour since doing a
full product reset from the driver also requires calling
an ACPI method first.) So keep the name aligned with ME.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618194245.ca2c55121a04.I889cd47210367ca9110411472ee696b796a37ab5@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: rename 'pldr_sync'
Johannes Berg [Tue, 18 Jun 2024 16:44:11 +0000 (19:44 +0300)]
wifi: iwlwifi: mvm: rename 'pldr_sync'

PLDR (product level device reset) is a Windows term, and
is something the driver triggers there, AFAICT.

Really what 'pldr_sync' here wants to capture is whether
or not the firmware will/may do a product reset during
initialization, which makes the device drop off the bus,
requiring a rescan. If this is the case, obviously the
init will fail/time out, so we don't want to report all
kinds of errors etc., hence this tracking variable.

Rename it to 'fw_product_reset' to capture the meaning
better.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618194245.ccf849642af8.I01dded6b2393771b7baf8b4b17336784d987c7c2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: Fix associated initiator key setting
Ilan Peer [Tue, 18 Jun 2024 16:44:10 +0000 (19:44 +0300)]
wifi: iwlwifi: mvm: Fix associated initiator key setting

When setting the keys for secure measurement with an AP the station
is associated with, the TK should only be referenced and not copied.

In addition set the cipher only when the correct station is found.

Fixes: 626be4bf99f6 ("wifi: iwlwifi: mvm: modify iwl_mvm_ftm_set_secured_ranging() parameters")
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618194245.be2a5327554d.Ie53220b075dacb23a8d073f6008aafd339368592@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: dissolve iwl_mvm_mac_remove_interface_common()
Johannes Berg [Tue, 18 Jun 2024 16:44:09 +0000 (19:44 +0300)]
wifi: iwlwifi: mvm: dissolve iwl_mvm_mac_remove_interface_common()

Since the function isn't actually common (any more), just
dissolve it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618194245.adf54ab5bc4a.I90339f152bba73b622e05063d16ae914ae20053f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: trans: remove unused status bits
Emmanuel Grumbach [Tue, 18 Jun 2024 16:44:08 +0000 (19:44 +0300)]
wifi: iwlwifi: trans: remove unused status bits

Those bits are never used.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618194245.cd26318d9513.I035ec7f3f022cdc19a650eca3b89455e3b5eca18@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: don't assume op_mode_nic_config exists
Emmanuel Grumbach [Tue, 18 Jun 2024 16:44:07 +0000 (19:44 +0300)]
wifi: iwlwifi: don't assume op_mode_nic_config exists

The new op_mode won't have this callback.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20240618194245.718983e7b832.I02fb130aa3d2044958cba7dced357031b92e33bb@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: bump FW API to 92 for BZ/SC devices
Miri Korenblit [Tue, 18 Jun 2024 16:44:06 +0000 (19:44 +0300)]
wifi: iwlwifi: bump FW API to 92 for BZ/SC devices

Start supporting API version 92 for new devices.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618194245.433cfbb6f042.I914da5bd0e2ed25148726f9fb55e7a60b895edfd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: trans: remove unused function parameter
Miri Korenblit [Tue, 18 Jun 2024 16:44:05 +0000 (19:44 +0300)]
wifi: iwlwifi: trans: remove unused function parameter

iwl_trans_pcie_gen2_fw_alive doesn't use the scd_addr parameter,
it was there only because we needed the functio to have a prototype same
as iwl_trans_ops::fw_alive callback.
But now the ops is removed so no reason to keep the parameter.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20240618194245.1aa8bf13aea9.I9662c10c1db545dd8849af4bb4ab47708d4548d8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: remove IWL_MVM_PARSE_NVM
Miri Korenblit [Tue, 18 Jun 2024 16:44:04 +0000 (19:44 +0300)]
wifi: iwlwifi: mvm: remove IWL_MVM_PARSE_NVM

This debug is not in use anymore. Remove it.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20240618194245.bded22049fae.I980c4a941d769f93cf74bfc90a7d7d9fb384dea1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: support fast resume
Emmanuel Grumbach [Tue, 18 Jun 2024 16:44:03 +0000 (19:44 +0300)]
wifi: iwlwifi: support fast resume

This will allow to suspend / resume the system without resetting the
firmware. This will allow to reduce the resume time.
In case the fast_resume fails, stop the device and bring it up from
scratch.

Raise the timeout for the D3_END notification since in some iterations,
it took 240ms.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618194245.03b8d2801044.I613d17c712de7a0d611cde4e14f37ebbe0c3c964@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: fix iwl_mvm_get_valid_rx_ant()
Daniel Gabay [Tue, 18 Jun 2024 17:03:03 +0000 (20:03 +0300)]
wifi: iwlwifi: fix iwl_mvm_get_valid_rx_ant()

Fix incorrect use of _tx_ valid ant data in the function.

Fixes: 4ea1ed1d14d8 ("wifi: iwlwifi: mvm: support set_antenna()")
Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618200104.b7c6a320c7dc.I3092eb5275056f2162b9694e583c310c38568b2a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: mvm: unify and fix interface combinations
Johannes Berg [Tue, 18 Jun 2024 17:03:02 +0000 (20:03 +0300)]
wifi: iwlwifi: mvm: unify and fix interface combinations

AP interfaces fundamentally cannot leave the channel, so multi-
channel operation with them isn't really possible. We shouldn't
advertise support for such, at least not as long as we don't
have full multi-radio support. Thus, remove the AP bit from the
interface combinations for two channels and add another set for
just one channel that has it.

Also, to avoid duplicating everything even more, unify the NAN
and non-NAN cases.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618200104.3213638262ef.I2a0031b37623d7763fd0c5405477ea7206a3e923@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: iwlwifi: pcie: fix a few legacy register accesses for new devices
Emmanuel Grumbach [Tue, 18 Jun 2024 17:03:01 +0000 (20:03 +0300)]
wifi: iwlwifi: pcie: fix a few legacy register accesses for new devices

Do not access legacy bits for new devices, this has no effect.
Somehow, wowlan worked despite the usage of the wrong bits. Now
that we want to keep the firmware loaded during suspend even without
wowlan, this change is needed.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618200104.399d4d215210.Id12e7fdb7bab9f2c4c0d292519b5c1b4753a8c84@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: mac80211: inform the low level if drv_stop() is a suspend
Emmanuel Grumbach [Tue, 18 Jun 2024 16:25:56 +0000 (19:25 +0300)]
wifi: mac80211: inform the low level if drv_stop() is a suspend

This will allow the low level driver to take different actions for
different flows.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240618192529.739036208b6e.Ie18a2fe8e02bf2717549d39420b350cfdaf3d317@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: cfg80211: Always call tracing
Ilan Peer [Fri, 14 Jun 2024 07:35:41 +0000 (09:35 +0200)]
wifi: cfg80211: Always call tracing

Call the tracing function even if the cfg80211 callbacks
are not set. This would allow better understanding of
user space actions.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Link: https://patch.msgid.link/20240614093541.018cb816e176.I28f68740a6b42144346f5c175c7874b0a669a364@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: mac80211: check SSID in beacon
Johannes Berg [Wed, 12 Jun 2024 12:38:10 +0000 (14:38 +0200)]
wifi: mac80211: check SSID in beacon

Check that the SSID in beacons is correct, if it's not hidden
and beacon protection is enabled (otherwise there's no value).
If it doesn't match, disconnect.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240612143809.8b24a3d26a3d.I3e3ef31dbd2ec606be74d502a9d00dd9514c6885@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: mac80211: correcty limit wider BW TDLS STAs
Johannes Berg [Wed, 12 Jun 2024 12:35:57 +0000 (14:35 +0200)]
wifi: mac80211: correcty limit wider BW TDLS STAs

When updating a channel context, the code can apply wider
bandwidth TDLS STA channel definitions to each and every
channel context used by the device, an approach that will
surely lead to problems if there is ever more than one.

Restrict the wider BW TDLS STA consideration to only TDLS
STAs that are actually related to links using the channel
context being updated.

Fixes: 0fabfaafec3a ("mac80211: upgrade BW of TDLS peers when possible")
Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240612143707.1ad989acecde.I5c75c94d95c3f4ea84f8ff4253189f4b13bad5c3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: mac80211: add ieee80211_tdls_sta_link_id()
Johannes Berg [Wed, 12 Jun 2024 12:35:56 +0000 (14:35 +0200)]
wifi: mac80211: add ieee80211_tdls_sta_link_id()

We've open-coded this twice and will need it again,
add ieee80211_tdls_sta_link_id() to get the one link
ID for a TDLS STA.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240612143707.9f8141ae1725.I343822bbba0ae08dedb2f54a0ce87f2ae5ebeb2b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: mac80211: update STA/chandef width during switch
Johannes Berg [Wed, 12 Jun 2024 12:32:06 +0000 (14:32 +0200)]
wifi: mac80211: update STA/chandef width during switch

In channel switch without an additional channel context,
where the reassign logic kicks in, we also need to update
the station bandwidth and chandef minimum width correctly
to avoid having station rate control configured to wider
bandwidth than the channel context. Do that now.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240612143418.0bc3d28231b3.I51e76df86212057ca0469e235ba9bf4461cbee75@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: mac80211: make ieee80211_chan_bw_change() able to use reserved
Johannes Berg [Wed, 12 Jun 2024 12:32:05 +0000 (14:32 +0200)]
wifi: mac80211: make ieee80211_chan_bw_change() able to use reserved

Make ieee80211_chan_bw_change() able to use the reserved chanreq
(really the chandef part of it) for the calculations, so it can
be used _without_ applying the changes first. Remove the comment
that indicates this is required, since it no longer is. However,
this capability only gets used later.

Also, this is not ideal, we really should not different so much
between reserved and non-reserved usage, to simplify. That's a
further cleanup later though.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240612143418.1a08cf83b8cb.Ie567bb272eb25ce487651088f13ad041f549651c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: mac80211: optionally pass chandef to ieee80211_sta_cur_vht_bw()
Johannes Berg [Wed, 12 Jun 2024 12:32:04 +0000 (14:32 +0200)]
wifi: mac80211: optionally pass chandef to ieee80211_sta_cur_vht_bw()

We'll need this as well for channel switching cases, so
add the ability now to pass the chandef to calculate for.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240612143418.f70e05d9f306.Ifa0ce267de4f0ef3c21d063fb0cbf50e84d7d6ff@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: mac80211: optionally pass chandef to ieee80211_sta_cap_rx_bw()
Johannes Berg [Wed, 12 Jun 2024 12:32:03 +0000 (14:32 +0200)]
wifi: mac80211: optionally pass chandef to ieee80211_sta_cap_rx_bw()

We'll need this function to take a new chandef in
(some) channel switching cases, so prepare for that
by allowing that to be passed and using it if so.
Clean up the code a little bit while at it.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240612143418.772313f08b6a.If9708249e5870671e745d4c2b02e03b25092bea3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: mac80211: handle protected dual of public action
Johannes Berg [Wed, 12 Jun 2024 12:28:37 +0000 (14:28 +0200)]
wifi: mac80211: handle protected dual of public action

The code currently handles ECSA (extended channel switch
announcement) public action frames. Handle also their
protected dual, which actually is protected.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240612143037.db642feb8b2e.I184fa5c9bffb68099171701e403c2aa733f60fde@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: mac80211: restrict public action ECSA frame handling
Johannes Berg [Wed, 12 Jun 2024 12:28:36 +0000 (14:28 +0200)]
wifi: mac80211: restrict public action ECSA frame handling

Public action extended channel switch announcement (ECSA)
frames cannot be protected well, the spec is unclear about
what should happen in the presence of stations that can
receive protected dual and stations that cannot.

Mitigate these issues by not treating public action frames
as the absolute truth, only treat them as a hint to stop
transmitting (quiet mode), and do the remainder of the CSA
handling only when receiving the next beacon (or protected
action frame) that contains the CSA; or, if it doesn't,
simply stop being quiet and continue operating normally.

This limits the exposure to malicious ECSA public action
frames, since they cannot cause a disconnect now, only a
short interruption in traffic.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240612143037.ec7ccc45903e.Ife17d55c7ecbf98060f9c52889f3c8ba48798970@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 months agowifi: mac80211: refactor CSA queue block/unblock
Johannes Berg [Wed, 12 Jun 2024 12:28:35 +0000 (14:28 +0200)]
wifi: mac80211: refactor CSA queue block/unblock

This code is duplicated many times, refactor it into
new separate functions.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240612143037.1ad22f10392d.If21490c2c67aae28f3c54038363181ee920ce3d1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: wilc1000: disable SDIO func IRQ before suspend
Alexis Lothoré [Thu, 13 Jun 2024 14:06:45 +0000 (16:06 +0200)]
wifi: wilc1000: disable SDIO func IRQ before suspend

Issuing a system suspend command raises the following warning:
WARNING: CPU: 0 PID: 15 at drivers/mmc/core/sdio.c:1042 mmc_sdio_suspend+0xd4/0x19c
CPU: 0 PID: 15 Comm: kworker/u2:1 Not tainted 6.7.0-rc1-wt+ #710
Hardware name: Atmel SAMA5
Workqueue: events_unbound async_run_entry_fn
 unwind_backtrace from show_stack+0x18/0x1c
 show_stack from dump_stack_lvl+0x34/0x48
 dump_stack_lvl from __warn+0x98/0x160
 __warn from warn_slowpath_fmt+0xcc/0x140
 warn_slowpath_fmt from mmc_sdio_suspend+0xd4/0x19c
 mmc_sdio_suspend from mmc_bus_suspend+0x50/0x70
 mmc_bus_suspend from dpm_run_callback+0xe4/0x248
 dpm_run_callback from __device_suspend+0x234/0x91c
 __device_suspend from async_suspend+0x24/0x9c
 async_suspend from async_run_entry_fn+0x6c/0x210
 async_run_entry_fn from process_one_work+0x3a0/0x870
[...]

This warning is due to a check in SDIO core ensuring that interrupts do not
remain enabled for cards being powered down during suspend. WILC driver
currently does not set the MMC_PM_KEEP_POWER flag, so disable interrupt
when entering resume.

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240613-wilc_suspend-v1-6-c2f766d0988c@bootlin.com
3 months agowifi: wilc1000: remove suspend/resume from cfg80211 part
Alexis Lothoré [Thu, 13 Jun 2024 14:06:44 +0000 (16:06 +0200)]
wifi: wilc1000: remove suspend/resume from cfg80211 part

WILC1000 suspend/resume implementation is currently composed of two parts:
suspend/resume ops implemented in cfg80211 ops, which merely sets a
flag, and suspend/resume ops in sdio/spi driver which, based on this flag,
execute or not the suspend/resume mechanism. This dual set of ops is not
really needed , so keep only the sdio part to implement suspend/resume.

While doing so, remove the now unused suspend_event flag.

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240613-wilc_suspend-v1-5-c2f766d0988c@bootlin.com
3 months agowifi: wilc1000: move sdio suspend method next to resume and pm ops definition
Alexis Lothoré [Thu, 13 Jun 2024 14:06:43 +0000 (16:06 +0200)]
wifi: wilc1000: move sdio suspend method next to resume and pm ops definition

Just move the suspend method next to the resume method in the sdio part

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240613-wilc_suspend-v1-4-c2f766d0988c@bootlin.com
3 months agowifi: wilc1000: do not keep sdio bus claimed during suspend/resume
Alexis Lothoré [Thu, 13 Jun 2024 14:06:42 +0000 (16:06 +0200)]
wifi: wilc1000: do not keep sdio bus claimed during suspend/resume

There is no reason to keep the MMC host claimed during suspend.

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240613-wilc_suspend-v1-3-c2f766d0988c@bootlin.com
3 months agowifi: wilc1000: let host->chip suspend/resume notifications manage chip wake/sleep
Alexis Lothoré [Thu, 13 Jun 2024 14:06:41 +0000 (16:06 +0200)]
wifi: wilc1000: let host->chip suspend/resume notifications manage chip wake/sleep

host_wakeup_notify and host_sleep_notify are surrounded by chip_wakeup and
chip_allow_sleep calls, which theorically need to be protected with the
hif_cs lock. This lock protection is currently missing. Instead of adding
the lock where those two functions are called, move those in host->chip
suspend notifications to benefit from the lock already used there (in
bus_acquire/bus_release)

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240613-wilc_suspend-v1-2-c2f766d0988c@bootlin.com
3 months agowifi: wilc1000: disable power sequencer
Ajay Singh [Thu, 13 Jun 2024 14:06:40 +0000 (16:06 +0200)]
wifi: wilc1000: disable power sequencer

Driver systematically disables some power mechanism each time it starts the
chip firmware (so mostly when interface is brought up). This has a negative
impact on some specific scenarios when the chip is exposed as a
hotpluggable SDIO card (eg: WILC1000 SD):
- when executing suspend/resume sequence while interface has been brought
  up
- rebooting the platform while module is plugged and interface has been
  brought up
Those scenarios lead to mmc core trying to initialize again the chip which
is now unresponsive (because of the power sequencer setting), so it fails
in mmc_rescan->mmc_attach_sdio and enter a failure loop while trying to
send CMD5:
mmc0: error -110 whilst initialising SDIO card
mmc0: error -110 whilst initialising SDIO card
mmc0: error -110 whilst initialising SDIO card
[...]

Preventing the driver from disabling this "power sequencer" fixes those
enumeration issues without affecting nominal operations.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240613-wilc_suspend-v1-1-c2f766d0988c@bootlin.com
3 months agowifi: wl18xx: allow firmwares > 8.9.0.x.58
Russell King (Oracle) [Tue, 28 May 2024 09:18:17 +0000 (10:18 +0100)]
wifi: wl18xx: allow firmwares > 8.9.0.x.58

wlcore firmware versions are structured thusly:

chip.if-type.major.sub-type.minor
e.g.   8    9       0       0     58

With WL18xx ignoring the major firmware version, looking for a
firmware version that conforms to:

chip >= 8
if-type >= 9
major (don't care)
sub-type (don't care)
minor >= 58

Each test is satisfied if the value read from the firmware is greater
than the minimum, but if it is equal (or we don't care about the
field), then the next field is checked.

Thus it doesn't recognise 8.9.1.x.0 as being newer than 8.9.0.x.58
since the major and sub-type numbers are "don't care" and the minor
needs to be greater or equal to 58.

We need to change the major version from "ignore" to "0" for this later
firmware to be correctly detected, and allow the dual-firmware version
support to work.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/E1sBsyH-00E8w6-Vu@rmk-PC.armlinux.org.uk
3 months agowifi: wl18xx: add support for reading 8.9.1 fw status
Russell King (Oracle) [Tue, 28 May 2024 09:18:12 +0000 (10:18 +0100)]
wifi: wl18xx: add support for reading 8.9.1 fw status

Add the necessary code to read the 8.9.1 firmware status into the
driver private status structure, augmenting the 8.9.0 firmware
status code. New structure layout taken from:

https://git.ti.com/cgit/wilink8-wlan/build-utilites/tree/patches/kernel_patches/4.19.38/0023-wlcore-Fixing-PN-drift-on-encrypted-link-after-recov.patch?h=r8.9&id=a2ee50aa5190ed3b334373d6cd09b1bff56ffcf7

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/E1sBsyC-00E8w0-Rz@rmk-PC.armlinux.org.uk
3 months agowifi: wlcore: add pn16 support
Russell King (Oracle) [Tue, 28 May 2024 09:18:07 +0000 (10:18 +0100)]
wifi: wlcore: add pn16 support

TI Wl18xx firmware adds a "pn16" field for AES and TKIP keys as per
their patch:

https://git.ti.com/cgit/wilink8-wlan/build-utilites/tree/patches/kernel_patches/4.19.38/0023-wlcore-Fixing-PN-drift-on-encrypted-link-after-recov.patch?h=r8.9&id=a2ee50aa5190ed3b334373d6cd09b1bff56ffcf7

Add support for this, but rather than requiring the field to be
present (which would break existing firmwares), make it optional.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/E1sBsy7-00E8vu-Nc@rmk-PC.armlinux.org.uk
3 months agowifi: wlcore: store AP encryption key type
Russell King (Oracle) [Tue, 28 May 2024 09:18:02 +0000 (10:18 +0100)]
wifi: wlcore: store AP encryption key type

Updates for WL18xx firmware 8.9.1.x.x need to know the AP encryption
key type. Store this when a new key is set. Patch extracted from:

https://git.ti.com/cgit/wilink8-wlan/build-utilites/tree/patches/kernel_patches/4.19.38/0023-wlcore-Fixing-PN-drift-on-encrypted-link-after-recov.patch?h=r8.9&id=a2ee50aa5190ed3b334373d6cd09b1bff56ffcf7

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/E1sBsy2-00E8vo-KK@rmk-PC.armlinux.org.uk
3 months agowifi: wlcore: pass "status" to wlcore_hw_convert_fw_status()
Russell King (Oracle) [Tue, 28 May 2024 09:17:57 +0000 (10:17 +0100)]
wifi: wlcore: pass "status" to wlcore_hw_convert_fw_status()

wlcore_fw_status() is passed a pointer to the struct wl_fw_status to
decode the status into, which is always wl->fw_status. Rather than
referencing wl->fw_status within wlcore_fw_status(), use the supplied
argument so that we access this member in a consistent manner.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/E1sBsxx-00E8vi-Gf@rmk-PC.armlinux.org.uk
3 months agowifi: wlcore: improve code in wlcore_fw_status()
Russell King (Oracle) [Tue, 28 May 2024 09:17:52 +0000 (10:17 +0100)]
wifi: wlcore: improve code in wlcore_fw_status()

Referring to status->counters.tx_lnk_free_pkts[i] multiple times leads
to less efficient code. Cache this value in a local variable. This
also makes the code clearer.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/E1sBsxs-00E8vc-DD@rmk-PC.armlinux.org.uk
3 months agowifi: wl18xx: make wl18xx_tx_immediate_complete() more efficient
Russell King (Oracle) [Tue, 28 May 2024 09:17:47 +0000 (10:17 +0100)]
wifi: wl18xx: make wl18xx_tx_immediate_complete() more efficient

wl18xx_tx_immediate_complete() iterates through the completed transmit
descriptors in a circular fashion, and in doing so uses a modulus
operation that is not a power of two. This leads to inefficient code
generation, which can be easily solved by providing a helper to
increment to the next descriptor. Use this more efficient solution.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/E1sBsxn-00E8vW-9h@rmk-PC.armlinux.org.uk
3 months agowifi: wlcore: correctness fix fwlog reading
Russell King (Oracle) [Tue, 28 May 2024 09:17:42 +0000 (10:17 +0100)]
wifi: wlcore: correctness fix fwlog reading

Fix the calculation of clear_offset, which may overflow the end of
the buffer. However, this is harmless if it does because in that case
it will be recalculated when we copy the chunk of messages at the
start of the buffer.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/E1sBsxi-00E8vQ-5r@rmk-PC.armlinux.org.uk
3 months agowifi: zd1211rw: use 'time_left' variable with wait_for_completion_timeout()
Wolfram Sang [Mon, 3 Jun 2024 09:15:39 +0000 (11:15 +0200)]
wifi: zd1211rw: use 'time_left' variable with wait_for_completion_timeout()

There is a confusing pattern in the kernel to use a variable named 'timeout' to
store the result of wait_for_completion_timeout() causing patterns like:

timeout = wait_for_completion_timeout(...)
if (!timeout) return -ETIMEDOUT;

with all kinds of permutations. Use 'time_left' as a variable to make the code
self explaining.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240603091541.8367-7-wsa+renesas@sang-engineering.com
3 months agowifi: p54: use 'time_left' variable with wait_for_completion_interruptible_timeout()
Wolfram Sang [Mon, 3 Jun 2024 09:15:37 +0000 (11:15 +0200)]
wifi: p54: use 'time_left' variable with wait_for_completion_interruptible_timeout()

There is a confusing pattern in the kernel to use a variable named 'timeout' to
store the result of wait_for_completion_interruptible_timeout() causing patterns like:

timeout = wait_for_completion_interruptible_timeout(...)
if (!timeout) return -ETIMEDOUT;

with all kinds of permutations. Use 'time_left' as a variable to make the code
self explaining.

Fix to the proper variable type 'long' while here.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240603091541.8367-5-wsa+renesas@sang-engineering.com
3 months agowifi: mwl8k: use 'time_left' variable with wait_for_completion_timeout()
Wolfram Sang [Mon, 3 Jun 2024 09:15:36 +0000 (11:15 +0200)]
wifi: mwl8k: use 'time_left' variable with wait_for_completion_timeout()

There is a confusing pattern in the kernel to use a variable named 'timeout' to
store the result of wait_for_completion_timeout() causing patterns like:

timeout = wait_for_completion_timeout(...)
if (!timeout) return -ETIMEDOUT;

with all kinds of permutations. Use 'time_left' as a variable to make the code
self explaining.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240603091541.8367-4-wsa+renesas@sang-engineering.com
3 months agowifi: brcmfmac: use 'time_left' variable with wait_event_timeout()
Wolfram Sang [Mon, 3 Jun 2024 09:15:35 +0000 (11:15 +0200)]
wifi: brcmfmac: use 'time_left' variable with wait_event_timeout()

There is a confusing pattern in the kernel to use a variable named 'timeout' to
store the result of wait_event_timeout() causing patterns like:

timeout = wait_event_timeout(...)
if (!timeout) return -ETIMEDOUT;

with all kinds of permutations. Use 'time_left' as a variable to make the code
self explaining.

Fix to the proper variable type 'long' while here.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240603091541.8367-3-wsa+renesas@sang-engineering.com
3 months agowifi: at76c50x: prefer struct_size over open coded arithmetic
Erick Archer [Sun, 2 Jun 2024 16:13:10 +0000 (18:13 +0200)]
wifi: at76c50x: prefer struct_size over open coded arithmetic

This is an effort to get rid of all multiplications from allocation
functions in order to prevent integer overflows [1][2].

As the "cmd_buf" variable is a pointer to "struct at76_command" and
this structure ends in a flexible array:

struct at76_command {
[...]
u8 data[];
} __packed;

the preferred way in the kernel is to use the struct_size() helper to
do the arithmetic instead of the calculation "size + count" in the
kmalloc() function.

Also, declare a new variable (total_size) since the return value of the
struct_size() helper is used several times.

At the same time, prepare for the coming implementation by GCC and Clang
of the __counted_by attribute. Flexible array members annotated with
__counted_by can have their accesses bounds-checked at run-time via
CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for
strcpy/memcpy-family functions). In this case, it is important to note
that the attribute used is "__counted_by_le" since the counter type is
"__le16".

This way, the code is more readable and safer.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Erick Archer <erick.archer@outlook.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/AS8PR02MB7237578654CEDDFE5F8C17BA8BFE2@AS8PR02MB7237.eurprd02.prod.outlook.com
3 months agowifi: at76c50x: use sizeof(*pointer) instead of sizeof(type)
Erick Archer [Sun, 2 Jun 2024 16:13:09 +0000 (18:13 +0200)]
wifi: at76c50x: use sizeof(*pointer) instead of sizeof(type)

It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.

At the same time remove some redundant NULL initializations.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/AS8PR02MB7237C784C14DBC943CB719F88BFE2@AS8PR02MB7237.eurprd02.prod.outlook.com
3 months agowifi: iwlwifi: mvm: use ROC for P2P device activities
Shaul Triebitz [Wed, 5 Jun 2024 11:07:39 +0000 (14:07 +0300)]
wifi: iwlwifi: mvm: use ROC for P2P device activities

This is the first step towards removing the P2P Device MAC.
Use ROC (which uses the AUX MAC) for P2P Device
discoveribility and action frames.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240605140556.8c90e457abbd.I8e340759ecb299e05b1809f3d8060429c6cbbd01@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: iwlwifi: mvm: separate non-BSS/ROC EMLSR blocking
Johannes Berg [Wed, 5 Jun 2024 11:07:36 +0000 (14:07 +0300)]
wifi: iwlwifi: mvm: separate non-BSS/ROC EMLSR blocking

If non-BSS and remain-on-channel (ROC) blocking were to occur
simultaneously, they'd step on each other's toes, unblocking
when not yet supported. Disentangle these bits, and ROC doesn't
need to use the non_bss_link() function then.

Fixes: a1efeb823084 ("wifi: iwlwifi: mvm: Block EMLSR when a p2p/softAP vif is active")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240605140556.461fcf7b95bb.Id0d21dcb739d426ff15ec068b5df8abaab58884d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: iwlwifi: bump min API version for Qu/So devices
Miri Korenblit [Wed, 5 Jun 2024 11:05:07 +0000 (14:05 +0300)]
wifi: iwlwifi: bump min API version for Qu/So devices

Stop supporting all FWs older than the max API version.
These FW versions were supported since v6.5.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240605140327.ad6d43fe9893.I96f769e7d5be3e6499d260451df781bd694a5142@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: iwlwifi: mvm: fix re-enabling EMLSR
Miri Korenblit [Wed, 5 Jun 2024 11:05:06 +0000 (14:05 +0300)]
wifi: iwlwifi: mvm: fix re-enabling EMLSR

When EMLSR gets unblocked, the current code checks if the last exit was
due to an EXIT reason (as opposed to a BLOCKING one), and if so, it
does nothing, as in this case a MLO scan was scheduled to run in 30
seconds.

But the code doesn't consider the time that passed from the last exit,
so if immediately after the exit a blocker occurred (e.g. non-BSS
interface), and lasts for more than 30 seconds, then the MLO scan and the
following link selection will decide not to enter EMLSR, and when the
unblocking event finally happens, the reason is still set to the EXIT one,
so it will do nothing, and we will not have the chance to re-enable EMLSR.

Fix this by checking also the time that has passed since the last exit,
only if it is less than 30 seconds, we can count on the scheduled MLO
scan.

Note that clearing the reason itself can't be done since it is needed
for the EMLSR prevention mechanism.

Fixes: 2f33561ea8f9 ("wifi: iwlwifi: mvm: trigger link selection after exiting EMLSR")
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240605140327.58556fc4cfa9.I4c55b3cd9f20b21b37f28258d0fb6842ba413966@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: iwlwifi: remove struct iwl_trans_ops
Yedidya Benshimol [Wed, 5 Jun 2024 11:05:03 +0000 (14:05 +0300)]
wifi: iwlwifi: remove struct iwl_trans_ops

This was needed when we had multiple types of transports. Now we only
have pcie, so there is no need for this ops.
Cleanup the code such as the different trans APIs will call the pcie
function directly, instead of calling the callback,
and remove struct iwl_trans_ops.

Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240605140327.8315ff64f9f3.Ifdbc1f26d49766f7de553dcb5f613885f4ee65cc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: iwlwifi: pcie: integrate TX queue code
Johannes Berg [Wed, 5 Jun 2024 11:05:02 +0000 (14:05 +0300)]
wifi: iwlwifi: pcie: integrate TX queue code

The TX queue code was mostly moved out to support an internal
transport that we were never going to publish, but we're no
longer using that. Since we're also going to be dissolving
the virtual transport layer entirely, integrate the TX queue
code into the PCIe layer.

This also has a small kernel of already removing the virtual
transport function layer, since iwl_trans_send_cmd() calls
iwl_trans_pcie_send_hcmd() directly now, even if that still
calls the transport send_cmd method for now, we'll clean it
up later.

Also, not everything is renamed yet.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240605140327.936b13f45071.Ib219ce01a1e67bcad79d5131626db950252aaa46@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: iwlwifi: api: fix includes in debug.h
Johannes Berg [Wed, 5 Jun 2024 11:05:01 +0000 (14:05 +0300)]
wifi: iwlwifi: api: fix includes in debug.h

This needs to include dbg-tlv.h since it uses the value of
IWL_FW_INI_ALLOCATION_NUM from that file.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240605140327.2d25691283eb.I0909621a0e293a8a21d4f1de6e5fd59c22e4b212@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: iwlwifi: move TXQ bytecount limit to queue code
Johannes Berg [Wed, 5 Jun 2024 11:05:00 +0000 (14:05 +0300)]
wifi: iwlwifi: move TXQ bytecount limit to queue code

This really isn't correct to be in the opmode, do the clamping
(and power-of-2 fixup that may be necessary due to this, or even
otherwise) in the queue code. Also move down the retrying of the
allocation, it should be after all the size fixups, but also it
just makes sense, and avoids retrying same-size allocations in
the case of the BZ-family A-step workaround.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240605140327.000a0a1e807d.Ib822590d5aca76ff3168418ae2c139b3d43d81ed@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: iwlwifi: mvm: fix DTIM skip powersave config
Johannes Berg [Wed, 5 Jun 2024 11:04:59 +0000 (14:04 +0300)]
wifi: iwlwifi: mvm: fix DTIM skip powersave config

When entering D3 we want to configure skip over DTIM, but
it can't use the deflink configuration, that will not even
exist. Adjust the code to handle multiple links by taking
the min skip, even if we should only have a single active
link at this point.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240605140327.bccf980fadb4.Idc98b9f3634f39d2fae9bd9916f5d050ccd48f95@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: iwlwifi: bump minimum API version in BZ/SC to 90
Miri Korenblit [Wed, 5 Jun 2024 11:04:58 +0000 (14:04 +0300)]
wifi: iwlwifi: bump minimum API version in BZ/SC to 90

Stop supporting older FWs.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240605140327.ff8477233010.Ic8c73bd6749cc5f8ab5297807bb0be9bd96a59fa@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: iwlwifi: mvm: remove unneeded debugfs entries
Miri Korenblit [Wed, 5 Jun 2024 11:04:57 +0000 (14:04 +0300)]
wifi: iwlwifi: mvm: remove unneeded debugfs entries

These entries are not used, remove them.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240605140327.0c7c520814d5.I19cefb3d81b03a5be94c029cfffd1c8b8c437182@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: cfg80211: honor WIPHY_FLAG_SPLIT_SCAN_6GHZ in cfg80211_conn_scan
Emmanuel Grumbach [Wed, 5 Jun 2024 10:57:20 +0000 (13:57 +0300)]
wifi: cfg80211: honor WIPHY_FLAG_SPLIT_SCAN_6GHZ in cfg80211_conn_scan

If a user uses iw to connect to a network and we don't have any
information about the existing networks, cfg80211 will trigger a scan
internally even if the user didn't ask for a scan. This scan is
implemented by cfg80211_conn_scan(). This function called rdev_scan()
directly without honoring the WIPHY_FLAG_SPLIT_SCAN_6GHZ flag.
Use cfg80211_scan instead, this will split the scan if the low level
driver asked to.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240605135233.33f03661476a.I7b5be20a55aafe012cd9ddb3b4ba2d46b256ace4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: mac80211: clean up 'ret' in sta_link_apply_parameters()
Johannes Berg [Wed, 5 Jun 2024 10:57:19 +0000 (13:57 +0300)]
wifi: mac80211: clean up 'ret' in sta_link_apply_parameters()

There's no need to have the always-zero ret variable in
the function scope, move it into the inner scope only.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240605135233.eb7a24632d98.I72d7fe1da89d4b89bcfd0f5fb9057e3e69355cfe@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: mac80211: fix erroneous errors for STA changes
Johannes Berg [Wed, 5 Jun 2024 10:57:18 +0000 (13:57 +0300)]
wifi: mac80211: fix erroneous errors for STA changes

When e.g. wpa_supplicant sets only the MLD "sta" authorized
state, the code actually applies that change, but then returns
an error to userspace anyway because there were no changes to
the link station, and no link ID was given. However, it's not
incorrect to not have a link ID when wanting to change only
the MLD peer ("sta") state, so the code shouldn't require it.

To fix this, separate the "new_link" argument out into a new
three-state enum, because if modify is called on a link STA
only, it should return an error if no link is given or if it
doesn't exist. For modify on the MLD "sta", not having a link
ID is OK, but if there is one it should be validated.

This seems to not have mattered much as wpa_supplicant just
prints a message and continues, and the authorized state was
already set before this error return. However, in the later
code powersave recalculation etc. will be skipped, so that it
may result in never allowing powersave on MLO connections.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240605135233.48e2b8af07e3.Ib9793c383fcba118c05100e024f4a11a1c3d0e85@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: mac80211_hwsim: add 320 MHz to hwsim channel widths
Avraham Stern [Wed, 5 Jun 2024 10:57:17 +0000 (13:57 +0300)]
wifi: mac80211_hwsim: add 320 MHz to hwsim channel widths

Setting a channel with 320 MHz channel width over hwsim results in an
array-index-out-of-bounds error. Fix it by adding 320 MHz to hwsim
supported channel widths.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240605135233.a766c1465566.Ib859c7233511b61b8a34022cfceeb4971c739d80@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: nl80211: remove the FTMs per burst limit for NDP ranging
Avraham Stern [Wed, 5 Jun 2024 10:57:16 +0000 (13:57 +0300)]
wifi: nl80211: remove the FTMs per burst limit for NDP ranging

In NDP ranging, the number of NDP exchanges is not negotiated
and thus is not limited by the protocol. Remove the limit on
FTMs per burst for trigger based and non trigger based ranging.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240605135233.916e228537d9.I5fe4c1cefa1c1328726e7615dd5a0d861c694381@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: cfg80211: reject non-conformant 6 GHz center frequencies
Benjamin Berg [Sun, 2 Jun 2024 07:22:00 +0000 (10:22 +0300)]
wifi: cfg80211: reject non-conformant 6 GHz center frequencies

On 6 GHz (and also 5 GHz to some degree), only a specific set of center
frequencies should be used depending on the channel bandwidth. Verify
this is the case on 6 GHz. For 5 GHz, we are more accepting as there are
APs that got it wrong historically.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240602102200.876b10a2beda.I0d3d0daea4014e99654437ff6691378dbe452652@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: cfg80211: add regulatory flag to allow VLP AP operation
Johannes Berg [Thu, 23 May 2024 10:09:49 +0000 (12:09 +0200)]
wifi: cfg80211: add regulatory flag to allow VLP AP operation

Add a regulatory flag to allow VLP AP operation even on
channels otherwise marked NO_IR, which may be possible
in some regulatory domains/countries.

Note that this requires checking also when the beacon is
changed, since that may change the regulatory power type.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240523120945.63792ce19790.Ie2a02750d283b78fbf3c686b10565fb0388889e2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: cfg80211: refactor regulatory beaconing checking
Johannes Berg [Thu, 23 May 2024 10:09:48 +0000 (12:09 +0200)]
wifi: cfg80211: refactor regulatory beaconing checking

There are two functions exported now, with different settings,
refactor to just export a single function that take a struct
with different settings. This will make it easier to add more
parameters.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240523120945.d44c34dadfc2.I59b4403108e0dbf7fc6ae8f7522e1af520cffb1c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: cfg80211: refactor 6 GHz AP power type parsing
Johannes Berg [Thu, 23 May 2024 10:09:47 +0000 (12:09 +0200)]
wifi: cfg80211: refactor 6 GHz AP power type parsing

Add cfg80211_get_6ghz_power_type() to parse the 6 GHz
power type from a given set of elements, which is now
only inside cfg80211_6ghz_power_type_valid().

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240523120945.84cdffd94085.I76f434ee12552e8be91273f3b2d776179eaa62f1@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: mac80211: refactor channel checks
Johannes Berg [Thu, 23 May 2024 10:09:46 +0000 (12:09 +0200)]
wifi: mac80211: refactor channel checks

To later introduce an override for VLP APs being allowed despite
NO-IR flags, which is somewhat similar in construction to being
allowed to monitor on disabled channels, refactor the code that
checks channel flags to have not a 'monitor' argument but a set
of 'permitting' flags that permit the operation without checking
for 'prohibited' flags.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240523120945.3da28ded4a50.I90cffc633d0510293d511f60097dc75e719b55f0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: cfg80211: move enum ieee80211_ap_reg_power to cfg80211
Johannes Berg [Thu, 23 May 2024 10:09:45 +0000 (12:09 +0200)]
wifi: cfg80211: move enum ieee80211_ap_reg_power to cfg80211

This really shouldn't have been in ieee80211.h, since it
doesn't directly represent the spec. Move it to cfg80211
rather than mac80211 since upcoming changes will use it
there.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240523120945.962b16c831cd.I5745962525b1b176c5b90d37b3720fc100eee406@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: ieee80211: remove unused enum ieee80211_client_reg_power
Johannes Berg [Thu, 23 May 2024 10:09:44 +0000 (12:09 +0200)]
wifi: ieee80211: remove unused enum ieee80211_client_reg_power

This has never been used, and it's really not directly
representing the spec, so shouldn't have been here in
the first place. Remove it.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240523120945.32ed8fc1522d.Id4480d162e1921478e33d145890dc16c263b57bf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: cfg80211: use BIT() for flag enums
Johannes Berg [Thu, 23 May 2024 10:09:43 +0000 (12:09 +0200)]
wifi: cfg80211: use BIT() for flag enums

Use BIT(x) instead of 1<<x, in part because it's mostly
missing spaces anyway, in part because it reads nicer.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240523120945.c21598fbf49c.Ib8f26c5e9f508aee19fdfa1fd4b5995f084c46d4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: nl80211: expose can-monitor channel property
Johannes Berg [Thu, 23 May 2024 10:09:42 +0000 (12:09 +0200)]
wifi: nl80211: expose can-monitor channel property

It may be possible to monitor on disabled channels per the
can-monitor flag, but evidently I forgot to expose that out
to userspace. Fix that.

Fixes: a110a3b79177 ("wifi: cfg80211: optionally support monitor on disabled channels")
Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240523120945.9a2c19a51e53.I50fa1b1a18b70f63a5095131ac23dc2e71f3d426@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: cfg80211: handle 2x996 RU allocation in cfg80211_calculate_bitrate_he()
Baochen Qiang [Thu, 6 Jun 2024 02:06:53 +0000 (10:06 +0800)]
wifi: cfg80211: handle 2x996 RU allocation in cfg80211_calculate_bitrate_he()

Currently NL80211_RATE_INFO_HE_RU_ALLOC_2x996 is not handled in
cfg80211_calculate_bitrate_he(), leading to below warning:

kernel: invalid HE MCS: bw:6, ru:6
kernel: WARNING: CPU: 0 PID: 2312 at net/wireless/util.c:1501 cfg80211_calculate_bitrate_he+0x22b/0x270 [cfg80211]

Fix it by handling 2x996 RU allocation in the same way as 160 MHz bandwidth.

Fixes: c4cbaf7973a7 ("cfg80211: Add support for HE")
Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
Link: https://msgid.link/20240606020653.33205-3-quic_bqiang@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: cfg80211: fix typo in cfg80211_calculate_bitrate_he()
Baochen Qiang [Thu, 6 Jun 2024 02:06:52 +0000 (10:06 +0800)]
wifi: cfg80211: fix typo in cfg80211_calculate_bitrate_he()

rates_996 is mistakenly written as rates_969, fix it.

Fixes: c4cbaf7973a7 ("cfg80211: Add support for HE")
Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
Link: https://msgid.link/20240606020653.33205-2-quic_bqiang@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: mac80211: Remove generic .ndo_get_stats64
Breno Leitao [Fri, 7 Jun 2024 10:20:44 +0000 (03:20 -0700)]
wifi: mac80211: Remove generic .ndo_get_stats64

Commit 3e2f544dd8a33 ("net: get stats64 if device if driver is
configured") moved the callback to dev_get_tstats64() to net core, so,
unless the driver is doing some custom stats collection, it does not
need to set .ndo_get_stats64.

Since this driver is now relying in NETDEV_PCPU_STAT_TSTATS, then, it
doesn't need to set the dev_get_tstats64() generic .ndo_get_stats64
function pointer.

In this driver specifically, .ndo_get_stats64 basically points to
dev_fetch_sw_netstats(). Now it will point to dev_get_tstats64(), which
calls netdev_stats_to_stats64() and dev_fetch_sw_netstats().
netdev_stats_to_stats64() seems irrelevant for this driver.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://msgid.link/20240607102045.235071-2-leitao@debian.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: mac80211: Move stats allocation to core
Breno Leitao [Fri, 7 Jun 2024 10:20:43 +0000 (03:20 -0700)]
wifi: mac80211: Move stats allocation to core

With commit 34d21de99cea9 ("net: Move {l,t,d}stats allocation to core and
convert veth & vrf"), stats allocation could be done on net core instead
of this driver.

With this new approach, the driver doesn't have to bother with error
handling (allocation failure checking, making sure free happens in the
right spot, etc). This is core responsibility now.

Move mac80211 driver to leverage the core allocation.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://msgid.link/20240607102045.235071-1-leitao@debian.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: cfg80211: make hash table duplicates more survivable
Johannes Berg [Fri, 7 Jun 2024 18:17:17 +0000 (20:17 +0200)]
wifi: cfg80211: make hash table duplicates more survivable

Jiazi Li reported that they occasionally see hash table duplicates
as evidenced by the WARN_ON() in rb_insert_bss() in this code.  It
isn't clear how that happens, nor have I been able to reproduce it,
but if it does happen, the kernel crashes later, when it tries to
unhash the entry that's now not hashed.

Try to make this situation more survivable by removing the BSS from
the list(s) as well, that way it's fully leaked here (as had been
the intent in the hash insert error path), and no longer reachable
through the list(s) so it shouldn't be unhashed again later.

Link: https://lore.kernel.org/r/20231026013528.GA24122@Jiazi.Li
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://msgid.link/20240607181726.36835-2-johannes@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agowifi: mac80211: correct EHT EIRP TPE parsing
Johannes Berg [Wed, 12 Jun 2024 08:05:33 +0000 (10:05 +0200)]
wifi: mac80211: correct EHT EIRP TPE parsing

For the EHT EIRP transmit power envelope, the 320 MHz is in
the last octet, but if we've copied 4 octets (count == 3),
the next one is at index 4 not 5 (count + 2). Fix this, and
just hardcode the offset since count is always 3 here.

Fixes: 39dc8b8ea387 ("wifi: mac80211: pass parsed TPE data to drivers")
Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240612100533.f96c1e0fb758.I2f301c4341abb44dafd29128e7e32c66dc0e296d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 months agoMerge branch 'intel-wired-lan-driver-updates-2024-06-03'
Jakub Kicinski [Tue, 11 Jun 2024 02:52:50 +0000 (19:52 -0700)]
Merge branch 'intel-wired-lan-driver-updates-2024-06-03'

Jacob Keller says:

====================
Intel Wired LAN Driver Updates 2024-06-03

This series includes miscellaneous improvements for the ice as well as a
cleanup to the Makefiles for all Intel net drivers.

Andy fixes all of the Intel net driver Makefiles to use the documented
'*-y' syntax for specifying object files to link into kernel driver
modules, rather than the '*-objs' syntax which works but is documented as
reserved for user-space host programs.

Jacob has a cleanup to refactor rounding logic in the ice driver into a
common roundup_u64 helper function.

Michal Schmidt replaces irq_set_affinity_hint() to use
irq_update_affinity_hint() which behaves better with user-applied affinity
settings.

v2: https://lore.kernel.org/r/20240605-next-2024-06-03-intel-next-batch-v2-0-39c23963fa78@intel.com
v1: https://lore.kernel.org/r/20240603-next-2024-06-03-intel-next-batch-v1-0-e0523b28f325@intel.com
====================

Link: https://lore.kernel.org/r/20240607-next-2024-06-03-intel-next-batch-v3-0-d1470cee3347@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
3 months agoice: use irq_update_affinity_hint()
Michal Schmidt [Fri, 7 Jun 2024 21:22:34 +0000 (14:22 -0700)]
ice: use irq_update_affinity_hint()

irq_set_affinity_hint() is deprecated. Use irq_update_affinity_hint()
instead. This removes the side-effect of actually applying the affinity.

The driver does not really need to worry about spreading its IRQs across
CPUs. The core code already takes care of that.
On the contrary, when the driver applies affinities by itself, it breaks
the users' expectations:
 1. The user configures irqbalance with IRQBALANCE_BANNED_CPULIST in
    order to prevent IRQs from being moved to certain CPUs that run a
    real-time workload.
 2. ice reconfigures VSIs at runtime due to a MIB change
    (ice_dcb_process_lldp_set_mib_change). Reopening a VSI resets the
    affinity in ice_vsi_req_irq_msix().
 3. ice has no idea about irqbalance's config, so it may move an IRQ to
    a banned CPU. The real-time workload suffers unacceptable latency.

I am not sure if updating the affinity hints is at all useful, because
irqbalance ignores them since 2016 ([1]), but at least it's harmless.

This ice change is similar to i40e commit d34c54d1739c ("i40e: Use
irq_update_affinity_hint()").

[1] https://github.com/Irqbalance/irqbalance/commit/dcc411e7bfdd

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Reviewed-by: Sunil Goutham <sgoutham@marvell.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/20240607-next-2024-06-03-intel-next-batch-v3-3-d1470cee3347@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>