platform/kernel/linux-starfive.git
10 months agowifi: mac80211: fix kernel-doc notation warning
Randy Dunlap [Mon, 10 Jul 2023 23:03:09 +0000 (16:03 -0700)]
wifi: mac80211: fix kernel-doc notation warning

Add description for struct member 'agg' to prevent a kernel-doc
warning.

mac80211.h:2289: warning: Function parameter or member 'agg' not described in 'ieee80211_link_sta'

Fixes: 4c51541ddb78 ("wifi: mac80211: keep A-MSDU data in sta and per-link")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Benjamin Berg <benjamin.berg@intel.com>
Cc: linux-wireless@vger.kernel.org
Link: https://lore.kernel.org/r/20230710230312.31197-10-rdunlap@infradead.org
[reword the kernel-doc comment]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: radiotap: fix kernel-doc notation warnings
Randy Dunlap [Mon, 10 Jul 2023 23:03:06 +0000 (16:03 -0700)]
wifi: radiotap: fix kernel-doc notation warnings

Fix a typo (82011 -> 80211) to prevent a kernel-doc warning.
Add one missing function parameter description to prevent a
kernel-doc warning.

ieee80211_radiotap.h:52: warning: expecting prototype for struct ieee82011_radiotap_header. Prototype was for struct ieee80211_radiotap_header instead
ieee80211_radiotap.h:581: warning: Function parameter or member 'data' not described in 'ieee80211_get_radiotap_len'

Fixes: 42f82e2e62ae ("wireless: radiotap: rewrite the radiotap header file")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Link: https://lore.kernel.org/r/20230710230312.31197-7-rdunlap@infradead.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: cfg80211: remove dead/unused enum value
Randy Dunlap [Mon, 10 Jul 2023 23:03:02 +0000 (16:03 -0700)]
wifi: cfg80211: remove dead/unused enum value

Drop an unused (extra) enum value to prevent a kernel-doc warning.

cfg80211.h:1492: warning: Excess enum value 'STATION_PARAM_APPLY_STA_TXPOWER' description in 'station_parameters_apply_mask'

Fixes: 2d8b08fef0af ("wifi: cfg80211: fix kernel-doc warnings all over the file")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/20230710230312.31197-3-rdunlap@infradead.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: cfg80211: improve documentation for flag fields
Dmitry Antipov [Thu, 13 Jul 2023 13:29:36 +0000 (16:29 +0300)]
wifi: cfg80211: improve documentation for flag fields

Fix and hopefully improve documentation for 'flag' fields of
a few types by adding references to relevant enumerations.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://lore.kernel.org/r/20230713132957.275859-1-dmantipov@yandex.ru
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: nl80211: Remove unused declaration nl80211_pmsr_dump_results()
Yue Haibing [Sat, 29 Jul 2023 12:16:51 +0000 (20:16 +0800)]
wifi: nl80211: Remove unused declaration nl80211_pmsr_dump_results()

