linux-block.git
8 months agoRevert "wifi: iwlegacy: do not skip frames with bad FCS"
Kalle Valo [Tue, 12 Nov 2024 14:24:19 +0000 (16:24 +0200)]
Revert "wifi: iwlegacy: do not skip frames with bad FCS"

This reverts commit 02b682d54598f61cbb7dbb14d98ec1801112b878.

Alf reports that this commit causes the connection to eventually die on
iwl4965. The reason is that rx_status.flag is zeroed after
RX_FLAG_FAILED_FCS_CRC is set and mac80211 doesn't know the received frame is
corrupted.

Fixes: 02b682d54598 ("wifi: iwlegacy: do not skip frames with bad FCS")
Reported-by: Alf Marius <post@alfmarius.net>
Closes: https://lore.kernel.org/r/60f752e8-787e-44a8-92ae-48bdfc9b43e7@app.fastmail.com/
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241112142419.1023743-1-kvalo@kernel.org
8 months agowifi: mac80211: pass MBSSID config by reference
Johannes Berg [Fri, 8 Nov 2024 08:22:27 +0000 (09:22 +0100)]
wifi: mac80211: pass MBSSID config by reference

It's inefficient and confusing to pass the MBSSID config
by value, requiring the whole struct to be copied. Pass
it by reference instead.

Link: https://patch.msgid.link/20241108092227.48fbd8a00112.I64abc1296a7557aadf798d88db931024486ab3b6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: mac80211: Support EHT 1024 aggregation size in TX
MeiChia Chiu [Tue, 12 Nov 2024 08:38:46 +0000 (16:38 +0800)]
wifi: mac80211: Support EHT 1024 aggregation size in TX

Support EHT 1024 aggregation size in TX

The 1024 agg size for RX is supported but not for TX.
This patch adds this support and refactors common parsing logics for
addbaext in both process_addba_resp and process_addba_req into a
function.

Reviewed-by: Shayne Chen <shayne.chen@mediatek.com>
Reviewed-by: Money Wang <money.wang@mediatek.com>
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
Link: https://patch.msgid.link/20241112083846.32063-1-MeiChia.Chiu@mediatek.com
[pass elems/len instead of mgmt/len/is_req]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agonet: rfkill: gpio: Add check for clk_enable()
Mingwei Zheng [Fri, 8 Nov 2024 19:53:41 +0000 (14:53 -0500)]
net: rfkill: gpio: Add check for clk_enable()

Add check for the return value of clk_enable() to catch the potential
error.

Fixes: 7176ba23f8b5 ("net: rfkill: add generic gpio rfkill driver")
Signed-off-by: Mingwei Zheng <zmw12306@gmail.com>
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Link: https://patch.msgid.link/20241108195341.1853080-1-zmw12306@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: brcmfmac: Fix oops due to NULL pointer dereference in brcmf_sdiod_sglist_rw()
Norbert van Bolhuis [Thu, 7 Nov 2024 13:28:13 +0000 (14:28 +0100)]
wifi: brcmfmac: Fix oops due to NULL pointer dereference in brcmf_sdiod_sglist_rw()

This patch fixes a NULL pointer dereference bug in brcmfmac that occurs
when a high 'sd_sgentry_align' value applies (e.g. 512) and a lot of queued SKBs
are sent from the pkt queue.

The problem is the number of entries in the pre-allocated sgtable, it is
nents = max(rxglom_size, txglom_size) + max(rxglom_size, txglom_size) >> 4 + 1.
Given the default [rt]xglom_size=32 it's actually 35 which is too small.
Worst case, the pkt queue can end up with 64 SKBs. This occurs when a new SKB
is added for each original SKB if tailroom isn't enough to hold tail_pad.
At least one sg entry is needed for each SKB. So, eventually the "skb_queue_walk loop"
in brcmf_sdiod_sglist_rw may run out of sg entries. This makes sg_next return
NULL and this causes the oops.

The patch sets nents to max(rxglom_size, txglom_size) * 2 to be able handle
the worst-case.
Btw. this requires only 64-35=29 * 16 (or 20 if CONFIG_NEED_SG_DMA_LENGTH) = 464
additional bytes of memory.

Signed-off-by: Norbert van Bolhuis <nvbolhuis@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241107132903.13513-1-nvbolhuis@gmail.com
8 months agowifi: Switch back to struct platform_driver::remove()
Uwe Kleine-König [Wed, 6 Nov 2024 17:07:06 +0000 (18:07 +0100)]
wifi: Switch back to struct platform_driver::remove()

After commit 0edb555a65d1 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.

Convert all platform drivers below drivers/net/wireless to use
.remove(), with the eventual goal to drop struct
platform_driver::remove_new(). As .remove() and .remove_new() have the
same prototypes, conversion is done by just changing the structure
member name in the driver initializer.

En passant several whitespace changes are done to make indentation
consistent in the struct initializers.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Acked-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241106170706.38922-2-u.kleine-koenig@baylibre.com
8 months agowifi: ipw2x00: libipw_rx_any(): fix bad alignment
Jiapeng Chong [Fri, 1 Nov 2024 06:07:25 +0000 (14:07 +0800)]
wifi: ipw2x00: libipw_rx_any(): fix bad alignment

This patch fixes incorrect code alignment.

./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:871:2-3: code aligned with following code on line 882.
./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:886:2-3: code aligned with following code on line 900.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11381
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241101060725.54640-1-jiapeng.chong@linux.alibaba.com
8 months agowifi: brcmfmac: release 'root' node in all execution paths
Javier Carrasco [Wed, 30 Oct 2024 17:34:45 +0000 (18:34 +0100)]
wifi: brcmfmac: release 'root' node in all execution paths

The fixed patch introduced an additional condition to enter the scope
where the 'root' device_node is released (!settings->board_type,
currently 'err'), which avoid decrementing the refcount with a call to
of_node_put() if that second condition is not satisfied.

Move the call to of_node_put() to the point where 'root' is no longer
required to avoid leaking the resource if err is not zero.

Cc: stable@vger.kernel.org
Fixes: 7682de8b3351 ("wifi: brcmfmac: of: Fetch Apple properties")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241030-brcmfmac-of-cleanup-v1-1-0b90eefb4279@gmail.com
8 months agoMerge tag 'rtw-next-2024-11-06' of https://github.com/pkshih/rtw
Kalle Valo [Mon, 11 Nov 2024 11:07:21 +0000 (13:07 +0200)]
Merge tag 'rtw-next-2024-11-06' of https://github.com/pkshih/rtw

rtw-next patches for v6.13

Major changes are listed:

rtw88:
 - support two USB adapters 8821au and 8812au

rtw89:
 - add thermal protection
 - fine tune BT-coexsitence to improve user experience
 - firmware secure boot for WiFi 6 chip
 - more materials for MLO

8 months agowifi: iwlwifi: mvm: don't call power_update_mac in fast suspend
Emmanuel Grumbach [Mon, 28 Oct 2024 11:54:59 +0000 (13:54 +0200)]
wifi: iwlwifi: mvm: don't call power_update_mac in fast suspend

We don't have any interface anyway.
Trying to send a command after the D3_CONFIG command is also a really
bad idea.
No harm done since this function wouldn't send anything to the firmware
anyway.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241028135215.2636b358c870.I36717b4cff98eaa79182e0f3b5404f71aeeaf2f9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: s/IWL_MVM_INVALID_STA/IWL_INVALID_STA
Miri Korenblit [Mon, 28 Oct 2024 11:54:58 +0000 (13:54 +0200)]
wifi: iwlwifi: s/IWL_MVM_INVALID_STA/IWL_INVALID_STA

This is not mvm specific

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241028135215.acb45e8c4a78.I58736fd85d82a1fe641e75037b77878854a91e50@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: bump minimum API version in BZ/SC to 92
Miri Korenblit [Mon, 28 Oct 2024 11:54:57 +0000 (13:54 +0200)]
wifi: iwlwifi: bump minimum API version in BZ/SC to 92

Stop supporting older FWs.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241028135215.525fe67393b6.Idbb031cf68d04b7c0c2b9fbc7d79181c538994f6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: move IWL_LMAC_*_INDEX to fw/api/context.h
Miri Korenblit [Mon, 28 Oct 2024 11:54:56 +0000 (13:54 +0200)]
wifi: iwlwifi: move IWL_LMAC_*_INDEX to fw/api/context.h

Those macros are currently in fw/api/binding.h, which should really not
be included in newer code, where this API is not used.
Just move it.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20241028135215.48443f1c1819.I1cfe8c6c58153031d44f81edc0f8731077666355@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: be less noisy if the NIC is dead in S3
Emmanuel Grumbach [Mon, 28 Oct 2024 11:54:55 +0000 (13:54 +0200)]
wifi: iwlwifi: be less noisy if the NIC is dead in S3

