platform/kernel/linux-rpi.git
2 years agomt76: mt7915: allow beaconing on all chains
Ryder Lee [Fri, 4 Mar 2022 23:42:24 +0000 (07:42 +0800)]
mt76: mt7915: allow beaconing on all chains

This improves rate reach performance on units with polarized antennas.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: fix monitor mode crash with sdio driver
Deren Wu [Fri, 4 Mar 2022 14:54:05 +0000 (22:54 +0800)]
mt76: fix monitor mode crash with sdio driver

mt7921s driver may receive frames with fragment buffers. If there is a
CTS packet received in monitor mode, the payload is 10 bytes only and
need 6 bytes header padding after RXD buffer. However, only RXD in the
first linear buffer, if we pull buffer size RXD-size+6 bytes with
skb_pull(), that would trigger "BUG_ON(skb->len < skb->data_len)" in
__skb_pull().

To avoid the nonlinear buffer issue, enlarge the RXD size from 128 to
256 to make sure all MCU operation in linear buffer.

[   52.007562] kernel BUG at include/linux/skbuff.h:2313!
[   52.007578] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[   52.007987] pc : skb_pull+0x48/0x4c
[   52.008015] lr : mt7921_queue_rx_skb+0x494/0x890 [mt7921_common]
[   52.008361] Call trace:
[   52.008377]  skb_pull+0x48/0x4c
[   52.008400]  mt76s_net_worker+0x134/0x1b0 [mt76_sdio 35339a92c6eb7d4bbcc806a1d22f56365565135c]
[   52.008431]  __mt76_worker_fn+0xe8/0x170 [mt76 ef716597d11a77150bc07e3fdd68eeb0f9b56917]
[   52.008449]  kthread+0x148/0x3ac
[   52.008466]  ret_from_fork+0x10/0x30

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: fix mt7921_queues_acq implementation
Lorenzo Bianconi [Thu, 3 Mar 2022 08:46:41 +0000 (09:46 +0100)]
mt76: mt7921: fix mt7921_queues_acq implementation

Fix mt7921_queues_acq implementation according to the vendor sdk.

