platform/kernel/linux-rpi.git
12 months agowifi: iwlwifi: mvm: check link during TX
Johannes Berg [Wed, 14 Jun 2023 09:41:26 +0000 (12:41 +0300)]
wifi: iwlwifi: mvm: check link during TX

Again, during some (botched) FW restart scenarios we can end
up with a NULL link in the driver but mac80211 thinking all
is still going OK. If we try to TX at the same time, we can
crash there. Fix that by checking for a NULL link during TX.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.cee48479deec.I4eef58f7b67afafb7b3294adbeb6e0067b68419d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: add a NULL pointer check
Johannes Berg [Wed, 14 Jun 2023 09:41:25 +0000 (12:41 +0300)]
wifi: iwlwifi: mvm: add a NULL pointer check

We've observed that in some botched firmware restart scenarios
when the firmware crashes again while we're reconfiguring, we
can hit NULL pointer crashes here. The underlying issue is the
botched restart which we need to fix separately, but until we
can do that, don't crash hard here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.e47b0192c78f.I67fa9f07cd1c8b3bdc8db25f5e31c1c680c49745@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: fw: Add new FSEQ defines to fw dump
Ariel Malamud [Wed, 14 Jun 2023 09:41:24 +0000 (12:41 +0300)]
wifi: iwlwifi: fw: Add new FSEQ defines to fw dump

On fw error dump, dmesg prints FSEQ register data. Add 4
additional prints in order to match those being dumped
by Windows driver. Allows fw infra to correctly detect
version mismatch.

Signed-off-by: Ariel Malamud <ariel.malamud@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.f40dc9c810a8.I26227900d0b7e9a71fefe5cbf57cf6b46ee44413@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: pcie: double-check ACK interrupt after timeout
Johannes Berg [Wed, 14 Jun 2023 09:41:23 +0000 (12:41 +0300)]
wifi: iwlwifi: pcie: double-check ACK interrupt after timeout

There are evidently cases where the firmware completes the
reset but the interrupt isn't received correctly, so check
for the interrupt again after the timeout, and don't dump
the firmware error log if the right bit is set.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.00cc2d9b88c3.I429bfe800f17c624e50c0b0c10dd2cd7d885f199@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: pull from TXQs with softirqs disabled
Johannes Berg [Wed, 14 Jun 2023 09:41:22 +0000 (12:41 +0300)]
wifi: iwlwifi: pull from TXQs with softirqs disabled

In mac80211, it's required that we pull from TXQs by calling
ieee80211_tx_dequeue() only with softirqs disabled. However,
in iwl_mvm_queue_state_change() we're often called with them
enabled, e.g. from flush if anything was flushed, triggering
a mac80211 warning.

Fix that by disabling the softirqs across the TX call.

Fixes: cfbc6c4c5b91 ("iwlwifi: mvm: support mac80211 TXQs model")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.0feef7fa81db.I4dd62542d955b40dd8f0af34fa4accb9d0d17c7e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: use iwl_mvm_is_vendor_in_approved_list()
Johannes Berg [Wed, 14 Jun 2023 09:41:21 +0000 (12:41 +0300)]
wifi: iwlwifi: mvm: use iwl_mvm_is_vendor_in_approved_list()

We have this helper now instead of open-coding the check for
the dmi_tas_approved_list, so use it even here. It was added
for debugfs use, but it's better to be consistent.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.f3741f5cdef4.I5e0bf522189dc595ee38d05e93994211d32ec0f4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: fw: make some ACPI functions static
Johannes Berg [Wed, 14 Jun 2023 09:41:20 +0000 (12:41 +0300)]
wifi: iwlwifi: fw: make some ACPI functions static

iwl_acpi_get_wifi_pkg_range(), iwl_acpi_get_wifi_pkg() and
iwl_acpi_get_object() need not be exported etc., they're used
only within the same file. Make them static.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.e866032e4106.Ifede7f7c25b17a8215b154ce01da513b75384325@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: Correctly indicate support for VHT TX STBC
Ilan Peer [Wed, 14 Jun 2023 09:41:19 +0000 (12:41 +0300)]
wifi: iwlwifi: Correctly indicate support for VHT TX STBC

If HT STBC is not supported, do not indicate support for VHT TX
STBC.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.b24b5fba6fab.I116617875eb4a9d520df23a8c49a6594f9d8b2c6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: correctly access HE/EHT sband capa
Johannes Berg [Wed, 14 Jun 2023 09:41:18 +0000 (12:41 +0300)]
wifi: iwlwifi: mvm: correctly access HE/EHT sband capa

We can't just dereference the sband->iftype_data pointer,
that's an array so we need to access the right entry. Use
the previously introduced helper functions to do that.

There are also cases, e.g. when loading with disable_11ax=1,
where the pointer might be NULL but we still attempt to use
it, causing a crash.

Fixes: 529281bdf0fc ("iwlwifi: mvm: limit TLC according to our HE capabilities")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614123446.a1f2b17ee39b.I8808120be744be8804815ce9e3e24ce6d2b424e3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: Add NULL check before dereferencing the pointer
Mukesh Sisodiya [Wed, 14 Jun 2023 12:50:08 +0000 (15:50 +0300)]
wifi: iwlwifi: mvm: Add NULL check before dereferencing the pointer

While vif pointers are protected by the corresponding "*active"
fields, static checkers can get confused sometimes. Add an explicit
check.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614154951.78749ae91fb5.Id3c05d13eeee6638f0930f750e93fb928d5c9dee@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: remove new checksum code
Johannes Berg [Wed, 14 Jun 2023 11:59:05 +0000 (14:59 +0300)]
wifi: iwlwifi: mvm: remove new checksum code

The hardware isn't going to get fixed, so this mode cannot work
in the foreseeable future. Remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230614145722.ddbc16c4affe.Ia6921e4b8a9624d4f57489ac775105ed0e400313@changeid
[restore original subject]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: Add debugfs entry to report dormant links
Ilan Peer [Sun, 11 Jun 2023 09:14:26 +0000 (12:14 +0300)]
wifi: mac80211: Add debugfs entry to report dormant links

Add debugfs entry to report dormant (valid but disabled) links.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230611121219.7fa5f022adfb.Iff6fa3e1a3b00ae726612f9d5a31f7fe2fcbfc68@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: Support disabled links during association
Ilan Peer [Thu, 8 Jun 2023 13:36:11 +0000 (16:36 +0300)]
wifi: mac80211: Support disabled links during association

When the association is complete, do not configure disabled
links, and track them as part of the interface data.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.c194fabeb81a.Iaefdef5ba0492afe9a5ede14c68060a4af36e444@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agoMerge wireless into wireless-next
Johannes Berg [Mon, 19 Jun 2023 10:03:51 +0000 (12:03 +0200)]
Merge wireless into wireless-next