If the NIC is dead upon resume, try to catch the error earlier and exit
earlier. We'll print less error messages and get to the same recovery
path as before: reload the firmware.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241028135215.3a18682261e5.I18f336a4537378a4c1a8537d7246cee1fc82b42c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: mvm: tell iwlmei when we finished suspending
Emmanuel Grumbach [Mon, 28 Oct 2024 11:54:54 +0000 (13:54 +0200)]
wifi: iwlwifi: mvm: tell iwlmei when we finished suspending

Since we no longer shut down the device in suspend, we also no longer
call iwl_mvm_mei_device_state() and this is a problem because iwlmei
expects this to be called when it runs its own suspend sequence. It
checks mei->device_down in iwl_mei_remove() which is called upon
suspend.

Fix this by telling iwlmei when we're done accessing the device.
When we'll wake up, the device should be untouched if CSME didn't use it
during the suspend time. If CSME used it, we'll notice it through the
CSR_FUNC_SCRATCH register.

Fixes: e8bb19c1d590 ("wifi: iwlwifi: support fast resume")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241028135215.525287b90af2.Ibf183824471ea5580d9276d104444e53191e6900@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: allow fast resume on ax200
Emmanuel Grumbach [Mon, 28 Oct 2024 11:54:53 +0000 (13:54 +0200)]
wifi: iwlwifi: allow fast resume on ax200

This feature can be used on ax200 as well. It'll avoid to restart the
firmware upon suspend / resume flow. Doing so also avoids releasing and
re-allocating all the device related memory which makes the memory's
subsystem task easier.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241028135215.514efe0ce4c7.I60061277526302a75cadbba10452e94c54763f13@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: mvm: support new initiator and responder command version
Avraham Stern [Mon, 28 Oct 2024 11:54:52 +0000 (13:54 +0200)]
wifi: iwlwifi: mvm: support new initiator and responder command version

Add support for range_request_cmd version 15. This version adds a
testing option flag to use bad secure LTF Tx key. The command struct
itself is not changed.
Add support for responder config command version 11. This version only
adds a flag which is part of the MVM_FTM_RESP_FLAGS and does not
require any special handling.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241028135215.264826832f16.Iad4fdcd177a9c4bcb0839d3f87c793b4f83eb2c7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: mvm: use wiphy locked debugfs for low-latency
Johannes Berg [Mon, 28 Oct 2024 11:54:51 +0000 (13:54 +0200)]
wifi: iwlwifi: mvm: use wiphy locked debugfs for low-latency

This will call into the OMI control path soon, and that will
require the wiphy mutex to be held. The files are removed by
mac80211 under wiphy mutex, so we must use the wiphy-locked
debugfs for 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/20241028135215.c62e23392400.Ifcb652d324bc60b7144fdf277d7989bede9e54d5@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: mvm: MLO scan upon channel condition degradation
Emmanuel Grumbach [Mon, 28 Oct 2024 11:54:50 +0000 (13:54 +0200)]
wifi: iwlwifi: mvm: MLO scan upon channel condition degradation

This will allow to prevent disconnections.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241028135215.6402718fbc94.Ia6ce651cc7c96f7aaeee449737dd28ed291788a6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: mvm: support new versions of the wowlan APIs
Emmanuel Grumbach [Mon, 28 Oct 2024 11:54:49 +0000 (13:54 +0200)]
wifi: iwlwifi: mvm: support new versions of the wowlan APIs

Add support version 7 of wowlan_config_cmd and version 5 of
iwl_wowlan_info_notif

This version is mainly a cleanup of the previous version.
Two fields were removed as the device already handled this data.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241028135215.d2afdf720073.I9901c8c4ad4508135d019efa213b1430acc70746@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: mvm: allow always calling iwl_mvm_get_bss_vif()
Johannes Berg [Mon, 28 Oct 2024 11:54:48 +0000 (13:54 +0200)]
wifi: iwlwifi: mvm: allow always calling iwl_mvm_get_bss_vif()

