platform/kernel/linux-rpi.git
21 months agowifi: iwlwifi: mvm: iterate over interfaces after an assert in d3
Yedidya Benshimol [Tue, 6 Sep 2022 13:42:18 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: iterate over interfaces after an assert in d3

In recent patches notifications based d3 resume flow was added,
and the resume flow was changed.

Currently, when resuming from d3 during which an assert was thrown,
the resume flow skips the iteration over active interfaces
preventing the sta to reconnect to the ap.

Perform the iteration in case an assert was thrown to fix it.

Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.ad888cc6cd91.Ib56e416fce17df089edf76d22896430df5ebe080@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: mvm: trigger resume flow before wait for notifications
Haim, Dreyfuss [Tue, 6 Sep 2022 13:42:17 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: trigger resume flow before wait for notifications

We have recently enabled resume flow based on notifications.
These notifications are sent by the FW when completing the resume flow.
From IWL_DEVICE_FAMILY_AX210 the resume flow is triggered by the
transport layer on iwl_trans_d3_resume.
On IWL_DEVICE_FAMILY_22000 and earlier we trigger the resume flow by
sending the D0I3 command.

Currently, we are waiting for the notifications before sending the
command, the notifications won't be sent by the FW since there is no
resume trigger to piggyback on.

Send the command before starting the wait flow to fix it.

Signed-off-by: Haim, Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.5f0f251edf9c.Ia49ab73105af6f52aa7d318f4984edecd3b0671a@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: mvm: Add handling for scan offload match info notification
Ilan Peer [Tue, 6 Sep 2022 13:42:16 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: Add handling for scan offload match info notification

To support FW versions that send the scan match information as
an asynchronous notification.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.bbc5602d0b6f.I1329c231f82e7bf18f7dba0ccbd9f2d4080cbfc1@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: mvm: enable resume based on notifications
Haim Dreyfuss [Tue, 6 Sep 2022 13:42:15 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: enable resume based on notifications

We have recently added support for resume based on notifications.
Enable it.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.a6344ba23df5.I09fce8cf5aac1d46b40ae81b1abcf7a0e54af196@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: mvm: Add support for d3 end notification
Haim Dreyfuss [Tue, 6 Sep 2022 13:42:14 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: Add support for d3 end notification

Due to IMR, when host returns from hibernate, commands cannot
be sent as part of the resume flow, and so after ending
d3 the FW needs to send notifications instead of responses.
This notification indicates whether a fw reset is required.

Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.898ecba881b2.I13eb69bb5af08b9ac33043647eaed6b8d50e8659@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: mvm: Add support for wowlan wake packet notification
Haim Dreyfuss [Tue, 6 Sep 2022 13:42:13 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: Add support for wowlan wake packet notification

The wowlan info notification is quite big.
(~750 bytes without the wake packet itself).
The max FW notification size is ~2K.
There might be cases where the wake packet gets truncated because of
this limit.

Separating the wake packet from the wowlan info notification allows us to
get more data without trimming it.

Note: we currently limit the wake packet to 1600 bytes.

Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.06d1e6aecf10.Ib3d6a46ffe71d10cbc69bdb5654e6b14c28df245@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: mvm: Add support for wowlan info notification
Haim Dreyfuss [Tue, 6 Sep 2022 13:42:12 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: Add support for wowlan info notification

IMR (Isolated Memory Regions) is a mechanism to protect memory regions
from unwarranted access by agents in the system that should not have access
to that memory.

When IMR is enabled, pages in the DRAM will be located within the IMR
memory space, accessible only by the device.
As a side effect, during S4 (a.k.a hibernate) the IMR memory space
is not retained.

While the DRAM is saved to the disk and restored by the OS upon resume,
the IMR, which is hidden from the OS neither saved upon suspend nor
restored upon resume.

As a consequence of the above, it turned out that commands cannot
be sent as part of the resume flow, and so after ending
d3 the FW needs to use notifications instead of cmd-resp.

The resume flow becomes asynchronous, with a series
of notifications, starting with wowlan_info_notif, through
wowlan_pkt_notif and complete the resume flow by d3_end_notif.

This patch adds the support for wowlan info notification.

The wake packet has been removed from the wowlan info struct
and will be handled in a dedicated notification.

Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.3ce8deefd929.Ieba8610e8bb4bec788076371ae38becb4a3d20d5@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: mvm: don't check D0I3 version
Haim Dreyfuss [Tue, 6 Sep 2022 13:42:11 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: don't check D0I3 version

This code is dead, even old FW versions don't use it.
The IWL_D0I3_RESET_REQUIRE flag will be sent by the FW via a notification,
instead of command, the notification handler will be introduced later
in the series.

Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.87c82482229a.I70456c38ed8f7beb7d62dd618f58e7dc0a7d33b2@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: cfg: remove IWL_DEVICE_BZ_COMMON macro
Johannes Berg [Tue, 6 Sep 2022 13:42:10 +0000 (16:42 +0300)]
wifi: iwlwifi: cfg: remove IWL_DEVICE_BZ_COMMON macro

We only have a single use of this inside the IWL_DEVICE_BZ
macro, so just combine the contents here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.23d6c92e9a11.I4a11928a6d698079dc742e3ba3d3ce6fd7a878d1@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: mvm: refactor iwl_mvm_set_sta_rate() a bit
Johannes Berg [Tue, 6 Sep 2022 13:42:09 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: refactor iwl_mvm_set_sta_rate() a bit

Use a switch statement over the rate type instead of the
if chain, to simplify.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.623e32931b67.Id743a7879e84ae37a849179e536c58b1bf55380f@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: mvm: rxmq: further unify some VHT/HE code
Johannes Berg [Tue, 6 Sep 2022 13:42:08 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: rxmq: further unify some VHT/HE code

There's some duplication here, unify it so that adding EHT
becomes easier.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.d1e8673b9443.I6d81fc9dd0856d75e3a799c23f0f8d212b077fca@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: mvm: rxmq: refactor mac80211 rx_status setting
Johannes Berg [Tue, 6 Sep 2022 13:42:07 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: rxmq: refactor mac80211 rx_status setting

There's a bunch of duplicated code in the normal data RX and
the no-data RX paths, refactor that.

Note that we're evidently not implementing the 6 GHz band in
the no-data path correctly, need to fix that in firmware
first. Also, we were setting the NSS differently, keep doing
that, but just override the previous values.

Note also that we used to drop frames with bad rate data, to
simplify that just report rate 0 and continue.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.a81580d5e769.I3ee7a1fe1adf8684c48713dbbdc2cbc60bd24cd1@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: mvm: fix typo in struct iwl_rx_no_data API
Johannes Berg [Tue, 6 Sep 2022 13:42:06 +0000 (16:42 +0300)]
wifi: iwlwifi: mvm: fix typo in struct iwl_rx_no_data API

The version 2 is also for RX, of course, that's just a typo.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.80f7eda56163.Ib783512104f0c135695b4d59b637f3eef3e8f537@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
21 months agowifi: iwlwifi: pcie: add support for BZ devices
Yaara Baruch [Tue, 6 Sep 2022 13:42:05 +0000 (16:42 +0300)]
wifi: iwlwifi: pcie: add support for BZ devices

Add support in BZ-FM and BZ-GL devices. Adjust current structs
steps to differ between the new devices.

Signed-off-by: Yaara Baruch <yaara.baruch@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20220906161827.0b7fc8487039.I984dcb58272e2f38c835e7aaa7e1ac646bc2f65e@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
22 months agowifi: rtl8xxxu: Remove copy-paste leftover in gen2_update_rate_mask
Bitterblue Smith [Fri, 2 Sep 2022 13:15:30 +0000 (16:15 +0300)]
wifi: rtl8xxxu: Remove copy-paste leftover in gen2_update_rate_mask

It looks like a leftover from copying rtl8xxxu_update_rate_mask,
which is used with the gen1 chips.

It wasn't causing any problems for my RTL8188FU test device, but it's
clearly a mistake, so remove it.

Fixes: f653e69009c6 ("rtl8xxxu: Implement basic 8723b specific update_rate_mask() function")
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/d5544fe8-9798-28f1-54bd-6839a1974b10@gmail.com
22 months agowifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration
Bitterblue Smith [Fri, 2 Sep 2022 11:48:32 +0000 (14:48 +0300)]
wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration

Found by comparing with the vendor driver. Currently this affects
only the RTL8192EU, which is the only gen2 chip with 2 TX paths
supported by this driver. It's unclear what kind of effect the
mistake had in practice, since I don't have any RTL8192EU devices
to test it.

Fixes: e1547c535ede ("rtl8xxxu: First stab at adding IQK calibration for 8723bu parts")
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/30a59f3a-cfa9-8379-7af0-78a8f4c77cfd@gmail.com
22 months agowifi: rtw89: split scan including lots of channels
Po-Hao Huang [Thu, 8 Sep 2022 05:12:57 +0000 (13:12 +0800)]
wifi: rtw89: split scan including lots of channels

The size limit of H2C commands is 2048. With regulatory that enables
U-NII-6 ~ UNII-8 channels, channel list length combining with channel info
length will exceed that. Split the channel list to parts and do scan
multiple times to workaround that.

Signed-off-by: Po-Hao Huang <phhuang@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/20220908051257.25353-10-pkshih@realtek.com
22 months agowifi: rtw89: 8852c: support hw_scan
Po-Hao Huang [Thu, 8 Sep 2022 05:12:56 +0000 (13:12 +0800)]
wifi: rtw89: 8852c: support hw_scan

This enables hw_scan function for 52c. The mechanism is similar to 52a
except that it adds modifications required for 6G channels and extends the
command length to make driver compatible to both newer and existing
firmware.

Signed-off-by: Po-Hao Huang <phhuang@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/20220908051257.25353-9-pkshih@realtek.com
22 months agowifi: rtw89: call tx_wake notify for 8852c in deep ps mode
Chin-Yen Lee [Thu, 8 Sep 2022 05:12:55 +0000 (13:12 +0800)]
wifi: rtw89: call tx_wake notify for 8852c in deep ps mode

8852c transmits packets with slow response in deep ps mode,
and lead to low throughput. We need to call tx_wake for
each pakcet to trigger firmware wake earlier to avoid it.

Signed-off-by: Chin-Yen Lee <timlee@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/20220908051257.25353-8-pkshih@realtek.com
22 months agowifi: rtw89: support deep ps mode for rtw8852c
Chin-Yen Lee [Thu, 8 Sep 2022 05:12:54 +0000 (13:12 +0800)]
wifi: rtw89: support deep ps mode for rtw8852c

rtw8852c could support deep ps mode if the firmware version
is greater than 0.17.34.

Signed-off-by: Chin-Yen Lee <timlee@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/20220908051257.25353-7-pkshih@realtek.com
22 months agowifi: rtw89: set response rate selection
Chia-Yuan Li [Thu, 8 Sep 2022 05:12:53 +0000 (13:12 +0800)]
wifi: rtw89: set response rate selection

With suitable response rate, it can acknowledge peer packets are received.
Otherwise, peer could re-transmit again due to missing of ACK frames.
To achieve this, refer to RX rate and CMAC table to choose the smaller
as initial response rate.

Signed-off-by: Chia-Yuan Li <leo.li@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/20220908051257.25353-6-pkshih@realtek.com
22 months agowifi: rtw89: 8852c: set TX to single path TX on path B in 6GHz band
Yi-Tang Chiu [Thu, 8 Sep 2022 05:12:52 +0000 (13:12 +0800)]
wifi: rtw89: 8852c: set TX to single path TX on path B in 6GHz band

With one path TX for 1SS rate, it can transmit higher power in 6GHz band
to yield better performance in high attenuation circumstance.

Signed-off-by: Yi-Tang Chiu <chiuyitang@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/20220908051257.25353-5-pkshih@realtek.com
22 months agowifi: rtw89: 8852c: enlarge polling timeout of RX DCK
Ping-Ke Shih [Thu, 8 Sep 2022 05:12:51 +0000 (13:12 +0800)]
wifi: rtw89: 8852c: enlarge polling timeout of RX DCK

The range of calibration time of RX DCK is quite wide from ~40us to
~1300us by experiments, and probability is about 0.1% for the cases larger
than 1000us. Though it can retry calibration and get positive result, it
will spend more time. Therefore, enlarge it to avoid warning and duplicate
calibration.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220908051257.25353-4-pkshih@realtek.com
22 months agowifi: rtw89: 8852c: enable the interference cancellation of MU-MIMO on 6GHz
Ping-Ke Shih [Thu, 8 Sep 2022 05:12:50 +0000 (13:12 +0800)]
wifi: rtw89: 8852c: enable the interference cancellation of MU-MIMO on 6GHz

Enable MU-MIMO interference cancellation (MUIC) to yield expected
performance of receiving MU-MIMO packets on 6GHz.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220908051257.25353-3-pkshih@realtek.com
22 months agowifi: rtw89: add DIG register struct to share common algorithm
Eric Huang [Thu, 8 Sep 2022 05:12:49 +0000 (13:12 +0800)]
wifi: rtw89: add DIG register struct to share common algorithm

Since control register address for DIG are different per IC, add a new
struct rtw89_dig_regs in chip info for each IC to define their own address.

Signed-off-by: Eric Huang <echuang@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/20220908051257.25353-2-pkshih@realtek.com
22 months agowifi: rtw89: support TX diversity for 1T2R chipset
Ping-Ke Shih [Thu, 8 Sep 2022 07:41:40 +0000 (15:41 +0800)]
wifi: rtw89: support TX diversity for 1T2R chipset

Check RSSI strength to decide which path is better, and then set TX path
accordingly.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220908074140.39776-6-pkshih@realtek.com
22 months agowifi: rtw89: record signal strength per RF path
Ping-Ke Shih [Thu, 8 Sep 2022 07:41:39 +0000 (15:41 +0800)]
wifi: rtw89: record signal strength per RF path

Originally, we show average signal strength. To support TX diversity, this
patch prepares strength per path, then we can decide TX path.

  RSSI: -54 dBm (raw=112, prev=110) [-57, -52]

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220908074140.39776-5-pkshih@realtek.com
22 months agowifi: rtw89: configure TX path via H2C command
Ping-Ke Shih [Thu, 8 Sep 2022 07:41:38 +0000 (15:41 +0800)]
wifi: rtw89: configure TX path via H2C command

In order to support TX diversity, add a function to control TX path.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220908074140.39776-4-pkshih@realtek.com
22 months agowifi: rtw89: parse phycap of TX/RX antenna number
Ping-Ke Shih [Thu, 8 Sep 2022 07:41:37 +0000 (15:41 +0800)]
wifi: rtw89: parse phycap of TX/RX antenna number

Two fields, TX/RX ANT NUM, are introduced to address variant TX/RX antenna
number of hardware. For example, a 1x1 chip with TX diversity, TX NSS = 1
and TX/RX ANT NUM = 2.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220908074140.39776-3-pkshih@realtek.com
22 months agowifi: rtw89: use u32_get_bits to access C2H content of PHY capability
Ping-Ke Shih [Thu, 8 Sep 2022 07:41:36 +0000 (15:41 +0800)]
wifi: rtw89: use u32_get_bits to access C2H content of PHY capability

The definitions of bit fields in structure will be wrong in big-endian
platform, so use u32_get_bits() to access them.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220908074140.39776-2-pkshih@realtek.com
22 months agowifi: b43: remove empty switch statement
Johannes Berg [Sun, 4 Sep 2022 19:29:12 +0000 (21:29 +0200)]
wifi: b43: remove empty switch statement

There's a TODO here, just move the dependency on phy->rev
into the comment. Not that this driver is likely to get
any updates.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220904212910.ea00a892e41b.I709217fc307125f8670c7f6a9093111b46194131@changeid
22 months agowifi: cw1200: use get_unaligned_le64()
Johannes Berg [Sun, 4 Sep 2022 19:29:11 +0000 (21:29 +0200)]
wifi: cw1200: use get_unaligned_le64()

Instead of the code here that copies into a variable
first and then flips endianness, which confuses sparse,
just directly use get_unaligned_le64().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220904212910.a5c9ea122f0f.If786a66f8fd9d45659cd5a2532cf395e21334453@changeid
22 months agowifi: cw1200: remove RCU STA pointer handling in TX
Johannes Berg [Sun, 4 Sep 2022 19:29:10 +0000 (21:29 +0200)]
wifi: cw1200: remove RCU STA pointer handling in TX

We can call this in one of two ways: through mac80211, where
we're already in an RCU read-side critical section, or from
some other code in the driver where this pointer can only be
NULL. In any case, we get a 'free' already protected pointer
to the sta through info->control.sta, so we can use it on
the stack without any further protection.

Remove the rcu_dereference() and critical section.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220904212910.e5bc20dd17bf.Ib570ff7fde33c2b6eddef493a3541fa04eb47181@changeid
22 months agowifi: mwifiex: fix endian annotations in casts
Johannes Berg [Sun, 4 Sep 2022 19:29:09 +0000 (21:29 +0200)]
wifi: mwifiex: fix endian annotations in casts

These cause sparse warnings, and since the device generally
works in little endian we can assume the code is correct, so
just fix the casts accordingly. No binary changes on x86.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220904212910.3f72609a3825.If4048592701bf04981be1dab18eaaa339b2ea382@changeid
22 months agowifi: mwifiex: fix endian conversion
Johannes Berg [Sun, 4 Sep 2022 19:29:08 +0000 (21:29 +0200)]
wifi: mwifiex: fix endian conversion

Clearly the value should be converted and then compared,
not the result of the comparison be converted. No binary
changes on x86.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220904212910.a32e45adb2b2.I8c966b07c0bf7be4485967b044d9dad3f4772a27@changeid
22 months agowifi: mwifiex: mark a variable unused
Johannes Berg [Sun, 4 Sep 2022 19:29:06 +0000 (21:29 +0200)]
wifi: mwifiex: mark a variable unused

We need to read a value from the device to wake it, but if it
succeeds we don't really care about it. Mark the variable to
avoid a compiler warning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220904212910.5d67f55178a1.If0789ab326935896e5886fa06dbb9ef0da6c0b41@changeid
22 months agowifi: wl18xx: add some missing endian conversions
Johannes Berg [Sun, 4 Sep 2022 19:29:05 +0000 (21:29 +0200)]
wifi: wl18xx: add some missing endian conversions

This caused sparse warnings, and clearly is needed per
how other firmware interfaces behave.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220904212910.2b5cb713cf4b.Ibabba2deb7bb22863d3a134e7a3333422d7eff17@changeid
22 months agowifi: libertas: fix a couple of sparse warnings
Johannes Berg [Sun, 4 Sep 2022 19:29:03 +0000 (21:29 +0200)]
wifi: libertas: fix a couple of sparse warnings

 - endian swapping is required in one place, use the
   already swapped 'bsssize' local
 - lbs_disablemesh need not be exported and can be static

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220904212910.76c34b2ae7a0.Ieb97c72b6d26f9d695cc4ab10fa7af5c3509612b@changeid
22 months agowifi: ipw2100: fix warnings about non-kernel-doc
Johannes Berg [Sun, 4 Sep 2022 19:29:01 +0000 (21:29 +0200)]
wifi: ipw2100: fix warnings about non-kernel-doc

Just remove the extra asterisk to make it not be
kernel-doc formatted.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220904212910.8169e8c9090c.I0357e80cc86be2d4ac6205d1f53568444dcf7c9b@changeid
22 months agowifi: rtl8xxxu: Fix skb misuse in TX queue selection
Bitterblue Smith [Wed, 31 Aug 2022 16:12:36 +0000 (19:12 +0300)]
wifi: rtl8xxxu: Fix skb misuse in TX queue selection

rtl8xxxu_queue_select() selects the wrong TX queues because it's
reading memory from the wrong address. It expects to find ieee80211_hdr
at skb->data, but that's not the case after skb_push(). Move the call
to rtl8xxxu_queue_select() before the call to skb_push().

Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/7fa4819a-4f20-b2af-b7a6-8ee01ac49295@gmail.com
22 months agowifi: brcmfmac: remove redundant variable err
Jinpeng Cui [Wed, 31 Aug 2022 13:22:54 +0000 (13:22 +0000)]
wifi: brcmfmac: remove redundant variable err

Return value from brcmf_fil_iovar_data_set() and
brcmf_config_ap_mgmt_ie() directly instead of
taking this in another redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220831132254.303697-1-cui.jinpeng2@zte.com.cn
22 months agowifi: brcmfmac: add 43439 SDIO ids and initialization
Marek Vasut [Sat, 27 Aug 2022 02:49:03 +0000 (04:49 +0200)]
wifi: brcmfmac: add 43439 SDIO ids and initialization

Add HW and SDIO ids for use with the muRata 1YN (Cypress CYW43439).
Add the firmware mapping structures for the CYW43439 chipset.
The 43439 needs some things setup similar to the 43430 chipset.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220827024903.617294-1-marex@denx.de
22 months agowifi: rtl8xxxu: Simplify the error handling code
Zheyu Ma [Thu, 18 Aug 2022 07:33:52 +0000 (15:33 +0800)]
wifi: rtl8xxxu: Simplify the error handling code

Since the logic of the driver's error handling code has changed, the
previous dead store and checks are not needed.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220818073352.3156288-1-zheyuma97@gmail.com
22 months agobcma: Fix typo in comments
Shaomin Deng [Thu, 11 Aug 2022 15:20:43 +0000 (11:20 -0400)]
bcma: Fix typo in comments

Remove the repeated word "registers" in comments.

Signed-off-by: Shaomin Deng <dengshaomin@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220811152043.11446-1-dengshaomin@cdjrlc.com
22 months agowifi: p54: Fix comment typo
Jason Wang [Thu, 11 Aug 2022 12:03:40 +0000 (20:03 +0800)]
wifi: p54: Fix comment typo

The double `to' is duplicated in the comment, remove one.

Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
Acked-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220811120340.12968-1-wangborong@cdjrlc.com
22 months agowifi: mwifiex: Fix comment typo
Jason Wang [Thu, 11 Aug 2022 12:02:01 +0000 (20:02 +0800)]
wifi: mwifiex: Fix comment typo

The double `the' is duplicated in the comment, remove one.

Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220811120201.10824-1-wangborong@cdjrlc.com
22 months agowifi: brcmfmac: Add DMI nvram filename quirk for Chuwi Hi8 Pro tablet
Hans de Goede [Wed, 10 Aug 2022 14:23:33 +0000 (16:23 +0200)]
wifi: brcmfmac: Add DMI nvram filename quirk for Chuwi Hi8 Pro tablet

The Chuwi Hi8 Pro tablet contains quite generic names in the sys_vendor
and product_name DMI strings, without this patch brcmfmac will try to load:
"brcmfmac43430a0-sdio.Default string-Default string.txt" as nvram file
which is way too generic.

The Chuwi Hi8 Pro uses the same Ampak AP6212 module as the Chuwi Vi8 Plus
and the nvram for the Vi8 Plus is already in linux-firmware, so point
the new DMI nvram filename quirk to the Vi8 Plus nvram file.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220810142333.141044-1-hdegoede@redhat.com
22 months agowifi: brcmfmac: Use ISO3166 country code and rev 0 as fallback on 43430
Hans de Goede [Wed, 10 Aug 2022 14:23:28 +0000 (16:23 +0200)]
wifi: brcmfmac: Use ISO3166 country code and rev 0 as fallback on 43430

Many devices ship with a nvram ccode value of X2/XT/XU/XV/ALL which are
all special world-wide compatibility ccode-s. Most of these world-wide
ccode-s allow passive scan mode only for 2.4GHz channels 12-14,
only enabling them when an AP is seen on them.

Since linux-firmware has moved to the new cyfmac43430-sdio.bin +
cyfmac43430-sdio.clm_blob firmware files this no longer works and
43430 devices using e.g. an X2 ccode fail to connect to an AP on
channel 13.

Add the 43430 chip-id to the list of chips for which to use the ISO3166
country code + rev 0 as fallback in brcmf_translate_country_code() to
fix this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220810142328.141030-1-hdegoede@redhat.com
22 months agowifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit()
Alexander Coffin [Mon, 8 Aug 2022 17:49:26 +0000 (10:49 -0700)]
wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit()

> ret = brcmf_proto_tx_queue_data(drvr, ifp->ifidx, skb);

may be schedule, and then complete before the line

> ndev->stats.tx_bytes += skb->len;

[   46.912801] ==================================================================
[   46.920552] BUG: KASAN: use-after-free in brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac]
[   46.928673] Read of size 4 at addr ffffff803f5882e8 by task systemd-resolve/328
[   46.935991]
[   46.937514] CPU: 1 PID: 328 Comm: systemd-resolve Tainted: G           O      5.4.199-[REDACTED] #1
[   46.947255] Hardware name: [REDACTED]
[   46.954568] Call trace:
[   46.957037]  dump_backtrace+0x0/0x2b8
[   46.960719]  show_stack+0x24/0x30
[   46.964052]  dump_stack+0x128/0x194
[   46.967557]  print_address_description.isra.0+0x64/0x380
[   46.972877]  __kasan_report+0x1d4/0x240
[   46.976723]  kasan_report+0xc/0x18
[   46.980138]  __asan_report_load4_noabort+0x18/0x20
[   46.985027]  brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac]
[   46.990613]  dev_hard_start_xmit+0x1bc/0xda0
[   46.994894]  sch_direct_xmit+0x198/0xd08
[   46.998827]  __qdisc_run+0x37c/0x1dc0
[   47.002500]  __dev_queue_xmit+0x1528/0x21f8
[   47.006692]  dev_queue_xmit+0x24/0x30
[   47.010366]  neigh_resolve_output+0x37c/0x678
[   47.014734]  ip_finish_output2+0x598/0x2458
[   47.018927]  __ip_finish_output+0x300/0x730
[   47.023118]  ip_output+0x2e0/0x430
[   47.026530]  ip_local_out+0x90/0x140
[   47.030117]  igmpv3_sendpack+0x14c/0x228
[   47.034049]  igmpv3_send_cr+0x384/0x6b8
[   47.037895]  igmp_ifc_timer_expire+0x4c/0x118
[   47.042262]  call_timer_fn+0x1cc/0xbe8
[   47.046021]  __run_timers+0x4d8/0xb28
[   47.049693]  run_timer_softirq+0x24/0x40
[   47.053626]  __do_softirq+0x2c0/0x117c
[   47.057387]  irq_exit+0x2dc/0x388
[   47.060715]  __handle_domain_irq+0xb4/0x158
[   47.064908]  gic_handle_irq+0x58/0xb0
[   47.068581]  el0_irq_naked+0x50/0x5c
[   47.072162]
[   47.073665] Allocated by task 328:
[   47.077083]  save_stack+0x24/0xb0
[   47.080410]  __kasan_kmalloc.isra.0+0xc0/0xe0
[   47.084776]  kasan_slab_alloc+0x14/0x20
[   47.088622]  kmem_cache_alloc+0x15c/0x468
[   47.092643]  __alloc_skb+0xa4/0x498
[   47.096142]  igmpv3_newpack+0x158/0xd78
[   47.099987]  add_grhead+0x210/0x288
[   47.103485]  add_grec+0x6b0/0xb70
[   47.106811]  igmpv3_send_cr+0x2e0/0x6b8
[   47.110657]  igmp_ifc_timer_expire+0x4c/0x118
[   47.115027]  call_timer_fn+0x1cc/0xbe8
[   47.118785]  __run_timers+0x4d8/0xb28
[   47.122457]  run_timer_softirq+0x24/0x40
[   47.126389]  __do_softirq+0x2c0/0x117c
[   47.130142]
[   47.131643] Freed by task 180:
[   47.134712]  save_stack+0x24/0xb0
[   47.138041]  __kasan_slab_free+0x108/0x180
[   47.142146]  kasan_slab_free+0x10/0x18
[   47.145904]  slab_free_freelist_hook+0xa4/0x1b0
[   47.150444]  kmem_cache_free+0x8c/0x528
[   47.154292]  kfree_skbmem+0x94/0x108
[   47.157880]  consume_skb+0x10c/0x5a8
[   47.161466]  __dev_kfree_skb_any+0x88/0xa0
[   47.165598]  brcmu_pkt_buf_free_skb+0x44/0x68 [brcmutil]
[   47.171023]  brcmf_txfinalize+0xec/0x190 [brcmfmac]
[   47.176016]  brcmf_proto_bcdc_txcomplete+0x1c0/0x210 [brcmfmac]
[   47.182056]  brcmf_sdio_sendfromq+0x8dc/0x1e80 [brcmfmac]
[   47.187568]  brcmf_sdio_dpc+0xb48/0x2108 [brcmfmac]
[   47.192529]  brcmf_sdio_dataworker+0xc8/0x238 [brcmfmac]
[   47.197859]  process_one_work+0x7fc/0x1a80
[   47.201965]  worker_thread+0x31c/0xc40
[   47.205726]  kthread+0x2d8/0x370
[   47.208967]  ret_from_fork+0x10/0x18
[   47.212546]
[   47.214051] The buggy address belongs to the object at ffffff803f588280
[   47.214051]  which belongs to the cache skbuff_head_cache of size 208
[   47.227086] The buggy address is located 104 bytes inside of
[   47.227086]  208-byte region [ffffff803f588280ffffff803f588350)
[   47.238814] The buggy address belongs to the page:
[   47.243618] page:ffffffff00dd6200 refcount:1 mapcount:0 mapping:ffffff804b6bf800 index:0xffffff803f589900 compound_mapcount: 0
[   47.255007] flags: 0x10200(slab|head)
[   47.258689] raw: 0000000000010200 ffffffff00dfa980 0000000200000002 ffffff804b6bf800
[   47.266439] raw: ffffff803f589900 0000000080190018 00000001ffffffff 0000000000000000
[   47.274180] page dumped because: kasan: bad access detected
[   47.279752]
[   47.281251] Memory state around the buggy address:
[   47.286051]  ffffff803f588180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   47.293277]  ffffff803f588200: fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   47.300502] >ffffff803f588280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   47.307723]                                                           ^
[   47.314343]  ffffff803f588300: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
[   47.321569]  ffffff803f588380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
[   47.328789] ==================================================================

Signed-off-by: Alexander Coffin <alex.coffin@matician.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220808174925.3922558-1-alex.coffin@matician.com
22 months agowifi: iwlwifi: calib: Refactor iwl_calib_result usage for clarity
Kees Cook [Thu, 1 Sep 2022 20:45:58 +0000 (13:45 -0700)]
wifi: iwlwifi: calib: Refactor iwl_calib_result usage for clarity

In preparation for FORTIFY_SOURCE performing run-time destination buffer
bounds checking for memcpy(), refactor the use of struct iwl_calib_result:

- Have struct iwl_calib_result contain struct iwl_calib_cmd since
  functions expect to operate on the "data" flex array in "cmd", which
  follows the "hdr" member.
- Switch argument passing around to use struct iwl_calib_cmd instead of
  struct iwl_calib_hdr to prepare functions to see the "data" member.
- Change iwl_calib_set()'s "len" argument to a size_t since it is always
  unsigned and is normally receiving the output of sizeof().
- Add an explicit length sanity check in iwl_calib_set().
- Adjust the memcpy() to avoid copying across the now visible composite
  flex array structure.

This avoids the future run-time warning:

  memcpy: detected field-spanning write (size 8) of single field "&res->hdr" (size 4)

Cc: Luca Coelho <luciano.coelho@intel.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Reported-by: Andy Lavr <andy.lavr@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220901204558.2256458-1-keescook@chromium.org
22 months agowifi: rsi: fix kernel-doc warning
Johannes Berg [Tue, 6 Sep 2022 08:33:44 +0000 (10:33 +0200)]
wifi: rsi: fix kernel-doc warning

One of my previous patches here changed the function prototype,
but since it was (half?) automated, I didn't update the docs.
Fix that now.

Fixes: b3e2130bf5f6 ("wifi: mac80211: change QoS settings API to take link into account")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211_hwsim: always activate all links
Johannes Berg [Fri, 2 Sep 2022 14:12:57 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: always activate all links

By default, even in client mode, hwsim always had all links
active, where it then uses them in a round-robin fashion.
Re-enable that by activating all valid links work right after
the connection is authorized.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: implement link switching
Johannes Berg [Fri, 2 Sep 2022 14:12:56 +0000 (16:12 +0200)]
wifi: mac80211: implement link switching

Implement an API function and debugfs file to switch
active links.

Also provide an async version of the API so drivers
can call it in arbitrary contexts, e.g. while in the
authorized callback.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: keep A-MSDU data in sta and per-link
Benjamin Berg [Fri, 2 Sep 2022 14:12:54 +0000 (16:12 +0200)]
wifi: mac80211: keep A-MSDU data in sta and per-link

The A-MSDU data needs to be stored per-link and aggregated into a single
value for the station. Add a new struct ieee_80211_sta_aggregates in
order to store this data and a new function
ieee80211_sta_recalc_aggregates to update the current data for the STA.

Note that in the non MLO case the pointer in ieee80211_sta will directly
reference the data in deflink.agg, which means that recalculation may be
skipped in that case.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: set up beacon timing config on links
Johannes Berg [Fri, 2 Sep 2022 14:12:53 +0000 (16:12 +0200)]
wifi: mac80211: set up beacon timing config on links

On secondary MLO links, I forgot to set the beacon interval
and DTIM period, fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: add vif/sta link RCU dereference macros
Johannes Berg [Fri, 2 Sep 2022 14:12:52 +0000 (16:12 +0200)]
wifi: mac80211: add vif/sta link RCU dereference macros

Add macros (and an exported function) to allow checking some
link RCU protected accesses that are happening in callbacks
from mac80211 and are thus under the correct lock.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211_hwsim: send NDP for link (de)activation
Johannes Berg [Fri, 2 Sep 2022 14:12:48 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: send NDP for link (de)activation

In hwsim we now track when we receive NDP (or other frames
carrying a PM bit) to see if a link should be active, but
then of course we also need to transmit NDPs to at least
set a link to inactive when we deacivate it. Implement that
as well as sending an NDP when we activate a link, which
allows receiving frames before transmitting any.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: extend ieee80211_nullfunc_get() for MLO
Johannes Berg [Fri, 2 Sep 2022 14:12:47 +0000 (16:12 +0200)]
wifi: mac80211: extend ieee80211_nullfunc_get() for MLO

Add a link_id parameter to ieee80211_nullfunc_get() to be
able to obtain a correctly addressed frame.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211_hwsim: track active STA links
Johannes Berg [Fri, 2 Sep 2022 14:12:45 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: track active STA links

Track the powersave bit on frames where we can look up
the STA by link addresses and set the links active or
inactive accordingly, and use this information to TX
only on links that are actually active in the peer.

Note that this doesn't implement powersave fully so
if no link is active things will not work right.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211_hwsim: skip inactive links on TX
Johannes Berg [Fri, 2 Sep 2022 14:12:44 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: skip inactive links on TX

With the link activation handling in mac80211, skip
any inactive links on TX.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: add ieee80211_find_sta_by_link_addrs API
Johannes Berg [Fri, 2 Sep 2022 14:12:43 +0000 (16:12 +0200)]
wifi: mac80211: add ieee80211_find_sta_by_link_addrs API

Add a new API function ieee80211_find_sta_by_link_addrs()
that looks up the STA and link ID based on interface and
station link addresses.

We're going to use it for mac80211-hwsim to track on the
AP side which links are active.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: isolate driver from inactive links
Johannes Berg [Fri, 2 Sep 2022 14:12:42 +0000 (16:12 +0200)]
wifi: mac80211: isolate driver from inactive links

In order to let the driver select active links and properly
make multi-link connections, as a first step isolate the
driver from inactive links, and set the active links to be
only the association link for client-side interfaces. For
AP side nothing changes since APs always have to have all
their links active.

To simplify things, update the for_each_sta_active_link()
API to include the appropriate vif pointer.

This also implies not allocating a chanctx for an inactive
link, which requires a few more changes.

Since we now no longer try to program multiple links to the
driver, remove the check in the MLME code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: make smps_mode per-link
Benjamin Berg [Fri, 2 Sep 2022 14:12:41 +0000 (16:12 +0200)]
wifi: mac80211: make smps_mode per-link

The SMPS power save mode needs to be per-link rather than being shared
for all links. As such, move it into struct ieee80211_link_sta.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: use correct rx link_sta instead of default
Benjamin Berg [Fri, 2 Sep 2022 14:12:40 +0000 (16:12 +0200)]
wifi: mac80211: use correct rx link_sta instead of default

Use rx->link_sta everywhere instead of accessing the default link.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: set link_sta in reorder timeout
Johannes Berg [Tue, 6 Sep 2022 08:08:37 +0000 (10:08 +0200)]
wifi: mac80211: set link_sta in reorder timeout

Now that we have a link_sta pointer in the rx struct
we also need to fill it in all the cases. It didn't
matter so much until now as we weren't using it, but
the code should really be able to assume that if the
rx.sta is set, so is rx.link_sta.

Fixes: ccdde7c74ffd ("wifi: mac80211: properly implement MLO key handling")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agoMerge remote-tracking branch 'wireless/main' into wireless-next
Johannes Berg [Tue, 6 Sep 2022 08:05:29 +0000 (10:05 +0200)]
Merge remote-tracking branch 'wireless/main' into wireless-next

Merge wireless/main to get the rx.link fix, which is needed
for further work in this area.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agoMerge tag 'wireless-next-2022-09-03' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Sun, 4 Sep 2022 10:24:34 +0000 (11:24 +0100)]
Merge tag 'wireless-next-2022-09-03' of git://git./linux/kernel/git/wireless/wireless-next

Johannes Berg says:

====================
drivers
 - rtw89: large update across the map, e.g. coex, pci(e), etc.
 - ath9k: uninit memory read fix
 - ath10k: small peer map fix and a WCN3990 device fix
 - wfx: underflow

stack
 - the "change MAC address while IFF_UP" change from James
   we discussed
 - more MLO work, including a set of fixes for the previous
   code, now that we have more code we can exercise it more
 - prevent some features with MLO that aren't ready yet
   (AP_VLAN and 4-address connections)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
22 months agowifi: mac80211_hwsim: fix multi-channel handling in netlink RX
Johannes Berg [Fri, 2 Sep 2022 14:12:49 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: fix multi-channel handling in netlink RX

In netlink RX, now that we can actually have multiple
channel contexts for MLO, things don't work well as we
only keep a single pointer, and then on link switching
we might NULL it, and hit the return if the channel is
NULL.

However, we already use mac80211_hwsim_tx_iter() which
deals with all this, so remove the test and adjust the
remaining code a bit.

This then means we no longer use the chanctx pointer,
so remove it as well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: call drv_sta_state() under sdata_lock() in reconfig
Johannes Berg [Fri, 2 Sep 2022 14:12:51 +0000 (16:12 +0200)]
wifi: mac80211: call drv_sta_state() under sdata_lock() in reconfig

Currently, other paths calling drv_sta_state() hold the mutex
and therefore drivers can assume that, and look at links with
that protection. Fix that for the reconfig path as well; to
do it more easily use ieee80211_reconfig_stations() for the
AP/AP_VLAN station reconfig as well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: nl80211: add MLD address to assoc BSS entries
Johannes Berg [Fri, 2 Sep 2022 14:12:50 +0000 (16:12 +0200)]
wifi: nl80211: add MLD address to assoc BSS entries

Add an MLD address attribute to BSS entries that the interface
is currently associated with to help userspace figure out what's
going on.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: mlme: refactor QoS settings code
Johannes Berg [Fri, 2 Sep 2022 14:12:46 +0000 (16:12 +0200)]
wifi: mac80211: mlme: refactor QoS settings code

Refactor the code to apply QoS settings to the driver so
we can call it on link switch.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211_hwsim: warn on invalid link address
Johannes Berg [Fri, 2 Sep 2022 14:12:39 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: warn on invalid link address

Catch the bugs fixed in mac80211 by the previous commits
and warn if an invalid address is added (or removed).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: fix double SW scan stop
Johannes Berg [Fri, 2 Sep 2022 14:12:55 +0000 (16:12 +0200)]
wifi: mac80211: fix double SW scan stop

When we stop a not-yet-started scan, we erroneously call
into the driver, causing a sequence of sw_scan_start()
followed by sw_scan_complete() twice. This will cause a
warning in hwsim with next in line commit that validates
the address passed to wmediumd/virtio. Fix this by doing
the calls only if we were actually scanning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: mlme: assign link address correctly
Johannes Berg [Fri, 2 Sep 2022 14:12:38 +0000 (16:12 +0200)]
wifi: mac80211: mlme: assign link address correctly

Right now, we assign the link address only after we add
the link to the driver, which is quite obviously wrong.
It happens to work in many cases because it gets updated
immediately, and then link_conf updates may update it,
but it's clearly not really right.

Set the link address during ieee80211_mgd_setup_link()
so it's set before telling the driver about the link.

Fixes: 81151ce462e5 ("wifi: mac80211: support MLO authentication/association with one link")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: move link code to a new file
Johannes Berg [Fri, 2 Sep 2022 14:12:37 +0000 (16:12 +0200)]
wifi: mac80211: move link code to a new file

We probably should've done that originally, we already have
about 300 lines of code there, and will add more. Move all
the link code we wrote to a new file.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211_hwsim: refactor RX a bit
Johannes Berg [Fri, 2 Sep 2022 14:12:36 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: refactor RX a bit

Refactor some common RX functionality between the netlink
and non-netlink paths, adding the special hwsim TLV (if
compiled) also in the netlink path.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211_hwsim: check STA magic in change_sta_links
Johannes Berg [Fri, 2 Sep 2022 14:12:35 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: check STA magic in change_sta_links

Just as an additional check that mac80211 isn't doing
anything strange, add a check of the STA magic (which
gets assigned when the station is added, and cleared
when the station is removed).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: remove unused arg to ieee80211_chandef_eht_oper
Johannes Berg [Fri, 2 Sep 2022 14:12:34 +0000 (16:12 +0200)]
wifi: mac80211: remove unused arg to ieee80211_chandef_eht_oper

We don't need the sdata argument, and it doesn't make any
sense for a direct conversion from one value to another,
so just remove the argument

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211_hwsim: remove multicast workaround
Johannes Berg [Fri, 2 Sep 2022 14:12:33 +0000 (16:12 +0200)]
wifi: mac80211_hwsim: remove multicast workaround

Now that we have proper multicast TX in mac80211, there's
no longer a need to fake something here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: nl80211: remove redundant err variable
Jinpeng Cui [Mon, 29 Aug 2022 11:29:53 +0000 (11:29 +0000)]
wifi: nl80211: remove redundant err variable

Return value from rdev_set_mcast_rate() directly instead of
taking this in another redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: Support POWERED_ADDR_CHANGE feature
James Prestwood [Fri, 26 Aug 2022 17:00:32 +0000 (10:00 -0700)]
wifi: mac80211: Support POWERED_ADDR_CHANGE feature

Adds support in mac80211 for NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE.
The motivation behind this functionality is to fix limitations of
address randomization on frequencies which are disallowed in world
roaming.

The way things work now, if a client wants to randomize their address
per-connection it must power down the device, change the MAC, and
power back up. Here lies a problem since powering down the device
may result in frequencies being disabled (until the regdom is set).
If the desired BSS is on one such frequency the client is unable to
connect once the phy is powered again.

For mac80211 based devices changing the MAC while powered is possible
but currently disallowed (-EBUSY). This patch adds some logic to
allow a MAC change while powered by removing the interface, changing
the MAC, and adding it again. mac80211 will advertise support for
this feature so userspace can determine the best course of action e.g.
disallow address randomization on certain frequencies if not
supported.

There are certain limitations put on this which simplify the logic:
 - No active connection
 - No offchannel work, including scanning.

Signed-off-by: James Prestwood <prestwoj@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: nl80211: Add POWERED_ADDR_CHANGE feature
James Prestwood [Fri, 26 Aug 2022 17:00:31 +0000 (10:00 -0700)]
wifi: nl80211: Add POWERED_ADDR_CHANGE feature

Add a new extended feature bit signifying that the wireless hardware
supports changing the MAC address while the underlying net_device is
powered. Note that this has a different meaning from
IFF_LIVE_ADDR_CHANGE as additional restrictions might be imposed by
the hardware, such as:

 - No connection is active on this interface, carrier is off
 - No scan is in progress
 - No offchannel operations are in progress

Signed-off-by: James Prestwood <prestwoj@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: prevent 4-addr use on MLDs
Johannes Berg [Fri, 2 Sep 2022 14:12:58 +0000 (16:12 +0200)]
wifi: mac80211: prevent 4-addr use on MLDs

We haven't tried this yet, and it's not very likely to
work well right now, so for now disable 4-addr use on
interfaces that are MLDs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20220902161143.f2e4cc2efaa1.I5924e8fb44a2d098b676f5711b36bbc1b1bd68e2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: prevent VLANs on MLDs
Johannes Berg [Fri, 2 Sep 2022 14:12:59 +0000 (16:12 +0200)]
wifi: mac80211: prevent VLANs on MLDs

Do not allow VLANs to be added to AP interfaces that are
MLDs, this isn't going to work because the link structs
aren't propagated to the VLAN interfaces yet.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20220902161144.8c88531146e9.If2ef9a3b138d4f16ed2fda91c852da156bdf5e4d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: use struct_group to copy addresses
Johannes Berg [Mon, 29 Aug 2022 09:46:38 +0000 (11:46 +0200)]
wifi: use struct_group to copy addresses

We sometimes copy all the addresses from the 802.11 header
for the AAD, which may cause complaints from fortify checks.
Use struct_group() to avoid the compiler warnings/errors.

Change-Id: Ic3ea389105e7813b22095b295079eecdabde5045
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211_hwsim: check length for virtio packets
Soenke Huster [Fri, 2 Sep 2022 08:19:58 +0000 (10:19 +0200)]
wifi: mac80211_hwsim: check length for virtio packets

An invalid packet with a length shorter than the specified length in the
netlink header can lead to use-after-frees and slab-out-of-bounds in the
processing of the netlink attributes, such as the following:

  BUG: KASAN: slab-out-of-bounds in __nla_validate_parse+0x1258/0x2010
  Read of size 2 at addr ffff88800ac7952c by task kworker/0:1/12

  Workqueue: events hwsim_virtio_rx_work
  Call Trace:
   <TASK>
   dump_stack_lvl+0x45/0x5d
   print_report.cold+0x5e/0x5e5
   kasan_report+0xb1/0x1c0
   __nla_validate_parse+0x1258/0x2010
   __nla_parse+0x22/0x30
   hwsim_virtio_handle_cmd.isra.0+0x13f/0x2d0
   hwsim_virtio_rx_work+0x1b2/0x370
   process_one_work+0x8df/0x1530
   worker_thread+0x575/0x11a0
   kthread+0x29d/0x340
   ret_from_fork+0x22/0x30
 </TASK>

Discarding packets with an invalid length solves this.
Therefore, skb->len must be set at reception.

Change-Id: Ieaeb9a4c62d3beede274881a7c2722c6c6f477b6
Signed-off-by: Soenke Huster <soenke.huster@eknoes.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: fix locking in auth/assoc timeout
Johannes Berg [Fri, 2 Sep 2022 14:11:14 +0000 (16:11 +0200)]
wifi: mac80211: fix locking in auth/assoc timeout

If we hit an authentication or association timeout, we only
release the chanctx for the deflink, and the other link(s)
are released later by ieee80211_vif_set_links(), but we're
not locking this correctly.

Fix the locking here while releasing the channels and links.

Change-Id: I9e08c1a5434592bdc75253c1abfa6c788f9f39b1
Fixes: 81151ce462e5 ("wifi: mac80211: support MLO authentication/association with one link")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: mlme: release deflink channel in error case
Johannes Berg [Fri, 2 Sep 2022 14:11:15 +0000 (16:11 +0200)]
wifi: mac80211: mlme: release deflink channel in error case

In the prep_channel error case we didn't release the deflink
channel leaving it to be left around. Fix that.

Change-Id: If0dfd748125ec46a31fc6045a480dc28e03723d2
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agowifi: mac80211: fix link warning in RX agg timer expiry
Mukesh Sisodiya [Fri, 2 Sep 2022 14:11:31 +0000 (16:11 +0200)]
wifi: mac80211: fix link warning in RX agg timer expiry

The rx data link pointer isn't set from the RX aggregation timer,
resulting in a later warning. Fix that by setting it to the first
valid link for now, with a FIXME to worry about statistics later,
it's not very important since it's just the timeout case.

Reported-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/498d714c-76be-9d04-26db-a1206878de5e@redhat.com
Fixes: 56057da4569b ("wifi: mac80211: rx: track link in RX data")
Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 months agoMerge branch 'net_sched-redundant-resource-cleanups'
David S. Miller [Sat, 3 Sep 2022 09:40:40 +0000 (10:40 +0100)]
Merge branch 'net_sched-redundant-resource-cleanups'

Zhengchao Shao says:

====================
net: sched: remove redundant resource cleanup when init() fails

qdisc_create() calls .init() to initialize qdisc. If the initialization
fails, qdisc_create() will call .destroy() to release resources.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
22 months agonet: sched: htb: remove redundant resource cleanup in htb_init()
Zhengchao Shao [Fri, 2 Sep 2022 08:34:30 +0000 (16:34 +0800)]
net: sched: htb: remove redundant resource cleanup in htb_init()

If htb_init() fails, qdisc_create() invokes htb_destroy() to clear
resources. Therefore, remove redundant resource cleanup in htb_init().

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
22 months agonet: sched: fq_codel: remove redundant resource cleanup in fq_codel_init()
Zhengchao Shao [Fri, 2 Sep 2022 08:34:29 +0000 (16:34 +0800)]
net: sched: fq_codel: remove redundant resource cleanup in fq_codel_init()

If fq_codel_init() fails, qdisc_create() invokes fq_codel_destroy() to
clear resources. Therefore, remove redundant resource cleanup in
fq_codel_init().

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
22 months agonet: fec: add stop mode support for imx8 platform
Wei Fang [Fri, 2 Sep 2022 02:30:01 +0000 (10:30 +0800)]
net: fec: add stop mode support for imx8 platform

The current driver support stop mode by calling machine api.
The patch add dts support to set GPR register for stop request.

imx8mq enter stop/exit stop mode by setting GPR bit, which can
be accessed by A core.
imx8qm enter stop/exit stop mode by calling IMX_SC ipc APIs that
communicate with M core ipc service, and the M core set the related
GPR bit at last.

Signed-off-by: Wei Fang <wei.fang@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
22 months agor8152: Add MAC passthrough support for Lenovo Travel Hub
André Apitzsch [Thu, 1 Sep 2022 17:00:13 +0000 (19:00 +0200)]
r8152: Add MAC passthrough support for Lenovo Travel Hub

The Lenovo USB-C Travel Hub supports MAC passthrough.

Signed-off-by: André Apitzsch <git@apitzsch.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
22 months agonet/ipv4: Use __DECLARE_FLEX_ARRAY() helper
Gustavo A. R. Silva [Wed, 31 Aug 2022 19:12:42 +0000 (14:12 -0500)]
net/ipv4: Use __DECLARE_FLEX_ARRAY() helper

We now have a cleaner way to keep compatibility with user-space
(a.k.a. not breaking it) when we need to keep in place a one-element
array (for its use in user-space) together with a flexible-array
member (for its use in kernel-space) without making it hard to read
at the source level. This is through the use of the new
__DECLARE_FLEX_ARRAY() helper macro.

The size and memory layout of the structure is preserved after the
changes. See below.

Before changes:

$ pahole -C ip_msfilter net/ipv4/igmp.o
struct ip_msfilter {
union {
struct {
__be32     imsf_multiaddr_aux;   /*     0     4 */
__be32     imsf_interface_aux;   /*     4     4 */
__u32      imsf_fmode_aux;       /*     8     4 */
__u32      imsf_numsrc_aux;      /*    12     4 */
__be32     imsf_slist[1];        /*    16     4 */
};                                       /*     0    20 */
struct {
__be32     imsf_multiaddr;       /*     0     4 */
__be32     imsf_interface;       /*     4     4 */
__u32      imsf_fmode;           /*     8     4 */
__u32      imsf_numsrc;          /*    12     4 */
__be32     imsf_slist_flex[0];   /*    16     0 */
};                                       /*     0    16 */
};                                               /*     0    20 */

/* size: 20, cachelines: 1, members: 1 */
/* last cacheline: 20 bytes */
};

After changes:

$ pahole -C ip_msfilter net/ipv4/igmp.o
struct ip_msfilter {
__be32                     imsf_multiaddr;       /*     0     4 */
__be32                     imsf_interface;       /*     4     4 */
__u32                      imsf_fmode;           /*     8     4 */
__u32                      imsf_numsrc;          /*    12     4 */
union {
__be32             imsf_slist[1];        /*    16     4 */
struct {
struct {
} __empty_imsf_slist_flex;       /*    16     0 */
__be32     imsf_slist_flex[0];   /*    16     0 */
};                                       /*    16     0 */
};                                               /*    16     4 */

/* size: 20, cachelines: 1, members: 5 */
/* last cacheline: 20 bytes */
};

In the past, we had to duplicate the whole original structure within
a union, and update the names of all the members. Now, we just need to
declare the flexible-array member to be used in kernel-space through
the __DECLARE_FLEX_ARRAY() helper together with the one-element array,
within a union. This makes the source code more clean and easier to read.

Link: https://github.com/KSPP/linux/issues/193
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
22 months agonet/sched: cls_api: remove redundant 0 check in tcf_qevent_init()
Zhengchao Shao [Thu, 1 Sep 2022 01:16:17 +0000 (09:16 +0800)]
net/sched: cls_api: remove redundant 0 check in tcf_qevent_init()

tcf_qevent_parse_block_index() never returns a zero block_index.
Therefore, it is unnecessary to check the value of block_index in
tcf_qevent_init().

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Link: https://lore.kernel.org/r/20220901011617.14105-1-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
22 months agonet: lantiq_etop: Fix return type for implementation of ndo_start_xmit
GUO Zihua [Fri, 2 Sep 2022 08:15:21 +0000 (16:15 +0800)]
net: lantiq_etop: Fix return type for implementation of ndo_start_xmit

Since Linux now supports CFI, it will be a good idea to fix mismatched
return type for implementation of hooks. Otherwise this might get
cought out by CFI and cause a panic.

ltq_etop_tx() would return either NETDEV_TX_BUSY or NETDEV_TX_OK, so
change the return type to netdev_tx_t directly.

Signed-off-by: GUO Zihua <guozihua@huawei.com>
Link: https://lore.kernel.org/r/20220902081521.59867-1-guozihua@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
22 months agonet: sunplus: Fix return type for implementation of ndo_start_xmit
GUO Zihua [Fri, 2 Sep 2022 08:15:50 +0000 (16:15 +0800)]
net: sunplus: Fix return type for implementation of ndo_start_xmit

Since Linux now supports CFI, it will be a good idea to fix mismatched
return type for implementation of hooks. Otherwise this might get
cought out by CFI and cause a panic.

spl2sw_ethernet_start_xmit() would return either NETDEV_TX_BUSY or
NETDEV_TX_OK, so change the return type to netdev_tx_t directly.

Signed-off-by: GUO Zihua <guozihua@huawei.com>
Link: https://lore.kernel.org/r/20220902081550.60095-1-guozihua@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
22 months agonet: xscale: Fix return type for implementation of ndo_start_xmit
GUO Zihua [Fri, 2 Sep 2022 08:16:12 +0000 (16:16 +0800)]
net: xscale: Fix return type for implementation of ndo_start_xmit

Since Linux now supports CFI, it will be a good idea to fix mismatched
return type for implementation of hooks. Otherwise this might get
cought out by CFI and cause a panic.

eth_xmit() would return either NETDEV_TX_BUSY or NETDEV_TX_OK, so
change the return type to netdev_tx_t directly.

Signed-off-by: GUO Zihua <guozihua@huawei.com>
Link: https://lore.kernel.org/r/20220902081612.60405-1-guozihua@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
22 months agonet: broadcom: Fix return type for implementation of
GUO Zihua [Fri, 2 Sep 2022 07:54:07 +0000 (15:54 +0800)]
net: broadcom: Fix return type for implementation of

Since Linux now supports CFI, it will be a good idea to fix mismatched
return type for implementation of hooks. Otherwise this might get
cought out by CFI and cause a panic.

bcm4908_enet_start_xmit() would return either NETDEV_TX_BUSY or
NETDEV_TX_OK, so change the return type to netdev_tx_t directly.

Signed-off-by: GUO Zihua <guozihua@huawei.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20220902075407.52358-1-guozihua@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>