Fixes: 474a9f21e2e20 ("mt76: mt7921: add debugfs support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: fix xmit-queue dump for usb and sdio
Lorenzo Bianconi [Wed, 2 Mar 2022 15:46:06 +0000 (16:46 +0100)]
mt76: mt7921: fix xmit-queue dump for usb and sdio

Use proper xmit queue handler to dump queue stats.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: make mt7921_init_tx_queues static
Lorenzo Bianconi [Wed, 2 Mar 2022 15:32:57 +0000 (16:32 +0100)]
mt76: mt7921: make mt7921_init_tx_queues static

mt7921 is only used in mt7921_dma_init routine.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: split single ldpc cap bit into bits
MeiChia Chiu [Wed, 2 Mar 2022 06:14:06 +0000 (14:14 +0800)]
mt76: split single ldpc cap bit into bits

The original single LDPC cap bit cannot be used to
differentiate LDPC cap in each PHY mode.
This modification split the single bit into 3 bits,
ht_ldpc, vht_ldpc, and he_ldpc.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Suggested-by: Money Wang <Money.Wang@mediatek.com>
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7915: fix DFS no radar detection event
Evelyn Tsai [Tue, 1 Mar 2022 05:29:10 +0000 (13:29 +0800)]
mt76: mt7915: fix DFS no radar detection event

Driver needs to carry region definition when radar detection starts.
Need to remap nl80211 DFS regions to chip region definition.

Signed-off-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Signed-off-by: Rubio Lu <Rubio-DW.Lu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: use mt76_hw instead of open coding it
Sean Wang [Tue, 1 Mar 2022 01:17:52 +0000 (09:17 +0800)]
mt76: mt7921: use mt76_hw instead of open coding it

use mt76_hw instead of open coding it

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7921: fix up the monitor mode
Sean Wang [Tue, 1 Mar 2022 01:17:51 +0000 (09:17 +0800)]
mt76: mt7921: fix up the monitor mode

Properly set up the monitor mode the firmware can support to fix up
RTS/CTS and beacon frames cannot be captured and forwarded to the host.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Tested-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7663u: introduce mt7663u_mcu_power_on routine
Lorenzo Bianconi [Mon, 28 Feb 2022 19:43:23 +0000 (20:43 +0100)]
mt76: mt7663u: introduce mt7663u_mcu_power_on routine

Introduce mt7663u_mcu_power_on utility routine since the code is shared
between mt7663u_mcu_init() and mt7663u_probe().

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agomt76: mt7615: honor ret from mt7615_mcu_restart in mt7663u_mcu_init
Lorenzo Bianconi [Mon, 28 Feb 2022 19:39:28 +0000 (20:39 +0100)]
mt76: mt7615: honor ret from mt7615_mcu_restart in mt7663u_mcu_init

Check return value of mt7615_mcu_restart routine in mt7663u_mcu_init().

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 years agortw89: fix uninitialized variable of rtw89_append_probe_req_ie()
Ping-Ke Shih [Fri, 11 Mar 2022 02:00:07 +0000 (10:00 +0800)]
rtw89: fix uninitialized variable of rtw89_append_probe_req_ie()

smatch reports that:
  fw.c:1997 rtw89_append_probe_req_ie() error: uninitialized symbol 'ret'.

This can be a issue only if no band is supported by the chip, but it is
impossible. So, it is still safe without this patch.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220311020007.20414-1-pkshih@realtek.com
2 years agoMAINTAINERS: fix ath11k DT bindings location
Lukas Bulwahn [Tue, 8 Mar 2022 08:55:03 +0000 (09:55 +0100)]
MAINTAINERS: fix ath11k DT bindings location

Commit dae0978d4174 ("dt: bindings: net: add qcom,ath11k.yaml") obviously
adds qcom,ath11k.yaml, but the file entry in MAINTAINERS, added with
commit fcda1cb81663 ("MAINTAINERS: add DT bindings files for ath10k and
ath11k") then refers to qcom,ath11k.txt.

Hence, ./scripts/get_maintainer.pl --self-test=patterns complains about a
broken reference.

Repair this file reference in QUALCOMM ATHEROS ATH11K WIRELESS DRIVER, and
put it in alphabetic order while at it.

Fixes: fcda1cb81663 ("MAINTAINERS: add DT bindings files for ath10k and ath11k")
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220308085503.537-1-lukas.bulwahn@gmail.com
2 years agoairo: fix typos in comments
Julia Lawall [Mon, 14 Mar 2022 11:53:44 +0000 (12:53 +0100)]
airo: fix typos in comments

Various spelling mistakes in comments.
Detected with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220314115354.144023-21-Julia.Lawall@inria.fr
2 years agortlwifi: rtl8821ae: fix typos in comments
Julia Lawall [Mon, 14 Mar 2022 11:53:43 +0000 (12:53 +0100)]
rtlwifi: rtl8821ae: fix typos in comments

Various spelling mistakes in comments.
Detected with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220314115354.144023-20-Julia.Lawall@inria.fr
2 years agortlwifi: rtl8192cu: Add On Networks N150
Jonathan Teh [Sun, 13 Mar 2022 20:10:55 +0000 (20:10 +0000)]
rtlwifi: rtl8192cu: Add On Networks N150

This is an RTL8188CUS device, identifies as model N150MA-199WWS.

Signed-off-by: Jonathan Teh <jonathan.teh@outlook.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/DBAPR04MB7366E8014ECA839E1F5CCE29920E9@DBAPR04MB7366.eurprd04.prod.outlook.com
2 years agozd1201: use kzalloc
Julia Lawall [Sat, 12 Mar 2022 10:27:04 +0000 (11:27 +0100)]
zd1201: use kzalloc

Use kzalloc instead of kmalloc + memset.

The semantic patch that makes this change is:
(https://coccinelle.gitlabpages.inria.fr/website/)

//<smpl>
@@
expression res, size, flag;
@@
- res = kmalloc(size, flag);
+ res = kzalloc(size, flag);
  ...
- memset(res, 0, size);
//</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220312102705.71413-6-Julia.Lawall@inria.fr
2 years agomwifiex: make read-only array wmm_oui static const
Colin Ian King [Fri, 11 Mar 2022 22:56:10 +0000 (22:56 +0000)]
mwifiex: make read-only array wmm_oui static const

Don't populate the read-only array wmm_oui on the stack but
instead make it static const. Also makes the object code a little
smaller.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220311225610.10895-1-colin.i.king@gmail.com
2 years agomac80211: update bssid_indicator in ieee80211_assign_beacon
Lorenzo Bianconi [Thu, 24 Feb 2022 11:55:00 +0000 (12:55 +0100)]
mac80211: update bssid_indicator in ieee80211_assign_beacon

Update bssid_indicator in ieee80211_bss_conf according to the
number of bssid in the set.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/f92317e002fca9933f05a445fcefb4f53291d601.1645702516.git.lorenzo@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: MBSSID channel switch
John Crispin [Thu, 24 Feb 2022 11:54:59 +0000 (12:54 +0100)]
mac80211: MBSSID channel switch

Trigger ieee80211_csa_finish() on the non-transmitting interfaces
when channel switch concludes on the transmitting interface.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Aloka Dixit <alokad@codeaurora.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
Signed-off-by: John Crispin <john@phrozen.org>
Link: https://lore.kernel.org/r/6fde4d7f9fa387494f46a7aa4a584478dcda06f1.1645702516.git.lorenzo@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: MBSSID beacon handling in AP mode
Lorenzo Bianconi [Thu, 24 Feb 2022 11:54:58 +0000 (12:54 +0100)]
mac80211: MBSSID beacon handling in AP mode

Add new fields in struct beacon_data to store all MBSSID elements.
Generate a beacon template which includes all MBSSID elements.
Move CSA offset to reflect the MBSSID element length.

Co-developed-by: Aloka Dixit <alokad@codeaurora.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
Co-developed-by: John Crispin <john@phrozen.org>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Money Wang <money.wang@mediatek.com>
Link: https://lore.kernel.org/r/5322db3c303f431adaf191ab31c45e151dde5465.1645702516.git.lorenzo@kernel.org
[small cleanups]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: always have ieee80211_sta_restart()
Johannes Berg [Sat, 12 Mar 2022 21:19:58 +0000 (22:19 +0100)]
mac80211: always have ieee80211_sta_restart()

When CONFIG_PM isn't defined we don't have the function
ieee80211_sta_restart() compiled in, but we always need
it now for firmware restart. Move it out of the ifdef.

Fixes: 7d352ccf1e99 ("mac80211: Add support to trigger sta disconnect on hardware restart")
Link: https://lore.kernel.org/r/20220312221957.1fa96c72db51.I8ecaa5f9402fede0272161e0531ab930b97fba3e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agoMerge tag 'linux-can-next-for-5.18-20220313' of git://git.kernel.org/pub/scm/linux...
David S. Miller [Sun, 13 Mar 2022 10:25:12 +0000 (10:25 +0000)]
Merge tag 'linux-can-next-for-5.18-20220313' of git://git./linux/kernel/git/mkl/linux-can-next

linux-can-next-for-5.18-20220313

Marc Kleine-Budde says:

====================
pull-request: can-next 2022-03-13

this is a pull request of 13 patches for net-next/master.

The 1st patch is by me and fixes the freeing of a skb in the vxcan
driver (initially added in this net-next window).

The remaining 12 patches are also by me and target the mcp251xfd
driver. The first patch fixes a printf modifier (initially added in
this net-next window). The remaining patches add ethtool based ring
and RX/TX IRQ coalescing support to the driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agocan: mcp251xfd: ring: increase number of RX-FIFOs to 3 and increase max TX-FIFO depth...
Marc Kleine-Budde [Mon, 25 Oct 2021 09:49:24 +0000 (11:49 +0200)]
can: mcp251xfd: ring: increase number of RX-FIFOs to 3 and increase max TX-FIFO depth to 16

This patch increases the number of RX-FIFOs to 3 and the max TX-FIFO
depth to 16. This leads to the following default ring configuration.

CAN-2.0 mode:

| FIFO setup: TEF:         0x400:  8*12 bytes =   96 bytes
| FIFO setup: RX-0: FIFO 1/0x460: 32*20 bytes =  640 bytes
| FIFO setup: RX-1: FIFO 2/0x6e0: 32*20 bytes =  640 bytes
| FIFO setup: RX-2: FIFO 3/0x960: 16*20 bytes =  320 bytes
| FIFO setup: TX:   FIFO 4/0xaa0:  8*16 bytes =  128 bytes
| FIFO setup: free:                              224 bytes

CAN-FD mode:

| FIFO setup: TEF:         0x400:  4*12 bytes =   48 bytes
| FIFO setup: RX-0: FIFO 1/0x430: 16*76 bytes = 1216 bytes
| FIFO setup: RX-1: FIFO 2/0x8f0:  4*76 bytes =  304 bytes
| FIFO setup: TX:   FIFO 3/0xa20:  4*72 bytes =  288 bytes
| FIFO setup: free:                              192 bytes

With the previously added ethtool ring configuration support the RAM
on the chip can now be runtime configured between RX and TX buffers.

Link: https://lore.kernel.org/20220313083640.501791-13-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agocan: mcp251xfd: add TX IRQ coalescing ethtool support
Marc Kleine-Budde [Mon, 15 Nov 2021 11:21:11 +0000 (12:21 +0100)]
can: mcp251xfd: add TX IRQ coalescing ethtool support

This patch adds support ethtool based configuration for the TX IRQ
coalescing added in the previous patch.

Link: https://lore.kernel.org/20220313083640.501791-12-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agocan: mcp251xfd: add TX IRQ coalescing support
Marc Kleine-Budde [Mon, 15 Nov 2021 11:21:11 +0000 (12:21 +0100)]
can: mcp251xfd: add TX IRQ coalescing support

This patch adds TX IRQ coalescing support to the driver.

The implemented algorithm is similar to the RX IRQ coalescing support
added in the previous patch.

Link: https://lore.kernel.org/20220313083640.501791-11-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agocan: mcp251xfd: add RX IRQ coalescing ethtool support
Marc Kleine-Budde [Tue, 16 Feb 2021 10:46:16 +0000 (11:46 +0100)]
can: mcp251xfd: add RX IRQ coalescing ethtool support

This patch adds support ethtool based configuration for the RX IRQ
coalescing added in the previous patch.

Link: https://lore.kernel.org/20220313083640.501791-10-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agocan: mcp251xfd: add RX IRQ coalescing support
Marc Kleine-Budde [Tue, 16 Feb 2021 10:46:16 +0000 (11:46 +0100)]
can: mcp251xfd: add RX IRQ coalescing support

This patch adds RX IRQ coalescing support to the driver.

The mcp251xfd chip doesn't support proper hardware based coalescing,
so this patch tries to implemented it in software. The RX-FIFO offers
a "FIFO not empty" interrupt, which is used if no coalescing is
active.

With activated RX IRQ coalescing the "FIFO not empty" interrupt is
disabled in the RX IRQ handler and the "FIFO half full" or "FIFO full
interrupt" (depending on RX max coalesced frames IRQ) is used instead.
To avoid RX CAN frame starvation a hrtimer is setup with RX coalesce
usecs IRQ,on timer expiration the "FIFO not empty" is enabled again.

Support for ethtool configuration is added in the next patch.

Link: https://lore.kernel.org/20220313083640.501791-9-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agocan: mcp251xfd: ring: add support for runtime configurable RX/TX ring parameters
Marc Kleine-Budde [Mon, 25 Oct 2021 09:34:32 +0000 (11:34 +0200)]
can: mcp251xfd: ring: add support for runtime configurable RX/TX ring parameters

This patch adds runtime configurable RX and TX ring parameters via
ethtool to the driver.

Link: https://lore.kernel.org/20220313083640.501791-8-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agocan: mcp251xfd: update macros describing ring, FIFO and RAM layout
Marc Kleine-Budde [Mon, 25 Oct 2021 09:34:32 +0000 (11:34 +0200)]
can: mcp251xfd: update macros describing ring, FIFO and RAM layout

So far the configuration of the hardware FIFOs is hard coded and
depend only on the selected CAN mode (CAN-2.0 or CAN-FD).

This patch updates the macros describing the ring, FIFO and RAM layout
to prepare for the next patches that add support for runtime
configurable ring parameters via ethtool.

Link: https://lore.kernel.org/20220313083640.501791-7-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agocan: mcp251xfd: ring: prepare support for runtime configurable RX/TX ring parameters
Marc Kleine-Budde [Mon, 25 Oct 2021 09:34:32 +0000 (11:34 +0200)]
can: mcp251xfd: ring: prepare support for runtime configurable RX/TX ring parameters

This patch prepares the driver for runtime configurable RX and TX ring
parameters. The actual runtime config support will be added in the
next patch.

Link: https://lore.kernel.org/20220313083640.501791-6-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agocan: mcp251xfd: ethtool: add support
Marc Kleine-Budde [Mon, 25 Oct 2021 09:34:32 +0000 (11:34 +0200)]
can: mcp251xfd: ethtool: add support

This patch adds basic ethtool support (to query the current and
maximum ring parameters) to the driver.

Link: https://lore.kernel.org/20220313083640.501791-5-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agocan: mcp251xfd: ram: coalescing support
Marc Kleine-Budde [Tue, 16 Feb 2021 10:46:16 +0000 (11:46 +0100)]
can: mcp251xfd: ram: coalescing support

This patch adds support for coalescing to the RAM layout calculation.

Link: https://lore.kernel.org/20220313083640.501791-4-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agocan: mcp251xfd: ram: add helper function for runtime ring size calculation
Marc Kleine-Budde [Fri, 22 Oct 2021 17:11:57 +0000 (19:11 +0200)]
can: mcp251xfd: ram: add helper function for runtime ring size calculation

This patch adds a helper function to calculate the ring configuration
of the controller based on various constraints, like available RAM,
size of RX and TX objects, CAN-mode, number of FIFOs and FIFO depth.

Link: https://lore.kernel.org/20220313083640.501791-3-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agocan: mcp251xfd: mcp251xfd_ring_init(): use %d to print free RAM
Marc Kleine-Budde [Sun, 6 Mar 2022 13:54:07 +0000 (14:54 +0100)]
can: mcp251xfd: mcp251xfd_ring_init(): use %d to print free RAM

In case of an erroneous ring configuration more RAM than available
might be used. Change the printf modifier to a signed int to properly
print this erroneous value.

Fixes: 83daa863f16b ("can: mcp251xfd: ring: update FIFO setup debug info")
Link: https://lore.kernel.org/20220313083640.501791-2-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agocan: vxcan: vxcan_xmit(): use kfree_skb() instead of kfree() to free skb
Marc Kleine-Budde [Fri, 11 Mar 2022 11:27:43 +0000 (12:27 +0100)]
can: vxcan: vxcan_xmit(): use kfree_skb() instead of kfree() to free skb

This patch fixes the freeing of the "oskb", by using kfree_skb()
instead of kfree().

Fixes: 1574481bb3de ("vxcan: remove sk reference in peer skb")
Link: https://lore.kernel.org/all/20220311123741.382618-1-mkl@pengutronix.de
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2 years agoMerge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next...
David S. Miller [Sat, 12 Mar 2022 11:54:29 +0000 (11:54 +0000)]
Merge branch '100GbE' of git://git./linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
ice: GTP support in switchdev

Marcin Szycik says:

Add support for adding GTP-C and GTP-U filters in switchdev mode.

To create a filter for GTP, create a GTP-type netdev with ip tool, enable
hardware offload, add qdisc and add a filter in tc:

ip link add $GTP0 type gtp role <sgsn/ggsn> hsize <hsize>
ethtool -K $PF0 hw-tc-offload on
tc qdisc add dev $GTP0 ingress
tc filter add dev $GTP0 ingress prio 1 flower enc_key_id 1337 \
action mirred egress redirect dev $VF1_PR

By default, a filter for GTP-U will be added. To add a filter for GTP-C,
specify enc_dst_port = 2123, e.g.:

tc filter add dev $GTP0 ingress prio 1 flower enc_key_id 1337 \
enc_dst_port 2123 action mirred egress redirect dev $VF1_PR

Note: outer IPv6 offload is not supported yet.
Note: GTP-U with no payload offload is not supported yet.

ICE COMMS package is required to create a filter as it contains GTP
profiles.

Changes in iproute2 [1] are required to be able to add GTP netdev and use
GTP-specific options (QFI and PDU type).

[1] https://lore.kernel.org/netdev/20220211182902.11542-1-wojciech.drewek@intel.com/T
---
v2: Add more CC
v3: Fix mail thread, sorry for spam
v4: Add GTP echo response in gtp module
v5: Change patch order
v6: Add GTP echo request in gtp module
v7: Fix kernel-docs in ice
v8: Remove handling of GTP Echo Response
v9: Add sending of multicast message on GTP Echo Response, fix GTP-C dummy
    packet selection
v10: Rebase, fixed most 80 char line limits
v11: Rebase, collect Harald's Reviewed-by on patch 3
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: usb: asix: suspend embedded PHY if external is used
Oleksij Rempel [Fri, 11 Mar 2022 08:50:14 +0000 (09:50 +0100)]
net: usb: asix: suspend embedded PHY if external is used

In case external PHY is used, we need to take care of embedded PHY.
Since there are no methods to disable this PHY from the MAC side and
keeping RMII reference clock, we need to suspend it.

This patch will reduce electrical noise (PHY is continuing to send FLPs)
and power consumption by 0,22W.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: usb: asix: make use of mdiobus_get_phy and phy_connect_direct
Oleksij Rempel [Fri, 11 Mar 2022 08:50:13 +0000 (09:50 +0100)]
net: usb: asix: make use of mdiobus_get_phy and phy_connect_direct

In most cases we use own mdio bus, there is no need to create and store
string for the PHY address.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: usb: asix: store chipid to avoid reading it on reset
Oleksij Rempel [Fri, 11 Mar 2022 08:50:12 +0000 (09:50 +0100)]
net: usb: asix: store chipid to avoid reading it on reset

We already read chipid on probe. There is no need to read it on reset.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: usb: asix: unify ax88772_resume code
Oleksij Rempel [Fri, 11 Mar 2022 08:50:11 +0000 (09:50 +0100)]
net: usb: asix: unify ax88772_resume code

The only difference is the reset code, so remove not needed duplicates.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: add per-cpu storage and net->core_stats
Eric Dumazet [Fri, 11 Mar 2022 05:14:20 +0000 (21:14 -0800)]
net: add per-cpu storage and net->core_stats

Before adding yet another possibly contended atomic_long_t,
it is time to add per-cpu storage for existing ones:
 dev->tx_dropped, dev->rx_dropped, and dev->rx_nohandler

Because many devices do not have to increment such counters,
allocate the per-cpu storage on demand, so that dev_get_stats()
does not have to spend considerable time folding zero counters.

Note that some drivers have abused these counters which
were supposed to be only used by core networking stack.

v4: should use per_cpu_ptr() in dev_get_stats() (Jakub)
v3: added a READ_ONCE() in netdev_core_stats_alloc() (Paolo)
v2: add a missing include (reported by kernel test robot <lkp@intel.com>)
    Change in netdev_core_stats_alloc() (Jakub)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: jeffreyji <jeffreyji@google.com>
Reviewed-by: Brian Vazquez <brianvv@google.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Link: https://lore.kernel.org/r/20220311051420.2608812-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agoMerge branch 'nfp-preliminary-support-for-nfp-3800'
Jakub Kicinski [Sat, 12 Mar 2022 07:10:23 +0000 (23:10 -0800)]
Merge branch 'nfp-preliminary-support-for-nfp-3800'

Simon Horman says:

====================
nfp: preliminary support for NFP-3800

This series is the first step to add support to the NFP driver for the
new NFP-3800 device. In this first series the goal is to clean
up small issues found while adding support for the new device, prepare
an abstraction of the differences between the already supported devices
and the new Kestrel device and add the new PCI ID.

* Patch 1/11 and 2/11 starts by removing some dead code and incorrect
  assumptions found while working Kestrel support. Patch 3/11, 4/11 and
  5/11 cleans up and prepares for adding the new PCI ID for Kestrel.
* Patches 6/11, 7/11, 8/11, 9/11, 10/11 adds, plumb and populates a device
   information structure to abstract the differences between the existed
   supported devices (NFP-4000, NFP-5000 and NFP-6000) and the
   new device (NFP3800).
* Finally patch 11/11 adds the new PCI ID for Kestrel.

More work is needed to drive the new NFP-3800 device after this first
batch of patches the foundation is prepared for the follow up work.

Thanks to the work of all those who contributed to this work.
====================

Link: https://lore.kernel.org/r/20220311104306.28357-1-simon.horman@corigine.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonfp: add support for NFP3800/NFP3803 PCIe devices
Dirk van der Merwe [Fri, 11 Mar 2022 10:43:06 +0000 (11:43 +0100)]
nfp: add support for NFP3800/NFP3803 PCIe devices

Enable binding the nfp driver to NFP3800 and NFP3803 devices.
The PCIE_SRAM offset is different for the NFP3800 device, which also
only supports a single explicit group.

Changes to Dirk's work:
* 48-bit dma addressing is not ready yet. Keep 40-bit dma addressing
for NFP3800.

Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonfp: take chip version into account for ring sizes
Jakub Kicinski [Fri, 11 Mar 2022 10:43:05 +0000 (11:43 +0100)]
nfp: take chip version into account for ring sizes

NFP3800 has slightly different queue controller range bounds.
Use the static chip data instead of defines.  This commit
still assumes unchanged descriptor format.  Later datapath
changes will allow adjusting for descriptor accounting.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonfp: parametrize QCP offset/size using dev_info
Jakub Kicinski [Fri, 11 Mar 2022 10:43:04 +0000 (11:43 +0100)]
nfp: parametrize QCP offset/size using dev_info

The queue controller (QCP) is accessed based on a device specific
offset. The NFP3800 device also supports more queues.

Furthermore, the NFP3800 VFs also access the QCP differently to how the
NFP6000 VFs accesses it, though still indirectly. Fortunately, we can
remove the offset all together for both VF types. This is safe for
NFP6000 VFs since the offset was effectively a wrap around and only used
for convenience to have it set the same as the NFP6000 PF.

Use nfp_dev_info to store queue controller parameters.

Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonfp: use dev_info for the DMA mask
Jakub Kicinski [Fri, 11 Mar 2022 10:43:03 +0000 (11:43 +0100)]
nfp: use dev_info for the DMA mask

In preparation for new chips instead of defines use dev_info constants
to store DMA mask length.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonfp: use dev_info for PCIe config space BAR offsets
Jakub Kicinski [Fri, 11 Mar 2022 10:43:02 +0000 (11:43 +0100)]
nfp: use dev_info for PCIe config space BAR offsets

NFP3800 uses a different PCIe configuration to CPP expansion BAR offsets.
We don't need to differentiate between the NFP4000, NFP5000 and NFP6000
since they all use the same offsets.

Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonfp: introduce dev_info static chip data
Jakub Kicinski [Fri, 11 Mar 2022 10:43:01 +0000 (11:43 +0100)]
nfp: introduce dev_info static chip data

In preparation for supporting new chip add a driver data structure
which will hold per-chip-version information such as register
offsets.

Plumb it through to the relevant functions (nfpcore and nfp_net).
For now only a very simple member holding chip names is added,
following commits will add more.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonfp: sort the device ID tables
Jakub Kicinski [Fri, 11 Mar 2022 10:43:00 +0000 (11:43 +0100)]
nfp: sort the device ID tables

Make sure the device ID tables are in ascending order.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonfp: use PluDevice register for model for non-NFP6000 chips
Dirk van der Merwe [Fri, 11 Mar 2022 10:42:59 +0000 (11:42 +0100)]
nfp: use PluDevice register for model for non-NFP6000 chips

The model number for NFP3800 and newer devices can be completely
derived from PluDevice register without subtracting 0x10.

Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonfp: use PCI_DEVICE_ID_NETRONOME_NFP6000_VF for VFs instead
Dirk van der Merwe [Fri, 11 Mar 2022 10:42:58 +0000 (11:42 +0100)]
nfp: use PCI_DEVICE_ID_NETRONOME_NFP6000_VF for VFs instead

The PCI_DEVICE_ID_NETRONOME_NFP6000_VF is available for use and
should be used instead of the PCI_DEVICE_NFP6000VF. Meanwhile,
PCI_DEVICE_NFP6000VF PCI ID is removed for not being used.

Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonfp: remove pessimistic NFP_QCP_MAX_ADD limits
Christo du Toit [Fri, 11 Mar 2022 10:42:57 +0000 (11:42 +0100)]
nfp: remove pessimistic NFP_QCP_MAX_ADD limits

Multiple writes cause intermediate pointer values that do not
end on complete TX descriptors.

The QCP peripheral on the NFP provides a number of access
modes.  In some access modes, the maximum amount to add must
be restricted to a 6bit value.  The particular access mode
used by _nfp_qcp_ptr_add() has no such restrictions, so the
"< NFP_QCP_MAX_ADD" test is unnecessary.

Note that trying to add more that the configured ring size
in a single add will cause a QCP overflow, caught and handled
by the QCP peripheral.

Signed-off-by: Christo du Toit <christo.du.toit@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonfp: remove define for an unused control bit
Jakub Kicinski [Fri, 11 Mar 2022 10:42:56 +0000 (11:42 +0100)]
nfp: remove define for an unused control bit

NFP driver ABI contains a bit for ring prioritization which
was never implemented in the initially envisioned form.

Remove it, and open up the possibility of reclaiming for other uses.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: Fei Qin <fei.qin@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agoethernet: 8390: Remove unnecessary print function dev_err()
Yang Li [Fri, 11 Mar 2022 00:17:56 +0000 (08:17 +0800)]
ethernet: 8390: Remove unnecessary print function dev_err()

The print function dev_err() is redundant because platform_get_irq()
already prints an error.

Eliminate the follow coccicheck warning:
./drivers/net/ethernet/8390/mcf8390.c:414:2-9: line 414 is redundant
because platform_get_irq() already prints an error

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Link: https://lore.kernel.org/r/20220311001756.12234-1-yang.lee@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: remove exports for netdev_name_node_alt_create() and destroy
Jakub Kicinski [Thu, 10 Mar 2022 22:39:52 +0000 (14:39 -0800)]
net: remove exports for netdev_name_node_alt_create() and destroy

netdev_name_node_alt_create() and netdev_name_node_alt_destroy()
are only called by rtnetlink, so no need for exports.

Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20220310223952.558779-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: netvsc: remove break after return
Saurabh Sengar [Thu, 10 Mar 2022 17:32:14 +0000 (09:32 -0800)]
net: netvsc: remove break after return

In function netvsc_process_raw_pkt for VM_PKT_DATA_USING_XFER_PAGES
case there is already a 'return' statement which results 'break'
as dead code

Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Link: https://lore.kernel.org/r/1646933534-29493-1-git-send-email-ssengar@linux.microsoft.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agotcp: unexport tcp_ca_get_key_by_name and tcp_ca_get_name_by_key
Christoph Hellwig [Thu, 10 Mar 2022 14:32:29 +0000 (15:32 +0100)]
tcp: unexport tcp_ca_get_key_by_name and tcp_ca_get_name_by_key

Both functions are only used by core networking code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220310143229.895319-1-hch@lst.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agonet: ipa: use struct_size() for the interconnect array
Alex Elder [Fri, 11 Mar 2022 16:24:23 +0000 (10:24 -0600)]
net: ipa: use struct_size() for the interconnect array

In review for commit 8ee7ec4890e2b ("net: ipa: embed interconnect
array in the power structure"), Jakub Kicinski suggested that a
follow-up patch use struct_size() when computing the size of the
IPA power structure, which ends with a flexible array member.

Do that.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Alex Elder <elder@linaro.org>
Link: https://lore.kernel.org/r/20220311162423.872645-1-elder@linaro.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agoMerge tag 'wireless-next-2022-03-11' of git://git.kernel.org/pub/scm/linux/kernel...
Jakub Kicinski [Fri, 11 Mar 2022 21:00:16 +0000 (13:00 -0800)]
Merge tag 'wireless-next-2022-03-11' of git://git./linux/kernel/git/wireless/wireless-next

Johannes Berg says:

====================
brcmfmac
 * add BCM43454/6 support

rtw89
 * add support for 160 MHz channels and 6 GHz band
 * hardware scan support

iwlwifi
 * support UHB TAS enablement via BIOS
 * remove a bunch of W=1 warnings
 * add support for channel switch offload
 * support 32 Rx AMPDU sessions in newer devices
 * add support for a couple of new devices
 * add support for band disablement via BIOS

mt76
 * mt7915 thermal management improvements
 * SAR support for more mt76 drivers
 * mt7986 wmac support on mt7915

ath11k
 * debugfs interface to configure firmware debug log level
 * debugfs interface to test Target Wake Time (TWT)
 * provide 802.11ax High Efficiency (HE) data via radiotap

ath9k
 * use hw_random API instead of directly dumping into random.c

wcn36xx
 * fix wcn3660 to work on 5 GHz band

ath6kl
 * add device ID for WLU5150-D81

cfg80211/mac80211
 * initial EHT (from 802.11be) support
   (EHT rates, 320 MHz, larger block-ack)
 * support disconnect on HW restart

* tag 'wireless-next-2022-03-11' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (247 commits)
  mac80211: Add support to trigger sta disconnect on hardware restart
  mac80211: fix potential double free on mesh join
  mac80211: correct legacy rates check in ieee80211_calc_rx_airtime
  nl80211: fix typo of NL80211_IF_TYPE_OCB in documentation
  mac80211: Use GFP_KERNEL instead of GFP_ATOMIC when possible
  mac80211: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE
  rtw89: 8852c: process logic efuse map
  rtw89: 8852c: process efuse of phycap
  rtw89: support DAV efuse reading operation
  rtw89: 8852c: add chip::dle_mem
  rtw89: add page_regs to handle v1 chips
  rtw89: add chip_info::{h2c,c2h}_reg to support more chips
  rtw89: add hci_func_en_addr to support variant generation
  rtw89: add power_{on/off}_func
  rtw89: read chip version depends on chip ID
  rtw89: pci: use a struct to describe all registers address related to DMA channel
  rtw89: pci: add V1 of PCI channel address
  rtw89: pci: add struct rtw89_pci_info
  rtw89: 8852c: add 8852c empty files
  MAINTAINERS: add devicetree bindings entry for mt76
  ...

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

Link: https://lore.kernel.org/r/20220311124029.213470-1-johannes@sipsolutions.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 years agoice: Support GTP-U and GTP-C offload in switchdev
Marcin Szycik [Fri, 4 Mar 2022 16:40:48 +0000 (17:40 +0100)]
ice: Support GTP-U and GTP-C offload in switchdev

Add support for creating filters for GTP-U and GTP-C in switchdev mode. Add
support for parsing GTP-specific options (QFI and PDU type) and TEID.

By default, a filter for GTP-U will be added. To add a filter for GTP-C,
specify enc_dst_port = 2123, e.g.:

tc filter add dev $GTP0 ingress prio 1 flower enc_key_id 1337 \
enc_dst_port 2123 action mirred egress redirect dev $VF1_PR

Note: GTP-U with outer IPv6 offload is not supported yet.
Note: GTP-U with no payload offload is not supported yet.

Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Sandeep Penigalapati <sandeep.penigalapati@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agoice: Fix FV offset searching
Michal Swiatkowski [Fri, 4 Mar 2022 16:40:47 +0000 (17:40 +0100)]
ice: Fix FV offset searching

Checking only protocol ids while searching for correct FVs can lead to a
situation, when incorrect FV will be added to the list. Incorrect means
that FV has correct protocol id but incorrect offset.

Call ice_get_sw_fv_list with ice_prot_lkup_ext struct which contains all
protocol ids with offsets.

With this modification allocating and collecting protocol ids list is
not longer needed.

Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Sandeep Penigalapati <sandeep.penigalapati@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agogtp: Add support for checking GTP device type
Wojciech Drewek [Fri, 4 Mar 2022 16:40:46 +0000 (17:40 +0100)]
gtp: Add support for checking GTP device type

Add a function that checks if a net device type is GTP.

Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agonet/sched: Allow flower to match on GTP options
Wojciech Drewek [Fri, 4 Mar 2022 16:40:45 +0000 (17:40 +0100)]
net/sched: Allow flower to match on GTP options

Options are as follows: PDU_TYPE:QFI and they refernce to
the fields from the  PDU Session Protocol. PDU Session data
is conveyed in GTP-U Extension Header.

GTP-U Extension Header is described in 3GPP TS 29.281.
PDU Session Protocol is described in 3GPP TS 38.415.

PDU_TYPE -  indicates the type of the PDU Session Information (4 bits)
QFI      -  QoS Flow Identifier (6 bits)

  # ip link add gtp_dev type gtp role sgsn
  # tc qdisc add dev gtp_dev ingress
  # tc filter add dev gtp_dev protocol ip parent ffff: \
      flower \
        enc_key_id 11 \
        gtp_opts 1:8/ff:ff \
      action mirred egress redirect dev eth0

Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agogtp: Implement GTP echo request
Wojciech Drewek [Fri, 4 Mar 2022 16:40:44 +0000 (17:40 +0100)]
gtp: Implement GTP echo request

Adding GTP device through ip link creates the situation where
GTP instance is not able to send GTP echo requests.
Echo requests are used to check if GTP peer is still alive.
With this patch, gtp_genl_ops are extended by new cmd (GTP_CMD_ECHOREQ)
which allows to send echo request in the given version of GTP
protocol (v0 or v1), from the given ms address to he given
peer. TID is not inclued because in all path management
messages it should be equal to 0.

When GTP echo response is detected, multicast message is
send to everyone in the gtp_genl_family. Message contains
GTP version, ms address and peer address.

Suggested-by: Harald Welte <laforge@gnumonks.org>
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agogtp: Implement GTP echo response
Wojciech Drewek [Fri, 4 Mar 2022 16:40:43 +0000 (17:40 +0100)]
gtp: Implement GTP echo response

Adding GTP device through ip link creates the situation where
there is no userspace daemon which would handle GTP messages
(Echo Request for example). GTP-U instance which would not respond
to echo requests would violate GTP specification.

When GTP packet arrives with GTP_ECHO_REQ message type,
GTP_ECHO_RSP is send to the sender. GTP_ECHO_RSP message
should contain information element with GTPIE_RECOVERY tag and
restart counter value. For GTPv1 restart counter is not used
and should be equal to 0, for GTPv0 restart counter contains
information provided from userspace(IFLA_GTP_RESTART_COUNT).

Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Suggested-by: Harald Welte <laforge@gnumonks.org>
Reviewed-by: Harald Welte <laforge@gnumonks.org>
Tested-by: Harald Welte <laforge@gnumonks.org>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agogtp: Allow to create GTP device without FDs
Wojciech Drewek [Fri, 4 Mar 2022 16:40:42 +0000 (17:40 +0100)]
gtp: Allow to create GTP device without FDs

Currently, when the user wants to create GTP device, he has to
provide file handles to the sockets created in userspace (IFLA_GTP_FD0,
IFLA_GTP_FD1). This behaviour is not ideal, considering the option of
adding support for GTP device creation through ip link. Ip link
application is not a good place to create such sockets.

This patch allows to create GTP device without providing
IFLA_GTP_FD0 and IFLA_GTP_FD1 arguments. If the user sets
IFLA_GTP_CREATE_SOCKETS attribute, then GTP module takes care
of creating UDP sockets by itself. Sockets are created with the
commonly known UDP ports used for GTP protocol (GTP0_PORT and
GTP1U_PORT). In this case we don't have to provide encap_destroy
because no extra deinitialization is needed, everything is covered
by udp_tunnel_sock_release.

Note: GTP instance created with only this change applied, does
not handle GTP Echo Requests. This is implemented in the following
patch.

Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2 years agoMerge branch 'ptp-ocp-new-firmware-support'
David S. Miller [Fri, 11 Mar 2022 11:54:45 +0000 (11:54 +0000)]
Merge branch 'ptp-ocp-new-firmware-support'

Jonathan Lemon says:

====================
ptp: ocp: support for new firmware

This series contains support for new firmware features for
the timecard.

v1 -> v2: roundup() is not 32-bit safe, use DIV_ROUND_UP_ULL
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agodocs: ABI: Document new timecard sysfs nodes.
Jonathan Lemon [Thu, 10 Mar 2022 20:19:12 +0000 (12:19 -0800)]
docs: ABI: Document new timecard sysfs nodes.

Add sysfs nodes for the frequency generator and signal counters.

Update SMA selector lists for these, and also add the new
'None', 'VCC' 'GND' selectors.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add 2 more timestampers
Jonathan Lemon [Thu, 10 Mar 2022 20:19:11 +0000 (12:19 -0800)]
ptp: ocp: Add 2 more timestampers

The timecard now has 4 general purpose timestampers.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add 4 frequency counters
Jonathan Lemon [Thu, 10 Mar 2022 20:19:10 +0000 (12:19 -0800)]
ptp: ocp: Add 4 frequency counters

Input signals can be steered to any of the frequency counters.
The counter measures the frequency over a number of seconds:

  echo 0 > freq1/seconds  = turns off measurement
  echo 1 > freq1/seconds  = sets period & turns on measurment.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Program the signal generators via PTP_CLK_REQ_PEROUT
Jonathan Lemon [Thu, 10 Mar 2022 20:19:09 +0000 (12:19 -0800)]
ptp: ocp: Program the signal generators via PTP_CLK_REQ_PEROUT

The signal generators can be programmed either via the sysfs
file or through a PTP_CLK_REQ_PEROUT ioctl request.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add signal generators and update sysfs nodes
Jonathan Lemon [Thu, 10 Mar 2022 20:19:08 +0000 (12:19 -0800)]
ptp: ocp: Add signal generators and update sysfs nodes

Newer firmware provides 4 programmable signal generators, add
support for those here.  The signal generators provide the
ability to set the period, duty cycle, phase offset, and polarity,
with new values defaulting to prior values.

The period and phase offset are specified in nanoseconds.

E.g:    period [duty [phase [polarity]]]

  echo 500000000 > signal # 1/2 second period
  echo 1000000 40 100 > signal # 1ms period, 40% on, offset 100ns
  echo 0 > signal # turn off generator

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add firmware capability bits for feature gating
Jonathan Lemon [Thu, 10 Mar 2022 20:19:07 +0000 (12:19 -0800)]
ptp: ocp: Add firmware capability bits for feature gating

Add the ability to group sysfs nodes behind a firmware feature
check.  This way non-present sysfs attributes are omitted on
older firmware, which does not have newer features.

This will be used in the upcoming patches which adds more
features to the timecard.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add GND and VCC output selectors
Jonathan Lemon [Thu, 10 Mar 2022 20:19:06 +0000 (12:19 -0800)]
ptp: ocp: Add GND and VCC output selectors

These will provide constant outputs.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Rename output selector 'GNSS' to 'GNSS1'
Jonathan Lemon [Thu, 10 Mar 2022 20:19:05 +0000 (12:19 -0800)]
ptp: ocp: Rename output selector 'GNSS' to 'GNSS1'

As there are may be 2 GNSS outputs, rename the first one for clarity.
This also works around a parsing issue when specifying selectors.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add ability to disable input selectors.
Jonathan Lemon [Thu, 10 Mar 2022 20:19:04 +0000 (12:19 -0800)]
ptp: ocp: Add ability to disable input selectors.

This adds support for the "IN: None" selector, which disables
the input on a sma pin.  This should be compatible with old firmware
(the firmware will ignore it if not supported).

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoptp: ocp: Add support for selectable SMA directions.
Jonathan Lemon [Thu, 10 Mar 2022 20:19:03 +0000 (12:19 -0800)]
ptp: ocp: Add support for selectable SMA directions.

Assuming the firmware allows it, the direction of each SMA connector
is no longer fixed.  Handle remapping directions for each pin.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: lan966x: Improve the CPU TX bitrate.
Horatiu Vultur [Thu, 10 Mar 2022 08:40:05 +0000 (09:40 +0100)]
net: lan966x: Improve the CPU TX bitrate.

When doing manual injection of the frame, it is required to check if the
TX FIFO is ready to accept the next word of the frame. For this we are
using 'readx_poll_timeout_atomic', the only problem is that before it
actually checks the status, is determining the time when to finish polling
the status. Which seems to be an expensive operation.
Therefore check the status of the TX FIFO before calling
'readx_poll_timeout_atomic'.
Doing this will improve the TX bitrate by ~70%. Because 99% the FIFO is
ready by that time. The measurements were done using iperf3.

Before:
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.03  sec  55.2 MBytes  46.2 Mbits/sec    0 sender
[  5]   0.00-10.04  sec  53.8 MBytes  45.0 Mbits/sec      receiver

After:
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.10  sec  95.0 MBytes  78.9 Mbits/sec    0 sender
[  5]   0.00-10.11  sec  95.0 MBytes  78.8 Mbits/sec      receiver

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: ethernet: ezchip: fix platform_get_irq.cocci warning
Yihao Han [Thu, 10 Mar 2022 08:12:19 +0000 (00:12 -0800)]
net: ethernet: ezchip: fix platform_get_irq.cocci warning

Remove dev_err() messages after platform_get_irq*() failures.
platform_get_irq() already prints an error.

Generated by: scripts/coccinelle/api/platform_get_irq.cocci

Signed-off-by: Yihao Han <hanyihao@vivo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoflow_dissector: Add support for HSRv0
Kurt Kanzenbach [Thu, 10 Mar 2022 07:35:05 +0000 (08:35 +0100)]
flow_dissector: Add support for HSRv0

Commit bf08824a0f47 ("flow_dissector: Add support for HSR") added support for
HSR within the flow dissector. However, it only works for HSR in version
1. Version 0 uses a different Ether Type. Add support for it.

Reported-by: Anthony Harivel <anthony.harivel@linutronix.de>
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: mv643xx_eth: use platform_get_irq() instead of platform_get_resource()
Minghao Chi [Thu, 10 Mar 2022 06:20:35 +0000 (06:20 +0000)]
net: mv643xx_eth: use platform_get_irq() instead of platform_get_resource()

It is not recommened to use platform_get_resource(pdev, IORESOURCE_IRQ)
for requesting IRQ's resources any more, as they can be not ready yet in
case of DT-booting.

platform_get_irq() instead is a recommended way for getting IRQ even if
it was not retrieved earlier.

It also makes code simpler because we're getting "int" value right away
and no conversion from resource to int is required.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: ethernet: ti: davinci_emac: Use platform_get_irq() to get the interrupt
Lad Prabhakar [Thu, 10 Mar 2022 01:26:06 +0000 (01:26 +0000)]
net: ethernet: ti: davinci_emac: Use platform_get_irq() to get the interrupt

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq() for DT users only.

While at it propagate error code in emac_dev_stop() in case
platform_get_irq_optional() fails.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agonet: ethernet: ti: am65-cpsw: Convert to PHYLINK
Siddharth Vadapalli [Wed, 9 Mar 2022 07:59:44 +0000 (13:29 +0530)]
net: ethernet: ti: am65-cpsw: Convert to PHYLINK

Convert am65-cpsw driver and am65-cpsw ethtool to use Phylink APIs
as described at Documentation/networking/sfp-phylink.rst. All calls
to Phy APIs are replaced with their equivalent Phylink APIs.

No functional change intended. Use Phylink instead of conventional
Phylib, in preparation to add support for SGMII/QSGMII modes.

Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomac80211: Add support to trigger sta disconnect on hardware restart
Youghandhar Chintala [Tue, 8 Mar 2022 11:53:24 +0000 (17:23 +0530)]
mac80211: Add support to trigger sta disconnect on hardware restart

Currently in case of target hardware restart, we just reconfig and
re-enable the security keys and enable the network queues to start
data traffic back from where it was interrupted.

Many ath10k wifi chipsets have sequence numbers for the data
packets assigned by firmware and the mac sequence number will
restart from zero after target hardware restart leading to mismatch
in the sequence number expected by the remote peer vs the sequence
number of the frame sent by the target firmware.

This mismatch in sequence number will cause out-of-order packets
on the remote peer and all the frames sent by the device are dropped
until we reach the sequence number which was sent before we restarted
the target hardware

In order to fix this, we trigger a sta disconnect, in case of target
hw restart. After this there will be a fresh connection and thereby
avoiding the dropping of frames by remote peer.

The right fix would be to pull the entire data path into the host
which is not feasible or would need lots of complex changes and
will still be inefficient.

Tested on ath10k using WCN3990, QCA6174

Signed-off-by: Youghandhar Chintala <youghand@codeaurora.org>
Link: https://lore.kernel.org/r/20220308115325.5246-2-youghand@codeaurora.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agopowerpc/net: Implement powerpc specific csum_shift() to remove branch
Christophe Leroy [Tue, 8 Mar 2022 16:12:10 +0000 (17:12 +0100)]
powerpc/net: Implement powerpc specific csum_shift() to remove branch

Today's implementation of csum_shift() leads to branching based on
parity of 'offset'

000002f8 <csum_block_add>:
     2f8: 70 a5 00 01  andi.   r5,r5,1
     2fc: 41 a2 00 08  beq     304 <csum_block_add+0xc>
     300: 54 84 c0 3e  rotlwi  r4,r4,24
     304: 7c 63 20 14  addc    r3,r3,r4
     308: 7c 63 01 94  addze   r3,r3
     30c: 4e 80 00 20  blr

Use first bit of 'offset' directly as input of the rotation instead of
branching.

000002f8 <csum_block_add>:
     2f8: 54 a5 1f 38  rlwinm  r5,r5,3,28,28
     2fc: 20 a5 00 20  subfic  r5,r5,32
     300: 5c 84 28 3e  rotlw   r4,r4,r5
     304: 7c 63 20 14  addc    r3,r3,r4
     308: 7c 63 01 94  addze   r3,r3
     30c: 4e 80 00 20  blr

And change to left shift instead of right shift to skip one more
instruction. This has no impact on the final sum.

000002f8 <csum_block_add>:
     2f8: 54 a5 1f 38  rlwinm  r5,r5,3,28,28
     2fc: 5c 84 28 3e  rotlw   r4,r4,r5
     300: 7c 63 20 14  addc    r3,r3,r4
     304: 7c 63 01 94  addze   r3,r3
     308: 4e 80 00 20  blr

Seems like only powerpc benefits from a branchless implementation.
Other main architectures like ARM or X86 get better code with
the generic implementation and its branch.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agoMerge tag 'mlx5-updates-2022-03-10' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Fri, 11 Mar 2022 10:53:32 +0000 (10:53 +0000)]
Merge tag 'mlx5-updates-2022-03-10' of git://git./linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-updates-2022-03-10

1) Leon removes useless includes from both mlx5 and mlx4
2) Tariq adds node awareness to some object allocations
3) Gal Cleanups and improvements to EEPROM query
4) Paul adds Software steering to Connection Tracking, to speed up
   CT Rules insertion.