There are some locking changes that will later otherwise
cause conflicts, so merge wireless into wireless-next to
avoid those.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: ray_cs: fix stringop-truncation GCC warning
Kalle Valo [Tue, 13 Jun 2023 14:09:18 +0000 (17:09 +0300)]
wifi: ray_cs: fix stringop-truncation GCC warning

GCC 12.2 with W=1 warns:

drivers/net/wireless/legacy/ray_cs.c:630:17: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation]

The driver uses SSID as a string which is just wrong, it should be treated as a
byte array instead. But as the driver is ancient and most likely there are no
users so convert it to use strscpy(). This makes sure that the string is
NUL-terminated and also the warning is fixed.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230613140918.389690-5-kvalo@kernel.org
12 months agowifi: hostap: fix stringop-truncations GCC warning
Kalle Valo [Tue, 13 Jun 2023 14:09:17 +0000 (17:09 +0300)]
wifi: hostap: fix stringop-truncations GCC warning

With GCC 13.1 and W=1 hostap has a warning:

drivers/net/wireless/intersil/hostap/hostap_ioctl.c:3633:17: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]

fortify-string.h recommends not to use strncpy() so use strscpy() which fixes
the warning. Also now it's guarenteed that the string is NUL-terminated.

Compile tested only.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230613140918.389690-4-kvalo@kernel.org
12 months agowifi: brcmsmac: fix gnu_printf warnings
Kalle Valo [Tue, 13 Jun 2023 14:09:16 +0000 (17:09 +0300)]
wifi: brcmsmac: fix gnu_printf warnings

With GCC 13.1 and W=1 brcmsmac has warnings like this:

./include/trace/stages/stage5_get_offsets.h:23:31: warning: function 'trace_event_get_offsets_brcms_dbg' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]

Add a workaround which disables -Wsuggest-attribute=format in
brcms_trace_brcmsmac_msg.h. I see similar workarounds in other drivers as well.

Compile tested only.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230613140918.389690-3-kvalo@kernel.org
12 months agowifi: brcmfmac: fix gnu_printf warnings
Kalle Valo [Tue, 13 Jun 2023 14:09:15 +0000 (17:09 +0300)]
wifi: brcmfmac: fix gnu_printf warnings

With GCC 13.1 and W=1 brcmfmac has warnings like this:

./include/trace/perf.h:26:16: warning: function 'perf_trace_brcmf_dbg' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]

Add a workaround which disables -Wsuggest-attribute=format in tracepoint.h. I
see similar workarounds in other drivers as well.

Compile tested only.

Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230613140918.389690-2-kvalo@kernel.org
12 months agowifi: rtw89: fix spelling typo of IQK debug messages
Dmitry Antipov [Wed, 14 Jun 2023 08:15:55 +0000 (11:15 +0300)]
wifi: rtw89: fix spelling typo of IQK debug messages

Fix spelling typo of IQK debug messages.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230614081555.91395-3-dmantipov@yandex.ru
12 months agowifi: rtw89: cleanup rtw89_iqk_info and related code
Dmitry Antipov [Wed, 14 Jun 2023 08:15:54 +0000 (11:15 +0300)]
wifi: rtw89: cleanup rtw89_iqk_info and related code

Drop useless '_iqk_track()' and 'rtw8852a_iqk_track()' (they
just change 'thermal_rek_en' field which is set but unused
and so removed as well) functions, set but unused 'kcount'
field of 'struct rtw89_iqk_info', and convert 'thermal' to
local variables where appropriate (it doesn't need to have
longer storage duration because it is actually used for the
debugging purposes only).

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230614081555.91395-2-dmantipov@yandex.ru
12 months agowifi: rtw89: cleanup private data structures
Dmitry Antipov [Wed, 14 Jun 2023 08:15:53 +0000 (11:15 +0300)]
wifi: rtw89: cleanup private data structures

Remove a bunch of unused (and set but unused) fields
from 'struct rtw89_btc_wl_nhm', 'struct rtw89_dle_info',
'struct rtw89_hal' and 'struct rtw89_env_monitor_info'
driver-specific data structures, adjust related bits.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230614081555.91395-1-dmantipov@yandex.ru
12 months agowifi: mt7601u: replace strlcpy() with strscpy()
Azeem Shaikh [Tue, 13 Jun 2023 00:34:57 +0000 (00:34 +0000)]
wifi: mt7601u: replace strlcpy() with strscpy()

strlcpy() reads the entire source buffer first.
This read may exceed the destination size limit.
This is both inefficient and can lead to linear read
overflows if a source string is not NUL-terminated [1].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().

Direct replacement is safe here since DEV_ASSIGN is only used by
TRACE macros and the return values are ignored.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230613003458.3538812-1-azeemshaikh38@gmail.com
12 months agowifi: rt2x00: fix the typo in comments
Deming Wang [Mon, 12 Jun 2023 11:46:12 +0000 (07:46 -0400)]
wifi: rt2x00: fix the typo in comments

Fix typo in the description of 'non-succesfull'.

Signed-off-by: Deming Wang <wangdeming@inspur.com>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230612114612.1640-1-wangdeming@inspur.com
12 months agowifi: iwlwifi: dbg-tlv: clear FW debug memory on init
Johannes Berg [Tue, 13 Jun 2023 12:57:27 +0000 (15:57 +0300)]
wifi: iwlwifi: dbg-tlv: clear FW debug memory on init