Allow calling iwl_mvm_get_bss_vif() without getting an error
message if multiple vifs are active etc., this is much easier
than having to check beforehand (which would be effectively
the same code as the function itself.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241028135215.a343824e2c61.Ib92534f17c63630aa2eb0604fd80dbae20077487@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: mvm: unify link info initialization
Johannes Berg [Mon, 28 Oct 2024 11:54:47 +0000 (13:54 +0200)]
wifi: iwlwifi: mvm: unify link info initialization

Move the link info initialization to a common function so
that it can be modified more easily later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241028135215.ab963cc90e56.Ice5cf66dec8351f8e94ca4c5b3a27e9311d0c20a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: iwlwifi: mvm: clarify fw_id_to_link_sta protection
Johannes Berg [Mon, 28 Oct 2024 11:54:46 +0000 (13:54 +0200)]
wifi: iwlwifi: mvm: clarify fw_id_to_link_sta protection

This is written only with wiphy and mvm mutexes held, but in
order to actually rely on that document it and add lockdep
assertions to ensure 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/20241028135215.a6c6aa4147cf.If7f1b30a7b92ce5e9226e8972201a20aa9905108@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: cfg80211: Fix an error handling path in nl80211_start_ap()
Christophe JAILLET [Sat, 26 Oct 2024 15:34:49 +0000 (17:34 +0200)]
wifi: cfg80211: Fix an error handling path in nl80211_start_ap()

All error handling paths go to "out", except this one. Before the
commit in Fixes, error in the previous code would also end to "out",
freeing the memory.

Move the code up to avoid the leak.

Fixes: 62262dd00c31 ("wifi: cfg80211: disallow SMPS in AP mode")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/eae54ce066d541914f272b10cab7b263c08eced3.1729956868.git.christophe.jaillet@wanadoo.fr
[move code, update commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: nl80211: fix bounds checker error in nl80211_parse_sched_scan
Aleksei Vetrov [Tue, 29 Oct 2024 13:22:11 +0000 (13:22 +0000)]
wifi: nl80211: fix bounds checker error in nl80211_parse_sched_scan

The channels array in the cfg80211_scan_request has a __counted_by
attribute attached to it, which points to the n_channels variable. This
attribute is used in bounds checking, and if it is not set before the
array is filled, then the bounds sanitizer will issue a warning or a
kernel panic if CONFIG_UBSAN_TRAP is set.

This patch sets the size of allocated memory as the initial value for
n_channels. It is updated with the actual number of added elements after
the array is filled.

Fixes: aa4ec06c455d ("wifi: cfg80211: use __counted_by where appropriate")
Cc: stable@vger.kernel.org
Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://patch.msgid.link/20241029-nl80211_parse_sched_scan-bounds-checker-fix-v2-1-c804b787341f@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: cfg80211: Remove the Medium Synchronization Delay validity check
Lingbo Kong [Thu, 31 Oct 2024 13:42:23 +0000 (21:42 +0800)]
wifi: cfg80211: Remove the Medium Synchronization Delay validity check

Currently, when the driver attempts to connect to an AP MLD with multiple
APs, the cfg80211_mlme_check_mlo_compat() function requires the Medium
Synchronization Delay values from different APs of the same AP MLD to be
equal, which may result in connection failures.

This is because when the driver receives a multi-link probe response from
an AP MLD with multiple APs, cfg80211 updates the Elements for each AP
based on the multi-link probe response. If the Medium Synchronization Delay
is set in the multi-link probe response, the Elements for each AP belonging
to the same AP MLD will have the Medium Synchronization Delay set
simultaneously. If non-multi-link probe responses are received from
different APs of the same MLD AP, cfg80211 will still update the Elements
based on the non-multi-link probe response. Since the non-multi-link probe
response does not set the Medium Synchronization Delay
(IEEE 802.11be-2024-35.3.4.4), if the Elements from a non-multi-link probe
response overwrite those from a multi-link probe response that has set the
Medium Synchronization Delay, the Medium Synchronization Delay values for
APs belonging to the same AP MLD will not be equal. This discrepancy causes
the cfg80211_mlme_check_mlo_compat() function to fail, leading to
connection failures. Commit ccb964b4ab16
("wifi: cfg80211: validate MLO connections better") did not take this into
account.

To address this issue, remove this validity check.

Fixes: ccb964b4ab16 ("wifi: cfg80211: validate MLO connections better")
Signed-off-by: Lingbo Kong <quic_lingbok@quicinc.com>
Link: https://patch.msgid.link/20241031134223.970-1-quic_lingbok@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: mac80211: fix description of ieee80211_set_active_links() for new sequence
Zong-Zhe Yang [Fri, 1 Nov 2024 08:21:43 +0000 (16:21 +0800)]
wifi: mac80211: fix description of ieee80211_set_active_links() for new sequence

The sequence of calls has changed, but the description is inconsistent.
So, fix the description.

Fixes: 188a1bf89432 ("wifi: mac80211: re-order assigning channel in activate links")
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Link: https://patch.msgid.link/20241101082143.11138-1-kevin_yang@realtek.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 months agowifi: rtlwifi: Remove some exhalbtc deadcode
Dr. David Alan Gilbert [Mon, 4 Nov 2024 14:43:31 +0000 (14:43 +0000)]
wifi: rtlwifi: Remove some exhalbtc deadcode

exhalbtc_rf_status_notify(), exhalbtc_coex_dm_switch() and
exhalbtc_antenna_detection() are unused since they were added in 2017's
commit 7937f02d1953 ("rtlwifi: btcoex: hook external functions for newer
chips")

Remove them.

This leaves ex_btc8723b1ant_coex_dm_reset() unused.

Remove it.

exhalbtc_dbg_control(), exhalbtc_stack_update_profile_info(),
exhalbtc_set_hci_version(), and exhalbtc_set_bt_patch_version() are
unused since their addition in 2014 by
commit aa45a673b291 ("rtlwifi: btcoexist: Add new mini driver")

Remove them.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241104144331.29262-1-linux@treblig.org
8 months agowifi: rtlwifi: Drastically reduce the attempts to read efuse in case of failures
Guilherme G. Piccoli [Fri, 1 Nov 2024 19:30:05 +0000 (16:30 -0300)]
wifi: rtlwifi: Drastically reduce the attempts to read efuse in case of failures

Syzkaller reported a hung task with uevent_show() on stack trace. That
specific issue was addressed by another commit [0], but even with that
fix applied (for example, running v6.12-rc5) we face another type of hung
task that comes from the same reproducer [1]. By investigating that, we
could narrow it to the following path:

(a) Syzkaller emulates a Realtek USB WiFi adapter using raw-gadget and
dummy_hcd infrastructure.

(b) During the probe of rtl8192cu, the driver ends-up performing an efuse
read procedure (which is related to EEPROM load IIUC), and here lies the
issue: the function read_efuse() calls read_efuse_byte() many times, as
loop iterations depending on the efuse size (in our example, 512 in total).

This procedure for reading efuse bytes relies in a loop that performs an
I/O read up to *10k* times in case of failures. We measured the time of
the loop inside read_efuse_byte() alone, and in this reproducer (which
involves the dummy_hcd emulation layer), it takes 15 seconds each. As a
consequence, we have the driver stuck in its probe routine for big time,
exposing a stack trace like below if we attempt to reboot the system, for
example:

task:kworker/0:3 state:D stack:0 pid:662 tgid:662 ppid:2 flags:0x00004000
Workqueue: usb_hub_wq hub_event
Call Trace:
 __schedule+0xe22/0xeb6
 schedule_timeout+0xe7/0x132
 __wait_for_common+0xb5/0x12e
 usb_start_wait_urb+0xc5/0x1ef
 ? usb_alloc_urb+0x95/0xa4
 usb_control_msg+0xff/0x184
 _usbctrl_vendorreq_sync+0xa0/0x161
 _usb_read_sync+0xb3/0xc5
 read_efuse_byte+0x13c/0x146
 read_efuse+0x351/0x5f0
 efuse_read_all_map+0x42/0x52
 rtl_efuse_shadow_map_update+0x60/0xef
 rtl_get_hwinfo+0x5d/0x1c2
 rtl92cu_read_eeprom_info+0x10a/0x8d5
 ? rtl92c_read_chip_version+0x14f/0x17e
 rtl_usb_probe+0x323/0x851
 usb_probe_interface+0x278/0x34b
 really_probe+0x202/0x4a4
 __driver_probe_device+0x166/0x1b2
 driver_probe_device+0x2f/0xd8
 [...]

We propose hereby to drastically reduce the attempts of doing the I/O
reads in case of failures, restricted to USB devices (given that
they're inherently slower than PCIe ones). By retrying up to 10 times
(instead of 10000), we got reponsiveness in the reproducer, while seems
reasonable to believe that there's no sane USB device implementation in
the field requiring this amount of retries at every I/O read in order
to properly work. Based on that assumption, it'd be good to have it
backported to stable but maybe not since driver implementation (the 10k
number comes from day 0), perhaps up to 6.x series makes sense.

[0] Commit 15fffc6a5624 ("driver core: Fix uevent_show() vs driver detach race")

[1] A note about that: this syzkaller report presents multiple reproducers
that differs by the type of emulated USB device. For this specific case,
check the entry from 2024/08/08 06:23 in the list of crashes; the C repro
is available at https://syzkaller.appspot.com/text?tag=ReproC&x=1521fc83980000.

Cc: stable@vger.kernel.org # v6.1+
Reported-by: syzbot+edd9fe0d3a65b14588d5@syzkaller.appspotmail.com
Tested-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241101193412.1390391-1-gpiccoli@igalia.com
8 months agowifi: rtw88: Enable the new RTL8821AU/RTL8812AU drivers
Bitterblue Smith [Wed, 30 Oct 2024 18:31:28 +0000 (20:31 +0200)]
wifi: rtw88: Enable the new RTL8821AU/RTL8812AU drivers

These are older Wifi 5 chips. RTL8821AU is 1x1, with or without
Bluetooth. RTL8812AU is 2x2, without Bluetooth.

Beamforming is not implemented. It looks like these chips need a
different implementation than what is in bf.c.

Speed tests with RTL8821AU: 137 Mbps download, 144 Mbps upload.
Speed tests with RTL8812AU: 344 Mbps download, 387 Mbps upload.

Station mode and AP mode were tested.

Bluetooth coexistence works. I used my Bluetooth headphones for
several days, listening to music and watching videos. There is only
a problem with the wifi speeds with one router:

With ISP's HG6544C router:
Official driver: 3/5 Mbps.
rtw88: a bit more, but not steady at all. Not enough to watch a 1080p
Youtube video.

With my D-Link Eagle R32 router running Openwrt, on the same channel:
Official driver: 6/10 Mbps.
rtw88: download starts around 30, climbs to 50 / upload is 10 Mbps.
I can watch a 1080p Youtube video.

The music doesn't cut out during any speed tests.

I also tested transferring files to and from my phone. I don't have
other types of Bluetooth devices to test.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/0b8e8093-8103-4999-86bf-0055ec52ea64@gmail.com
8 months agowifi: rtw88: Add rtw8821au.c and rtw8812au.c
Bitterblue Smith [Wed, 30 Oct 2024 18:29:28 +0000 (20:29 +0200)]
wifi: rtw88: Add rtw8821au.c and rtw8812au.c

These are the entry points for the new modules rtw88_8821au
(RTL8821AU/RTL8811AU) and rtw88_8812au (RTL8812AU).

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/91c495f8-a607-429b-8bc0-5a45d3c1393e@gmail.com
8 months agowifi: rtw88: Add rtw8812a.{c,h}
Bitterblue Smith [Wed, 30 Oct 2024 18:28:49 +0000 (20:28 +0200)]
wifi: rtw88: Add rtw8812a.{c,h}

These contain code specific to RTL8812AU.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/a0057683-79eb-4ab2-8f74-11a3bc58adfb@gmail.com
8 months agowifi: rtw88: Add rtw8821a.{c,h}
Bitterblue Smith [Wed, 30 Oct 2024 18:28:15 +0000 (20:28 +0200)]
wifi: rtw88: Add rtw8821a.{c,h}

These contain code specific to RTL8821AU.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/37218648-ada7-4fad-b7bd-d2aee28cefb9@gmail.com
8 months agowifi: rtw88: Add rtw88xxa.{c,h}
Bitterblue Smith [Wed, 30 Oct 2024 18:27:39 +0000 (20:27 +0200)]
wifi: rtw88: Add rtw88xxa.{c,h}

These contain code shared by both RTL8821AU and RTL8812AU chips.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/b8590382-a954-412d-a96b-63e360b97acc@gmail.com
8 months agowifi: rtw88: Add rtw8821a_table.{c,h}
Bitterblue Smith [Wed, 30 Oct 2024 18:25:16 +0000 (20:25 +0200)]
wifi: rtw88: Add rtw8821a_table.{c,h}

These contain various arrays for initialising RTL8821AU. Also TX power
limits.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/087c7260-fcc3-4e22-886b-ac477cad9198@gmail.com
8 months agowifi: rtw88: Add rtw8812a_table.{c,h}
Bitterblue Smith [Wed, 30 Oct 2024 18:24:33 +0000 (20:24 +0200)]
wifi: rtw88: Add rtw8812a_table.{c,h}

These contain various arrays for initialising RTL8812AU. Also TX power
limits.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/086f476c-e832-4867-963c-a64a63252fd6@gmail.com
8 months agowifi: rtw89: coex: set higher priority to BT when WL scan and BT A2DP exist
Ching-Te Ku [Thu, 31 Oct 2024 02:30:32 +0000 (10:30 +0800)]
wifi: rtw89: coex: set higher priority to BT when WL scan and BT A2DP exist

If WiFi operation channel & scan channel both at 2.4GHz, original will keep
going at WL > BT priority table for a long time. It makes A2DP can not sent
audio data to SUT device in time then performed a lag audio. Assign
a BT > WL priority table when A2DP exist, to avoid the issue.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241031023032.7102-1-pkshih@realtek.com
8 months agowifi: rtw89: 8852b: change RF mode to normal mode when set channel
Chih-Kang Chang [Wed, 30 Oct 2024 09:16:03 +0000 (17:16 +0800)]
wifi: rtw89: 8852b: change RF mode to normal mode when set channel

Set the RF mode from 0xA(low power mode) to 0x3(Normal mode) to avoid
abnormal TX waveform in OFDM rate. Originally the RF mode will be changed
to normal mode by the firmware after entering LPS once. Therefore, this
change does not affect power saving.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241030091603.6073-1-pkshih@realtek.com
8 months agowifi: rtw89: coex: check NULL return of kmalloc in btc_fw_set_monreg()
Pei Xiao [Wed, 30 Oct 2024 03:20:58 +0000 (11:20 +0800)]
wifi: rtw89: coex: check NULL return of kmalloc in btc_fw_set_monreg()

kmalloc may fail, return value might be NULL and will cause
NULL pointer dereference. Add check NULL return of kmalloc in
btc_fw_set_monreg().

Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Fixes: b952cb0a6e2d ("wifi: rtw89: coex: Add register monitor report v7 format")
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/516a91f3997534f708af43c7592cbafdd53dd599.1730253508.git.xiaopei01@kylinos.cn
8 months agowifi: rtw89: 8922a: fill the missing OP1dB configuration
Kuan-Chung Chen [Wed, 30 Oct 2024 02:29:03 +0000 (10:29 +0800)]
wifi: rtw89: 8922a: fill the missing OP1dB configuration

OP1dB stands for Output 1dB Compression Point. At this point, the power
amplifier starts to enter the saturation region, resulting in distortion.
The configuration of OP1dB can optimize the RX gain saturation region,
improving RX throughput from 573 to 675 Mbps.

Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241030022903.13243-1-pkshih@realtek.com
8 months agowifi: rtw89: mac: no configure CMAC/DMAC tables for firmware secure boot
Ping-Ke Shih [Wed, 30 Oct 2024 02:21:35 +0000 (10:21 +0800)]
wifi: rtw89: mac: no configure CMAC/DMAC tables for firmware secure boot

The initial CMAC/DMAC tables used by WiFi 6 chips are not needed to be
called for firmware secure boot. Otherwise, it causes firmware abnormal
and throw warnings.

  rtw89_8852be 0000:03:00.0: FW status = 0x1400
  rtw89_8852be 0000:03:00.0: FW BADADDR = 0xb872f800
  rtw89_8852be 0000:03:00.0: FW EPC/RA = 0xb89333b7
  rtw89_8852be 0000:03:00.0: FW MISC = 0x0
  rtw89_8852be 0000:03:00.0: R_AX_HALT_C2H = 0x10002010
  rtw89_8852be 0000:03:00.0: R_AX_SER_DBG_INFO = 0x0
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c97
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c95
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c99
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c9b
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c9f
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c9b
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c99
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c9d
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c97
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c97
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c97
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c99
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c97
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c9f
  rtw89_8852be 0000:03:00.0: [ERR]fw PC = 0xb89a2c99

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241030022135.11688-9-pkshih@realtek.com
8 months agowifi: rtw89: fw: use common function to parse security section for WiFi 6 chips
Ping-Ke Shih [Wed, 30 Oct 2024 02:21:34 +0000 (10:21 +0800)]
wifi: rtw89: fw: use common function to parse security section for WiFi 6 chips

The MSSC (multiple security section count) can be regular number (shown in
below figure) or 0xFF (supported already). For WiFi 7 or newer WiFi 6
chips, the MSSC will be 0xFF. But early WiFi 6 chip such as RTL8852B
could be either one of the cases.

Extend __parse_security_section() to support both with/without secure
boot mode accordingly.

           +---------------------------+ -\
           |      firmware header      |  |
           |                           |  |
           | +-----------------------+ |  |
           | | section type/size * N | |  |
           | +-----------------------+ |  |
           +---------------------------+ -/
           :                           :
           +---------------------------+ -\
           | secure section type (ID:9)|  |
           |                           |  |
      +----|-> [ security key data ]   |  |
      |    +---------------------------+ -/
      |    |MSS Pool for above section |
      |    |  [ security key data 1 ]  |
      +----|- [ security key data 2 ]  |
by mss_idx |  [ security key data 3 ]  |
           |  ...                 M    | * M = MSSC (MSSC != 0xFF)
           +---------------------------+

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241030022135.11688-8-pkshih@realtek.com
8 months agowifi: rtw89: fw: move v1 MSSC out of __parse_security_section() to share with v0
Ping-Ke Shih [Wed, 30 Oct 2024 02:21:33 +0000 (10:21 +0800)]
wifi: rtw89: fw: move v1 MSSC out of __parse_security_section() to share with v0

The security section can be a common parser for v0 and v1 format of
firmware header, so move retrieval code of v1 MSSC from the function, and
then sharing becomes possible.

Not logic change at all.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241030022135.11688-7-pkshih@realtek.com
8 months agowifi: rtw89: fw: set recorded IDMEM share mode in firmware header to register
Ping-Ke Shih [Wed, 30 Oct 2024 02:21:32 +0000 (10:21 +0800)]
wifi: rtw89: fw: set recorded IDMEM share mode in firmware header to register

For WiFi 6 chips, firmware secure boot will run on a IDMEM mode specified
in firmware header. Retrieve the mode from firmware, and set to registers
accordingly.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241030022135.11688-6-pkshih@realtek.com
8 months agowifi: rtw89: fw: shrink download size of security section for RTL8852B
Ping-Ke Shih [Wed, 30 Oct 2024 02:21:31 +0000 (10:21 +0800)]
wifi: rtw89: fw: shrink download size of security section for RTL8852B

For RTL8852B, when current firmware is secure boot, the security section
needs a special treatment that shrink its size to 960.

As figure below, not only shrink the amount of download size of security
section (2), but also need to modify the section size in firmware header
(1) that is also downloaded to chip.

   +---------------------------+
   |      firmware header      |
   |                           |
   | +-----------------------+ |
   | | section type, size N -|-|-------+
   | | ...               (1) | |       |
   | +-----------------------+ |       |
   +---------------------------+       | 2048 shrink to 960
   :                           :       |
   +---------------------------+ -\    |
   |  security section type 9  |  |    |
   |           (2)             |  | <--+
   |                           |  |
   +---------------------------+ -/

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241030022135.11688-5-pkshih@realtek.com
8 months agowifi: rtw89: efuse: read firmware secure info v0 from efuse for WiFi 6 chips
Ping-Ke Shih [Wed, 30 Oct 2024 02:21:30 +0000 (10:21 +0800)]
wifi: rtw89: efuse: read firmware secure info v0 from efuse for WiFi 6 chips

WiFi 6 chips could program secure information in v0 or v1 format. Use
existing v1 parser or newly added v0 parser to recognize firmware key
that is going to be used.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241030022135.11688-4-pkshih@realtek.com
8 months agowifi: rtw89: efuse: move recognize firmware MSS info v1 to common
Ping-Ke Shih [Wed, 30 Oct 2024 02:21:29 +0000 (10:21 +0800)]
wifi: rtw89: efuse: move recognize firmware MSS info v1 to common

The WiFi 6 chip use the same firmware MSS information v1 read from efuse,
so move this logic to common.

No change logic at all.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241030022135.11688-3-pkshih@realtek.com
8 months agowifi: rtw89: efuse: move reading efuse of fw secure info to common
Ping-Ke Shih [Wed, 30 Oct 2024 02:21:28 +0000 (10:21 +0800)]
wifi: rtw89: efuse: move reading efuse of fw secure info to common

The secure key used by certain hardware module is programmed in efuse, so
driver should read the information from efuse before downloading firmware.

Originally only RTL8922AE can support firmware secure boot, and read efuse
during chip power on. To extend to support all chips, move the caller to
common power on flow and add separate functions to read efuse for
WiFi 6 chips.

No logic change at all.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241030022135.11688-2-pkshih@realtek.com
8 months agowifi: rtw89: set pause_data field to avoid transmitting data in scan channels
Chih-Kang Chang [Sat, 26 Oct 2024 02:21:43 +0000 (10:21 +0800)]
wifi: rtw89: set pause_data field to avoid transmitting data in scan channels

Set pause_data to all of the scan channels, excluding the OP channel,
to prevent data frame transmission to the scan channels, which causes
retransmission. Additionally, this flag won't affect the transmission
of probe requests from the scan channels.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241026022143.7304-1-pkshih@realtek.com
8 months agowifi: rtw89: don't check done-ack for entering PS
Chin-Yen Lee [Thu, 24 Oct 2024 05:55:09 +0000 (13:55 +0800)]
wifi: rtw89: don't check done-ack for entering PS

In WoWLAN mode, driver will disable interrupt after calling H2C command
for entering PS mode, but it may lead to failing to enter deep PS mode by
firmware because the done-ack of the H2C from firmware is not handled by
driver. In fact, the done-ack for entering PS is not necessary for driver
to check, so remove it.

Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20241024055509.8000-1-pkshih@realtek.com
8 months agowifi: cw1200: Fix potential NULL dereference
Linus Walleij [Mon, 28 Oct 2024 22:06:53 +0000 (23:06 +0100)]
wifi: cw1200: Fix potential NULL dereference

A recent refactoring was identified by static analysis to
cause a potential NULL dereference, fix this!

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202410121505.nyghqEkK-lkp@intel.com/
Fixes: 2719a9e7156c ("wifi: cw1200: Convert to GPIO descriptors")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241028-cw1200-fix-v1-1-e092b6558d1e@linaro.org
8 months agowifi: brcm80211: Remove unused dma_txflush()
Dr. David Alan Gilbert [Fri, 25 Oct 2024 20:46:51 +0000 (21:46 +0100)]
wifi: brcm80211: Remove unused dma_txflush()

dma_fxflush() has been unused since 2013's
commit 7b2385b95363 ("brcmsmac: rework of mac80211 .flush() callback
operation")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241025204651.244627-1-linux@treblig.org
8 months agowifi: wfx: Fix error handling in wfx_core_init()
Yuan Can [Tue, 22 Oct 2024 09:04:53 +0000 (17:04 +0800)]
wifi: wfx: Fix error handling in wfx_core_init()

The wfx_core_init() returns without checking the retval from
sdio_register_driver().
If the sdio_register_driver() failed, the module failed to install,
leaving the wfx_spi_driver not unregistered.

Fixes: a7a91ca5a23d ("staging: wfx: add infrastructure for new driver")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20241022090453.84679-1-yuancan@huawei.com
8 months agoMerge tag 'ath-next-20241030' of git://git.kernel.org/pub/scm/linux/kernel/git/ath/ath
Kalle Valo [Thu, 31 Oct 2024 14:03:57 +0000 (16:03 +0200)]
Merge tag 'ath-next-20241030' of git://git./linux/kernel/git/ath/ath

ath.git patches for v6.13

This development cycle featured phase 1 of patches to ath12k to
support the new 802.11be MLO feature, along with other ath12k feature
patches.  In older drivers, support for some additional devices were
added. And there was the usual set of bug fixes and cleanups across
most drivers.

Per-driver highlights:

ath12k
* Switch to using wiphy_lock() and remove ar->conf_mutex
* Convert struct ath12k_sta::update_wk to use struct wiphy_work
* Add phase 1 of 802.11be MLO support
* Add firmware coredump collection support
* Add debugfs support for a multitude of statistics
* Fix host representation of multiple hal_rx structs
* Fix use-after-free in ath12k_dp_cc_cleanup()
* Skip Rx TID cleanup for self peer
* Fix warning and crash when unloading in a VM
* Convert CE interrupt handling from tasklet to BH workqueue
* Fix A-MSDU indication in monitor mode

ath11k
* Fix double free issue during SRNG deinit
* Enable firmware diagnostic events for WCN6750
* Fix CE offset address calculation for WCN6750 during SSR
* Fix stack frame size warning in ath11k_vif_wow_set_wakeups()
* Document the inputs for ath11k on WCN6855

ath10k
* Fix multiple stack frame size warnings
* Fix invalid VHT parameters in supported_vht_mcs_rate_nss* structs
* Avoid NULL pointer error during SDIO remove

ath5k
* Add support for Arcadyan ARV45XX AR2417 & Gigaset SX76[23] AR241[34]A

8 months agoDocumentation: networking: Add missing PHY_GET command in the message list
Kory Maincent [Mon, 28 Oct 2024 13:23:51 +0000 (14:23 +0100)]
Documentation: networking: Add missing PHY_GET command in the message list

ETHTOOL_MSG_PHY_GET/GET_REPLY/NTF is missing in the ethtool message list.
Add it to the ethool netlink documentation.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20241028132351.75922-1-kory.maincent@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoMerge tag 'wireless-next-2024-10-25' of git://git.kernel.org/pub/scm/linux/kernel...
Jakub Kicinski [Wed, 30 Oct 2024 01:50:57 +0000 (18:50 -0700)]
Merge tag 'wireless-next-2024-10-25' of git://git./linux/kernel/git/wireless/wireless-next

Kalle Valo says:

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

The first -next "new features" pull request for v6.13. This is a big
one as we have not been able to send one earlier. We have also some
patches affecting other subsystems: in staging we deleted the rtl8192e
driver and in debugfs added a new interface to save struct
file_operations memory; both were acked by GregKH.

Because of the lib80211/libipw move there were quite a lot of
conflicts and to solve those we decided to merge net-next into
wireless-next.

Major changes:

cfg80211/mac80211
 * stop exporting wext symbols
 * new mac80211 op to indicate that a new interface is to be added
 * support radio separation of multi-band devices

Wireless Extensions
 * move wext spy implementation to libiw
 * remove iw_public_data from struct net_device

brcmfmac
 * optional LPO clock support

ipw2x00
 * move remaining lib80211 code into libiw

wilc1000
 * WILC3000 support

rtw89
 * RTL8852BE and RTL8852BE-VT BT-coexistence improvements

* tag 'wireless-next-2024-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (126 commits)
  mac80211: Remove NOP call to ieee80211_hw_config
  wifi: iwlwifi: work around -Wenum-compare-conditional warning
  wifi: mac80211: re-order assigning channel in activate links
  wifi: mac80211: convert debugfs files to short fops
  debugfs: add small file operations for most files
  wifi: mac80211: remove misleading j_0 construction parts
  wifi: mac80211_hwsim: use hrtimer_active()
  wifi: mac80211: refactor BW limitation check for CSA parsing
  wifi: mac80211: filter on monitor interfaces based on configured channel
  wifi: mac80211: refactor ieee80211_rx_monitor
  wifi: mac80211: add support for the monitor SKIP_TX flag
  wifi: cfg80211: add monitor SKIP_TX flag
  wifi: mac80211: add flag to opt out of virtual monitor support
  wifi: cfg80211: pass net_device to .set_monitor_channel
  wifi: mac80211: remove status->ampdu_delimiter_crc
  wifi: cfg80211: report per wiphy radio antenna mask
  wifi: mac80211: use vif radio mask to limit creating chanctx
  wifi: mac80211: use vif radio mask to limit ibss scan frequencies
  wifi: cfg80211: add option for vif allowed radios
  wifi: iwlwifi: allow IWL_FW_CHECK() with just a string
  ...

====================

Link: https://patch.msgid.link/20241025170705.5F6B2C4CEC3@smtp.kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoMerge branch 'devlink-minor-cleanup'
Jakub Kicinski [Tue, 29 Oct 2024 23:52:59 +0000 (16:52 -0700)]
Merge branch 'devlink-minor-cleanup'

Przemek Kitszel says:

====================
devlink: minor cleanup

(Patch 1, 2) Add one helper shortcut to put u64 values into skb.
(Patch 3, 4) Minor cleanup for error codes.
(Patch 5, 6, 7) Remove some devlink_resource_*() usage and functions
itself via replacing devlink_* variants by devl_* ones.

v2: fix metadata (cc list, target tree) - Jiri; rebase; tags collected

v1: https://lore.kernel.org/20241018102009.10124-1-przemyslaw.kitszel@intel.com
====================

Link: https://patch.msgid.link/20241023131248.27192-1-przemyslaw.kitszel@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agodevlink: remove unused devlink_resource_register()
Przemek Kitszel [Wed, 23 Oct 2024 13:09:07 +0000 (15:09 +0200)]
devlink: remove unused devlink_resource_register()

Remove unused devlink_resource_register(); all the drivers use
devl_resource_register() variant instead.

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/20241023131248.27192-8-przemyslaw.kitszel@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agodevlink: remove unused devlink_resource_occ_get_register() and _unregister()
Przemek Kitszel [Wed, 23 Oct 2024 13:09:06 +0000 (15:09 +0200)]
devlink: remove unused devlink_resource_occ_get_register() and _unregister()

Remove not used devlink_resource_occ_get_register() and
devlink_resource_occ_get_unregister() functions; current devlink resource
users are fine with devl_ variants of the two.

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/20241023131248.27192-7-przemyslaw.kitszel@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agonet: dsa: replace devlink resource registration calls by devl_ variants
Przemek Kitszel [Wed, 23 Oct 2024 13:09:05 +0000 (15:09 +0200)]
net: dsa: replace devlink resource registration calls by devl_ variants

Replace devlink_resource_register(), devlink_resource_occ_get_register(),
and devlink_resource_occ_get_unregister() calls by respective devl_*
variants. Mentioned functions have no direct users in any drivers, and are
going to be removed in subsequent patches.

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/20241023131248.27192-6-przemyslaw.kitszel@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agodevlink: region: snapshot IDs: consolidate error values
Przemek Kitszel [Wed, 23 Oct 2024 13:09:04 +0000 (15:09 +0200)]
devlink: region: snapshot IDs: consolidate error values

Consolidate error codes for too big message size.

Current code is written to return -EINVAL when tailroom in the skb msg
would be exhausted precisely when it's time to nest, and return -EMSGSIZE
in all other "not enough space" conditions.

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/20241023131248.27192-5-przemyslaw.kitszel@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agodevlink: devl_resource_register(): differentiate error codes
Przemek Kitszel [Wed, 23 Oct 2024 13:09:03 +0000 (15:09 +0200)]
devlink: devl_resource_register(): differentiate error codes

Differentiate error codes of devl_resource_register().

Replace one of -EINVAL exit paths by -EEXIST. This should aid developers
introducing new resources and registering them in the wrong order.

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/20241023131248.27192-4-przemyslaw.kitszel@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agodevlink: use devlink_nl_put_u64() helper
Przemek Kitszel [Wed, 23 Oct 2024 13:09:02 +0000 (15:09 +0200)]
devlink: use devlink_nl_put_u64() helper

Use devlink_nl_put_u64() shortcut added by prev commit on all devlink/.

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/20241023131248.27192-3-przemyslaw.kitszel@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agodevlink: introduce devlink_nl_put_u64()
Przemek Kitszel [Wed, 23 Oct 2024 13:09:01 +0000 (15:09 +0200)]
devlink: introduce devlink_nl_put_u64()

Add devlink_nl_put_u64() that abstracts padding for u64 values.
All u64 values are passed with the very same padding option.

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/20241023131248.27192-2-przemyslaw.kitszel@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agor8169: fix inconsistent indenting in rtl8169_get_eth_mac_stats
Heiner Kallweit [Thu, 24 Oct 2024 20:48:59 +0000 (22:48 +0200)]
r8169: fix inconsistent indenting in rtl8169_get_eth_mac_stats

This fixes an inconsistent indenting introduced with e3fc5139bd8f
("r8169: implement additional ethtool stats ops").

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410220413.1gAxIJ4t-lkp@intel.com/
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20fd6f39-3c1b-4af0-9adc-7d1f49728fad@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agosocket: Print pf->create() when it does not clear sock->sk on failure.
Kuniyuki Iwashima [Thu, 24 Oct 2024 20:14:58 +0000 (13:14 -0700)]
socket: Print pf->create() when it does not clear sock->sk on failure.

I suggested to put DEBUG_NET_WARN_ON_ONCE() in __sock_create() to
catch possible use-after-free.

But the warning itself was not useful because our interest is in
the callee than the caller.

Let's define DEBUG_NET_WARN_ONCE() and print the name of pf->create()
and the socket identifier.

While at it, we enclose DEBUG_NET_WARN_ON_ONCE() in parentheses too
to avoid a checkpatch error.

Note that %pf or %pF were obsoleted and will be removed later as per
comment in lib/vsprintf.c.

Link: https://lore.kernel.org/netdev/202410231427.633734b3-lkp@intel.com/
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20241024201458.49412-1-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agor8169: add support for RTL8125D
Heiner Kallweit [Thu, 24 Oct 2024 20:42:33 +0000 (22:42 +0200)]
r8169: add support for RTL8125D

This adds support for new chip version RTL8125D, which can be found on
boards like Gigabyte X870E AORUS ELITE WIFI7. Firmware rtl8125d-1.fw
for this chip version is available in linux-firmware already.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/d0306912-e88e-4c25-8b5d-545ae8834c0c@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agonet: qlogic: use ethtool string helpers
Rosen Penev [Thu, 24 Oct 2024 19:55:34 +0000 (12:55 -0700)]
net: qlogic: use ethtool string helpers

The latter is the preferred way to copy ethtool strings.

Avoids manually incrementing the pointer. Cleans up the code quite well.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241024195534.176410-1-rosenp@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agonet: marvell: use ethtool string helpers
Rosen Penev [Thu, 24 Oct 2024 19:58:33 +0000 (12:58 -0700)]
net: marvell: use ethtool string helpers

The latter is the preferred way to copy ethtool strings.

Avoids manually incrementing the pointer. Cleans up the code quite well.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241024195833.176843-1-rosenp@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agomlx5: simplify EQ interrupt polling logic
Caleb Sander Mateos [Wed, 23 Oct 2024 20:51:12 +0000 (14:51 -0600)]
mlx5: simplify EQ interrupt polling logic

Use a while loop in mlx5_eq_comp_int() and mlx5_eq_async_int() to
clarify the EQE polling logic. This consolidates the next_eqe_sw() calls
for the first and subequent iterations. It also avoids a goto. Turn the
num_eqes < MLX5_EQ_POLLING_BUDGET check into a break condition.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241023205113.255866-1-csander@purestorage.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agomlx5: fix typo in "mlx5_cqwq_get_cqe_enahnced_comp"
Caleb Sander Mateos [Wed, 23 Oct 2024 16:48:38 +0000 (10:48 -0600)]
mlx5: fix typo in "mlx5_cqwq_get_cqe_enahnced_comp"

"enahnced" looks to be a misspelling of "enhanced".
Rename "mlx5_cqwq_get_cqe_enahnced_comp" to
"mlx5_cqwq_get_cqe_enhanced_comp".

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Link: https://patch.msgid.link/20241023164840.140535-1-csander@purestorage.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoamd-xgbe: use ethtool string helpers
Rosen Penev [Tue, 22 Oct 2024 23:32:03 +0000 (16:32 -0700)]
amd-xgbe: use ethtool string helpers

The latter is the preferred way to copy ethtool strings.

Avoids manually incrementing the pointer.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241022233203.9670-1-rosenp@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agonet: mana: use ethtool string helpers
Rosen Penev [Tue, 22 Oct 2024 20:49:08 +0000 (13:49 -0700)]
net: mana: use ethtool string helpers

The latter is the preferred way to copy ethtool strings.

Avoids manually incrementing the data pointer.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
Link: https://patch.msgid.link/20241022204908.511021-1-rosenp@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoibmvnic: use ethtool string helpers
Rosen Penev [Tue, 22 Oct 2024 20:32:40 +0000 (13:32 -0700)]
ibmvnic: use ethtool string helpers

They are the preferred way to copy ethtool strings.

Avoids manually incrementing the data pointer.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Tested-by: Nick Child <nnac123@linux.ibm.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241022203240.391648-1-rosenp@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agonet: ftgmac100: refactor getting phy device handle
Jacky Chou [Tue, 22 Oct 2024 08:42:14 +0000 (16:42 +0800)]
net: ftgmac100: refactor getting phy device handle

Consolidate the handling of dedicated PHY and fixed-link phy by taking
advantage of logic in of_phy_get_and_connect() which handles both of
these cases, rather than open coding the same logic in ftgmac100_probe().

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20241022084214.1261174-1-jacky_chou@aspeedtech.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoMerge branch 'net-phylink-simplify-sfp-phy-attachment'
Jakub Kicinski [Tue, 29 Oct 2024 18:57:35 +0000 (11:57 -0700)]
Merge branch 'net-phylink-simplify-sfp-phy-attachment'

Russell King says:

====================
net: phylink: simplify SFP PHY attachment

These two patches simplify how we attach SFP PHYs.

The first patch notices that at the two sites where we call
sfp_select_interface(), if that fails, we always print the same error.
Move this into its own function.

The second patch adds an additional level of validation, checking that
the returned interface is one that is supported by the MAC/PCS.

The last patch simplifies how SFP PHYs are attached, reducing the
number of times that we do validation in this path.
====================

Link: https://patch.msgid.link/Zxj8_clRmDA_G7uH@shell.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agonet: phylink: simplify how SFP PHYs are attached
Russell King (Oracle) [Wed, 23 Oct 2024 13:41:57 +0000 (14:41 +0100)]
net: phylink: simplify how SFP PHYs are attached

There are a few issues with how SFP PHYs are attached:

a) The phylink_sfp_connect_phy() and phylink_sfp_config_phy() code
   validates the configuration three times:

1. To discover the support/advertising masks that the PHY/PCS/MAC
   can support in order to select an interface.
2. To validate the selected interface.
3. When the PHY is brought up after being attached, another validation
   is done.

   This is needlessly complex.

b) The configuration is set prior to the PHY being attached, which
   means we don't have the PHY available in phylink_major_config()
   for phylink_pcs_neg_mode() to make decisions upon.

We have already added an extra step to validate the selected interface,
so we can now move the attachment and bringup of the PHY earlier,
inside phylink_sfp_config_phy(). This results in the validation at
step 2 above becoming entirely unnecessary, so remove that too.

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1t3bcb-000c8H-3e@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agonet: phylink: validate sfp_select_interface() returned interface
Russell King (Oracle) [Wed, 23 Oct 2024 13:41:51 +0000 (14:41 +0100)]
net: phylink: validate sfp_select_interface() returned interface

Validate that the returned interface from sfp_select_interface() is
supportable by the MAC/PCS. If it isn't, print an error and return
the NA interface type. This is a preparatory step to reorganising
how a PHY on a SFP module is handled.

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1t3bcV-000c8B-Vz@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agonet: phylink: add common validation for sfp_select_interface()
Russell King (Oracle) [Wed, 23 Oct 2024 13:41:46 +0000 (14:41 +0100)]
net: phylink: add common validation for sfp_select_interface()

Whenever we call sfp_select_interface(), we check the returned value
and print an error. There are two cases where this happens with the
same message. Provide a common function to do this.

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1t3bcQ-000c85-S4@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agonet: phylink: simplify phylink_parse_fixedlink()
Russell King (Oracle) [Tue, 22 Oct 2024 14:17:07 +0000 (15:17 +0100)]
net: phylink: simplify phylink_parse_fixedlink()

phylink_parse_fixedlink() wants to preserve the pause, asym_pause and
autoneg bits in pl->supported. Rather than reading the bits into
separate bools, zeroing pl->supported, and then setting them if they
were previously set, use a mask and linkmode_and() to achieve the same
result.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/E1t3Fh5-000aQi-Nk@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoMerge branch 'mlx5e-update-features-on-config-changes'
Jakub Kicinski [Tue, 29 Oct 2024 18:48:29 +0000 (11:48 -0700)]
Merge branch 'mlx5e-update-features-on-config-changes'

Tariq Toukan says:

====================
mlx5e update features on config changes

This small patchset by Dragos adds a call to netdev_update_features()
in configuration changes that could impact the features status.
====================

Link: https://patch.msgid.link/20241024164134.299646-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agonet/mlx5e: Update features on ring size change
Dragos Tatulea [Thu, 24 Oct 2024 16:41:33 +0000 (19:41 +0300)]
net/mlx5e: Update features on ring size change

When the ring size changes successfully, trigger
netdev_update_features() to enable features in wanted state if
applicable.

An example of such scenario:
$ ip link set dev eth1 up
$ ethtool --set-ring eth1 rx 8192
$ ip link set dev eth1 mtu 9000
$ ethtool --features eth1 rx-gro-hw on --> fails
$ ethtool --set-ring eth1 rx 1024

With this patch, HW GRO will be turned on automatically because
it is set in the device's wanted_features.

Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241024164134.299646-3-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agonet/mlx5e: Update features on MTU change
Dragos Tatulea [Thu, 24 Oct 2024 16:41:32 +0000 (19:41 +0300)]
net/mlx5e: Update features on MTU change

When the MTU changes successfully, trigger netdev_update_features() to
enable features in wanted state if applicable.

An example of such scenario:
$ ip link set dev eth1 up
$ ethtool --set-ring eth1 rx 8192
$ ip link set dev eth1 mtu 9000
$ ethtool --features eth1 rx-gro-hw on --> fails
$ ip link set dev eth1 mtu 7000

With this patch, HW GRO will be turned on automatically because
it is set in the device's wanted_features.

Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241024164134.299646-2-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agowwan: core: Pass string literal as format argument of dev_set_name()
Simon Horman [Wed, 23 Oct 2024 12:15:28 +0000 (13:15 +0100)]
wwan: core: Pass string literal as format argument of dev_set_name()

Both gcc-14 and clang-18 report that passing a non-string literal as the
format argument of dev_set_name() is potentially insecure.

E.g. clang-18 says:

drivers/net/wwan/wwan_core.c:442:34: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
  442 |         return dev_set_name(&port->dev, buf);
      |                                         ^~~
drivers/net/wwan/wwan_core.c:442:34: note: treat the string as an argument to avoid this
  442 |         return dev_set_name(&port->dev, buf);
      |                                         ^
      |                                         "%s",

It is always the case where the contents of mod is safe to pass as the
format argument. That is, in my understanding, it never contains any
format escape sequences.

But, it seems better to be safe than sorry. And, as a bonus, compiler
output becomes less verbose by addressing this issue as suggested by
clang-18.

Compile tested only.
No functional change intended.

Signed-off-by: Simon Horman <horms@kernel.org>
Acked-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Link: https://patch.msgid.link/20241023-wwan-fmt-v1-1-521b39968639@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoselftests: tc-testing: Fix typo error
Karan Sanghavi [Tue, 22 Oct 2024 18:30:52 +0000 (18:30 +0000)]
selftests: tc-testing: Fix typo error

Correct the typo errors in json files

- "diffferent" is corrected to "different".
- "muliple" and "miltiple" is corrected to "multiple".

Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Karan Sanghavi <karansanghvi98@gmail.com>
Link: https://patch.msgid.link/20241022-multiple_spell_error-v2-1-7e5036506fe5@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agortnetlink: Fix kdoc of rtnl_af_register().
Kuniyuki Iwashima [Tue, 22 Oct 2024 21:03:20 +0000 (14:03 -0700)]
rtnetlink: Fix kdoc of rtnl_af_register().

Commit 26eebdc4b005 ("rtnetlink: Return int from rtnl_af_register().")
made rtnl_af_register() return int again, and kdoc needs to be fixed up.

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241022210320.86111-1-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoMerge branch 'ipv4-prepare-core-ipv4-files-to-future-flowi4_tos-conversion'
Jakub Kicinski [Tue, 29 Oct 2024 18:21:25 +0000 (11:21 -0700)]
Merge branch 'ipv4-prepare-core-ipv4-files-to-future-flowi4_tos-conversion'

Guillaume Nault says:

====================
ipv4: Prepare core ipv4 files to future .flowi4_tos conversion.

Continue preparing users of ->flowi4_tos (struct flowi4) to the future
conversion of this field (from __u8 to dscp_t). The objective is to
have type annotation to properly separate DSCP bits from ECN ones. This
way we'll ensure that ECN doesn't interfere with DSCP and avoid
regressions where it break routing descisions (fib rules in particular).

This series concentrates on some easy IPv4 conversions where
->flowi4_tos is set directly from an IPv4 header, so we can get the
DSCP value using the ip4h_dscp() helper function.
====================

Link: https://patch.msgid.link/cover.1729530028.git.gnault@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoipv4: Prepare ip_rt_get_source() to future .flowi4_tos conversion.
Guillaume Nault [Tue, 22 Oct 2024 09:48:23 +0000 (11:48 +0200)]
ipv4: Prepare ip_rt_get_source() to future .flowi4_tos conversion.

Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
dscp_t value to __u8 with inet_dscp_to_dsfield().

Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
the inet_dscp_to_dsfield() call.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/0a13a200f31809841975e38633914af1061e0c04.1729530028.git.gnault@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoipv4: Prepare ipmr_rt_fib_lookup() to future .flowi4_tos conversion.
Guillaume Nault [Tue, 22 Oct 2024 09:48:15 +0000 (11:48 +0200)]
ipv4: Prepare ipmr_rt_fib_lookup() to future .flowi4_tos conversion.

Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
dscp_t value to __u8 with inet_dscp_to_dsfield().

Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
the inet_dscp_to_dsfield() call.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/462402a097260357a7aba80228612305f230b6a9.1729530028.git.gnault@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoipv4: Prepare icmp_reply() to future .flowi4_tos conversion.
Guillaume Nault [Tue, 22 Oct 2024 09:48:08 +0000 (11:48 +0200)]
ipv4: Prepare icmp_reply() to future .flowi4_tos conversion.

Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
dscp_t value to __u8 with inet_dscp_to_dsfield().

Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
the inet_dscp_to_dsfield() call.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/61b7563563f8b0a562b5b62032fe5260034d0aac.1729530028.git.gnault@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoipv4: Prepare fib_compute_spec_dst() to future .flowi4_tos conversion.
Guillaume Nault [Tue, 22 Oct 2024 09:48:00 +0000 (11:48 +0200)]
ipv4: Prepare fib_compute_spec_dst() to future .flowi4_tos conversion.

Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
dscp_t value to __u8 with inet_dscp_to_dsfield().

Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
the inet_dscp_to_dsfield() call.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/a0eba69cce94f747e4c7516184a85ffd0abbe3f0.1729530028.git.gnault@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
8 months agoMerge branch 'ibm-emac-more-cleanups'
Paolo Abeni [Tue, 29 Oct 2024 14:33:24 +0000 (15:33 +0100)]
Merge branch 'ibm-emac-more-cleanups'

Rosen Penev says:

====================
ibm: emac: more cleanups

Tested on Cisco MX60W.

v2: fixed build errors. Also added extra commits to clean the driver up
further.
v3: Added tested message. Removed bad alloc_netdev_dummy commit.
v4: removed modules changes from patchset. Added fix for if MAC not
found.
v5: added of_find_matching_node commit.
v6: resend after net-next merge.
v7: removed of_find_matching_node commit. Adjusted mutex_init patch.
v8: removed patch removing custom init/exit. Needs more work.
====================

Link: https://patch.msgid.link/20241022002245.843242-1-rosenp@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
8 months agonet: ibm: emac: generate random MAC if not found
Rosen Penev [Tue, 22 Oct 2024 00:22:45 +0000 (17:22 -0700)]
net: ibm: emac: generate random MAC if not found

On this Cisco MX60W, u-boot sets the local-mac-address property.
Unfortunately by default, the MAC is wrong and is actually located on a
UBI partition. Which means nvmem needs to be used to grab it.

In the case where that fails, EMAC fails to initialize instead of
generating a random MAC as many other drivers do.

Match behavior with other drivers to have a working ethernet interface.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
8 months agonet: ibm: emac: use devm for mutex_init
Rosen Penev [Tue, 22 Oct 2024 00:22:44 +0000 (17:22 -0700)]
net: ibm: emac: use devm for mutex_init

It seems since inception that mutex_destroy was never called for these
in _remove. Instead of handling this manually, just use devm for
simplicity.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
8 months agonet: ibm: emac: use platform_get_irq
Rosen Penev [Tue, 22 Oct 2024 00:22:43 +0000 (17:22 -0700)]
net: ibm: emac: use platform_get_irq

No need for irq_of_parse_and_map since we have platform_device.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
8 months agonet: ibm: emac: use devm_platform_ioremap_resource
Rosen Penev [Tue, 22 Oct 2024 00:22:42 +0000 (17:22 -0700)]
net: ibm: emac: use devm_platform_ioremap_resource

No need to have a struct resource. Gets rid of the TODO.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
8 months agonet: ibm: emac: use netif_receive_skb_list
Rosen Penev [Tue, 22 Oct 2024 00:22:41 +0000 (17:22 -0700)]
net: ibm: emac: use netif_receive_skb_list

Small rx improvement. Would use napi_gro_receive instead but that's a
lot more involved than netif_receive_skb_list because of how the
function is implemented.

Before:

> iperf -c 192.168.1.1
------------------------------------------------------------
Client connecting to 192.168.1.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  1] local 192.168.1.101 port 51556 connected with 192.168.1.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  1] 0.00-10.04 sec   559 MBytes   467 Mbits/sec
> iperf -c 192.168.1.1
------------------------------------------------------------
Client connecting to 192.168.1.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  1] local 192.168.1.101 port 48228 connected with 192.168.1.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  1] 0.00-10.03 sec   558 MBytes   467 Mbits/sec
> iperf -c 192.168.1.1
------------------------------------------------------------
Client connecting to 192.168.1.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  1] local 192.168.1.101 port 47600 connected with 192.168.1.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  1] 0.00-10.04 sec   557 MBytes   466 Mbits/sec
> iperf -c 192.168.1.1
------------------------------------------------------------
Client connecting to 192.168.1.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  1] local 192.168.1.101 port 37252 connected with 192.168.1.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  1] 0.00-10.05 sec   559 MBytes   467 Mbits/sec