Paul Blakey Says:
=================
To improve insertion rate, this series allows for using software
steering API directly instead of going through the fs_core layer.
This can be done for CT because it doesn't need fs_core layer extra
facilities, such as autogroups, FTE IDs and modifications (which require
a copy of the flow key/mask). Skipping fs_core layer also allows to
create the software steering objects (dr_* objects) ahead of time and
re-use them for multiple rules, whereas software steering under fs_core
creates them on the fly and discards them. This in turn increased insertion
rate.

The series first introduces a lightweight CT flow steering provider
with the first implementations using fs_core layer, and moves CT to use it.
The next patches implement a provider using software steering directly,
bypassing fs_core, and uses it if software steering is available.

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

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

Signed-off-by: David S. Miller <davem@davemloft.net>
2 years agomac80211: fix potential double free on mesh join
Linus Lüssing [Thu, 10 Mar 2022 18:35:13 +0000 (19:35 +0100)]
mac80211: fix potential double free on mesh join

While commit 6a01afcf8468 ("mac80211: mesh: Free ie data when leaving
mesh") fixed a memory leak on mesh leave / teardown it introduced a
potential memory corruption caused by a double free when rejoining the
mesh:

  ieee80211_leave_mesh()
  -> kfree(sdata->u.mesh.ie);
  ...
  ieee80211_join_mesh()
  -> copy_mesh_setup()
     -> old_ie = ifmsh->ie;
     -> kfree(old_ie);

This double free / kernel panics can be reproduced by using wpa_supplicant
with an encrypted mesh (if set up without encryption via "iw" then
ifmsh->ie is always NULL, which avoids this issue). And then calling:

  $ iw dev mesh0 mesh leave
  $ iw dev mesh0 mesh join my-mesh

Note that typically these commands are not used / working when using
wpa_supplicant. And it seems that wpa_supplicant or wpa_cli are going
through a NETDEV_DOWN/NETDEV_UP cycle between a mesh leave and mesh join
where the NETDEV_UP resets the mesh.ie to NULL via a memcpy of
default_mesh_setup in cfg80211_netdev_notifier_call, which then avoids
the memory corruption, too.

The issue was first observed in an application which was not using
wpa_supplicant but "Senf" instead, which implements its own calls to
nl80211.

Fixing the issue by removing the kfree()'ing of the mesh IE in the mesh
join function and leaving it solely up to the mesh leave to free the
mesh IE.

Cc: stable@vger.kernel.org
Fixes: 6a01afcf8468 ("mac80211: mesh: Free ie data when leaving mesh")
Reported-by: Matthias Kretschmer <mathias.kretschmer@fit.fraunhofer.de>
Signed-off-by: Linus Lüssing <ll@simonwunderlich.de>
Tested-by: Mathias Kretschmer <mathias.kretschmer@fit.fraunhofer.de>
Link: https://lore.kernel.org/r/20220310183513.28589-1-linus.luessing@c0d3.blue
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: correct legacy rates check in ieee80211_calc_rx_airtime
MeiChia Chiu [Tue, 8 Mar 2022 02:16:45 +0000 (10:16 +0800)]
mac80211: correct legacy rates check in ieee80211_calc_rx_airtime

There are no legacy rates on 60GHz or sub-1GHz band, so modify the check.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
Link: https://lore.kernel.org/r/20220308021645.16272-1-MeiChia.Chiu@mediatek.com
[Ghz ->  GHz]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agonl80211: fix typo of NL80211_IF_TYPE_OCB in documentation
Veerendranath Jakkam [Tue, 22 Feb 2022 15:06:39 +0000 (20:36 +0530)]
nl80211: fix typo of NL80211_IF_TYPE_OCB in documentation

It should be NL80211_IFTYPE_OCB instead.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/1645542399-4680-1-git-send-email-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: Use GFP_KERNEL instead of GFP_ATOMIC when possible
Christophe JAILLET [Sun, 20 Feb 2022 08:23:15 +0000 (09:23 +0100)]
mac80211: Use GFP_KERNEL instead of GFP_ATOMIC when possible

Previous memory allocations in this function already use GFP_KERNEL, so
use __dev_alloc_skb() and an explicit GFP_KERNEL instead of an implicit
GFP_ATOMIC.

This gives more opportunities of successful allocation.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/194a0e2ff00c3fae88cc9fba47431747360c8242.1645345378.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agomac80211: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE
Yihao Han [Fri, 18 Feb 2022 07:02:28 +0000 (23:02 -0800)]
mac80211: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE

Fix the following coccicheck warning:
./drivers/net/wireless/mac80211_hwsim.c:1040:0-23: WARNING:
hwsim_fops_rx_rssi should be defined with
DEFINE_DEBUGFS_ATTRIBUTE

Signed-off-by: Yihao Han <hanyihao@vivo.com>
Link: https://lore.kernel.org/r/20220218070228.6210-1-hanyihao@vivo.com
[fix indentation]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2 years agonet/mlx5e: Remove overzealous validations in netlink EEPROM query
Gal Pressman [Wed, 26 Jan 2022 14:28:23 +0000 (16:28 +0200)]
net/mlx5e: Remove overzealous validations in netlink EEPROM query

Unlike the legacy EEPROM callbacks, when using the netlink EEPROM query
(get_module_eeprom_by_page) the driver should not try to validate the
query parameters, but just perform the read requested by the userspace.

Recent discussion in the mailing list:
https://lore.kernel.org/netdev/20220120093051.70845141@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net/

Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
2 years agonet/mlx5: Parse module mapping using mlx5_ifc
Gal Pressman [Mon, 17 Jan 2022 13:53:06 +0000 (15:53 +0200)]
net/mlx5: Parse module mapping using mlx5_ifc

The assumption that the first byte in the module mapping dword is the
module number shouldn't be hard-coded in the driver, but come from
mlx5_ifc structs.

While at it, fix the incorrect width for the 'rx_lane' and 'tx_lane'
fields.

Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
2 years agonet/mlx5: Query the maximum MCIA register read size from firmware
Gal Pressman [Mon, 17 Jan 2022 13:14:44 +0000 (15:14 +0200)]
net/mlx5: Query the maximum MCIA register read size from firmware

The MCIA register supports either 12 or 32 dwords, use the correct value
by querying the capability from the MCAM register.

Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
2 years agonet/mlx5: CT: Create smfs dr matchers dynamically
Paul Blakey [Sun, 5 Sep 2021 07:47:56 +0000 (10:47 +0300)]
net/mlx5: CT: Create smfs dr matchers dynamically

SMFS dr matchers are processed sequentially in hardware according to
their priorities, and not skipped if empty.

Currently, smfs ct fs creates four predefined dr matchers per ct
table (ct/ct nat) with hardcoded priority. Compared to dmfs ct fs
using autogroups, this might cause additional hops in fastpath for
traffic patterns that match later priorties, even if previous
priorites are empty, e.g user only using ipv6 UDP traffic will
have additional 3 hops.

Create the matchers dynamically, using the highest priority available,
on first rule usage, and remove them on last usage.

Signed-off-by: Paul Blakey <paulb@nvidia.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
2 years agonet/mlx5: CT: Add software steering ct flow steering provider
Paul Blakey [Wed, 29 Sep 2021 10:56:56 +0000 (13:56 +0300)]
net/mlx5: CT: Add software steering ct flow steering provider

fs_core layer adds extra book keeping that is either unneeded for CT, or
unused by the underlying software steering, such as allocating FTEs and
FTE ids, saving the match key and mask, and autogroups management.
On top of that, direct steering has a translation layer (fs_dr) from PRM
commands to direct steering objects, for example, creating temporary
dr_action objects. This has a performance impact when dealing
with CT high insertion rate.

To use direct steering (smfs) directly for ct, add a tc ct fs smfs
implementation. Instead of dmfs autogroups, smfs ct fs uses one of 4
predefined dr matchers in CT and CT-NAT tables, for each combination
of tuple ethertype (ipv4/ipv6), and tuple ip_proto (udp/tcp) that
is currently used by nf flow table flow offload.

At rule insertions, validate the flow rule fits one of the predfined
matcher, and insert to it.

To fill the dr_actions of the rule efficiently, create the fwd to post_ct
tbl dr_action at fs init, the count dr_action at counter creation,
and re-use the already pre-allocated modify header dr_action.

Signed-off-by: Paul Blakey <paulb@nvidia.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
2 years agonet/mlx5: Add smfs lib to export direct steering API to CT
Paul Blakey [Thu, 30 Sep 2021 09:06:35 +0000 (12:06 +0300)]
net/mlx5: Add smfs lib to export direct steering API to CT

Add a thin layer that exports selected direct steering (dr) API
which will be used by a ct fs implementation in a following
patch.

Signed-off-by: Paul Blakey <paulb@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
2 years agonet/mlx5: DR, Add helper to get backing dr table from a mlx5 flow table
Paul Blakey [Tue, 13 Jul 2021 08:19:24 +0000 (11:19 +0300)]
net/mlx5: DR, Add helper to get backing dr table from a mlx5 flow table

If sw steering was used to create the table, dr steeering fs creates
a backing dr table for the mlx5 flow table.

Add helper to return this table so it can be used to create matchers and
add rules on it directly instead of passing via eswitch_offloads/fs_core
insertion.

Signed-off-by: Paul Blakey <paulb@nvidia.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
2 years agonet/mlx5: CT: Introduce a platform for multiple flow steering providers
Paul Blakey [Tue, 23 Nov 2021 12:41:18 +0000 (14:41 +0200)]
net/mlx5: CT: Introduce a platform for multiple flow steering providers

Currently, fs_core layer provides flow steering services to the driver
including: autogroups, allocating FTEs (flow table entries) and FTE ids,
and support of fte action modification. If then software steering is
configured, rule insertion will go through a translation layer from
firmware buffers to software steering objects (see fs_dr.c).

The connection tracking table is a system table that is not directly
controlled by the user and is a very high scale table. These fs_core
services introduces an overhead that may be optimized by using software
steering API directly.

Introduce ct flow steering interface to allow multiple flow steering
providers. Use the new interface to implement the current dmfs (device
managed flow steering) provider which uses fs_core insertion.

Signed-off-by: Paul Blakey <paulb@nvidia.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>