nl80211_pmsr_dump_results() is never implemented since it was added in
commit 9bb7e0f24e7e ("cfg80211: add peer measurement with FTM initiator
API").

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230729121651.36836-1-yuehaibing@huawei.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: mac80211: mesh: Remove unused function declaration mesh_ids_set_default()
Yue Haibing [Mon, 31 Jul 2023 14:07:12 +0000 (22:07 +0800)]
wifi: mac80211: mesh: Remove unused function declaration mesh_ids_set_default()

Commit ccf80ddfe492 ("mac80211: mesh function and data structures
definitions") introducted this but never implemented it.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230731140712.1204-1-yuehaibing@huawei.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: mac80211: Remove unused function declarations
Yue Haibing [Tue, 1 Aug 2023 13:43:37 +0000 (21:43 +0800)]
wifi: mac80211: Remove unused function declarations

Commit 685429623f88 ("mac80211: Fix circular locking dependency in
ARP filter handling") left the ieee80211_set_arp_filter() declaration
unused.
And commit 164eb02d070a ("mac80211: add radar detection command/event")
introducted ieee80211_dfs_cac_timer() declaration but never implemented
it.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230801134337.24452-1-yuehaibing@huawei.com
[reword commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: wext: Remove unused declaration dev_get_wireless_info()
Yue Haibing [Mon, 7 Aug 2023 14:50:32 +0000 (22:50 +0800)]
wifi: wext: Remove unused declaration dev_get_wireless_info()

Commit 556829657397 ("[NL80211]: add netlink interface to cfg80211")
declared but never implemented this, remove it.
Commit 11433ee450eb ("[WEXT]: Move to net/wireless") rename net/core/wireless.c
to net/wireless/wext.c, then commit 3d23e349d807 ("wext: refactor") refactor
wext.c to wext-core.c, fix the wext comment.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230807145032.44768-1-yuehaibing@huawei.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: nl80211/cfg80211: add forgotten nla_policy for BSS color attribute
Lin Ma [Wed, 9 Aug 2023 03:31:51 +0000 (11:31 +0800)]
wifi: nl80211/cfg80211: add forgotten nla_policy for BSS color attribute

The previous commit dd3e4fc75b4a ("nl80211/cfg80211: add BSS color to
NDP ranging parameters") adds a parameter for NDP ranging by introducing
a new attribute type named NL80211_PMSR_FTM_REQ_ATTR_BSS_COLOR.

However, the author forgot to also describe the nla_policy at
nl80211_pmsr_ftm_req_attr_policy (net/wireless/nl80211.c). Just
complement it to avoid malformed attribute that causes out-of-attribute
access.

Fixes: dd3e4fc75b4a ("nl80211/cfg80211: add BSS color to NDP ranging parameters")
Signed-off-by: Lin Ma <linma@zju.edu.cn>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230809033151.768910-1-linma@zju.edu.cn
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: mac80211_hwsim: avoid calling nlmsg_free() in IRQ or IRQ disabled
EN-WEI WU [Tue, 15 Aug 2023 09:54:27 +0000 (17:54 +0800)]
wifi: mac80211_hwsim: avoid calling nlmsg_free() in IRQ or IRQ disabled

The nlmsg_free() ends up calling kfree_skb(), and kfree_skb() is not allowed to be called
from hardware interrupt context or with hardware interrupts being disabled. Replace the
mistaken usage of nlmsg_free() by dev_kfree_skb_irq(), which is safe in both cases.

Signed-off-by: EN-WEI WU <enweiwu@FreeBSD.org>
Link: https://lore.kernel.org/r/20230815095427.13589-1-enweiwu@FreeBSD.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: mac80211: fix puncturing bitmap handling in CSA
Johannes Berg [Wed, 16 Aug 2023 10:13:36 +0000 (12:13 +0200)]
wifi: mac80211: fix puncturing bitmap handling in CSA

Code inspection reveals that we switch the puncturing bitmap
before the real channel switch, since that happens only in
the second round of the worker after the channel context is
switched by ieee80211_link_use_reserved_context().

Fixes: 2cc25e4b2a04 ("wifi: mac80211: configure puncturing bitmap")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: mac80211_hwsim: drop short frames
Johannes Berg [Tue, 15 Aug 2023 19:28:01 +0000 (21:28 +0200)]
wifi: mac80211_hwsim: drop short frames

While technically some control frames like ACK are shorter and
end after Address 1, such frames shouldn't be forwarded through
wmediumd or similar userspace, so require the full 3-address
header to avoid accessing invalid memory if shorter frames are
passed in.

Reported-by: syzbot+b2645b5bf1512b81fa22@syzkaller.appspotmail.com
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: mac80211: check for station first in client probe
Johannes Berg [Tue, 15 Aug 2023 16:41:32 +0000 (18:41 +0200)]
wifi: mac80211: check for station first in client probe

When probing a client, first check if we have it, and then
check for the channel context, otherwise you can trigger
the warning there easily by probing when the AP isn't even
started yet. Since a client existing means the AP is also
operating, we can then keep the warning.

Also simplify the moved code a bit.

Reported-by: syzbot+999fac712d84878a7379@syzkaller.appspotmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: cfg80211: ocb: don't leave if not joined
Johannes Berg [Tue, 15 Aug 2023 16:32:03 +0000 (18:32 +0200)]
wifi: cfg80211: ocb: don't leave if not joined

If there's no OCB state, don't ask the driver/mac80211 to
leave, since that's just confusing. Since set/clear the
chandef state, that's a simple check.

Reported-by: syzbot+09d1cd2f71e6dd3bfd2c@syzkaller.appspotmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: cfg80211: reject auth/assoc to AP with our address
Johannes Berg [Tue, 15 Aug 2023 16:09:00 +0000 (18:09 +0200)]
wifi: cfg80211: reject auth/assoc to AP with our address

If the AP uses our own address as its MLD address or BSSID, then
clearly something's wrong. Reject such connections so we don't
try and fail later.

Reported-by: syzbot+2676771ed06a6df166ad@syzkaller.appspotmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: mac80211: check S1G action frame size
Johannes Berg [Tue, 15 Aug 2023 15:51:05 +0000 (17:51 +0200)]
wifi: mac80211: check S1G action frame size

Before checking the action code, check that it even
exists in the frame.

Reported-by: syzbot+be9c824e6f269d608288@syzkaller.appspotmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlmei: don't send nic info with invalid mac address
Avraham Stern [Tue, 22 Aug 2023 07:33:19 +0000 (10:33 +0300)]
wifi: iwlmei: don't send nic info with invalid mac address

In case the SAP connection is established before the interface is
added, the mac address is still not set. Don't send the nic info
SAP message in this case since it will result in sending an invalid
mac address. The nic info message will be sent with a valid mac
address when the interface is added.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230822103048.a49436bed387.I0ca88d72456e6e9f939bbc2e0c52ffb173fbc97e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlmei: send driver down SAP message only if wiamt is enabled
Avraham Stern [Tue, 22 Aug 2023 07:33:18 +0000 (10:33 +0300)]
wifi: iwlmei: send driver down SAP message only if wiamt is enabled

When wiamt is disabled the driver up SAP message is not sent, so
there is no need to send the driver down message as well.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230822103048.100f41b84656.I583d3e18ea65793f53aa710af13e47f8af82b53d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlmei: send HOST_GOES_DOWN message even if wiamt is disabled
Avraham Stern [Tue, 22 Aug 2023 07:33:17 +0000 (10:33 +0300)]
wifi: iwlmei: send HOST_GOES_DOWN message even if wiamt is disabled

The HOST_GOES_DOWN message should be sent even if wiamt is disabled.
Otherwise wiamt may still use the shared memory (e.g. if enabled
later) while it's no longer valid.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230822103048.2baad50eb1c3.If7b7c1dc2d6bfc6bacf7f6c72972f19714d9d973@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlmei: don't send SAP messages if AMT is disabled
Avraham Stern [Tue, 22 Aug 2023 07:33:16 +0000 (10:33 +0300)]
wifi: iwlmei: don't send SAP messages if AMT is disabled

SAP messages should not be sent when AMT is disabled.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230822103048.db16b55c27c1.I48834c14f5af8d31792f5048b3023509cba191dd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: pcie: avoid a warning in case prepare card failed
Avraham Stern [Tue, 22 Aug 2023 07:33:15 +0000 (10:33 +0300)]
wifi: iwlwifi: pcie: avoid a warning in case prepare card failed

In case CSME holds the NIC and SAP connection is already established,
iwl_pcie_prepare_card_hw() during iwl_pci_probe() will fail
(which is fine since CSME will release the nic later when asked with
a SAP message). In this case tring to grab nic access to read the
crf ids will fail with a warning.
Avoid the warning by only trying to read the crf ids in case prepare
card succeeded.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230822103048.9b026fa7b97e.I12bea7e6eef54eeeaf916b68d71583e92ff310fd@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: remove memory check for LMAC error address
Mukesh Sisodiya [Wed, 16 Aug 2023 08:10:54 +0000 (11:10 +0300)]
wifi: iwlwifi: remove memory check for LMAC error address

LMAC error table address was checked against UMAC
error table minimum address defined. Because of that,
the LMAC error table was not read, since both addresses
belong to different ranges. As addresses are updated from
FW alive message and should be correct, this check is not
needed.

Still keep the check for address 0 to avoid NULL address read.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230816104355.08ab1497904d.I270d4c5bcc23c5ecd0b7db475501032c450852ad@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: mvm: support flush on AP interfaces
Johannes Berg [Wed, 16 Aug 2023 08:10:53 +0000 (11:10 +0300)]
wifi: iwlwifi: mvm: support flush on AP interfaces

Support TX flush on AP interfaces so that we will do a
proper flush for frames on the queue before keys are
removed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230816104355.f4b749b91ec2.Ia8381bd4f7d47592e74387c564739798a01c4049@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: mvm: enable HE TX/RX <242 tone RU on new RFs
Johannes Berg [Wed, 16 Aug 2023 08:10:52 +0000 (11:10 +0300)]
wifi: iwlwifi: mvm: enable HE TX/RX <242 tone RU on new RFs

Two new RFs were added in the code, but we forgot to
add them to the list here that enables HE TX/RX 1024
QAM less than 242 tone RU.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230816104355.ddb090c86c8c.Ic630aa579e3dc52069758d8698069480d555eefe@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: add Razer to ppag approved list
Gregory Greenman [Wed, 16 Aug 2023 08:10:51 +0000 (11:10 +0300)]
wifi: iwlwifi: add Razer to ppag approved list

Add a new vendor (Razer) to PPAG approved list.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230816104355.f586a86fa644.I97408afb20bd7c46fcff8c3561ead8ed9c60b37e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: pcie: point invalid TFDs to invalid data
Johannes Berg [Wed, 16 Aug 2023 08:10:50 +0000 (11:10 +0300)]
wifi: iwlwifi: pcie: point invalid TFDs to invalid data

There are occasionally bugs which cause the device to try
to use a TFD that it wasn't supposed to, and these are
very hard to diagnose. Fill all unused TFDs with a debug
command that immediately causes an error to be detected
in these cases.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230816104355.10a9af1ca91f.Ifc790d62c52b4bc9a74c9581610af498509f5759@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: queue: move iwl_txq_gen2_set_tb() up
Johannes Berg [Wed, 16 Aug 2023 08:10:49 +0000 (11:10 +0300)]
wifi: iwlwifi: queue: move iwl_txq_gen2_set_tb() up

We need this earlier in the file next, move it up to have
an easier to read change, since this moves other things
in the diff git generates by default.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230816104355.c6d798b600bb.I9b891ee3d3dc67822a28e44941409f5b7cb637cf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: pcie: move gen1 TB handling to header
Johannes Berg [Wed, 16 Aug 2023 08:10:48 +0000 (11:10 +0300)]
wifi: iwlwifi: pcie: move gen1 TB handling to header

We will need this in another place soon in reclaim and init,
so add this function to the queue header file instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230816104355.52b6f66de219.Ic8403fd098c187fac067977808c0129d96514c91@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: remove 'def_rx_queue' struct member
Johannes Berg [Wed, 16 Aug 2023 08:10:47 +0000 (11:10 +0300)]
wifi: iwlwifi: remove 'def_rx_queue' struct member

This is only ever initialized to zero, use a new define
for the default RX queue instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230816104355.e0c6fa57c162.I907bbb428cf99725f06a348c8dbce5d3dd877136@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: pcie: clean up gen1/gen2 TFD unmap
Johannes Berg [Wed, 16 Aug 2023 08:10:46 +0000 (11:10 +0300)]
wifi: iwlwifi: pcie: clean up gen1/gen2 TFD unmap

This is a bit messy right now, there are functions for both,
but then gen1 function can actually deal with both gen1 and
gen2, due to the confusion about use_tfh/gen2 cleaned up in
the previous patch.

Fix the common paths to call the right functions and remove
handling of gen2 from the gen1 function.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230816104355.baf23841ec5c.I40702e94b25db05e82f935f14548316f8c6429b9@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: remove WARN from read_mem32()
Johannes Berg [Wed, 16 Aug 2023 08:10:45 +0000 (11:10 +0300)]
wifi: iwlwifi: remove WARN from read_mem32()

There's no reason to warn here, it's not an internal consistency
issue, we even use this to check if the device is dead, and if it
read_mem() returns an error that's either because grab NIC access
or memory allocation failed, both of which are already noisy.

Just remove the warning entirely.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230816104355.5f4e80eb63cc.Iffd88f63f95575f28e503da13b473724e3341aee@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: api: fix a small upper/lower-case typo
Johannes Berg [Wed, 16 Aug 2023 08:10:44 +0000 (11:10 +0300)]
wifi: iwlwifi: api: fix a small upper/lower-case typo

The structure name in the docs should be given in all
lower case matching the actual C declaration.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230816104355.c06f98055dbb.Ie9267108c57edcbb913f0d0f349eac85ca39409b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: iwlwifi: mvm: advertise MLO only if EHT is enabled
Johannes Berg [Wed, 16 Aug 2023 08:10:43 +0000 (11:10 +0300)]
wifi: iwlwifi: mvm: advertise MLO only if EHT is enabled

If 11ax/EHT is disabled, then we shouldn't advertise MLO
support either.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230816104355.ae4f9151440e.I6ce0b98d063d5005fd7a613454fcdb8b866a417a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: cfg80211: Annotate struct cfg80211_tid_config with __counted_by
Kees Cook [Thu, 17 Aug 2023 21:15:29 +0000 (14:15 -0700)]
wifi: cfg80211: Annotate struct cfg80211_tid_config with __counted_by

Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct cfg80211_tid_config.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230817211531.4193219-7-keescook@chromium.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: cfg80211: Annotate struct cfg80211_scan_request with __counted_by
Kees Cook [Thu, 17 Aug 2023 21:15:28 +0000 (14:15 -0700)]
wifi: cfg80211: Annotate struct cfg80211_scan_request with __counted_by

Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct cfg80211_scan_request.
Additionally, since the element count member must be set before accessing
the annotated flexible array member, move its initialization earlier.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230817211531.4193219-6-keescook@chromium.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: cfg80211: Annotate struct cfg80211_rnr_elems with __counted_by
Kees Cook [Thu, 17 Aug 2023 21:15:27 +0000 (14:15 -0700)]
wifi: cfg80211: Annotate struct cfg80211_rnr_elems with __counted_by

Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct cfg80211_rnr_elems.
Additionally, since the element count member must be set before accessing
the annotated flexible array member, move its initialization earlier.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230817211531.4193219-5-keescook@chromium.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: cfg80211: Annotate struct cfg80211_pmsr_request with __counted_by
Kees Cook [Thu, 17 Aug 2023 21:15:26 +0000 (14:15 -0700)]
wifi: cfg80211: Annotate struct cfg80211_pmsr_request with __counted_by

Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct cfg80211_pmsr_request.
Additionally, since the element count member must be set before accessing
the annotated flexible array member, move its initialization earlier.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230817211531.4193219-4-keescook@chromium.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: cfg80211: Annotate struct cfg80211_mbssid_elems with __counted_by
Kees Cook [Thu, 17 Aug 2023 21:15:25 +0000 (14:15 -0700)]
wifi: cfg80211: Annotate struct cfg80211_mbssid_elems with __counted_by

Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct cfg80211_mbssid_elems.
Additionally, since the element count member must be set before accessing
the annotated flexible array member, move its initialization earlier.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230817211531.4193219-3-keescook@chromium.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: cfg80211: Annotate struct cfg80211_cqm_config with __counted_by
Kees Cook [Thu, 17 Aug 2023 21:15:24 +0000 (14:15 -0700)]
wifi: cfg80211: Annotate struct cfg80211_cqm_config with __counted_by

Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct cfg80211_cqm_config.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230817211531.4193219-2-keescook@chromium.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: cfg80211: Annotate struct cfg80211_acl_data with __counted_by
Kees Cook [Thu, 17 Aug 2023 21:15:23 +0000 (14:15 -0700)]
wifi: cfg80211: Annotate struct cfg80211_acl_data with __counted_by

Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct cfg80211_acl_data.
Additionally, since the element count member must be set before accessing
the annotated flexible array member, move its initialization earlier.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230817211531.4193219-1-keescook@chromium.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 months agowifi: rtw89: regd: update regulatory map to R64-R43
Zong-Zhe Yang [Tue, 15 Aug 2023 12:02:53 +0000 (20:02 +0800)]
wifi: rtw89: regd: update regulatory map to R64-R43

Sync Realtek Regulatory R43 and Realtek Channel Plan R64.

1. add entry for XK (Kosovo)
2. change TH (Thailand) to Realtek regd world-wide
3. configures Realtek 6 GHz regd for below countries
   * AR, MX, HT -> FCC
   * LB, ZA, BF, LA, MN -> ETSI

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230815120253.9901-1-pkshih@realtek.com
10 months agowifi: rtw89: fix a width vs precision bug
Dan Carpenter [Tue, 8 Aug 2023 05:36:09 +0000 (08:36 +0300)]
wifi: rtw89: fix a width vs precision bug

The "buf" is skb->data that comes from the firmware.  We want to print
"len" number of bytes.  But there is a missing period so the "len"
variable is used for formatting (width) instead of limiting the output
(precision).

Fixes: cad2bd8a136c ("wifi: rtw89: support firmware log with formatted text")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/0700c7b9-bfd3-4aa6-82bf-5bf3c74644e1@moroto.mountain
10 months agowifi: rt2x00: correct MAC_SYS_CTRL register RX mask in R-Calibration
Shiji Yang [Sat, 5 Aug 2023 09:17:28 +0000 (17:17 +0800)]
wifi: rt2x00: correct MAC_SYS_CTRL register RX mask in R-Calibration

For MAC_SYS_CTRL register, Bit[2] controls MAC_TX_EN and Bit[3]
controls MAC_RX_EN (Bit index starts from 0). Therefore, 0x08 is
the correct mask for RX.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/TYAP286MB03150B571B67B896A504AC34BC0EA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM
10 months agowifi: rtlwifi: use eth_broadcast_addr() to assign broadcast address
Yang Yingliang [Fri, 4 Aug 2023 09:01:20 +0000 (17:01 +0800)]
wifi: rtlwifi: use eth_broadcast_addr() to assign broadcast address

Use eth_broadcast_addr() to assign broadcast address instead
of memcpy().

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230804090120.1332091-1-yangyingliang@huawei.com
10 months agowifi: rtw89: Introduce Time Averaged SAR (TAS) feature
Kuan-Chung Chen [Fri, 4 Aug 2023 05:34:58 +0000 (13:34 +0800)]
wifi: rtw89: Introduce Time Averaged SAR (TAS) feature

Time Averaged SAR (TAS) tracks the amount of transmit power over a
period of time and adjusts the power accordingly. Two thresholds are
used to determine when to increase or reduce transmit power: Dynamic
Power Reduction (DPR) on/off. Compared to Static SAR, which has a
constant transmit power, TAS can improve the user experience or
range extension.

TAS can be enabled through BIOS, and the driver will evaluate
Realtek ACPI DSM with RTW89_ACPI_DSM_FUNC_TAS_EN to determine
whether TAS should be enabled.

Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230804053458.31492-1-pkshih@realtek.com
10 months agowifi: rtw89: 8852b: rfk: fine tune IQK parameters to improve performance on 2GHz...
Ping-Ke Shih [Thu, 3 Aug 2023 11:01:50 +0000 (19:01 +0800)]
wifi: rtw89: 8852b: rfk: fine tune IQK parameters to improve performance on 2GHz band

A few samples get bad performance on 2GHz band, so use proper IQK command
code and select another group to have wider range of calibration value.

Fixes: f2abe804e823 ("wifi: rtw89: 8852b: rfk: add IQK")
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230803110150.8457-1-pkshih@realtek.com
10 months agowifi: ipw2x00: refactor to use kstrtoul
Justin Stitt [Wed, 2 Aug 2023 01:23:06 +0000 (01:23 +0000)]
wifi: ipw2x00: refactor to use kstrtoul

The current implementation seems to reinvent what `kstrtoul` already does
in terms of functionality and error handling. Remove uses of `simple_strtoul()`
in favor of `kstrtoul()`.

There is the following note at `lib/vsprintf.c:simple_strtoull()` which
further backs this change:
| * This function has caveats. Please use kstrtoull (or kstrtoul) instead.

And here, simple_str* are explicitly deprecated [3].

This patch also removes an instance of the deprecated `strncpy` which helps [2].

Compile tested only.

Link: https://lore.kernel.org/all/202308011602.3CC1C0244C@keescook/
Link: https://github.com/KSPP/linux/issues/90
Link: https://docs.kernel.org/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull
Cc: linux-hardening@vger.kernel.org
Suggested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230802-wifi-ipw2x00-refactor-v2-1-d33f765e9cd5@google.com
10 months agowifi: mwifiex: fix comment typos in SDIO module
Dmitry Antipov [Mon, 14 Aug 2023 14:19:05 +0000 (17:19 +0300)]
wifi: mwifiex: fix comment typos in SDIO module

Fix comment typos around ' mwifiex_deaggr_sdio_pkt()'
and 'mwifiex_host_to_card_mp_aggr()'.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230814142101.60308-2-dmantipov@yandex.ru
10 months agowifi: mwifiex: cleanup adapter data
Dmitry Antipov [Mon, 14 Aug 2023 14:19:04 +0000 (17:19 +0300)]
wifi: mwifiex: cleanup adapter data

Remove unused and set but unused 'dfs_workqueue', 'dfs_work', and
'scan_channels' members of 'struct mwifiex_adapter', adjust users.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230814142101.60308-1-dmantipov@yandex.ru
10 months agowifi: mwifiex: Fix missed return in oob checks failed path
Polaris Pi [Thu, 10 Aug 2023 08:39:11 +0000 (08:39 +0000)]
wifi: mwifiex: Fix missed return in oob checks failed path

Add missed return in mwifiex_uap_queue_bridged_pkt() and
mwifiex_process_rx_packet().

Fixes: 119585281617 ("wifi: mwifiex: Fix OOB and integer underflow when rx packets")
Signed-off-by: Polaris Pi <pinkperfect2021@gmail.com>
Reported-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230810083911.3725248-1-pinkperfect2021@gmail.com
10 months agowifi: mwifiex: use is_zero_ether_addr() instead of ether_addr_equal()
Ruan Jinjie [Tue, 8 Aug 2023 08:10:23 +0000 (16:10 +0800)]
wifi: mwifiex: use is_zero_ether_addr() instead of ether_addr_equal()

Use is_zero_ether_addr() instead of ether_addr_equal()
to check if the ethernet address is all zeros.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230808081023.2303423-1-ruanjinjie@huawei.com
10 months agowifi: mwifiex: drop BUG_ON from TX paths
Dmitry Antipov [Wed, 2 Aug 2023 16:07:19 +0000 (19:07 +0300)]
wifi: mwifiex: drop BUG_ON from TX paths

In 'mwifiex_process_sta_txpd()' and 'mwifiex_process_uap_txpd()',
replace 'BUG_ON()' with runtime check, and move all these checks
to 'mwifiex_process_tx()'. This way, both callees may be converted
to 'void', and the caller may be simplified as well.

Suggested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230802160726.85545-5-dmantipov@yandex.ru
10 months agowifi: mwifiex: handle possible mwifiex_write_reg() errors
Dmitry Antipov [Wed, 2 Aug 2023 16:07:18 +0000 (19:07 +0300)]
wifi: mwifiex: handle possible mwifiex_write_reg() errors

Return -1 on possible 'mwifiex_write_reg()' errors in
'mwifiex_init_sdio_ioport()', do not ignore the value
returned by the latter in 'mwifiex_init_sdio()' and
'mwifiex_sdio_up_dev()' as well.

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

Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230802160726.85545-4-dmantipov@yandex.ru
10 months agowifi: mwifiex: handle possible sscanf() errors
Dmitry Antipov [Wed, 2 Aug 2023 16:07:17 +0000 (19:07 +0300)]
wifi: mwifiex: handle possible sscanf() errors

Return -EINVAL on possible 'sscanf()' errors in
'mwifiex_regrdwr_write()' and 'mwifiex_rdeeprom_write()'.

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

Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230802160726.85545-3-dmantipov@yandex.ru
10 months agowifi: mwifiex: cleanup private data structures
Dmitry Antipov [Wed, 2 Aug 2023 16:07:16 +0000 (19:07 +0300)]
wifi: mwifiex: cleanup private data structures

Drop unused fields 'status_code' of 'struct mwifiex_txinfo',
'dfs_chan_switch_timer', 'sleep_params' (including related data
type 'struct mwifiex_sleep_params') of 'struct mwifiex_adapter',
adjust related code.

Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230802160726.85545-2-dmantipov@yandex.ru
10 months agowifi: mwifiex: fix memory leak in mwifiex_histogram_read()
Dmitry Antipov [Wed, 2 Aug 2023 16:07:15 +0000 (19:07 +0300)]
wifi: mwifiex: fix memory leak in mwifiex_histogram_read()

Always free the zeroed page on return from 'mwifiex_histogram_read()'.

Fixes: cbf6e05527a7 ("mwifiex: add rx histogram statistics support")

Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230802160726.85545-1-dmantipov@yandex.ru
10 months agopds_core: Fix some kernel-doc comments
Yang Li [Mon, 21 Aug 2023 01:55:37 +0000 (09:55 +0800)]
pds_core: Fix some kernel-doc comments

Fix some kernel-doc comments to silence the warnings:

drivers/net/ethernet/amd/pds_core/auxbus.c:18: warning: Function parameter or member 'pf' not described in 'pds_client_register'
drivers/net/ethernet/amd/pds_core/auxbus.c:18: warning: Excess function parameter 'pf_pdev' description in 'pds_client_register'
drivers/net/ethernet/amd/pds_core/auxbus.c:58: warning: Function parameter or member 'pf' not described in 'pds_client_unregister'
drivers/net/ethernet/amd/pds_core/auxbus.c:58: warning: Excess function parameter 'pf_pdev' description in 'pds_client_unregister'

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: annotate data-races around sk->sk_lingertime
Eric Dumazet [Sat, 19 Aug 2023 04:06:46 +0000 (04:06 +0000)]
net: annotate data-races around sk->sk_lingertime

sk_getsockopt() runs locklessly. This means sk->sk_lingertime
can be read while other threads are changing its value.

Other reads also happen without socket lock being held,
and must be annotated.

Remove preprocessor logic using BITS_PER_LONG, compilers
are smart enough to figure this by themselves.

v2: fixed a clang W=1 (-Wtautological-constant-out-of-range-compare) warning
    (Jakub)

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agoIPv4: add extack info for IPv4 address add/delete
Hangbin Liu [Fri, 18 Aug 2023 08:25:23 +0000 (16:25 +0800)]
IPv4: add extack info for IPv4 address add/delete

Add extack info for IPv4 address add/delete, which would be useful for
users to understand the problem without having to read kernel code.

No extack message for the ifa_local checking in __inet_insert_ifa() as
it has been checked in find_matching_ifa().

Suggested-by: Ido Schimmel <idosch@idosch.org>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: stmmac: Check more MAC HW features for XGMAC Core 3.20
Furong Xu [Sat, 19 Aug 2023 10:54:40 +0000 (18:54 +0800)]
net: stmmac: Check more MAC HW features for XGMAC Core 3.20

1. XGMAC Core does not have hash_filter definition, it uses
vlhash(VLAN Hash Filtering) instead, skip hash_filter when XGMAC.
2. Show exact size of Hash Table instead of raw register value.
3. Show full description of safety features defined by Synopsys Databook.
4. When safety feature is configured with no parity, or ECC only,
keep FSM Parity Checking disabled.

Signed-off-by: Furong Xu <0x1207@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agoMerge branch 'ipv6-update-route-when-delete-saddr'
David S. Miller [Sun, 20 Aug 2023 14:27:22 +0000 (15:27 +0100)]
Merge branch 'ipv6-update-route-when-delete-saddr'

Hangbin Liu says:

====================
ipv6: update route when delete source address

Currently, when remove an address, the IPv6 route will not remove the
prefer source address when the address is bond to other device. Fix this
issue and add related tests as Ido and David suggested.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agoselftests: fib_test: add a test case for IPv6 source address delete
Hangbin Liu [Fri, 18 Aug 2023 08:29:02 +0000 (16:29 +0800)]
selftests: fib_test: add a test case for IPv6 source address delete

Add a test case for IPv6 source address delete.

As David suggested, add tests:
- Single device using src address
- Two devices with the same source address
- VRF with single device using src address
- VRF with two devices using src address

As Ido points out, in IPv6, the preferred source address is looked up in
the same VRF as the first nexthop device. This will give us similar results
to IPv4 if the route is installed in the same VRF as the nexthop device, but
not when the nexthop device is enslaved to a different VRF. So add tests:
- src address and nexthop dev in same VR
- src address and nexthop device in different VRF

The link local address delete logic is different from the global address.
It should only affect the associate device it bonds to. So add tests cases
for link local address testing.

Here is the test result:

IPv6 delete address route tests
    Single device using src address
    TEST: Prefsrc removed when src address removed on other device      [ OK ]
    Two devices with the same source address
    TEST: Prefsrc not removed when src address exist on other device    [ OK ]
    TEST: Prefsrc removed when src address removed on all devices       [ OK ]
    VRF with single device using src address
    TEST: Prefsrc removed when src address removed on other device      [ OK ]
    VRF with two devices using src address
    TEST: Prefsrc not removed when src address exist on other device    [ OK ]
    TEST: Prefsrc removed when src address removed on all devices       [ OK ]
    src address and nexthop dev in same VRF
    TEST: Prefsrc removed from VRF when source address deleted          [ OK ]
    TEST: Prefsrc in default VRF not removed                            [ OK ]
    TEST: Prefsrc not removed from VRF when source address exist        [ OK ]
    TEST: Prefsrc in default VRF removed                                [ OK ]
    src address and nexthop device in different VRF
    TEST: Prefsrc not removed from VRF when nexthop dev in diff VRF     [ OK ]
    TEST: Prefsrc not removed in default VRF                            [ OK ]
    TEST: Prefsrc removed from VRF when nexthop dev in diff VRF         [ OK ]
    TEST: Prefsrc removed in default VRF                                [ OK ]
    Table ID 0
    TEST: Prefsrc removed from default VRF when source address deleted  [ OK ]
    Link local source route
    TEST: Prefsrc not removed when delete ll addr from other dev        [ OK ]
    TEST: Prefsrc removed when delete ll addr                           [ OK ]
    TEST: Prefsrc not removed when delete ll addr from other dev        [ OK ]
    TEST: Prefsrc removed even ll addr still exist on other dev         [ OK ]

Tests passed:  19
Tests failed:   0

Suggested-by: Ido Schimmel <idosch@idosch.org>
Suggested-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agoipv6: do not match device when remove source route
Hangbin Liu [Fri, 18 Aug 2023 08:29:01 +0000 (16:29 +0800)]
ipv6: do not match device when remove source route

After deleting an IPv6 address on an interface and cleaning up the
related preferred source entries, it is important to ensure that all
routes associated with the deleted address are properly cleared. The
current implementation of rt6_remove_prefsrc() only checks the preferred
source addresses bound to the current device. However, there may be
routes that are bound to other devices but still utilize the same
preferred source address.

To address this issue, it is necessary to also delete entries that are
bound to other interfaces but share the same source address with the
current device. Failure to delete these entries would leave routes that
are bound to the deleted address unclear. Here is an example reproducer
(I have omitted unrelated routes):

+ ip link add dummy1 type dummy
+ ip link add dummy2 type dummy
+ ip link set dummy1 up
+ ip link set dummy2 up
+ ip addr add 1:2:3:4::5/64 dev dummy1
+ ip route add 7:7:7:0::1 dev dummy1 src 1:2:3:4::5
+ ip route add 7:7:7:0::2 dev dummy2 src 1:2:3:4::5
+ ip -6 route show
1:2:3:4::/64 dev dummy1 proto kernel metric 256 pref medium
7:7:7::1 dev dummy1 src 1:2:3:4::5 metric 1024 pref medium
7:7:7::2 dev dummy2 src 1:2:3:4::5 metric 1024 pref medium
+ ip addr del 1:2:3:4::5/64 dev dummy1
+ ip -6 route show
7:7:7::1 dev dummy1 metric 1024 pref medium
7:7:7::2 dev dummy2 src 1:2:3:4::5 metric 1024 pref medium

As Ido reminds, in IPv6, the preferred source address is looked up in
the same VRF as the first nexthop device, which is different with IPv4.
So, while removing the device checking, we also need to add an
ipv6_chk_addr() check to make sure the address does not exist on the other
devices of the rt nexthop device's VRF.

After fix:
+ ip addr del 1:2:3:4::5/64 dev dummy1
+ ip -6 route show
7:7:7::1 dev dummy1 metric 1024 pref medium
7:7:7::2 dev dummy2 metric 1024 pref medium

Reported-by: Thomas Haller <thaller@redhat.com>
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2170513
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agoselftests: vrf_route_leaking: remove ipv6_ping_frag from default testing
Hangbin Liu [Fri, 18 Aug 2023 08:06:13 +0000 (16:06 +0800)]
selftests: vrf_route_leaking: remove ipv6_ping_frag from default testing

As the initial commit 1a01727676a8 ("selftests: Add VRF route leaking
tests") said, the IPv6 MTU test fails as source address selection
picking ::1. Every time we run the selftest this one report failed.
There seems not much meaning  to keep reporting a failure for 3 years
that no one plan to fix/update. Let't just skip this one first. We can
add it back when the issue fixed.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: release reference to inet6_dev pointer
Patrick Rohr [Fri, 18 Aug 2023 18:22:49 +0000 (11:22 -0700)]
net: release reference to inet6_dev pointer

addrconf_prefix_rcv returned early without releasing the inet6_dev
pointer when the PIO lifetime is less than accept_ra_min_lft.

Fixes: 5027d54a9c30 ("net: change accept_ra_min_rtr_lft to affect all RA lifetimes")
Cc: Maciej Żenczykowski <maze@google.com>
Cc: Lorenzo Colitti <lorenzo@google.com>
Cc: David Ahern <dsahern@kernel.org>
Cc: Simon Horman <horms@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Patrick Rohr <prohr@google.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: selectively purge error queue in IP_RECVERR / IPV6_RECVERR
Eric Dumazet [Fri, 18 Aug 2023 17:41:45 +0000 (17:41 +0000)]
net: selectively purge error queue in IP_RECVERR / IPV6_RECVERR

Setting IP_RECVERR and IPV6_RECVERR options to zero currently
purges the socket error queue, which was probably not expected
for zerocopy and tx_timestamp users.

I discovered this issue while preparing commit 6b5f43ea0815
("inet: move inet->recverr to inet->inet_flags"), I presume this
change does not need to be backported to stable kernels.

Add skb_errqueue_purge() helper to purge error messages only.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agoMerge branch 'fixed_phy_register-return-value'
David S. Miller [Sun, 20 Aug 2023 14:13:27 +0000 (15:13 +0100)]
Merge branch 'fixed_phy_register-return-value'

Ruan Jinjie says:

====================
net: Return PTR_ERR() for fixed_phy_register()

fixed_phy_register() returns not only -EIO or -ENODEV, but also
-EPROBE_DEFER, -EINVAL and -EBUSY. The Best practice is to return these
error codes with PTR_ERR().
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: lan743x: Return PTR_ERR() for fixed_phy_register()
Ruan Jinjie [Fri, 18 Aug 2023 07:07:07 +0000 (15:07 +0800)]
net: lan743x: Return PTR_ERR() for fixed_phy_register()

fixed_phy_register() returns -EPROBE_DEFER, -EINVAL and -EBUSY,
etc, in addition to -EIO. The Best practice is to return these
error codes with PTR_ERR().

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: bcmgenet: Return PTR_ERR() for fixed_phy_register()
Ruan Jinjie [Fri, 18 Aug 2023 07:07:06 +0000 (15:07 +0800)]
net: bcmgenet: Return PTR_ERR() for fixed_phy_register()

fixed_phy_register() returns -EPROBE_DEFER, -EINVAL and -EBUSY,
etc, in addition to -ENODEV. The Best practice is to return these
error codes with PTR_ERR().

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Acked-by: Doug Berger <opendmb@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: bgmac: Return PTR_ERR() for fixed_phy_register()
Ruan Jinjie [Fri, 18 Aug 2023 07:07:05 +0000 (15:07 +0800)]
net: bgmac: Return PTR_ERR() for fixed_phy_register()

fixed_phy_register() returns -EPROBE_DEFER, -EINVAL and -EBUSY,
etc, in addition to -ENODEV. The best practice is to return
these error codes with PTR_ERR().

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: dsa: realtek: add phylink_get_caps implementation
Russell King (Oracle) [Sat, 19 Aug 2023 11:11:06 +0000 (12:11 +0100)]
net: dsa: realtek: add phylink_get_caps implementation

The user ports use RSGMII, but we don't have that, and DT doesn't
specify a phy interface mode, so phylib defaults to GMII. These support
1G, 100M and 10M with flow control. It is unknown whether asymetric
pause is supported at all speeds.

The CPU port uses MII/GMII/RGMII/REVMII by hardware pin strapping,
and support speeds specific to each, with full duplex only supported
in some modes. Flow control may be supported again by hardware pin
strapping, and theoretically is readable through a register but no
information is given in the datasheet for that.

So, we do a best efforts - and be lenient.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agoMerge branch 'vcap_get_rule-return-value'
David S. Miller [Sat, 19 Aug 2023 18:29:23 +0000 (19:29 +0100)]
Merge branch 'vcap_get_rule-return-value'

Ruan Jinjie says:

====================
net: Update and fix return value check for vcap_get_rule()

As Simon Horman suggests, update vcap_get_rule() to always
return an ERR_PTR() and update the error detection conditions to
use IS_ERR(), which would be more cleaner.

So se IS_ERR() to update the return value and fix the issue
in lan966x_ptp_add_trap().

Changes in v2:
- Update vcap_get_rule() to always return an ERR_PTR().
- Update the return value fix in lan966x_ptp_add_trap().
- Update the return value check in sparx5_tc_free_rule_resources().
====================

Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: microchip: sparx5: Update return value check for vcap_get_rule()
Ruan Jinjie [Fri, 18 Aug 2023 05:05:05 +0000 (13:05 +0800)]
net: microchip: sparx5: Update return value check for vcap_get_rule()

As Simon Horman suggests, update vcap_get_rule() to always
return an ERR_PTR() and update the error detection conditions to
use IS_ERR(), so use IS_ERR() to check the return value.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Suggested-by: Simon Horman <horms@kernel.org>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: lan966x: Fix return value check for vcap_get_rule()
Ruan Jinjie [Fri, 18 Aug 2023 05:05:04 +0000 (13:05 +0800)]
net: lan966x: Fix return value check for vcap_get_rule()

As Simon Horman suggests, update vcap_get_rule() to always
return an ERR_PTR() and update the error detection conditions to
use IS_ERR(), so use IS_ERR() to fix the return value issue.

Fixes: 72df3489fb10 ("net: lan966x: Add ptp trap rules")
Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Suggested-by: Simon Horman <horms@kernel.org>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: microchip: vcap api: Always return ERR_PTR for vcap_get_rule()
Ruan Jinjie [Fri, 18 Aug 2023 05:05:03 +0000 (13:05 +0800)]
net: microchip: vcap api: Always return ERR_PTR for vcap_get_rule()

As Simon Horman suggests, update vcap_get_rule() to always
return an ERR_PTR() and update the error detection conditions to
use IS_ERR(), which would be more cleaner in this case.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Suggested-by: Simon Horman <horms@kernel.org>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: mdio: xgene: remove useless xgene_mdio_status
Russell King (Oracle) [Fri, 18 Aug 2023 11:33:24 +0000 (12:33 +0100)]
net: mdio: xgene: remove useless xgene_mdio_status

xgene_mdio_status is declared static, and is only written once by the
driver. It appears to have been this way since the driver was first
added to the kernel tree. No other users can be found, so let's remove
it.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agotools: ynl-gen: use temporary file for rendering
Jiri Pirko [Fri, 18 Aug 2023 11:19:27 +0000 (13:19 +0200)]
tools: ynl-gen: use temporary file for rendering

Currently any error during render leads to output an empty file.
That is quite annoying when using tools/net/ynl/ynl-regen.sh
which git greps files with content of "YNL-GEN.." and therefore ignores
empty files. So once you fail to regen, you have to checkout the file.

Avoid that by rendering to a temporary file first, only at the end
copy the content to the actual destination.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agostmmac: intel: Enable correction of MAC propagation delay
Kurt Kanzenbach [Fri, 18 Aug 2023 11:14:01 +0000 (13:14 +0200)]
stmmac: intel: Enable correction of MAC propagation delay

All captured timestamps should be corrected by PHY, MAC and CDC introduced
latency/errors. The CDC correction is already used. Enable MAC propagation delay
correction as well which is available since commit 26cfb838aa00 ("net: stmmac:
correct MAC propagation delay").

Before:
|ptp4l[390.458]: rms    7 max   21 freq   +177 +/-  14 delay   357 +/-   1

After:
|ptp4l[620.012]: rms    7 max   20 freq   +195 +/-  14 delay   345 +/-   1

Tested on Intel Elkhart Lake.

Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Reviewed-by: Johannes Zink <j.zink@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: add skb_queue_purge_reason and __skb_queue_purge_reason
Eric Dumazet [Fri, 18 Aug 2023 09:40:39 +0000 (09:40 +0000)]
net: add skb_queue_purge_reason and __skb_queue_purge_reason

skb_queue_purge() and __skb_queue_purge() become wrappers
around the new generic functions.

New SKB_DROP_REASON_QUEUE_PURGE drop reason is added,
but users can start adding more specific reasons.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agoMerge branch 'smc-features'
David S. Miller [Sat, 19 Aug 2023 11:46:53 +0000 (12:46 +0100)]
Merge branch 'smc-features'

Guangguan Wang says:

====================
net/smc: several features's implementation for smc v2.1

This patch set implement several new features in SMC v2.1(https://
www.ibm.com/support/pages/node/7009315), including vendor unique
experimental options, max connections per lgr negotiation, max links
per lgr negotiation.

v1 - v2:
 - rename field fce_v20 to fce_v2_base in struct
   smc_clc_first_contact_ext_v2x
 - use smc_get_clc_first_contact_ext in smc_connect
   _rdma_v2_prepare
 - adding comment about field vendor_oui in struct
   smc_clc_msg_smcd
 - remove comment about SMC_CONN_PER_LGR_MAX in smc_
   clc_srv_v2x_features_validate
 - rename smc_clc_clnt_v2x_features_validate

RFC v2 - v1:
 - more description in commit message
 - modify SMC_CONN_PER_LGR_xxx and SMC_LINKS_ADD_LNK_xxx
   macro defination and usage
 - rename field release_ver to release_nr
 - remove redundant release version check in client
 - explicitly set the rc value in smc_llc_cli/srv_add_link

RFC v1 - RFC v2:
 - Remove ini pointer NULL check and fix code style in
   smc_clc_send_confirm_accept.
 - Optimize the max_conns check in smc_clc_xxx_v2x_features_validate.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet/smc: Extend SMCR v2 linkgroup netlink attribute
Guangguan Wang [Thu, 17 Aug 2023 13:20:32 +0000 (21:20 +0800)]
net/smc: Extend SMCR v2 linkgroup netlink attribute

Add SMC_NLA_LGR_R_V2_MAX_CONNS and SMC_NLA_LGR_R_V2_MAX_LINKS
to SMCR v2 linkgroup netlink attribute SMC_NLA_LGR_R_V2 for
linkgroup's detail info showing.

Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
Reviewed-by: Jan Karcher <jaka@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet/smc: support max links per lgr negotiation in clc handshake
Guangguan Wang [Thu, 17 Aug 2023 13:20:31 +0000 (21:20 +0800)]
net/smc: support max links per lgr negotiation in clc handshake

Support max links per lgr negotiation in clc handshake for SMCR v2.1,
which is one of smc v2.1 features. Server makes decision for the final
value of max links based on the client preferred max links and
self-preferred max links. Here use the minimum value of the client
preferred max links and server preferred max links.

Client                                       Server
     Proposal(max links(client preferred))
     -------------------------------------->

     Accept(max links(accepted value))
accepted value=min(client preferred, server preferred)
     <-------------------------------------

      Confirm(max links(accepted value))
     ------------------------------------->

Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>
Reviewed-by: Jan Karcher <jaka@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet/smc: support max connections per lgr negotiation
Guangguan Wang [Thu, 17 Aug 2023 13:20:30 +0000 (21:20 +0800)]
net/smc: support max connections per lgr negotiation

Support max connections per lgr negotiation for SMCR v2.1,
which is one of smc v2.1 features. Server makes decision for
the final value of max conns based on the client preferred
max conns and self-preferred max conns. Here use the minimum
value of client preferred max conns and server preferred max
conns.

Client                                     Server
     Proposal(max conns(client preferred))
     ------------------------------------>

     Accept(max conns(accepted value))
accepted value=min(client preferred, server preferred)
     <-----------------------------------

     Confirm(max conns(accepted value))
     ----------------------------------->

Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>
Reviewed-by: Jan Karcher <jaka@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet/smc: support smc v2.x features validate
Guangguan Wang [Thu, 17 Aug 2023 13:20:29 +0000 (21:20 +0800)]
net/smc: support smc v2.x features validate

Support SMC v2.x features validate for SMC v2.1. This is the frame
code for SMC v2.x features validate, and will take effects only when
the negotiated release version is v2.1 or later.

For Server, v2.x features' validation should be done in smc_clc_srv_
v2x_features_validate when receiving v2.1 or later CLC Proposal Message,
such as max conns, max links negotiation, the decision of the final
value of max conns and max links should be made in this function.
And final check for server when receiving v2.1 or later CLC Confirm
Message should be done in smc_clc_v2x_features_confirm_check.

For client, v2.x features' validation should be done in smc_clc_clnt_
v2x_features_validate when receiving v2.1 or later CLC Accept Message,
for example, the decision to accpt the accepted value or to decline
should be made in this function.

Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>
Reviewed-by: Jan Karcher <jaka@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet/smc: add vendor unique experimental options area in clc handshake
Guangguan Wang [Thu, 17 Aug 2023 13:20:28 +0000 (21:20 +0800)]
net/smc: add vendor unique experimental options area in clc handshake

Add vendor unique experimental options area in clc handshake. In clc
accept and confirm msg, vendor unique experimental options use the
16-Bytes reserved field, which defined in struct smc_clc_fce_gid_ext
in previous version. Because of the struct smc_clc_first_contact_ext
is widely used and limit the scope of modification, this patch moves
the 16-Bytes reserved field out of struct smc_clc_fce_gid_ext, and
followed with the struct smc_clc_first_contact_ext in a new struct
names struct smc_clc_first_contact_ext_v2x.

For SMC-R first connection, in previous version, the struct smc_clc_
first_contact_ext and the 16-Bytes reserved field has already been
included in clc accept and confirm msg. Thus, this patch use struct
smc_clc_first_contact_ext_v2x instead of the struct smc_clc_first_
contact_ext and the 16-Bytes reserved field in SMC-R clc accept and
confirm msg is compatible with previous version.

For SMC-D first connection, in previous version, only the struct smc_
clc_first_contact_ext is included in clc accept and confirm msg, and
the 16-Bytes reserved field is not included. Thus, when the negotiated
smc release version is the version before v2.1, we still use struct
smc_clc_first_contact_ext for compatible consideration. If the negotiated
smc release version is v2.1 or later, use struct smc_clc_first_contact_
ext_v2x instead.

Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>
Reviewed-by: Jan Karcher <jaka@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet/smc: support smc release version negotiation in clc handshake
Guangguan Wang [Thu, 17 Aug 2023 13:20:27 +0000 (21:20 +0800)]
net/smc: support smc release version negotiation in clc handshake

Support smc release version negotiation in clc handshake based on
SMC v2, where no negotiation process for different releases, but
for different versions. The latest smc release version was updated
to v2.1. And currently there are two release versions of SMCv2, v2.0
and v2.1. In the release version negotiation, client sends the preferred
release version by CLC Proposal Message, server makes decision for which
release version to use based on the client preferred release version and
self-supported release version (here choose the minimum release version
of the client preferred and server latest supported), then the decision
returns to client by CLC Accept Message. Client confirms the decision by
CLC Confirm Message.

Client                                    Server
      Proposal(preferred release version)
     ------------------------------------>

      Accept(accpeted release version)
 min(client preferred, server latest supported)
     <------------------------------------

      Confirm(accpeted release version)
     ------------------------------------>

Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>
Reviewed-by: Jan Karcher <jaka@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
10 months agonet: freescale: Remove unused declarations
Yue Haibing [Thu, 17 Aug 2023 13:41:59 +0000 (21:41 +0800)]
net: freescale: Remove unused declarations

Commit 5d93cfcf7360 ("net: dpaa: Convert to phylink") removed
fman_set_mac_active_pause()/fman_get_pause_cfg() but not declarations.
Commit 48257c4f168e ("Add fs_enet ethernet network driver, for several
embedded platforms.") declared but never implemented
fs_enet_platform_init() and fs_enet_platform_cleanup().

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Acked-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20230817134159.38484-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agotcp: refine skb->ooo_okay setting
Eric Dumazet [Thu, 17 Aug 2023 18:23:53 +0000 (18:23 +0000)]
tcp: refine skb->ooo_okay setting

Enabling BIG TCP on a low end platform apparently increased
chances of getting flows locked on one busy TX queue.

A similar problem was handled in commit 9b462d02d6dd
("tcp: TCP Small Queues and strange attractors"),
but the strategy worked for either bulk flows,
or 'large enough' RPC. BIG TCP changed how large
RPC needed to be to enable the work around:
If RPC fits in a single skb, TSQ never triggers.

Root cause for the problem is a busy TX queue,
with delayed TX completions.

This patch changes how we set skb->ooo_okay to detect
the case TX completion was not done, but incoming ACK
already was processed and emptied rtx queue.

Update the comment to explain the tricky details.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20230817182353.2523746-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agoMerge branch 'bnxt_en-update-for-net-next'
Jakub Kicinski [Sat, 19 Aug 2023 02:14:01 +0000 (19:14 -0700)]
Merge branch 'bnxt_en-update-for-net-next'

Michael Chan says:

====================
bnxt_en: Update for net-next

This patchset contains 2 features:

- The page pool implementation for the normal RX path (non-XDP) for
paged buffers in the aggregation ring.

- Saving of the ring error counters across reset.
====================

Link: https://lore.kernel.org/r/20230817231911.165035-1-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agobnxt_en: Add tx_resets ring counter
Michael Chan [Thu, 17 Aug 2023 23:19:11 +0000 (16:19 -0700)]
bnxt_en: Add tx_resets ring counter

Add a new tx_resets ring counter.  This counter will be saved as
tx_total_resets across any reset.  Since we currently do a full reset
in bnxt_sched_reset_txr(), the per ring counter will always be cleared
during reset.  Only the tx_total_resets count will be meaningful and we
only display this under ethtool -S.

Link: https://lore.kernel.org/netdev/CACKFLimD-bKmJ1tGZOLYRjWzEwxkri-Mw7iFme1x2Dr0twdCeg@mail.gmail.com/
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20230817231911.165035-7-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agobnxt_en: Display the ring error counters under ethtool -S
Michael Chan [Thu, 17 Aug 2023 23:19:10 +0000 (16:19 -0700)]
bnxt_en: Display the ring error counters under ethtool -S

The existing driver displays the sum of 4 ring counters under ethtool -S.
These counters are in the array bnxt_sw_func_stats.  These counters are
summed at the time of ethtool -S and will be lost when the device is reset.

Replace these counters with the new total ring error counters added in the
last patch.  These new counters are saved before reset.  ethtool -S will
now display the sum of the saved counters plus the current counters.

Link: https://lore.kernel.org/netdev/CACKFLimD-bKmJ1tGZOLYRjWzEwxkri-Mw7iFme1x2Dr0twdCeg@mail.gmail.com/
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20230817231911.165035-6-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agobnxt_en: Save ring error counters across reset
Michael Chan [Thu, 17 Aug 2023 23:19:09 +0000 (16:19 -0700)]
bnxt_en: Save ring error counters across reset

Currently, the ring counters are stored in the per ring datastructure.
During reset, all the rings are freed together with the associated
datastructures.  As a result, all the ring error counters will be reset
to zero.

Add logic to keep track of the total error counts of all the rings
and save them before reset (including ifdown).  The next patch will
display these total ring error counters under ethtool -S.

Link: https://lore.kernel.org/netdev/CACKFLimD-bKmJ1tGZOLYRjWzEwxkri-Mw7iFme1x2Dr0twdCeg@mail.gmail.com/
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20230817231911.165035-5-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agobnxt_en: Increment rx_resets counter in bnxt_disable_napi()
Michael Chan [Thu, 17 Aug 2023 23:19:08 +0000 (16:19 -0700)]
bnxt_en: Increment rx_resets counter in bnxt_disable_napi()

If we are doing a complete reset with irq_re_init set to true in
bnxt_close_nic(), all the ring structures will be freed.  New
structures will be allocated in bnxt_open_nic().  The current code
increments rx_resets counter in bnxt_enable_napi() if bnapi->in_reset
is true.  In a complete reset, bnapi->in_reset will never be true
since the structure is just allocated.

Increment the rx_resets counter in bnxt_disable_napi() instead.  This
will allow us to save all the ring error counters including the
rx_resets counters in the next patch.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20230817231911.165035-4-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agobnxt_en: Let the page pool manage the DMA mapping
Somnath Kotur [Thu, 17 Aug 2023 23:19:07 +0000 (16:19 -0700)]
bnxt_en: Let the page pool manage the DMA mapping

Use the page pool's ability to maintain DMA mappings for us.
This avoids re-mapping of the recycled pages.

Link: https://lore.kernel.org/netdev/20230728231829.235716-4-michael.chan@broadcom.com/
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20230817231911.165035-3-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agobnxt_en: Use the unified RX page pool buffers for XDP and non-XDP
Somnath Kotur [Thu, 17 Aug 2023 23:19:06 +0000 (16:19 -0700)]
bnxt_en: Use the unified RX page pool buffers for XDP and non-XDP

Convert to use the page pool buffers for the aggregation ring when
running in non-XDP mode.  This simplifies the driver and we benefit
from the recycling of pages.  Adjust the page pool size to account
for the aggregation ring size.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20230817231911.165035-2-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agoMerge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next...
Jakub Kicinski [Sat, 19 Aug 2023 02:09:02 +0000 (19:09 -0700)]
Merge branch '100GbE' of git://git./linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2023-08-17 (ice)

This series contains updates to ice driver only.

Jan removes unused functions and refactors code to make, possible,
functions static.

Jake rearranges some functions to be logically grouped.

Marcin removes an unnecessary call to disable VLAN stripping.

Yang Yingliang utilizes list_for_each_entry() helper for a couple list
traversals.

Przemek removes some parameters from ice_aq_alloc_free_res() which were
always the same and reworks ice_aq_wait_for_event() to reduce chance of
race.

* '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  ice: split ice_aq_wait_for_event() func into two
  ice: embed &ice_rq_event_info event into struct ice_aq_task
  ice: ice_aq_check_events: fix off-by-one check when filling buffer
  ice: drop two params from ice_aq_alloc_free_res()
  ice: use list_for_each_entry() helper
  ice: Remove redundant VSI configuration in eswitch setup
  ice: move E810T functions to before device agnostic ones
  ice: refactor ice_vsi_is_vlan_pruning_ena
  ice: refactor ice_ptp_hw to make functions static
  ice: refactor ice_sched to make functions static
  ice: Utilize assign_bit() helper
  ice: refactor ice_vf_lib to make functions static
  ice: refactor ice_lib to make functions static
  ice: refactor ice_ddp to make functions static
  ice: remove unused methods
====================

Link: https://lore.kernel.org/r/20230817212239.2601543-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agonet: dm9051: Use PTR_ERR_OR_ZERO() to simplify code
Ruan Jinjie [Thu, 17 Aug 2023 02:24:18 +0000 (10:24 +0800)]
net: dm9051: Use PTR_ERR_OR_ZERO() to simplify code

Return PTR_ERR_OR_ZERO() instead of return 0 or PTR_ERR() to
simplify code.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20230817022418.3588831-1-ruanjinjie@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agosky2: Remove redundant NULL check for debugfs_create_dir
Ruan Jinjie [Thu, 17 Aug 2023 07:30:17 +0000 (15:30 +0800)]
sky2: Remove redundant NULL check for debugfs_create_dir

Since debugfs_create_dir() returns ERR_PTR, IS_ERR() is enough to
check whether the directory is successfully created. So remove the
redundant NULL check.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20230817073017.350002-1-ruanjinjie@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agopds_core: remove redundant pci_clear_master()
Yu Liao [Thu, 17 Aug 2023 02:57:09 +0000 (10:57 +0800)]
pds_core: remove redundant pci_clear_master()

do_pci_disable_device() disable PCI bus-mastering as following:
static void do_pci_disable_device(struct pci_dev *dev)
{
u16 pci_command;

pci_read_config_word(dev, PCI_COMMAND, &pci_command);
if (pci_command & PCI_COMMAND_MASTER) {
pci_command &= ~PCI_COMMAND_MASTER;
pci_write_config_word(dev, PCI_COMMAND, pci_command);
}

pcibios_disable_device(dev);
}
And pci_disable_device() sets dev->is_busmaster to 0.

pci_enable_device() is called only once before calling to
pci_disable_device() and such pci_clear_master() is not needed. So remove
redundant pci_clear_master().

Also rename goto label 'err_out_clear_master' to 'err_out_disable_device'.

Signed-off-by: Yu Liao <liaoyu15@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Acked-by: Shannon Nelson <shannon.nelson@amd.com>
Link: https://lore.kernel.org/r/20230817025709.2023553-1-liaoyu15@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
10 months agoMerge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next...
Jakub Kicinski [Fri, 18 Aug 2023 22:22:05 +0000 (15:22 -0700)]
Merge branch '40GbE' of git://git./linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
virtchnl: fix fake 1-elem arrays

Alexander Lobakin says:

6.5-rc1 started spitting warning splats when composing virtchnl
messages, precisely on virtchnl_rss_key and virtchnl_lut:

[   84.167709] memcpy: detected field-spanning write (size 52) of single
field "vrk->key" at drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1095
(size 1)
[   84.169915] WARNING: CPU: 3 PID: 11 at drivers/net/ethernet/intel/
iavf/iavf_virtchnl.c:1095 iavf_set_rss_key+0x123/0x140 [iavf]
...
[   84.191982] Call Trace:
[   84.192439]  <TASK>
[   84.192900]  ? __warn+0xc9/0x1a0
[   84.193353]  ? iavf_set_rss_key+0x123/0x140 [iavf]
[   84.193818]  ? report_bug+0x12c/0x1b0
[   84.194266]  ? handle_bug+0x42/0x70
[   84.194714]  ? exc_invalid_op+0x1a/0x50
[   84.195149]  ? asm_exc_invalid_op+0x1a/0x20
[   84.195592]  ? iavf_set_rss_key+0x123/0x140 [iavf]
[   84.196033]  iavf_watchdog_task+0xb0c/0xe00 [iavf]
...
[   84.225476] memcpy: detected field-spanning write (size 64) of single
field "vrl->lut" at drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1127
(size 1)
[   84.227190] WARNING: CPU: 27 PID: 1044 at drivers/net/ethernet/intel/
iavf/iavf_virtchnl.c:1127 iavf_set_rss_lut+0x123/0x140 [iavf]
...
[   84.246601] Call Trace:
[   84.247228]  <TASK>
[   84.247840]  ? __warn+0xc9/0x1a0
[   84.248263]  ? iavf_set_rss_lut+0x123/0x140 [iavf]
[   84.248698]  ? report_bug+0x12c/0x1b0
[   84.249122]  ? handle_bug+0x42/0x70
[   84.249549]  ? exc_invalid_op+0x1a/0x50
[   84.249970]  ? asm_exc_invalid_op+0x1a/0x20
[   84.250390]  ? iavf_set_rss_lut+0x123/0x140 [iavf]
[   84.250820]  iavf_watchdog_task+0xb16/0xe00 [iavf]

Gustavo already tried to fix those back in 2021[0][1]. Unfortunately,
a VM can run a different kernel than the host, meaning that those
structures are sorta ABI.
However, it is possible to have proper flex arrays + struct_size()
calculations and still send the very same messages with the same sizes.
The common rule is:

elem[1] -> elem[]
size = struct_size() + <difference between the old and the new msg size>

The "old" size in the current code is calculated 3 different ways for
10 virtchnl structures total. Each commit addresses one of the ways
cumulatively instead of per-structure.

I was planning to send it to -net initially, but given that virtchnl was
renamed from i40evf and got some fat style cleanup commits in the past,
it's not very straightforward to even pick appropriate SHAs, not
speaking of automatic portability. I may send manual backports for
a couple of the latest supported kernels later on if anyone needs it
at all.

[0] https://lore.kernel.org/all/20210525230912.GA175802@embeddedor
[1] https://lore.kernel.org/all/20210525231851.GA176647@embeddedor

* '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  virtchnl: fix fake 1-elem arrays for structures allocated as `nents`
  virtchnl: fix fake 1-elem arrays in structures allocated as `nents + 1`
  virtchnl: fix fake 1-elem arrays in structs allocated as `nents + 1` - 1
====================

Link: https://lore.kernel.org/r/20230816210657.1326772-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>