platform/kernel/linux-starfive.git
3 years agocw1200: Remove unused function pointer typedef cw1200_wsm_handler
Chen Lin [Tue, 16 Feb 2021 03:41:58 +0000 (11:41 +0800)]
cw1200: Remove unused function pointer typedef cw1200_wsm_handler

Remove the 'cw1200_wsm_handler' typedef as it is not used.

Signed-off-by: Chen Lin <chen.lin5@zte.com.cn>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1613446918-4532-1-git-send-email-chen45464546@163.com
3 years agoMerge tag 'iwlwifi-next-for-kalle-2021-04-12-v2' of git://git.kernel.org/pub/scm...
Kalle Valo [Sat, 17 Apr 2021 08:38:01 +0000 (11:38 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2021-04-12-v2' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

iwlwifi patches for v5.13

* Add support for new FTM FW APIs;
* Some CSA fixes;
* Support for new HW family and other HW detection fixes;
* Robustness improvement in the HW detection code;
* One fix in PMF;
* Some new regulatory features;
* Support for passive scan in 6GHz;
* Some improvements in the sync queue implementation;
* Support for new devices;
* Support for a new FW API command version;
* Some locking fixes;
* Bump the FW API version support for AX devices;
* Some other small fixes, clean-ups and improvements.

# gpg: Signature made Wed 14 Apr 2021 12:33:29 PM EEST using RSA key ID 1A3CC5FA
# gpg: Good signature from "Luciano Roth Coelho (Luca) <luca@coelho.fi>"
# gpg:                 aka "Luciano Roth Coelho (Intel) <luciano.coelho@intel.com>"

3 years agoMerge tag 'mt76-for-kvalo-2021-04-12' of https://github.com/nbd168/wireless
Kalle Valo [Sat, 17 Apr 2021 08:34:43 +0000 (11:34 +0300)]
Merge tag 'mt76-for-kvalo-2021-04-12' of https://github.com/nbd168/wireless

mt76 patches for 5.13

* code cleanup
* mt7915/mt7615 decap offload support
* driver fixes
* mt7613 eeprom support
* MCU code unification
* threaded NAPI support
* new device IDs
* mt7921 device reset support
* rx timestamp support

# gpg: Signature made Tue 13 Apr 2021 12:11:25 AM EEST using DSA key ID 02A76EF5
# gpg: Good signature from "Felix Fietkau <nbd@nbd.name>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 75D1 1A7D 91A7 710F 4900  42EF D77D 141D 02A7 6EF5

3 years agoMerge tag 'linux-can-next-for-5.13-20210414' of git://git.kernel.org/pub/scm/linux...
David S. Miller [Wed, 14 Apr 2021 21:37:02 +0000 (14:37 -0700)]
Merge tag 'linux-can-next-for-5.13-20210414' of git://git./linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
pull-request: can-next 2021-04-14

this is a pull request of a single patch for net-next/master.

Vincent Mailhol's patch fixes a NULL pointer dereference when handling
error frames in the etas_es58x driver, which has been added in the
previous PR.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet/packet: remove data races in fanout operations
Eric Dumazet [Wed, 14 Apr 2021 19:36:44 +0000 (12:36 -0700)]
net/packet: remove data races in fanout operations

af_packet fanout uses RCU rules to ensure f->arr elements
are not dismantled before RCU grace period.

However, it lacks rcu accessors to make sure KCSAN and other tools
wont detect data races. Stupid compilers could also play games.

Fixes: dc99f600698d ("packet: Add fanout support.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: "Gong, Sishuai" <sishuai@purdue.edu>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: bridge: propagate error code and extack from br_mc_disabled_update
Florian Fainelli [Wed, 14 Apr 2021 19:22:57 +0000 (22:22 +0300)]
net: bridge: propagate error code and extack from br_mc_disabled_update

Some Ethernet switches might only be able to support disabling multicast
snooping globally, which is an issue for example when several bridges
span the same physical device and request contradictory settings.

Propagate the return value of br_mc_disabled_update() such that this
limitation is transmitted correctly to user-space.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge tag 'mlx5-updates-2021-04-13' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Wed, 14 Apr 2021 21:14:03 +0000 (14:14 -0700)]
Merge tag 'mlx5-updates-2021-04-13' of git://git./linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-updates-2021-04-13

mlx5 core and netdev driver updates

1) E-Switch updates from Parav,
  1.1) Devlink parameter to control mlx5 metadata enablement for E-Switch
  1.2) Trivial cleanups for E-Switch code
  1.3) Dynamically allocate vport steering namespaces only when required

2) From Jianbo, Use variably sized data structures for Software steering

3) Several minor cleanups
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: enetc: fetch MAC address from device tree
Michael Walle [Wed, 14 Apr 2021 14:48:14 +0000 (16:48 +0200)]
net: enetc: fetch MAC address from device tree

Normally, the bootloader will already initialize the MAC address
registers of the ENETC and the driver will just use them or generate a
random one, if it is not initialized.

Add a new way to provide the MAC address: via device tree. Besides the
usual 'mac-address' property, there is also the possibility to fetch it
via a NVMEM provider. The sl28 board stores the MAC address in the SPI
NOR flash OTP region. Having this will allow linux to fetch the MAC
address from there without being dependent on the bootloader.

No in-tree boards have the device tree properties set, thus for these,
this is a no-op.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agosfc: Remove duplicate argument
Wan Jiabing [Wed, 14 Apr 2021 11:06:45 +0000 (19:06 +0800)]
sfc: Remove duplicate argument

Fix the following coccicheck warning:

./drivers/net/ethernet/sfc/enum.h:80:7-28: duplicated argument to |

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoskbuff: revert "skbuff: remove some unnecessary operation in skb_segment_list()"
Paolo Abeni [Wed, 14 Apr 2021 10:48:48 +0000 (12:48 +0200)]
skbuff: revert "skbuff: remove some unnecessary operation in skb_segment_list()"