After:

> iperf -c 192.168.1.1
------------------------------------------------------------
Client connecting to 192.168.1.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  1] local 192.168.1.101 port 40786 connected with 192.168.1.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  1] 0.00-10.05 sec   572 MBytes   478 Mbits/sec
> iperf -c 192.168.1.1
------------------------------------------------------------
Client connecting to 192.168.1.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  1] local 192.168.1.101 port 52482 connected with 192.168.1.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  1] 0.00-10.04 sec   571 MBytes   477 Mbits/sec
> iperf -c 192.168.1.1
------------------------------------------------------------
Client connecting to 192.168.1.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  1] local 192.168.1.101 port 48370 connected with 192.168.1.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  1] 0.00-10.04 sec   572 MBytes   478 Mbits/sec
> iperf -c 192.168.1.1
------------------------------------------------------------
Client connecting to 192.168.1.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  1] local 192.168.1.101 port 46086 connected with 192.168.1.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  1] 0.00-10.05 sec   571 MBytes   476 Mbits/sec
> iperf -c 192.168.1.1
------------------------------------------------------------
Client connecting to 192.168.1.1, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  1] local 192.168.1.101 port 46062 connected with 192.168.1.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  1] 0.00-10.04 sec   572 MBytes   478 Mbits/sec

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
8 months agoMerge branch 'ipv4-convert-rtm_-new-del-addr-and-more-to-per-netns-rtnl'
Paolo Abeni [Tue, 29 Oct 2024 10:55:28 +0000 (11:55 +0100)]
Merge branch 'ipv4-convert-rtm_-new-del-addr-and-more-to-per-netns-rtnl'