When we restart the firmware, we shouldn't keep old debug data
around. Since the "allocate" function might not reallocate the
memory blocks (they're only freed when we unbind from the device),
clear the memory to have a clean slate for debug data.

This is a bit more complex since we normally don't enter into
the allocation function, but duplicating the logic didn't seem
enticing either, so rework the allocation a bit to always go
into the individual block allocation, but there clear if it's
already allocated, rather than allocating again.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.30b82881cfbf.I39520aff8ac95ee64d39dc5913525a1efd7995fa@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: pcie: remove redundant argument
Johannes Berg [Tue, 13 Jun 2023 12:57:26 +0000 (15:57 +0300)]
wifi: iwlwifi: pcie: remove redundant argument

The iwl_pcie_alloc_fw_monitor_block() function has an argument
that's only ever hard-coded to 11, remove it and hard-code the
value into the function itself with a comment.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.737c153e8259.Ibe6250ca812cfa2f00ac47e5e0d1595c6b9b4875@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: pcie: clear FW debug memory on init
Johannes Berg [Tue, 13 Jun 2023 12:57:25 +0000 (15:57 +0300)]
wifi: iwlwifi: pcie: clear FW debug memory on init

When we restart the firmware, we shouldn't keep old debug data
around. Since the "allocate" function might not reallocate the
memory block (it's only freed when we unbind from the device),
clear the memory to have a clean slate for debug data.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.73c32255a132.Ibd7101dcd285b01ee879fddfbf52c30d49ced3c0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: dbg-tlv: fix DRAM data init
Johannes Berg [Tue, 13 Jun 2023 12:57:24 +0000 (15:57 +0300)]
wifi: iwlwifi: dbg-tlv: fix DRAM data init

Given the existing code in iwl_dbg_tlv_update_drams(), the
following can happen and cause firmware asserts, and even
the device to become unusable:

 * We set the magic so the firmware will use the data;
 * we try to fill multiple allocation IDs, with at least
   one successful, but - crucially - one failing and thus
   not touching the data;
 * we don't clear the data since there was one success.

This doesn't seem like much of a problem just yet, however,
what happens now is that the allocation ID(s) that failed
are not initialized.

There are two additional things to know:
 * we never free these allocations across FW restart or
   interface down/up etc., in fact we never free them until
   the driver is unbound from the device (e.g. unloaded)
 * the firmware uses the DRAM info structure for real debug
   data when it has used it completely

Given that, and the fact that we never initialize the data
on restart, we can be unlucky and end up with an allocation
that looks for the most part valid (valid ID, valid number
of buffers, etc.) but has bad sizes - causing the firmware
to throw an assert we can never recover from.

Fixing the code to have the entire buffers cleared (which
we should do so old debug data isn't sticking around) is a
bit more complex, so as a first step make the actual code
that fills the information more robust by clearing the
structure first, and filling the magic values only if it
actually succeeded for one, rather than doing it the other
way around.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.87cf5528f4bc.I26ac907a4162297808b33467fc7f5d8177474a34@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: allow ADD_STA not to be advertised by the firwmare
Emmanuel Grumbach [Tue, 13 Jun 2023 12:57:23 +0000 (15:57 +0300)]
wifi: iwlwifi: mvm: allow ADD_STA not to be advertised by the firwmare

Newest firmware don't advertise the version of ADD_STA because it has
been replaced by another command. There are old firmware images
that also don't advertise it. Replace all the checks with a new
inline, and in that check for either MLD API or the ADD_STA
command version.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.4b9305510223.I7cc143d87186f8441e9b8435cc550b76734c7eef@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: put only a single IGTK into FW
Johannes Berg [Tue, 13 Jun 2023 12:57:22 +0000 (15:57 +0300)]
wifi: iwlwifi: mvm: put only a single IGTK into FW

The firmware only supports a single IGTK, and due to some
changes it really doesn't like to have multiple programmed
in later versions. Since only newer firmware cannot remove
a key that isn't present any more, adjust only the MLD API
code to keep track of the previous IGTK and remove it when
a new one is added.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.3fde1ef09270.I2e12a3b0bba4325c07dc8fcce39b711f158bd621@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: fix potential array out of bounds access
Gregory Greenman [Tue, 13 Jun 2023 12:57:21 +0000 (15:57 +0300)]
wifi: iwlwifi: mvm: fix potential array out of bounds access

Account for IWL_SEC_WEP_KEY_OFFSET when needed while verifying
key_len size in iwl_mvm_sec_key_add().

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.f193b7493a93.I6948ba625b9318924b96a5e22602ac75d2bd0125@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: support version C0 of BZ and GL devices
Mukesh Sisodiya [Tue, 13 Jun 2023 12:57:20 +0000 (15:57 +0300)]
wifi: iwlwifi: support version C0 of BZ and GL devices

Add support for C0 version of MAC and RF for BZ and GL devices.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.90ad8aab8a03.I86d1675095f0e4f5286d9b7c2b00a0220f524472@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: add support for Extra EHT LTF
Gregory Greenman [Tue, 13 Jun 2023 12:57:19 +0000 (15:57 +0300)]
wifi: iwlwifi: mvm: add support for Extra EHT LTF

Add support for Extra EHT LTF defined in 9.4.2.313
EHT Capabilities element.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.de019d7cc174.I806f0f6042b89274192701a60b4f7900822db666@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: Refactor iwl_mvm_get_lmac_id()
Ariel Malamud [Tue, 13 Jun 2023 12:57:18 +0000 (15:57 +0300)]
wifi: iwlwifi: mvm: Refactor iwl_mvm_get_lmac_id()

The iwl_mvm_get_lmac_id() function is currently
defined as a static inline function under fw/api
and receives mvm's fw pointer. It will need the
ability to access other mvm struct members for
future capabilities such as debug. Move the function
out of the fw/api and into mvm proper as a regular
function and have it receive the pointer to mvm.

Signed-off-by: Ariel Malamud <ariel.malamud@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.507b2f9f64eb.I0ec91310e1911c33faf396b5e17bcb11a164f6ea@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: improve debug prints in iwl_read_ppag_table()
Alon Giladi [Tue, 13 Jun 2023 12:57:17 +0000 (15:57 +0300)]
wifi: iwlwifi: improve debug prints in iwl_read_ppag_table()

Add prints of ETSI and China bits.
Check if need to mask the China bit (when the firmware doesn't
support it) in a separate flow, so it will be easier to follow
the conditions. Add a separate message for the command version.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.4ee455ec1ee8.I6f1a4b7dfa5cfd9b4f4a4b5bb5567849e629ae96@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: initialize the rx_vec before using it
Mukesh Sisodiya [Tue, 13 Jun 2023 12:57:16 +0000 (15:57 +0300)]
wifi: iwlwifi: mvm: initialize the rx_vec before using it

Initialize the phy_data.rx_vec for both version-3 and above
where it is 4-byte data size and below version which has
data size of 2-byte.
The data will be sent uninitialized in called function if
notification version is less than three.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.a6bb856f04bc.I9a15075f3dad61dcabdcd1ed0d34cf3e8ec5453f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: rename BTM support flag and its TLV
Haim Dreyfuss [Tue, 13 Jun 2023 12:57:15 +0000 (15:57 +0300)]
wifi: iwlwifi: mvm: rename BTM support flag and its TLV

Currently, we only need to support BTM rejection.
However, in the future we might want to support other BTM modes.
Rephrase its naming.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.ad20f10668d1.Icbb3fbae50b2302b97225b183dd336b02a4f37ee@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: support U-SIG EHT validate checks
Johannes Berg [Tue, 13 Jun 2023 12:57:14 +0000 (15:57 +0300)]
wifi: iwlwifi: mvm: support U-SIG EHT validate checks

Support new firmware that can validate the validate bits in
sniffer mode, and advertise that fact and the result of the
checks in the U-SIG radiotap field.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.c20480aa1171.Icc0d077dae01d662ccb948823e196aa9c5c87976@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: Replace strlcpy with strscpy
Azeem Shaikh [Tue, 13 Jun 2023 00:34:04 +0000 (00:34 +0000)]
wifi: mac80211: Replace strlcpy with strscpy

strlcpy() reads the entire source buffer first.
This read may exceed the destination size limit.
This is both inefficient and can lead to linear read
overflows if a source string is not NUL-terminated [1].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().

Direct replacement is safe here since LOCAL_ASSIGN is only used by
TRACE macros and the return values are ignored.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230613003404.3538524-1-azeemshaikh38@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: cfg80211: replace strlcpy() with strscpy()
Azeem Shaikh [Mon, 12 Jun 2023 23:23:01 +0000 (23:23 +0000)]
wifi: cfg80211: replace strlcpy() with strscpy()

strlcpy() reads the entire source buffer first.
This read may exceed the destination size limit.
This is both inefficient and can lead to linear read
overflows if a source string is not NUL-terminated [1].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().

Direct replacement is safe here since WIPHY_ASSIGN is only used by
TRACE macros and the return values are ignored.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230612232301.2572316-1-azeemshaikh38@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: Propagate ERP slot changes to FW
Ilan Peer [Mon, 12 Jun 2023 15:51:16 +0000 (18:51 +0300)]
wifi: iwlwifi: mvm: Propagate ERP slot changes to FW

In AP mode, ERP slot changes weren't properly indicated to the FW.
Fix it.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.ef242b8ce245.I01eddee9d3a9a3208499c223eb8e70fe6663f42c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: FTM responder MLO support
Avraham Stern [Mon, 12 Jun 2023 15:51:15 +0000 (18:51 +0300)]
wifi: iwlwifi: mvm: FTM responder MLO support

Add a link configuration parameter to FTM responder start instead
of using the default link.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.b367f9bd19b8.I158c71998f39a6c15463ff5ae30129da8ad46d22@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: pass ESR parameters to the firmware
Emmanuel Grumbach [Mon, 12 Jun 2023 15:51:14 +0000 (18:51 +0300)]
wifi: iwlwifi: pass ESR parameters to the firmware

The firmware needs to know the esr_transtition_timeout to time the
transition between EMLSR and single radio with the AP.
Add the EMLSR support bit to the wiphy extended capabilities so that
it'll be sent in our association request frame. There are some
limitations in the implementation so we cannot use zero
padding/transition delay; fill the correct values.

Also, feed the medium_synchronization delay to the firmware.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.09fa06820d03.Ie9a9fd37d4948f8c5dd91161de254184b1a093c0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: debugfs: add ppag capa to fw info file
Alon Giladi [Mon, 12 Jun 2023 15:51:13 +0000 (18:51 +0300)]
wifi: iwlwifi: debugfs: add ppag capa to fw info file

Add information about ppag_china_bit_support capability.

Signed-off-by: Alon Giladi <alon.giladi@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.4655922aff4d.Ie934027940bd53d05124222aa6a8a8b7021952c4@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: always set MH len in offload_assist
Johannes Berg [Mon, 12 Jun 2023 15:51:12 +0000 (18:51 +0300)]
wifi: iwlwifi: mvm: always set MH len in offload_assist

Some versions of the new hardware don't have a functional
version of the new offload method, but still have stricter
checks on the MAC header (MH) length in the offload assist
word. Include that even if checksumming isn't offloaded to
hardware.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.bba713f7495a.Idbc8e3ce313b51af4060326e0191bd338b3163a2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: fw: print PC register value instead of address
Mukesh Sisodiya [Mon, 12 Jun 2023 15:51:11 +0000 (18:51 +0300)]
wifi: iwlwifi: fw: print PC register value instead of address

The program counter address is read from the TLV and
PC address is printed in debug messages.
Read the value at PC address and print the value
instead of the register address.

Fixes: 5e31b3df86ec ("wifi: iwlwifi: dbg: print pc register data once fw dump occurred")
Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.e5a5f18f1b2c.Ib6117a4e7f66a075913241cc81477c0059953d5d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: unify checks for HW error values
Johannes Berg [Mon, 12 Jun 2023 15:51:10 +0000 (18:51 +0300)]
wifi: iwlwifi: unify checks for HW error values

The hardware, depending on which part fails or times out,
returns 0xA5A5A5A. or 0x5A5A5A5. with the lowest 4 bits
encoding some further reason/status. However, mostly we
don't really need to care about the exact reasons, so
unify the checks for this to avoid hardcoding those magic
values all over the driver.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.3e2959741a38.I1c297a53787b87e4e2b8f296c041921338573f4d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: fix getting LDPC/STBC support
Mukesh Sisodiya [Mon, 12 Jun 2023 15:51:08 +0000 (18:51 +0300)]
wifi: iwlwifi: mvm: fix getting LDPC/STBC support

Use flags field from struct ieee80211_tx_info in order to get
LDPC/STBC support. The rate parameter, used originally, is 16
bits only and does not have details of LDPC/STBC support.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.5a8856739b11.I6af4a55b22ed856f484ba77f87723dceec4904f2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: bump FW API to 79 for AX devices
Gregory Greenman [Mon, 12 Jun 2023 15:51:07 +0000 (18:51 +0300)]
wifi: iwlwifi: bump FW API to 79 for AX devices

Start supporting API version 79 for AX devices.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.c54013425732.I4df33c68ee3ef6b6a330f1cbef7f5bbf4f54b269@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: update response for mcc_update command
Abhishek Naik [Mon, 12 Jun 2023 15:51:06 +0000 (18:51 +0300)]
wifi: iwlwifi: update response for mcc_update command

Add support for the MCC update response version 8.
Versions 5-6 are already covered by the existing
flags conversion, and 7 isn't used.

The capabilities field in iwl_mcc_update_resp is 32 bits
wide now, and the flags moved, so some more changes are
needed.

While at it, convert the flags to bool (to avoid having
to deal with BIT(16) specially etc.) and use the
struct_size() macro for the memory allocation.

Signed-off-by: Abhishek Naik <abhishek.naik@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.71a7070aecd7.Ibddcb9fbfa74895f742c0ac20968720691c94853@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: FTM initiator MLO support
Avraham Stern [Mon, 12 Jun 2023 15:51:05 +0000 (18:51 +0300)]
wifi: iwlwifi: mvm: FTM initiator MLO support

When checking if the initiator is associated to the responder,
iterate over all active links.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.1737f26e9cf7.I8f140ca55094da1d73c387fc036394fb2c148c85@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: Handle return value for iwl_mvm_sta_init
Mukesh Sisodiya [Mon, 12 Jun 2023 15:51:04 +0000 (18:51 +0300)]
wifi: iwlwifi: mvm: Handle return value for iwl_mvm_sta_init

sta_init function can fail and if it returns an error then
driver should not send the request to fw to add a station.

Fixes: 69aef848052b ("wifi: iwlwifi: mvm: refactor iwl_mvm_add_sta(), iwl_mvm_rm_sta()")
Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.1ecd293539e8.I5ec6aab387bb2fe743a7402581beaeb9c801d31f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: make debugfs entries link specific
Benjamin Berg [Mon, 12 Jun 2023 15:51:02 +0000 (18:51 +0300)]
wifi: iwlwifi: make debugfs entries link specific

All of the station elements are really elements for the link. Create
them from the correct callback and return the link specific information
rather than always using the default link.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.a8e0c40d325e.I374d9433c3b8694667e1ce550d65f6f1f0d23c05@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: Fix permissions for valid_links debugfs entry
Ilan Peer [Sun, 11 Jun 2023 09:14:28 +0000 (12:14 +0300)]
wifi: mac80211: Fix permissions for valid_links debugfs entry

The entry should be a read only one and not a write only one. Fix it.

Fixes: 3d9011029227 ("wifi: mac80211: implement link switching")
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230611121219.c75316990411.I1565a7fcba8a37f83efffb0cc6b71c572b896e94@changeid
[remove x16 change since it doesn't work yet]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: Do not use "non-MLD AP" syntax
Ilan Peer [Sun, 11 Jun 2023 09:14:27 +0000 (12:14 +0300)]
wifi: mac80211: Do not use "non-MLD AP" syntax

Instead clarify the cases where link ID == 0 is intended
for an AP STA that is not part of an AP MLD.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230611121219.77236a2e26ad.I8193ca8e236c9eb015870471f77a7d5134da3156@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: cfg80211: Support association to AP MLD with disabled links
Ilan Peer [Thu, 8 Jun 2023 13:36:10 +0000 (16:36 +0300)]
wifi: cfg80211: Support association to AP MLD with disabled links

An AP part of an AP MLD might be temporarily disabled, and might be
enabled later. Such a link should be included in the association
exchange, but should not be used until enabled.

Extend the NL80211_CMD_ASSOCIATE to also indicate disabled links.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.c4c61ee4c4a5.I784ef4a0d619fc9120514b5615458fbef3b3684a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211_hwsim: Don't access vif valid links directly
Ilan Peer [Thu, 8 Jun 2023 13:36:09 +0000 (16:36 +0300)]
wifi: mac80211_hwsim: Don't access vif valid links directly

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

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.8966bd5ce7c8.Ia73e3555aaf4ddf9917bced8d413fad08cc28f1b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: Add getter functions for vif MLD state
Ilan Peer [Thu, 8 Jun 2023 13:36:08 +0000 (16:36 +0300)]
wifi: mac80211: Add getter functions for vif MLD state

As a preparation to support disabled/dormant links, add the
following function:

- ieee80211_vif_usable_links(): returns the bitmap of the links
  that can be activated. Use this function in all the places that
  the bitmap of the usable links is needed.

- ieee80211_vif_is_mld(): returns true iff the vif is an MLD.
  Use this function in all the places where an indication that the
  connection is a MLD is needed.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.86e3351da1fc.If6fe3a339fda2019f13f57ff768ecffb711b710a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: allow disabling SMPS debugfs controls
Miri Korenblit [Thu, 8 Jun 2023 13:36:06 +0000 (16:36 +0300)]
wifi: mac80211: allow disabling SMPS debugfs controls

There are cases in which we don't want the user to override the
smps mode, e.g. when SMPS should be disabled due to EMLSR. Add
a driver flag to disable SMPS overriding and don't override if
it is set.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.ef129e80556c.I74a298fdc86b87074c95228d3916739de1400597@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: don't update rx_stats.last_rate for NDP
Johannes Berg [Thu, 8 Jun 2023 13:36:05 +0000 (16:36 +0300)]
wifi: mac80211: don't update rx_stats.last_rate for NDP

If we get an NDP (null data packet), there's reason to
believe the peer is just sending it to probe, and that
would happen at a low rate. Don't track this packet for
purposes of last RX rate reporting.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.8af46c4ac094.I13d9d5019addeaa4aff3c8a05f56c9f5a86b1ebd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: fix CSA processing while scanning
Benjamin Berg [Thu, 8 Jun 2023 13:36:03 +0000 (16:36 +0300)]
wifi: mac80211: fix CSA processing while scanning

The channel switch parsing code would simply return if a scan is
in-progress. Supposedly, this was because channel switch announcements
from other APs should be ignored.

For the beacon case, the function is already only called if we are
associated with the sender. For the action frame cases, add the
appropriate check whether the frame is coming from the AP we are
associated with. Finally, drop the scanning check from
ieee80211_sta_process_chanswitch.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.3366e9302468.I6c7e0b58c33b7fb4c675374cfe8c3a5cddcec416@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: mlme: clarify WMM messages
Johannes Berg [Thu, 8 Jun 2023 13:36:00 +0000 (16:36 +0300)]
wifi: mac80211: mlme: clarify WMM messages

These messages apply to a single link only, use link_info()
to indicate that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.21a6bece4313.I08118e5e851fae2f9e43f8a58d3b6217709bf578@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: pass roc->sdata to drv_cancel_remain_on_channel()
Anjaneyulu [Thu, 8 Jun 2023 13:35:58 +0000 (16:35 +0300)]
wifi: mac80211: pass roc->sdata to drv_cancel_remain_on_channel()

In suspend flow "sdata" is NULL, destroy all roc's which are started.
pass "roc->sdata" to drv_cancel_remain_on_channel() to avoid NULL
dereference and destroy that roc

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.c678187a308c.Ic11578778655e273931efc5355d570a16465d1be@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: include key action/command in tracing
Johannes Berg [Thu, 8 Jun 2023 13:35:57 +0000 (16:35 +0300)]
wifi: mac80211: include key action/command in tracing

We trace the key information and all, but not whether the key
is added or removed - add that information.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.546e86e216df.Ie3bf9009926f8fa154dde52b0c02537ff7edae36@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: mac80211: add helpers to access sband iftype data
Johannes Berg [Sun, 4 Jun 2023 09:11:24 +0000 (12:11 +0300)]
wifi: mac80211: add helpers to access sband iftype data

There's quite a bit of code accessing sband iftype data
(HE, HE 6 GHz, EHT) and we always need to remember to use
the ieee80211_vif_type_p2p() helper. Add new helpers to
directly get it from the sband/vif rather than having to
call ieee80211_vif_type_p2p().

Convert most code with the following spatch:

    @@
    expression vif, sband;
    @@
    -ieee80211_get_he_iftype_cap(sband, ieee80211_vif_type_p2p(vif))
    +ieee80211_get_he_iftype_cap_vif(sband, vif)

    @@
    expression vif, sband;
    @@
    -ieee80211_get_eht_iftype_cap(sband, ieee80211_vif_type_p2p(vif))
    +ieee80211_get_eht_iftype_cap_vif(sband, vif)

    @@
    expression vif, sband;
    @@
    -ieee80211_get_he_6ghz_capa(sband, ieee80211_vif_type_p2p(vif))
    +ieee80211_get_he_6ghz_capa_vif(sband, vif)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.db099f49e764.Ie892966c49e22c7b7ee1073bc684f142debfdc84@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: cfg80211: S1G rate information and calculations
Gilad Itzkovitch [Thu, 18 May 2023 00:07:23 +0000 (12:07 +1200)]
wifi: cfg80211: S1G rate information and calculations

Increase the size of S1G rate_info flags to support S1G and add
flags for new S1G MCS and the supported bandwidths. Also, include
S1G rate information to netlink STA rate message. Lastly, add
rate calculation function for S1G MCS.

Signed-off-by: Gilad Itzkovitch <gilad.itzkovitch@morsemicro.com>
Link: https://lore.kernel.org/r/20230518000723.991912-1-gilad.itzkovitch@morsemicro.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: iwlwifi: mvm: spin_lock_bh() to fix lockdep regression
Hugh Dickins [Fri, 9 Jun 2023 21:29:39 +0000 (14:29 -0700)]
wifi: iwlwifi: mvm: spin_lock_bh() to fix lockdep regression

Lockdep on 6.4-rc on ThinkPad X1 Carbon 5th says
=====================================================
WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected
6.4.0-rc5 #1 Not tainted
-----------------------------------------------------
kworker/3:1/49 [HC0[0]:SC0[4]:HE1:SE0] is trying to acquire:
ffff8881066fa368 (&mvm_sta->deflink.lq_sta.rs_drv.pers.lock){+.+.}-{2:2}, at: rs_drv_get_rate+0x46/0xe7

and this task is already holding:
ffff8881066f80a8 (&sta->rate_ctrl_lock){+.-.}-{2:2}, at: rate_control_get_rate+0xbd/0x126
which would create a new lock dependency:
 (&sta->rate_ctrl_lock){+.-.}-{2:2} -> (&mvm_sta->deflink.lq_sta.rs_drv.pers.lock){+.+.}-{2:2}

but this new dependency connects a SOFTIRQ-irq-safe lock:
 (&sta->rate_ctrl_lock){+.-.}-{2:2}
etc. etc. etc.

Changing the spin_lock() in rs_drv_get_rate() to spin_lock_bh() was not
enough to pacify lockdep, but changing them all on pers.lock has worked.

Fixes: a8938bc881d2 ("wifi: iwlwifi: mvm: Add locking to the rate read flow")
Signed-off-by: Hugh Dickins <hughd@google.com>
Link: https://lore.kernel.org/r/79ffcc22-9775-cb6d-3ffd-1a517c40beef@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agowifi: rtw88: add missing unwind goto for __rtw_download_firmware()
Ping-Ke Shih [Wed, 7 Jun 2023 01:27:41 +0000 (09:27 +0800)]
wifi: rtw88: add missing unwind goto for __rtw_download_firmware()

This flaw is detected by smatch:
  drivers/net/wireless/realtek/rtw88/mac.c:748 __rtw_download_firmware()
  warn: missing unwind goto?

Though most things of dlfw_fail have been done by
download_firmware_end_flow() and wlan_cpu_enable(), an exception is that
download_firmware_end_flow() clear BIT_MCUFWDL_EN bit conditionally.
So, make this change to clear the bit.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202306052310.OVhcUjZ3-lkp@intel.com/
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230607012741.10353-1-pkshih@realtek.com
12 months agowifi: mac80211: fragment per STA profile correctly
Benjamin Berg [Sun, 11 Jun 2023 09:14:29 +0000 (12:14 +0300)]
wifi: mac80211: fragment per STA profile correctly

When fragmenting the ML per STA profile, the element ID should be
IEEE80211_MLE_SUBELEM_PER_STA_PROFILE rather than WLAN_EID_FRAGMENT.

Change the helper function to take the to be used element ID and pass
the appropriate value for each of the fragmentation levels.

Fixes: 81151ce462e5 ("wifi: mac80211: support MLO authentication/association with one link")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230611121219.9b5c793d904b.I7dad952bea8e555e2f3139fbd415d0cd2b3a08c3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 months agoMerge branch 'mptcp-unify-pm-interfaces'
Jakub Kicinski [Sat, 10 Jun 2023 07:06:01 +0000 (00:06 -0700)]
Merge branch 'mptcp-unify-pm-interfaces'

Matthieu Baerts says:

====================
mptcp: unify PM interfaces

These patches from Geliang better isolate the two MPTCP path-managers by
avoiding calling userspace PM functions from the in-kernel PM. Instead,
new functions declared in pm.c directly dispatch to the right PM.

In addition to have a clearer code, this also avoids a bit of duplicated
checks.

This is a refactoring, there is no behaviour change intended here.
====================

Link: https://lore.kernel.org/r/20230608-upstream-net-next-20230608-mptcp-unify-pm-interfaces-v1-0-b301717c9ff5@tessares.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12 months agomptcp: unify pm set_flags interfaces
Geliang Tang [Thu, 8 Jun 2023 13:20:52 +0000 (15:20 +0200)]
mptcp: unify pm set_flags interfaces

This patch unifies the three PM set_flags() interfaces:

mptcp_pm_nl_set_flags() in mptcp/pm_netlink.c for the in-kernel PM and
mptcp_userspace_pm_set_flags() in mptcp/pm_userspace.c for the
userspace PM.

They'll be switched in the common PM infterface mptcp_pm_set_flags() in
mptcp/pm.c based on whether token is NULL or not.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12 months agomptcp: unify pm get_flags_and_ifindex_by_id
Geliang Tang [Thu, 8 Jun 2023 13:20:51 +0000 (15:20 +0200)]
mptcp: unify pm get_flags_and_ifindex_by_id

This patch unifies the three PM get_flags_and_ifindex_by_id() interfaces:

mptcp_pm_nl_get_flags_and_ifindex_by_id() in mptcp/pm_netlink.c for the
in-kernel PM and mptcp_userspace_pm_get_flags_and_ifindex_by_id() in
mptcp/pm_userspace.c for the userspace PM.

They'll be switched in the common PM infterface
mptcp_pm_get_flags_and_ifindex_by_id() in mptcp/pm.c based on whether
mptcp_pm_is_userspace() or not.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12 months agomptcp: unify pm get_local_id interfaces
Geliang Tang [Thu, 8 Jun 2023 13:20:50 +0000 (15:20 +0200)]
mptcp: unify pm get_local_id interfaces

This patch unifies the three PM get_local_id() interfaces:

mptcp_pm_nl_get_local_id() in mptcp/pm_netlink.c for the in-kernel PM and
mptcp_userspace_pm_get_local_id() in mptcp/pm_userspace.c for the
userspace PM.

They'll be switched in the common PM infterface mptcp_pm_get_local_id()
in mptcp/pm.c based on whether mptcp_pm_is_userspace() or not.

Also put together the declarations of these three functions in protocol.h.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12 months agomptcp: export local_address
Geliang Tang [Thu, 8 Jun 2023 13:20:49 +0000 (15:20 +0200)]
mptcp: export local_address

Rename local_address() with "mptcp_" prefix and export it in protocol.h.

This function will be re-used in the common PM code (pm.c) in the
following commit.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12 months agoMerge tag 'wireless-next-2023-06-09' of git://git.kernel.org/pub/scm/linux/kernel...
Jakub Kicinski [Sat, 10 Jun 2023 06:26:55 +0000 (23:26 -0700)]
Merge tag 'wireless-next-2023-06-09' of git://git./linux/kernel/git/wireless/wireless-next

Kalle Valo says:

====================
wireless-next patches for v6.5

The second pull request for v6.5. We have support for three new
Realtek chipsets, all from different generations. Shows how active
Realtek development is right now, even older generations are being
worked on.

Note: We merged wireless into wireless-next to avoid complex conflicts
between the trees.

Major changes:

rtl8xxxu
 - RTL8192FU support

rtw89
 - RTL8851BE support

rtw88
 - RTL8723DS support

ath11k
 - Multiple Basic Service Set Identifier (MBSSID) and Enhanced MBSSID
   Advertisement (EMA) support in AP mode

iwlwifi
 - support for segmented PNVM images and power tables
 - new vendor entries for PPAG (platform antenna gain) feature

cfg80211/mac80211
 - more Multi-Link Operation (MLO) support such as hardware restart
 - fixes for a potential work/mutex deadlock and with it beginnings of
   the previously discussed locking simplifications

* tag 'wireless-next-2023-06-09' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (162 commits)
  wifi: rtlwifi: remove misused flag from HAL data
  wifi: rtlwifi: remove unused dualmac control leftovers
  wifi: rtlwifi: remove unused timer and related code
  wifi: rsi: Do not set MMC_PM_KEEP_POWER in shutdown
  wifi: rsi: Do not configure WoWlan in shutdown hook if not enabled
  wifi: brcmfmac: Detect corner error case earlier with log
  wifi: rtw89: 8852c: update RF radio A/B parameters to R63
  wifi: rtw89: 8852c: update TX power tables to R63 with 6 GHz power type (3 of 3)
  wifi: rtw89: 8852c: update TX power tables to R63 with 6 GHz power type (2 of 3)
  wifi: rtw89: 8852c: update TX power tables to R63 with 6 GHz power type (1 of 3)
  wifi: rtw89: process regulatory for 6 GHz power type
  wifi: rtw89: regd: update regulatory map to R64-R40
  wifi: rtw89: regd: judge 6 GHz according to chip and BIOS
  wifi: rtw89: refine clearing supported bands to check 2/5 GHz first
  wifi: rtw89: 8851b: configure CRASH_TRIGGER feature for 8851B
  wifi: rtw89: set TX power without precondition during setting channel
  wifi: rtw89: debug: txpwr table access only valid page according to chip
  wifi: rtw89: 8851b: enable hw_scan support
  wifi: cfg80211: move scan done work to wiphy work
  wifi: cfg80211: move sched scan stop to wiphy work
  ...
====================

Link: https://lore.kernel.org/r/87bkhohkbg.fsf@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agoMerge branch 'tools-ynl-gen-code-gen-improvements-before-ethtool'
Jakub Kicinski [Fri, 9 Jun 2023 21:40:33 +0000 (14:40 -0700)]
Merge branch 'tools-ynl-gen-code-gen-improvements-before-ethtool'

Jakub Kicinski says:

====================
tools: ynl-gen: code gen improvements before ethtool

I was going to post ethtool but I couldn't stand the ugliness
of the if conditions which were previously generated.
So I cleaned that up and improved a number of other things
ethtool will benefit from.
====================

Link: https://lore.kernel.org/r/20230608211200.1247213-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agotools: ynl-gen: support / skip pads on the way to kernel
Jakub Kicinski [Thu, 8 Jun 2023 21:12:00 +0000 (14:12 -0700)]
tools: ynl-gen: support / skip pads on the way to kernel

Kernel does not have padding requirements for 64b attrs.
We can ignore pad attrs.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agotools: ynl-gen: don't pass op_name to RenderInfo
Jakub Kicinski [Thu, 8 Jun 2023 21:11:59 +0000 (14:11 -0700)]
tools: ynl-gen: don't pass op_name to RenderInfo

The op_name argument is barely used and identical to op.name
in all cases.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agotools: ynl-gen: support code gen for events
Jakub Kicinski [Thu, 8 Jun 2023 21:11:58 +0000 (14:11 -0700)]
tools: ynl-gen: support code gen for events

Netlink specs support both events and notifications (former can
define their own message contents). Plug in missing code to
generate types, parsers and include events into notification
tables.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agotools: ynl-gen: sanitize notification tracking
Jakub Kicinski [Thu, 8 Jun 2023 21:11:57 +0000 (14:11 -0700)]
tools: ynl-gen: sanitize notification tracking

Don't modify the raw dicts (as loaded from YAML) to pretend
that the notify attributes also exist on the ops. This makes
the code easier to follow.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agotools: ynl: regen: stop generating common notification handlers
Jakub Kicinski [Thu, 8 Jun 2023 21:11:56 +0000 (14:11 -0700)]
tools: ynl: regen: stop generating common notification handlers

Remove unused notification handlers.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agotools: ynl-gen: stop generating common notification handlers
Jakub Kicinski [Thu, 8 Jun 2023 21:11:55 +0000 (14:11 -0700)]
tools: ynl-gen: stop generating common notification handlers

Common notification handler was supposed to be a way for the user
to parse the notifications from a socket synchronously.
I don't think we'll end up using it, ynl_ntf_check() works for
all known use cases.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agotools: ynl: regen: regenerate the if ladders
Jakub Kicinski [Thu, 8 Jun 2023 21:11:54 +0000 (14:11 -0700)]
tools: ynl: regen: regenerate the if ladders

Renegate the code to combine } and else and use tmp variable
to store type.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agotools: ynl-gen: get attr type outside of if()
Jakub Kicinski [Thu, 8 Jun 2023 21:11:53 +0000 (14:11 -0700)]
tools: ynl-gen: get attr type outside of if()

Reading attr type with mnl_attr_get_type() for each condition
leads to most conditions being longer than 80 chars.
Avoid this by reading the type to a variable on the stack.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agotools: ynl-gen: combine else with closing bracket
Jakub Kicinski [Thu, 8 Jun 2023 21:11:52 +0000 (14:11 -0700)]
tools: ynl-gen: combine else with closing bracket

Code gen currently prints:

  }
  else if (...

This is really ugly. Fix it by delaying printing of closing
brackets in anticipation of else coming along.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agotools: ynl-gen: complete the C keyword list
Jakub Kicinski [Thu, 8 Jun 2023 21:11:51 +0000 (14:11 -0700)]
tools: ynl-gen: complete the C keyword list

C keywords need to be avoided when naming things.
Complete the list (ethtool has at least one thing called "auto").

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agotools: ynl: regen: cleanup user space header includes
Jakub Kicinski [Thu, 8 Jun 2023 21:11:50 +0000 (14:11 -0700)]
tools: ynl: regen: cleanup user space header includes

Remove unnecessary includes.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agotools: ynl-gen: cleanup user space header includes
Jakub Kicinski [Thu, 8 Jun 2023 21:11:49 +0000 (14:11 -0700)]
tools: ynl-gen: cleanup user space header includes

Bots started screaming that we're including stdlib.h twice.
While at it move string.h into a common spot and drop stdio.h
which we don't need.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5464
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5466
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5467
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agoRevert "tools: ynl: Remove duplicated include in handshake-user.c"
Jakub Kicinski [Fri, 9 Jun 2023 18:00:59 +0000 (11:00 -0700)]
Revert "tools: ynl: Remove duplicated include in handshake-user.c"

This reverts commit e7c5433c5aaab52ddd5448967a9a5db94a3939cc.

Commit e7c5433c5aaa ("tools: ynl: Remove duplicated include
in handshake-user.c") was applied too hastily. It changes
an auto-generated file, and there's already a proper fix
on the list.

Link: https://lore.kernel.org/all/ZIMPLYi%2FxRih+DlC@nanopsycho/
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 months agowifi: mac80211: Use active_links instead of valid_links in Tx
Ilan Peer [Thu, 8 Jun 2023 13:36:07 +0000 (16:36 +0300)]
wifi: mac80211: Use active_links instead of valid_links in Tx

Fix few places on the Tx path where the valid_links were used instead
of active links.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.e24832691fc8.I9ac10dc246d7798a8d26b1a94933df5668df63fc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agowifi: cfg80211: remove links only on AP
Johannes Berg [Thu, 8 Jun 2023 13:36:04 +0000 (16:36 +0300)]
wifi: cfg80211: remove links only on AP

Since links are only controlled by userspace via cfg80211
in AP mode, also only remove them from the driver in that
case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.ed65b94916fa.I2458c46888284cc5ce30715fe642bc5fc4340c8f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agowifi: mac80211: take lock before setting vif links
Benjamin Berg [Thu, 8 Jun 2023 13:36:02 +0000 (16:36 +0300)]
wifi: mac80211: take lock before setting vif links

ieee80211_vif_set_links requires the sdata->local->mtx lock to be held.
Add the appropriate locking around the calls in both the link add and
remove handlers.

This causes a warning when e.g. ieee80211_link_release_channel is called
via ieee80211_link_stop from ieee80211_vif_update_links.

Fixes: 0d8c4a3c8688 ("wifi: mac80211: implement add/del interface link callbacks")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.fa0c6597fdad.I83dd70359f6cda30f86df8418d929c2064cf4995@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agowifi: cfg80211: fix link del callback to call correct handler
Benjamin Berg [Thu, 8 Jun 2023 13:36:01 +0000 (16:36 +0300)]
wifi: cfg80211: fix link del callback to call correct handler

The wrapper function was incorrectly calling the add handler instead of
the del handler. This had no negative side effect as the default
handlers are essentially identical.

Fixes: f2a0290b2df2 ("wifi: cfg80211: add optional link add/remove callbacks")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.ebd00e000459.Iaff7dc8d1cdecf77f53ea47a0e5080caa36ea02a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agowifi: mac80211: fix link activation settings order
Johannes Berg [Thu, 8 Jun 2023 13:35:59 +0000 (16:35 +0300)]
wifi: mac80211: fix link activation settings order

In the normal MLME code we always call
ieee80211_mgd_set_link_qos_params() before
ieee80211_link_info_change_notify() and some drivers,
notably iwlwifi, rely on that as they don't do anything
(but store the data) in their conf_tx.

Fix the order here to be the same as in the normal code
paths, so this isn't broken.

Fixes: 3d9011029227 ("wifi: mac80211: implement link switching")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230608163202.a2a86bba2f80.Iac97e04827966d22161e63bb6e201b4061e9651b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agowifi: cfg80211: fix double lock bug in reg_wdev_chan_valid()
Dan Carpenter [Fri, 9 Jun 2023 10:48:44 +0000 (13:48 +0300)]
wifi: cfg80211: fix double lock bug in reg_wdev_chan_valid()

The locking was changed recently so now the caller holds the wiphy_lock()
lock.  Taking the lock inside the reg_wdev_chan_valid() function will
lead to a deadlock.

Fixes: f7e60032c661 ("wifi: cfg80211: fix locking in regulatory disconnect")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/40c4114a-6cb4-4abf-b013-300b598aba65@moroto.mountain
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 months agotools: ynl: Remove duplicated include in handshake-user.c
Yang Li [Thu, 8 Jun 2023 08:31:48 +0000 (16:31 +0800)]
tools: ynl: Remove duplicated include in handshake-user.c

./tools/net/ynl/generated/handshake-user.c: stdlib.h is included more than once.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5464
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 months agoMerge branch 'broadcom-phy-led-brightness'
David S. Miller [Fri, 9 Jun 2023 09:38:44 +0000 (10:38 +0100)]
Merge branch 'broadcom-phy-led-brightness'

Florian Fainelli says:

====================
LED brightness support for Broadcom PHYs

This patch series adds support for controlling the LED brightness on
Broadcom PHYs.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
13 months agonet: phy: broadcom: Add support for setting LED brightness
Florian Fainelli [Wed, 7 Jun 2023 18:34:53 +0000 (11:34 -0700)]
net: phy: broadcom: Add support for setting LED brightness

Broadcom PHYs have two LEDs selector registers which allow us to control
the LED assignment, including how to turn them on/off.

Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 months agonet: phy: broadcom: Rename LED registers
Florian Fainelli [Wed, 7 Jun 2023 18:34:52 +0000 (11:34 -0700)]
net: phy: broadcom: Rename LED registers

These registers are common to most PHYs and are not specific to the
BCM5482, renamed the constants accordingly, no functional change.

Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 months agoMerge branch 'net-ncsi-refactoring-for-GMA-cmd'
David S. Miller [Fri, 9 Jun 2023 09:32:51 +0000 (10:32 +0100)]
Merge branch 'net-ncsi-refactoring-for-GMA-cmd'

Ivan Mikhaylov says:

====================
net/ncsi: refactoring for GMA command

Make one GMA function for all manufacturers, change ndo_set_mac_address
to dev_set_mac_address for notifiying net layer about MAC change which
ndo_set_mac_address doesn't do.

Changes from v1:
1. delete ftgmac100.txt changes about mac-address-increment
2. add convert to yaml from ftgmac100.txt
3. add mac-address-increment option for ethernet-controller.yaml

Changes from v2:
1. remove DT changes from series, will be done in another one
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
13 months agonet/ncsi: change from ndo_set_mac_address to dev_set_mac_address
Ivan Mikhaylov [Wed, 7 Jun 2023 15:17:42 +0000 (18:17 +0300)]
net/ncsi: change from ndo_set_mac_address to dev_set_mac_address

Change ndo_set_mac_address to dev_set_mac_address because
dev_set_mac_address provides a way to notify network layer about MAC
change. In other case, services may not aware about MAC change and keep
using old one which set from network adapter driver.

As example, DHCP client from systemd do not update MAC address without
notification from net subsystem which leads to the problem with acquiring
the right address from DHCP server.

Fixes: cb10c7c0dfd9e ("net/ncsi: Add NCSI Broadcom OEM command")
Cc: stable@vger.kernel.org # v6.0+ 2f38e84 net/ncsi: make one oem_gma function for all mfr id
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>