the commit 1ddc3229ad3c ("skbuff: remove some unnecessary operation
in skb_segment_list()") introduces an issue very similar to the
one already fixed by commit 53475c5dd856 ("net: fix use-after-free when
UDP GRO with shared fraglist").

If the GSO skb goes though skb_clone() and pskb_expand_head() before
entering skb_segment_list(), the latter  will unshare the frag_list
skbs and will release the old list. With the reverted commit in place,
when skb_segment_list() completes, skb->next points to the just
released list, and later on the kernel will hit UaF.

Note that since commit e0e3070a9bc9 ("udp: properly complete L4 GRO
over UDP tunnel packet") the critical scenario can be reproduced also
receiving UDP over vxlan traffic with:

NIC (NETIF_F_GRO_FRAGLIST enabled) -> vxlan -> UDP sink

Attaching a packet socket to the NIC will cause skb_clone() and the
tunnel decapsulation will call pskb_expand_head().

Fixes: 1ddc3229ad3c ("skbuff: remove some unnecessary operation in skb_segment_list()")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoatm: idt77252: remove unused function
Jiapeng Chong [Wed, 14 Apr 2021 07:13:39 +0000 (15:13 +0800)]
atm: idt77252: remove unused function

Fix the following clang warning:

drivers/atm/idt77252.c:1787:1: warning: unused function
'idt77252_fbq_level' [-Wunused-function].

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec...
David S. Miller [Wed, 14 Apr 2021 20:15:12 +0000 (13:15 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/klassert/ipsec-next

Steffen Klassert says:

====================
pull request (net-next): ipsec-next 2021-04-14

Not much this time:

1) Simplification of some variable calculations in esp4 and esp6.
   From Jiapeng Chong and Junlin Yang.

2) Fix a clang Wformat warning in esp6 and ah6.
   From Arnd Bergmann.

Please pull or let me know if there are problems.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agor8169: add support for pause ethtool ops
Heiner Kallweit [Wed, 14 Apr 2021 06:23:15 +0000 (08:23 +0200)]
r8169: add support for pause ethtool ops

This adds support for the [g|s]et_pauseparam ethtool ops. It considers
that the chip doesn't support pause frame use in jumbo mode.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next...
David S. Miller [Wed, 14 Apr 2021 19:59:41 +0000 (12:59 -0700)]
Merge branch '10GbE' of git://git./linux/kernel/git/tnguy/next-queue

Tony Nguyen says:

====================
10GbE Intel Wired LAN Driver Updates 2021-04-13

This series contains updates to ixgbe and ixgbevf driver.

Jostar Yang adds support for BCM54616s PHY for ixgbe.

Chen Lin removes an unused function pointer for ixgbe and ixgbevf.

Bhaskar Chowdhury fixes a typo in ixgbe.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: stmmac: Add support for external trigger timestamping
Tan Tee Min [Wed, 14 Apr 2021 00:16:17 +0000 (08:16 +0800)]
net: stmmac: Add support for external trigger timestamping

The Synopsis MAC controller supports auxiliary snapshot feature that
allows user to store a snapshot of the system time based on an external
event.

This patch add supports to the above mentioned feature. Users will be
able to triggered capturing the time snapshot from user-space using
application such as testptp or any other applications that uses the
PTP_EXTTS_REQUEST ioctl request.

Cc: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Tan Tee Min <tee.min.tan@intel.com>
Co-developed-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'marvell-88x2222-improvements'
David S. Miller [Wed, 14 Apr 2021 19:56:44 +0000 (12:56 -0700)]
Merge branch 'marvell-88x2222-improvements'

Ivan Bornyakov says:

====================
net: phy: marvell-88x2222: a couple of improvements

First, there are some SFP modules that only uses RX_LOS for link
indication. Add check that link is operational before actual read of
line-side status.

Second, it is invalid to set 10G speed without autonegotiation,
according to phy_ethtool_ksettings_set(). Implement switching between
10GBase-R and 1000Base-X/SGMII if autonegotiation can't complete but
there is signal in line.

Changelog:
  v1 -> v2:
    * make checking that link is operational more friendly for
      trancievers without SFP cages.
    * split swapping 1G/10G modes into non-functional and functional
      commits for the sake of easier review.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: phy: marvell-88x2222: swap 1G/10G modes on autoneg
Ivan Bornyakov [Tue, 13 Apr 2021 20:54:52 +0000 (23:54 +0300)]
net: phy: marvell-88x2222: swap 1G/10G modes on autoneg

Setting 10G without autonegotiation is invalid according to
phy_ethtool_ksettings_set(). Thus, we need to set it during
autonegotiation.

If 1G autonegotiation can't complete for quite a time, but there is
signal in line, switch line interface type to 10GBase-R, if supported,
in hope for link to be established.

And vice versa. If 10GBase-R link can't be established for quite a time,
and autonegotiation is enabled, and there is signal in line, switch line
interface type to appropriate 1G mode, i.e. 1000Base-X or SGMII, if
supported.

Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: phy: marvell-88x2222: move read_status after config_aneg
Ivan Bornyakov [Tue, 13 Apr 2021 20:54:51 +0000 (23:54 +0300)]
net: phy: marvell-88x2222: move read_status after config_aneg

No functional changes, just move read link status routines below
autonegotiation configuration to make future functional changes more
distinct.

Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: phy: marvell-88x2222: check that link is operational
Ivan Bornyakov [Tue, 13 Apr 2021 20:54:50 +0000 (23:54 +0300)]
net: phy: marvell-88x2222: check that link is operational

Some SFP modules uses RX_LOS for link indication. In such cases link
will be always up, even without cable connected. RX_LOS changes will
trigger link_up()/link_down() upstream operations. Thus, check that SFP
link is operational before actual read link status.

If there is no SFP cage connected to the tranciever, check only PMD
Recieve Signal Detect register.

Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet/mlx5e: Fix RQ creation flow for queues which doesn't support XDP
Aya Levin [Wed, 7 Apr 2021 11:09:05 +0000 (14:09 +0300)]
net/mlx5e: Fix RQ creation flow for queues which doesn't support XDP

Allow to create an RQ which is not registered as an XDP RQ. For example:
the trap-RQ doesn't register as an XDP RQ.

Fixes: 869c5f926247 ("net/mlx5e: Generalize open RQ")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: Replace spaces with tab at the start of a line
Wenpeng Liang [Thu, 1 Apr 2021 13:07:43 +0000 (21:07 +0800)]
net/mlx5: Replace spaces with tab at the start of a line

There should be no spaces at the start of the line.

Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: Remove return statement exist at the end of void function
Wenpeng Liang [Thu, 1 Apr 2021 13:07:42 +0000 (21:07 +0800)]
net/mlx5: Remove return statement exist at the end of void function

void function return statements are not generally useful.

Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: Add a blank line after declarations
Wenpeng Liang [Thu, 1 Apr 2021 13:07:41 +0000 (21:07 +0800)]
net/mlx5: Add a blank line after declarations

There should be a blank lines after declarations.

Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: Fix bit-wise and with zero
Colin Ian King [Tue, 6 Apr 2021 16:53:46 +0000 (17:53 +0100)]
net/mlx5: Fix bit-wise and with zero

The bit-wise and of the action field with MLX5_ACCEL_ESP_ACTION_DECRYPT
is incorrect as MLX5_ACCEL_ESP_ACTION_DECRYPT is zero and not intended
to be a bit-flag. Fix this by using the == operator as was originally
intended.

Addresses-Coverity: ("Logically dead code")
Fixes: 7dfee4b1d79e ("net/mlx5: IPsec, Refactor SA handle creation and destruction")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: DR, Alloc cmd buffer with kvzalloc() instead of kzalloc()
Roi Dayan [Mon, 15 Mar 2021 08:22:51 +0000 (10:22 +0200)]
net/mlx5: DR, Alloc cmd buffer with kvzalloc() instead of kzalloc()

The cmd size is 8K so use kvzalloc().

Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: DR, Use variably sized data structures for different actions
Jianbo Liu [Thu, 12 Nov 2020 01:32:52 +0000 (01:32 +0000)]
net/mlx5: DR, Use variably sized data structures for different actions

mlx5dr_action is a generally used data structure, and there is an
union for different types of actions in it. The size of mlx5dr_action
is about 72 bytes, but for those actions with fewer fields, most of
the allocated memory is wasted.
Remove this union, and mlx5dr_action becomes a generic action header.
Then actions are dynamically allocated with needed memory, the data
for each action is stored right after the header.

Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: SF, Reuse stored hardware function id
Parav Pandit [Fri, 5 Mar 2021 05:38:02 +0000 (07:38 +0200)]
net/mlx5: SF, Reuse stored hardware function id

SF's hardware function id is already stored in mlx5_sf. Reuse it,
instead of querying the hw table.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: SF, Use device pointer directly
Parav Pandit [Fri, 5 Mar 2021 08:11:21 +0000 (10:11 +0200)]
net/mlx5: SF, Use device pointer directly

At many places in the code, device pointer is directly available. Make
use of it, instead of accessing it from the table.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: E-Switch, Initialize eswitch acls ns when eswitch is enabled
Parav Pandit [Mon, 1 Mar 2021 12:12:13 +0000 (14:12 +0200)]
net/mlx5: E-Switch, Initialize eswitch acls ns when eswitch is enabled

Currently eswitch flow steering (FS) namespace of vport's ingress and
egress ACL are enabled when FS layer is initialized. This is done even
when eswitch is diabled. This demands that total eswitch ports to be
known to FS layer without eswitch in use.

Given the FS core is not dependent on eswitch, make namespace init and
cleanup routines as helper routines to be invoked only when eswitch is
needed.

With this change, ingress and egress ACL namespaces are created only
when eswitch legacy/offloads mode is enabled.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: E-Switch, Move legacy code to a individual file
Parav Pandit [Fri, 26 Feb 2021 12:30:50 +0000 (14:30 +0200)]
net/mlx5: E-Switch, Move legacy code to a individual file

Currently eswitch offers two modes. Legacy and offloads.
Offloads code is already in its own file eswitch_offloads.c

However eswitch.c contains the eswitch legacy code and common
infrastructure  code.

To enable future extensions and to better manage generic common eswitch
infrastructure code, move the legacy code to its own legacy.c file.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: E-Switch, Convert a macro to a helper routine
Parav Pandit [Fri, 26 Feb 2021 12:36:22 +0000 (14:36 +0200)]
net/mlx5: E-Switch, Convert a macro to a helper routine

Convert ESW_ALLOWED macro to a helper routine so that it can be used in
other eswitch files.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: E-Switch Make cleanup sequence mirror of init
Parav Pandit [Tue, 2 Mar 2021 19:39:01 +0000 (21:39 +0200)]
net/mlx5: E-Switch Make cleanup sequence mirror of init

Make cleanup sequence mirror of init sequence for cleaning up reps
and freeing vports.

Also when reps initialization fails, there is no need to perform reps
cleanup.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: E-Switch, Make vport number u16
Parav Pandit [Tue, 2 Mar 2021 19:27:47 +0000 (21:27 +0200)]
net/mlx5: E-Switch, Make vport number u16

Vport number is 16-bit field in hardware. Make it u16.

Move location of vport in the structure so that it reduces a hole
in the structure.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: E-Switch, Skip querying SF enabled bits
Parav Pandit [Mon, 8 Mar 2021 09:50:40 +0000 (11:50 +0200)]
net/mlx5: E-Switch, Skip querying SF enabled bits

With vhca events, SF state is queried through the VHCA events. Device no
longer expects SF bitmap in the query eswitch functions command.

Hence, remove it to simplify the code.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
3 years agonet/mlx5: E-Switch, let user to enable disable metadata
Parav Pandit [Fri, 30 Oct 2020 20:44:16 +0000 (22:44 +0200)]
net/mlx5: E-Switch, let user to enable disable metadata

Currently each packet inserted in eswitch is tagged with a internal
metadata to indicate source vport. Metadata tagging is not always
needed. Metadata insertion is needed for multi-port RoCE, failover
between representors and stacked devices. In many other cases,
metadata enablement is not needed.

Metadata insertion slows down the packet processing rate of the E-switch
when it is in switchdev mode.

Below table show performance gain with metadata disabled for VXLAN
offload rules in both SMFS and DMFS steering mode on ConnectX-5 device.

----------------------------------------------
| steering | metadata | pkt size | rx pps    |
| mode     |          |          | (million) |
----------------------------------------------
| smfs     | disabled | 128Bytes | 42        |
----------------------------------------------
| smfs     | enabled  | 128Bytes | 36        |
----------------------------------------------
| dmfs     | disabled | 128Bytes | 42        |
----------------------------------------------
| dmfs     | enabled  | 128Bytes | 36        |
----------------------------------------------

Hence, allow user to disable metadata using driver specific devlink
parameter. Metadata setting of the eswitch is applicable only for the
switchdev mode.

Example to show and disable metadata before changing eswitch mode:
$ devlink dev param show pci/0000:06:00.0 name esw_port_metadata
pci/0000:06:00.0:
  name esw_port_metadata type driver-specific
    values:
      cmode runtime value true

$ devlink dev param set pci/0000:06:00.0 \
  name esw_port_metadata value false cmode runtime

$ devlink dev eswitch set pci/0000:06:00.0 mode switchdev

Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Vu Pham <vuhuong@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
changelog:
v1->v2:
 - added performance numbers in commit log
 - updated commit log and documentation for switchdev mode
 - added explicit note on when user can disable metadata in
   documentation

3 years agoiwlwifi: dbg: disable ini debug in 9000 family and below
Mukesh Sisodiya [Sun, 11 Apr 2021 10:25:44 +0000 (13:25 +0300)]
iwlwifi: dbg: disable ini debug in 9000 family and below

Yoyo based debug is not applicable to old devices.  As init debug is
enabled by default in the driver, it needs to be disabled to work the
old debug mechanism in old devices.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Fixes: b0d8d2c27007 ("iwlwifi: yoyo: enable yoyo by default")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411132130.805401a1b8ec.I30db38184a418cfc1c5ca1a305cc14a52501d415@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: pcie: Change ma product string name
Matti Gottlieb [Sun, 11 Apr 2021 10:25:43 +0000 (13:25 +0300)]
iwlwifi: pcie: Change ma product string name

Change ma product string name to the correct name,
and to reflect the CRF and not the CNV.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411132130.c05b4c55540f.I8dd0361b033f63658999ba53640949701b048f17@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: fw: print out trigger delay when collecting data
Johannes Berg [Sun, 11 Apr 2021 10:25:42 +0000 (13:25 +0300)]
iwlwifi: fw: print out trigger delay when collecting data

It can be confusing to see "Collecting data: ..." followed by
that not actually happening immediately so print out the delay
in that message.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411132130.5bd095dc579a.Id1f3b746ac61497951638ba7ce70fc4b63dd87d1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: trans/pcie: defer transport initialisation
Johannes Berg [Sun, 11 Apr 2021 10:25:41 +0000 (13:25 +0300)]
iwlwifi: trans/pcie: defer transport initialisation

In a few PCIe devices we may have to swap out the configuration
after we allocate/initialise some parts of the device because
we only know the correct one after reading some registers. This
causes some things such as the byte-count table allocations to
be incorrect, since the configuration is swapped for one with a
bigger queue size.

Fix this by initialising most of the transport much later, only
after the configuration has finally been determined.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411132130.8f5db97db1e4.Ic622da559b586a04ca536a0ec49ed5ecf03a9354@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: bump FW API to 63 for AX devices
Luca Coelho [Sun, 11 Apr 2021 10:25:40 +0000 (13:25 +0300)]
iwlwifi: bump FW API to 63 for AX devices

Start supporting API version 63 for AX devices.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411132130.a588a9dacd98.Ie4f96b8988c2cbd5f096ee64d0eb0f4829d55aee@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: don't WARN if we can't remove a time event
Emmanuel Grumbach [Sun, 11 Apr 2021 10:25:39 +0000 (13:25 +0300)]
iwlwifi: mvm: don't WARN if we can't remove a time event

It is not very useful to WARN if we can't send a host command
The firmware is likely in a bad situation and the fact that
we didn't send the host command has an impact on the firmware
only, not on the driver. The driver could clean up all its
state.

Don't WARN in this case, but just leave a smaller note.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411132130.0324abc169c8.I4f9b769bc38d68f8ed43f77d2cd75e8f1993e964@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: don't disconnect immediately if we don't hear beacons after CSA
Emmanuel Grumbach [Sun, 11 Apr 2021 10:25:38 +0000 (13:25 +0300)]
iwlwifi: mvm: don't disconnect immediately if we don't hear beacons after CSA

When we switch channel, we may miss a few beacons on the
new channel. Don't disconnect if the time event for the
switch ends before we hear the beacons.

Note that this is relevant only for old devices that still
use the TIME_EVENT firmware API for channel switch.

The check that we hear a beacon before the time event
ends was meant to be used for the association time event
and not for the channel switch time event.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411132130.3d710091a0bd.I37a161ffdfb099a10080fbdc3b70a4deb76952e2@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: rs-fw: don't support stbc for HE 160
Mordechay Goodstein [Sun, 11 Apr 2021 09:46:30 +0000 (12:46 +0300)]
iwlwifi: rs-fw: don't support stbc for HE 160

Our HE doesn't support it so never set HE 160 stbc

Fixes: 3e467b8e4cf4 ("iwlwifi: rs-fw: enable STBC in he correctly")
Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124418.550fd1903eb7.I8ddbc2f87044a5ef78d916c9c59be797811a1b7f@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: warn on SKB free w/o op-mode
Johannes Berg [Sun, 11 Apr 2021 09:46:29 +0000 (12:46 +0300)]
iwlwifi: warn on SKB free w/o op-mode

If this ever happens, and it looks like some code in PCIe is
a bit broken and might lead to this, we want to know without
crashing, so add a WARN_ON_ONCE().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124418.a18b7443dc55.Ia29836738acf14a55af5504aba90c6fea9fff785@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: add support for version 3 of LARI_CONFIG_CHANGE command.
Miri Korenblit [Sun, 11 Apr 2021 09:46:28 +0000 (12:46 +0300)]
iwlwifi: mvm: add support for version 3 of LARI_CONFIG_CHANGE command.

Add support for version 3 of the LARI_CONFIG_CHANGE command.
This is needed to support FW API change which is needed
to support 11ax enablement in Russia.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124418.7e68856c8a95.I83acdbe39b63c363cabc04ad42d1d0b9ce98901c@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: pcie: add ISR debug info for msix debug
Mordechay Goodstein [Sun, 11 Apr 2021 09:46:27 +0000 (12:46 +0300)]
iwlwifi: pcie: add ISR debug info for msix debug

The debug prints help in case we get timeout on waiting for
hw.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124417.306e2e56d3e8.I72e2977abbb1fddf23b8476bedf6a183fe969ff5@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: pcie: merge napi_poll_msix functions
Mordechay Goodstein [Sun, 11 Apr 2021 09:46:26 +0000 (12:46 +0300)]
iwlwifi: pcie: merge napi_poll_msix functions

The only difference between iwl_pcie_napi_poll_msix_shared() and
iwl_pcie_napi_poll_msix() is when we have a shared queue and nothing
in the rx queue.  This case doesn't affect CPU performance, so we can
merge the two functions.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124417.9d1b61ef53a5.I60b33d5379cf7c12f1de30fc3fd4cefc38220141@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: don't lock mutex in RCU critical section
Johannes Berg [Sun, 11 Apr 2021 09:46:25 +0000 (12:46 +0300)]
iwlwifi: mvm: don't lock mutex in RCU critical section

We cannot lock a mutex while we're in an RCU critical section. At
the same time, we're accessing data structures that are protected
by the mvm->mutex anyway, so just move the entire locking here to
use only that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124417.4d27bd36e10e.I1fd8e8fe442c41a5deaa560452b598ed7a60ada5@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: remove PS from lower rates.
Mordechay Goodstein [Sun, 11 Apr 2021 09:46:24 +0000 (12:46 +0300)]
iwlwifi: mvm: remove PS from lower rates.

Power save (PS) should only be enabled when we reach the max phy rate.
Before we reach it (MCS_9) for VHT, we should keep trying to improve the
throughput.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124417.2a2fb9f9c25e.I7c7bbcfbdc1d35d2c3338778fb397dd5b08ea0e8@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: umac error table mismatch
Roee Goldfiner [Sun, 11 Apr 2021 09:46:23 +0000 (12:46 +0300)]
iwlwifi: mvm: umac error table mismatch

umac_error_table In TLV address was read using mask on MSB
but on the same table in alive message it was without which
caused mismatch in devices with different memory region MSB

Signed-off-by: Roee Goldfiner <roee.h.goldfiner@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124417.179fee442115.Ib6eabe86cfda0b6044f07c07448c366b6e07e53d@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: queue: avoid memory leak in reset flow
Mordechay Goodstein [Sun, 11 Apr 2021 09:46:22 +0000 (12:46 +0300)]
iwlwifi: queue: avoid memory leak in reset flow

In case the device is stopped any usage of hw queues needs to be
reallocated in fw due to fw reset after device stop, so all driver
internal queue should also be freed, and if we don't free the next usage
would leak the old memory and get in recover flows
"iwlwifi 0000:00:03.0: dma_pool_destroy iwlwifi:bc" warning.

Also warn about trying to reuse an internal allocated queue.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124417.c72d2f0355c4.Ia3baff633b9b9109f88ab379ef0303aa152c16bf@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: don't warn if we can't wait for empty tx queues
Emmanuel Grumbach [Sun, 11 Apr 2021 09:46:21 +0000 (12:46 +0300)]
iwlwifi: don't warn if we can't wait for empty tx queues

If the firmware is dead, the Tx queues won't drain, but
leaving a print in the log is enough, no need to WARN.
If the firmware is dead, we must already have printed enough
information in the log anyway.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124417.9a438b2320a9.I4aa897178df82acefd80173d76dd6849ad1bcdc1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: remove remaining software checksum code
Johannes Berg [Sun, 11 Apr 2021 09:46:20 +0000 (12:46 +0300)]
iwlwifi: remove remaining software checksum code

After the removal of the software checksum code for the
A-MSDU path that we had for testing, the csum_skb variable
stuck around. Remove it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124417.280f268ae679.Iad455b6c91e427c9f74963bbd3eb0ce743aaac53@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: remove TCM events
Emmanuel Grumbach [Sun, 11 Apr 2021 09:46:19 +0000 (12:46 +0300)]
iwlwifi: remove TCM events

Nobody uses that in the user space.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411124417.b6560a5de0cd.I5dac9c60faed7f48b06d352aa2d65bcf8142c2dc@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: Use IWL_INFO in fw_reset_handshake()
Ravi Darsi [Wed, 31 Mar 2021 09:14:52 +0000 (12:14 +0300)]
iwlwifi: mvm: Use IWL_INFO in fw_reset_handshake()

Debug message "firmware didn't ACK the reset - continue anyway\n"
in fw_reset_handshake() is classified as error, however this is not
an error as it is ignored. So, change it to info message for proper
classification of debug messages.

Signed-off-by: Ravi Darsi <ravi.darsi@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.449b3092c330.I515edcc41913ca7fbe4a4de923671d120d5618c6@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: refactor ACPI DSM evaluation function
Harish Mitty [Wed, 31 Mar 2021 09:14:51 +0000 (12:14 +0300)]
iwlwifi: mvm: refactor ACPI DSM evaluation function

Instead of implementing the DSM evaluation function in the MVM code,
refactor it so it can be generalized and part of the common ACPI
implementation.

Signed-off-by: Harish Mitty <harish.mitty@intel.com>
[reworded subject and commit message]
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.a24af3551aac.I8e6bd5eb05f853b6331fa4823750f7ba8ffe46e6@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: support BIOS enable/disable for 11ax in Ukraine
Miri Korenblit [Wed, 31 Mar 2021 09:14:50 +0000 (12:14 +0300)]
iwlwifi: mvm: support BIOS enable/disable for 11ax in Ukraine

Read the new BIOS DSM and Pass to FW if to disable\enable
11ax for Ukraine according to the BIOS key. this is
needed to enable OEMs to control enable/disable 11ax in Ukraine

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.055654e7707e.If7eaf9839cd5d59729a235df07e31668b408e740@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: move iwl_configure_rxq to be used by other op_modes
Mordechay Goodstein [Wed, 31 Mar 2021 09:14:49 +0000 (12:14 +0300)]
iwlwifi: move iwl_configure_rxq to be used by other op_modes

All the op_modes need to send this command as well. Instead of
duplicating the code from mvm, put the code in a common place.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.deb71fce883a.I5eef009512f180e5974f3f491ff56c763cdcc878@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: add new so-gf device
ybaruch [Wed, 31 Mar 2021 09:14:48 +0000 (12:14 +0300)]
iwlwifi: add new so-gf device

add new so-gf device to the driver.

Signed-off-by: ybaruch <yaara.baruch@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.d6b0c1f85a7e.I2098ca066607edc48336021ea2e5afdbf8196acf@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: enable PPAG in China
Miri Korenblit [Wed, 31 Mar 2021 09:14:47 +0000 (12:14 +0300)]
iwlwifi: mvm: enable PPAG in China

Add support for ppag in China by reading revision 2 of the ppag table
from ACPI, and passing the data to the FW.
This is needed to enable OEMs to control ppag enablement
in China.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.69af388d0dce.I8cfddf9e6837bf394b00390181b4b774ded19acd@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: Add support for 6GHz passive scan
Ilan Peer [Wed, 31 Mar 2021 09:14:46 +0000 (12:14 +0300)]
iwlwifi: mvm: Add support for 6GHz passive scan

When doing scan while 6GHz channels are not enabled, the 6GHz band
is not scanned. Thus, if there are no APs on the 2GHz and 5GHz bands
(that will allow discovery of geographic location etc. that would
allow enabling the 6GHz channels) but there are non collocated APs
on 6GHz PSC channels these would never be discovered.

To overcome this, FW added support for performing passive UHB scan
in case no APs were discovered during scan on the 2GHz and 5GHz
channels.

Add support for enabling such scan when the following conditions are
met:

- 6GHz channels are supported but not enabled by regulatory.
- Station interface is not associated or less than a defined time
  interval passed from the last resume or HW reset flows.
- At least 4 channels are included in the scan request
- The scan request includes the widlcard SSID.
- At least 50 minutes passed from the last 6GHz passive scan.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.7c7bd00e0aeb.Ib226ad57e416b43a710c36a78a617d4243458b99@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: add ax201 killer device
ybaruch [Wed, 31 Mar 2021 09:14:44 +0000 (12:14 +0300)]
iwlwifi: add ax201 killer device

add new killer devices configurations.

Signed-off-by: ybaruch <yaara.baruch@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.54967363d26d.I5d1a3d810cf6abace51ebb2630d62d891e9fd302@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: when associated with PMF, use protected NDP ranging negotiation
Avraham Stern [Wed, 31 Mar 2021 09:14:43 +0000 (12:14 +0300)]
iwlwifi: mvm: when associated with PMF, use protected NDP ranging negotiation

When associated to the resonder with PMF, request to protect the NDP
ranging negotiation with PMF.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.e7982c72e12b.Ib6db362d01a31132c638e194d49476cd8e3ff430@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: clean up queue sync implementation
Johannes Berg [Wed, 31 Mar 2021 09:14:42 +0000 (12:14 +0300)]
iwlwifi: mvm: clean up queue sync implementation

When we do queue sync, it's confusing that we have the structures
declared in the FW API header files that aren't really firmware,
and the union is also confusing - especially now in the code that
checks the size on the return.

So rework this: change the type of sync and whether to do it in a
synchronous fashion to arguments, and build the data structure in
the function, so we don't need the union.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.f62833fd9893.I612d7ac1c655ec4880329360e15d207698c750bc@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: write queue_sync_state only for sync
Johannes Berg [Wed, 31 Mar 2021 09:14:41 +0000 (12:14 +0300)]
iwlwifi: mvm: write queue_sync_state only for sync

We use mvm->queue_sync_state to wait for synchronous queue sync
messages, but if an async one happens inbetween we shouldn't
clear mvm->queue_sync_state after sending the async one, that
can run concurrently (at least from the CPU POV) with another
synchronous queue sync.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.d11c9bcdb4aa.I0772171dbaec87433a11513e9586d98b5d920b5f@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: responder: support responder config command version 8
Avraham Stern [Tue, 30 Mar 2021 13:25:00 +0000 (16:25 +0300)]
iwlwifi: mvm: responder: support responder config command version 8

Version 8 add NDP ranging parameters configuration, as well as
enable/disable NDP ranging and LMR feedback.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.ce9570d755d3.Ic81cb8da9aecbbc9edff468cb4ffbb741418cc73@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: support range request command version 12
Avraham Stern [Tue, 30 Mar 2021 13:24:59 +0000 (16:24 +0300)]
iwlwifi: mvm: support range request command version 12

Version 12 adds configuration of NDP ranging parameters:
- max number of LTF repetitions
- max number of spatial streams
- max total LTFs

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.2c30c376c5cf.I01460f7277594ee7c98a8e1fe5447c59e70bf073@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: pcie: make cfg vs. trans_cfg more robust
Johannes Berg [Tue, 30 Mar 2021 13:24:58 +0000 (16:24 +0300)]
iwlwifi: pcie: make cfg vs. trans_cfg more robust

If we (for example) have a trans_cfg entry in the PCI IDs table,
but then don't find a full cfg entry for it in the info table,
we fall through to the code that treats the PCI ID table entry
as a full cfg entry. This obviously causes crashes later, e.g.
when trying to build the firmware name string.

Avoid such crashes by using the low bit of the pointer as a tag
for trans_cfg entries (automatically using a macro that checks
the type when assigning) and then checking that before trying to
use the data as a full entry - if it's just a partial entry at
that point, fail.

Since we're adding some macro magic, also check that the type is
in fact either struct iwl_cfg_trans_params or struct iwl_cfg,
failing compilation ("initializer element is not constant") if
it isn't.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.6f69fe6e4128.I921d4ae20ef5276716baeeeda0b001cf25b9b968@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: pcie: clear only FH bits handle in the interrupt
Mordechay Goodstein [Tue, 30 Mar 2021 13:24:57 +0000 (16:24 +0300)]
iwlwifi: pcie: clear only FH bits handle in the interrupt

For simplicity we assume that msix has 2 IRQ lines one used for rx data
called msix_non_share, and another used for one bit flags messages
(alive, hw error, sw error, rx data flag) called msix_share.

Every time the FW has data to send it puts it on the RX queue and HW
turns on the flags in msix_share (inta_fw) indicating about rx data,
and HW sends an interrupt a bit later to the msix_non_share _unless_
the msix_shared RX data bit was cleared.

Currently in the code every time we get an msix_shared we clear all bits
including rx data queue bits.

So we can have a race

----------------------------------------------------
DRIVER        |   HW                |   FW
----------------------------------------------------
- send host cmd to FW  |      |
       |      | - handle message
       |      |   and put a response
       |      |   on the RX queue
       | - RX flag on        |
       |            | - send alive msix
       | - alive flag on     |
       | - interrupt         |
       |   msix_share driver |
- handle msix_shared   |      |
  and clear all flags  |      |
  bits        |      |
       | - don't send an     |
       |   interrupt on      |
       |   msix_non_shared   |
       |   (driver cleared)  |
- driver timeout on    |      |
  waiting for host cmd |      |
  respond        |      |
       |      |
----------------------------------------------------

The change is to clear only the msi_shared flags that are handled in
the msix_shared flow, which will cause the hardware to send an interrupt
on the msix_non_share line as well, when it has data.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.a1cdda2fa270.I02a82312679f4541f30bb8db8747a797dbb70ee7@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: add 160Mhz to killer 1550 name
ybaruch [Tue, 30 Mar 2021 13:24:56 +0000 (16:24 +0300)]
iwlwifi: add 160Mhz to killer 1550 name

change the name of 1550 killer device to 160Mhz.

Signed-off-by: ybaruch <yaara.baruch@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.b87618a26ff8.Icf1d9c150ec108f30ce0e72c18b9350da6ae5087@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: change name to AX 211 and 411 family
ybaruch [Tue, 30 Mar 2021 13:24:55 +0000 (16:24 +0300)]
iwlwifi: change name to AX 211 and 411 family

change the name of the ax211 and ax411.

Signed-off-by: ybaruch <yaara.baruch@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.fc3218805052.I203f1a802338f59955bd511c90217f63b918390b@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: change step in so-gf struct
ybaruch [Tue, 30 Mar 2021 13:24:54 +0000 (16:24 +0300)]
iwlwifi: change step in so-gf struct

change the step of iwlax210_2ax_cfg_so_jf_a0 to
iwlax210_2ax_cfg_so_jf_b0 as it is on the wcd_fw-dev
repository.

Signed-off-by: ybaruch <yaara.baruch@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.e9a9d1da76bc.Ie964f37872bbb88d1a02094134f9a2c38faad884@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: pcie: Add support for Bz Family
Matti Gottlieb [Tue, 30 Mar 2021 13:24:53 +0000 (16:24 +0300)]
iwlwifi: pcie: Add support for Bz Family

Add support for different combinations of Bz
and CRFs.

Note: As of now we do not know the exact values
for ltr_delay and xtal_latency, so for now use the
worst case scenario values until the actual values
are clarified.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.caac8d996532.I6a22d6decb106cd50d7954b19236b69d685dcc39@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: don't allow CSA if we haven't been fully associated
Emmanuel Grumbach [Tue, 30 Mar 2021 13:24:52 +0000 (16:24 +0300)]
iwlwifi: mvm: don't allow CSA if we haven't been fully associated

"Fully associated" means that we heard a beacon with the DTIM
information and the firmware is configured to track the beacons.
Since the firmware needs to track the beacons for the CSA, we
can't configure the firmware for CSA before it knows when the
beacons are expected otherwise we'd get ASSERT 301D.
If we are required to start CSA before we told the firmware
when the beacons are expected to arrive, just report a
failure and let mac80211 disconnect.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.9adaedeb59e4.Idaad6aaf3f9759d023b8e00b10064915c0db9aa3@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: pcie: normally grab NIC access for inflight-hcmd
Johannes Berg [Tue, 30 Mar 2021 13:24:51 +0000 (16:24 +0300)]
iwlwifi: pcie: normally grab NIC access for inflight-hcmd

We currently have a special, separate, code path to acquire NIC
access for the in-flight host-command workaround on 7000 series
hardware. However, the normal code path here has grown a number
of additional workarounds/semantics over time, such as reprobing
the device if things fail.

Rather than try to replicate any of this logic, call the normal
grab_nic_access logic for the workaround.

This changes the spinlock to _bh, but that's OK since it's just
redundant, we already have soft-IRQs disabled when we get here,
and so didn't (have to) do it again. Since it's only for commands
there's however no point in making the code more complex just to
not use _bh here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.d196fc6ffb23.Idc1ce3ce9fed9178beee7e5409bc669f79b06a0d@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: pcie: avoid unnecessarily taking spinlock
Johannes Berg [Tue, 30 Mar 2021 13:24:50 +0000 (16:24 +0300)]
iwlwifi: pcie: avoid unnecessarily taking spinlock

Most devices don't set the apmg_wake_up_wa flag, so we don't do
anything for them. Avoid taking the spinlock for every command
unless the device needs this workaround.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.1ab60af3f318.I51cc202f68a2a953223e70c3e8610343412961b6@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agoiwlwifi: mvm: enable TX on new CSA channel before disconnecting
Sara Sharon [Tue, 30 Mar 2021 13:24:49 +0000 (16:24 +0300)]
iwlwifi: mvm: enable TX on new CSA channel before disconnecting

When moving to the new channel, we block TX until we hear the
first beacon. if it is not heard, we proceed to disconnect.
Since TX is blocked (without mac80211 being aware of it) the frame
is stuck, resulting with queue hang.

Instead, reenable TX before reporting on the connection loss.
As we are on the new channel, there is no problem with that,
even if the original CSA had quiet mode.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210330162204.eb4f2ff1b863.Ib16238106b33d58b2b7688dc6297018b915ecef4@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 years agocan: etas_es58x: fix null pointer dereference when handling error frames
Vincent Mailhol [Tue, 13 Apr 2021 11:42:42 +0000 (20:42 +0900)]
can: etas_es58x: fix null pointer dereference when handling error frames

During the handling of CAN bus errors, a CAN error SKB is allocated
using alloc_can_err_skb(). Even if the allocation of the SKB fails,
the function continues in order to do the stats handling.

All access to the can_frame pointer (cf) should be guarded by an if
statement:
if (cf)

However, the increment of the rx_bytes stats:
netdev->stats.rx_bytes += cf->can_dlc;
dereferences the cf pointer and was not guarded by an if condition
leading to a NULL pointer dereference if the can_err_skb() function
failed.

Replacing the cf->can_dlc by the macro CAN_ERR_DLC (which is the
length of any CAN error frames) solves this NULL pointer dereference.

Fixes: 8537257874e9 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces")
Link: https://lore.kernel.org/r/20210413114242.2760-1-mailhol.vincent@wanadoo.fr
Reported-by: Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com>
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agonet: ethernet: intel: Fix a typo in the file ixgbe_dcb_nl.c
Bhaskar Chowdhury [Wed, 17 Mar 2021 10:00:01 +0000 (15:30 +0530)]
net: ethernet: intel: Fix a typo in the file ixgbe_dcb_nl.c

s/Reprogam/Reprogram/

Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
3 years agonet: intel: Remove unused function pointer typedef ixgbe_mc_addr_itr
Chen Lin [Mon, 15 Feb 2021 12:04:58 +0000 (20:04 +0800)]
net: intel: Remove unused function pointer typedef ixgbe_mc_addr_itr

Remove the 'ixgbe_mc_addr_itr' typedef as it is not used.

Signed-off-by: Chen Lin <chen.lin5@zte.com.cn>
Tested-by: Dave Switzer <david.switzer@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
3 years agoixgbe: Support external GBE SerDes PHY BCM54616s
Jostar Yang [Thu, 12 Nov 2020 20:33:56 +0000 (21:33 +0100)]
ixgbe: Support external GBE SerDes PHY BCM54616s

The Broadcom PHY is used in switches, so add the ID, and hook it up.

This upstreams the Linux kernel patch from the network operating system
SONiC from February 2020 [1].

[1]: https://github.com/Azure/sonic-linux-kernel/pull/122

Signed-off-by: Jostar Yang <jostar_yang@accton.com>
Signed-off-by: Guohan Lu <lguohan@gmail.com>
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
3 years agonet: Space: remove hp100 probe
Arnd Bergmann [Tue, 13 Apr 2021 14:16:17 +0000 (16:16 +0200)]
net: Space: remove hp100 probe

The driver was removed last year, but the static initialization got left
behind by accident.

Fixes: a10079c66290 ("staging: remove hp100 driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'dpaa2-switch-tc-hw-offload'
David S. Miller [Tue, 13 Apr 2021 22:12:19 +0000 (15:12 -0700)]
Merge branch 'dpaa2-switch-tc-hw-offload'

Ioana Ciornei says:

====================
dpaa2-switch: add tc hardware offload on ingress traffic

This patch set adds tc hardware offload on ingress traffic in
dpaa2-switch. The cls flower and matchall classifiers are supported
using the same ACL infrastructure supported by the dpaa2-switch.

The first patch creates a new structure to hold all the necessary
information related to an ACL table. This structure is used in the next
patches to create a link between each switch port and the table used.
Multiple ports can share the same ACL table when they also share the
ingress tc block. Also, some small changes in the priority of the
default STP trap is done in the second patch.

The support for cls flower is added in the 3rd patch, while the 4th
one builds on top of the infrastructure put in place and adds cls
matchall support.

The following flow keys are supported:
 - Ethernet: dst_mac/src_mac
 - IPv4: dst_ip/src_ip/ip_proto/tos
 - VLAN: vlan_id/vlan_prio/vlan_tpid/vlan_dei
 - L4: dst_port/src_port

Each filter can support only one action from the following list:
 - drop
 - mirred egress redirect
 - trap

With the last patch, we reuse the dpaa2_switch_acl_entry_add() function
added previously instead of open-coding the install of a new ACL entry
into the table.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agodpaa2-switch: reuse dpaa2_switch_acl_entry_add() for STP frames trap
Ioana Ciornei [Tue, 13 Apr 2021 13:24:48 +0000 (16:24 +0300)]
dpaa2-switch: reuse dpaa2_switch_acl_entry_add() for STP frames trap

Since we added the dpaa2_switch_acl_entry_add() function in the previous
patches to hide all the details of actually adding the ACL entry by
issuing a firmware command, let's use it also for adding a CPU trap for
the STP frames.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agodpaa2-switch: add tc matchall filter support
Ioana Ciornei [Tue, 13 Apr 2021 13:24:47 +0000 (16:24 +0300)]
dpaa2-switch: add tc matchall filter support

Add support TC_SETUP_CLSMATCHALL by using the same ACL table entries
framework as for tc flower. Adding a matchall rule is done by installing
an entry which has a mask of all zeroes, thus matching on any packet.

This can be used as a catch-all type of rule if used correctly, ie the
priority of the matchall filter should be kept as the lowest one in the
entire filter block.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agodpaa2-switch: add tc flower hardware offload on ingress traffic
Ioana Ciornei [Tue, 13 Apr 2021 13:24:46 +0000 (16:24 +0300)]
dpaa2-switch: add tc flower hardware offload on ingress traffic

This patch adds support for tc flower hardware offload on the ingress
path. Shared filter blocks are supported by sharing a single ACL table
between multiple ports.

The following flow keys are supported:
 - Ethernet: dst_mac/src_mac
 - IPv4: dst_ip/src_ip/ip_proto/tos
 - VLAN: vlan_id/vlan_prio/vlan_tpid/vlan_dei
 - L4: dst_port/src_port

As per flow actions, the following are supported:
 - drop
 - mirred egress redirect
 - trap
Each ACL entry (filter) can be setup with only one of the listed
actions.

A sorted single linked list is used to keep the ACL entries by their
order of priority. When adding a new filter, this enables us to quickly
ascertain if the new entry has the highest priority of the entire block
or if we should make some space in the ACL table by increasing the
priority of the filters already in the table.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agodpaa2-switch: install default STP trap rule with the highest priority
Ioana Ciornei [Tue, 13 Apr 2021 13:24:45 +0000 (16:24 +0300)]
dpaa2-switch: install default STP trap rule with the highest priority

Change the default ACL trap rule for STP frames to have the highest
priority.

In the same ACL table will reside both default rules added by the driver
for its internal use as well as rules added with tc flower.  In this
case, the default rules such as the STP one that we already have should
have the highest priority.

Also, remove the check for a full ACL table since we already know that
it's sized so that we don't hit this case.  The last thing changes is
that default trap filters will not be counted in the acl_tbl's num_rules
variable since their number doesn't change.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agodpaa2-switch: create a central dpaa2_switch_acl_tbl structure
Ioana Ciornei [Tue, 13 Apr 2021 13:24:44 +0000 (16:24 +0300)]
dpaa2-switch: create a central dpaa2_switch_acl_tbl structure

Introduce a new structure - dpaa2_switch_acl_tbl - to hold all data
related to an ACL table: number of rules added, ACL table id, etc.
This will be used more in the next patches when adding support for
sharing an ACL table between ports.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoionic: return -EFAULT if copy_to_user() fails
Dan Carpenter [Tue, 13 Apr 2021 10:47:59 +0000 (13:47 +0300)]
ionic: return -EFAULT if copy_to_user() fails

The copy_to_user() function returns the number of bytes that it wasn't
able to copy.  We want to return -EFAULT to the user.

Fixes: fee6efce565d ("ionic: add hw timestamp support files")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'stmmac-xdp-zc'
David S. Miller [Tue, 13 Apr 2021 22:06:51 +0000 (15:06 -0700)]
Merge branch 'stmmac-xdp-zc'

Ong Boon Leong says:

====================
stmmac: add XDP ZC support

This is the v2 patch series to add XDP ZC support to stmmac driver.

Summary of v2 patch change:-

6/7: fix synchronize_rcu() is called stmmac_disable_all_queues() that is
     used by ndo_setup_tc().

 ########################################################################

Continuous burst traffics are generated by pktgen script and in the midst
of each packet processing operation by xdpsock the following tc-loop.sh
script is looped continuously:-

 #!/bin/bash
 tc qdisc del dev eth0 parent root
 tc qdisc add dev eth0 ingress
 tc qdisc add dev eth0 root mqprio num_tc 4 map 0 1 2 3 0 0 0 0 0 0 0 0 0 0 0 0 queues 1@0 1@1 1@2 1@3 hw 0
 tc filter add dev eth0 parent ffff: protocol 802.1Q flower vlan_prio 0 hw_tc 0
 tc filter add dev eth0 parent ffff: protocol 802.1Q flower vlan_prio 1 hw_tc 1
 tc filter add dev eth0 parent ffff: protocol 802.1Q flower vlan_prio 2 hw_tc 2
 tc filter add dev eth0 parent ffff: protocol 802.1Q flower vlan_prio 3 hw_tc 3
 tc qdisc list dev eth0
 tc filter show dev eth0 ingress

 On different ssh terminal
 $ while true; do ./tc-loop.sh; sleep 1; done

The v2 patch series have been tested using the xdpsock app:
 $ ./xdpsock -i eth0 -l -z

From xdpsock poller pps report and dmesg, we don't find any warning
related to rcu and the only difference when the script is executed is
the pps rate drops momentarily.

 sock0@eth0:0 l2fwd xdp-drv
                   pps            pkts           1.00
rx                 436347         191361334
tx                 436411         191361334

 sock0@eth0:0 l2fwd xdp-drv
                   pps            pkts           1.00
rx                 254117         191615476
tx                 254053         191615412

 sock0@eth0:0 l2fwd xdp-drv
                   pps            pkts           1.00
rx                 466395         192081924
tx                 466395         192081860

 sock0@eth0:0 l2fwd xdp-drv
                   pps            pkts           1.00
rx                 287410         192369365
tx                 287474         192369365

 sock0@eth0:0 l2fwd xdp-drv
                   pps            pkts           1.00
rx                 395853         192765329
tx                 395789         192765265

 sock0@eth0:0 l2fwd xdp-drv
                   pps            pkts           1.00
rx                 466132         193231514
tx                 466132         193231450

 ########################################################################

Based on the above result, the fix looks promising. Appreciate that if
community can help to review the patch series and provide me feedback
for improvement.
====================

3 years agonet: stmmac: Add TX via XDP zero-copy socket
Ong Boon Leong [Tue, 13 Apr 2021 09:36:26 +0000 (17:36 +0800)]
net: stmmac: Add TX via XDP zero-copy socket

We add the support of XDP ZC TX submission and cleaning into
stmmac_tx_clean(). The function is made to clean as many TX complete
frames as possible, i.e. limit by priv->dma_tx_size instead of NAPI
budget. For TX ring that is associated with XSK pool, the function
stmmac_xdp_xmit_zc() is introduced to TX frame buffers from XSK pool by
using xsk_tx_peek_desc(). To make stmmac_tx_clean() support the cleaning
of XSK TX frames, STMMAC_TXBUF_T_XSK_TX TX buffer type is introduced.

As stmmac_tx_clean() uses the return value to cue whether NAPI function
should continue to poll, we augment the caller of stmmac_tx_clean() to
pass NAPI budget instead of priv->dma_tx_size through 'budget' input and
made stmmac_tx_clean() to always clean up-to the TX ring size instead.
This allows us to use the return boolean status of stmmac_xdp_xmit_zc()
to decide if XSK TX work is done or not: If true, set 'xmits' to return
'budget - 1' so that NAPI poll may exit. Else, set 'xmits' to return
'budget' to make NAPI poll continue to poll since XSK TX work is not
done. Finally, at the end of stmmac_tx_clean(), the function now take
a maximum value between 'count' and 'xmits' so that status from both
TX cleaning and XSK TX (only for XDP ZC) is considered.

This patch adds a new NAPI poll called stmmac_napi_poll_rxtx() that is
meant to be enabled/disabled for RX and TX ring that are bound to XSK
pool. This NAPI poll function starts with cleaning TX ring, then submits
XSK TX frames to TX ring before proceed to perform RX operations, i.e.
, receiving RX frames and replenishing RX ring with RX free buffers
obtained from XSK pool. Therefore, during XSK RX and TX setup, the driver
enables stmmac_napi_poll_rxtx() for RX and TX operations, then during
XSK RX and TX pool tear-down, the driver reenables the exisiting
independent NAPI poll functions accordingly: stmmac_napi_poll_rx() and
stmmac_napi_poll_tx().

Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: stmmac: Enable RX via AF_XDP zero-copy
Ong Boon Leong [Tue, 13 Apr 2021 09:36:25 +0000 (17:36 +0800)]
net: stmmac: Enable RX via AF_XDP zero-copy

This patch adds the support for receiving packet via AF_XDP zero-copy
mechanism.

XDP ZC uses 1:1 mapping of XDP buffer to receive packet, therefore the
use of split header is not used currently. The 'xdp_buff' is declared as
union together with a struct that contains 'page', 'addr' and
'page_offset' that are associated with primary buffer.

RX buffers are now allocated either via page_pool or xsk pool. For RX
buffers from xsk_pool they are allocated and deallocated using below
functions:

 * stmmac_alloc_rx_buffers_zc(struct stmmac_priv *priv, u32 queue)
 * dma_free_rx_xskbufs(struct stmmac_priv *priv, u32 queue)

With above functions now available, we then extend the following driver
functions to support XDP ZC:
 * stmmac_reinit_rx_buffers()
 * __init_dma_rx_desc_rings()
 * init_dma_rx_desc_rings()
 * __free_dma_rx_desc_resources()

Note: stmmac_alloc_rx_buffers_zc() may return -ENOMEM due to RX XDP
buffer pool is not allocated (e.g. samples/bpf/xdpsock TX-only). But,
it is still ok to let TX XDP ZC to continue, therefore, the -ENOMEM
is silently ignored to let the driver succcessfully transition to XDP
ZC mode for the said RX and TX queue.

As XDP ZC buffer size is different, the DMA buffer size is required
to be reprogrammed accordingly for RX DMA/Queue that is populated with
XDP buffer from XSK pool.

Next, to add or remove per-queue XSK pool, stmmac_xdp_setup_pool()
will call stmmac_xdp_enable_pool() or stmmac_xdp_disable_pool()
that in-turn coordinates the tearing down and setting up RX ring via
RX buffers and descriptors removal and reallocation through
stmmac_disable_rx_queue() and stmmac_enable_rx_queue(). In addition,
stmmac_xsk_wakeup() is added to initiate XDP RX buffer replenishing
by signalling user application to add available XDP frames back to
FILL queue.

For RX processing using XDP zero-copy buffer, stmmac_rx_zc() is
introduced which is implemented with the assumption that RX split
header is disabled. For XDP verdict is XDP_PASS, the XDP buffer is
copied into a sk_buff allocated through stmmac_construct_skb_zc()
and sent to Linux network GRO inside stmmac_dispatch_skb_zc(). Free RX
buffers are then replenished using stmmac_rx_refill_zc()

v2: introduce __stmmac_disable_all_queues() to contain the original code
    that does napi_disable() and then make stmmac_setup_tc_block_cb()
    to use it. Move synchronize_rcu() into stmmac_disable_all_queues()
    that eventually calls __stmmac_disable_all_queues(). Then,
    make both stmmac_release() and stmmac_suspend() to use
    stmmac_disable_all_queues(). Thanks David Miller for spotting the
    synchronize_rcu() issue in v1 patch.

Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: stmmac: Refactor __stmmac_xdp_run_prog for XDP ZC
Ong Boon Leong [Tue, 13 Apr 2021 09:36:24 +0000 (17:36 +0800)]
net: stmmac: Refactor __stmmac_xdp_run_prog for XDP ZC

Prepare stmmac_xdp_run_prog() for AF_XDP zero-copy support which will be
added by upcoming patches by splitting out the XDP verdict processing
into __stmmac_xdp_run_prog() and it callable for XDP ZC path which does
not need to verify bpf_prog is not NULL.

The stmmac_xdp_run_prog() is used for regular XDP Rx path which requires
bpf_prog to be verified.

Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: stmmac: rearrange RX and TX desc init into per-queue basis
Ong Boon Leong [Tue, 13 Apr 2021 09:36:23 +0000 (17:36 +0800)]
net: stmmac: rearrange RX and TX desc init into per-queue basis

Below functions are made to be per-queue in preparation of XDP ZC:

 __init_dma_rx_desc_rings(struct stmmac_priv *priv, u32 queue, gfp_t flags)
 __init_dma_tx_desc_rings(struct stmmac_priv *priv, u32 queue)

The original functions below are stay maintained for all queue usage:

 init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)
 init_dma_tx_desc_rings(struct net_device *dev)

Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: stmmac: refactor stmmac_init_rx_buffers for stmmac_reinit_rx_buffers
Ong Boon Leong [Tue, 13 Apr 2021 09:36:22 +0000 (17:36 +0800)]
net: stmmac: refactor stmmac_init_rx_buffers for stmmac_reinit_rx_buffers

The per-queue RX buffer allocation in stmmac_reinit_rx_buffers() can be
made to use stmmac_alloc_rx_buffers() by merging the page_pool alloc
checks for "buf->page" and "buf->sec_page" in stmmac_init_rx_buffers().

This is in preparation for XSK pool allocation later.

Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: stmmac: introduce dma_recycle_rx_skbufs for stmmac_reinit_rx_buffers
Ong Boon Leong [Tue, 13 Apr 2021 09:36:21 +0000 (17:36 +0800)]
net: stmmac: introduce dma_recycle_rx_skbufs for stmmac_reinit_rx_buffers

Rearrange RX buffer page_pool recycling logics into dma_recycle_rx_skbufs,
so that we prepare stmmac_reinit_rx_buffers() for XSK pool expansion.

Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: stmmac: rearrange RX buffer allocation and free functions
Ong Boon Leong [Tue, 13 Apr 2021 09:36:20 +0000 (17:36 +0800)]
net: stmmac: rearrange RX buffer allocation and free functions

This patch restructures the per RX queue buffer allocation from page_pool
to stmmac_alloc_rx_buffers().

We also rearrange dma_free_rx_skbufs() so that it can be used in
init_dma_rx_desc_rings() during freeing of RX buffer in the event of
page_pool allocation failure to replace the more efficient method earlier.
The replacement is needed to make the RX buffer alloc and free method
scalable to XDP ZC xsk_pool alloc and free later.

Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agoMerge branch 'ipa-SM8350-SoC'
David S. Miller [Tue, 13 Apr 2021 22:02:25 +0000 (15:02 -0700)]
Merge branch 'ipa-SM8350-SoC'

Alex Elder says:

====================
net: ipa: add support for the SM8350 SoC

This small series adds IPA driver support for the Qualcomm SM8350
SoC, which implements IPA v4.9.

The first patch updates the DT binding, and depends on a previous
patch that has already been accepted into net-next.

The second just defines the IPA v4.9 configuration data file.

(Device Tree files to support this SoC will be sent separately and
will go through the Qualcomm tree.)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: ipa: add IPA v4.9 configuration data
Alex Elder [Tue, 13 Apr 2021 16:38:26 +0000 (11:38 -0500)]
net: ipa: add IPA v4.9 configuration data

Add support for the SM8350 SoC, which includes IPA version 4.9.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agodt-bindings: net: qcom,ipa: add support for SM8350
Alex Elder [Tue, 13 Apr 2021 16:38:25 +0000 (11:38 -0500)]
dt-bindings: net: qcom,ipa: add support for SM8350

Add support for "qcom,sm8350-ipa", which uses IPA v4.9.

Use "enum" rather than "oneOf/const ..." to specify compatible
strings, as suggested by Rob Herring.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>