Kuniyuki Iwashima says:

====================
ipv4: Convert RTM_{NEW,DEL}ADDR and more to per-netns RTNL.

The IPv4 address hash table and GC are already namespacified.

This series converts RTM_NEWADDR/RTM_DELADDR and some more
RTNL users to per-netns RTNL.

Changes:
  v2:
    * Add patch 1 to address sparse warning for CONFIG_DEBUG_NET_SMALL_RTNL=n
    * Add Eric's tags to patch 2-12

  v1: https://lore.kernel.org/netdev/20241018012225.90409-1-kuniyu@amazon.com/
====================

Link: https://patch.msgid.link/20241021183239.79741-1-kuniyu@amazon.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
8 months agoipv4: Convert devinet_ioctl to per-netns RTNL.
Kuniyuki Iwashima [Mon, 21 Oct 2024 18:32:39 +0000 (11:32 -0700)]
ipv4: Convert devinet_ioctl to per-netns RTNL.

ioctl(SIOCGIFCONF) calls dev_ifconf() that operates on the current netns.

Let's use per-netns RTNL helpers in dev_ifconf() and inet_gifconf().

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
8 months agoipv4: Convert devinet_ioctl() to per-netns RTNL except for SIOCSIFFLAGS.
Kuniyuki Iwashima [Mon, 21 Oct 2024 18:32:38 +0000 (11:32 -0700)]
ipv4: Convert devinet_ioctl() to per-netns RTNL except for SIOCSIFFLAGS.

Basically, devinet_ioctl() operates on a single netns.

However, ioctl(SIOCSIFFLAGS) will trigger the netdev notifier
that could touch another netdev in different netns.

Let's use per-netns RTNL helper in devinet_ioctl() and place
ASSERT_RTNL() for SIOCSIFFLAGS.

We will remove ASSERT_RTNL() once RTM_SETLINK and RTM_DELLINK
are converted.

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>