Commit 637bc8f0 authored by David S. Miller's avatar David S. Miller

Merge tag 'mlx5-updates-2023-02-04' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-updates-2023-02-04

This series provides misc updates to mlx5 driver:

1) Trivial LAG code cleanup patches from Roi

2) Rahul improves mlx5's documentation structure
Separates the documentation into multiple pages related to different
components in the device driver. Adds Kconfig parameters, devlink
parameters, and tracepoints that were previously introduced but not added
to the documentation. Introduces a new page on ethtool statistics counters
with information about counters previously implemented in the mlx5_core
driver but not documented in the kernel tree.

3) From Raed, policy/state selector support for IPSec.

4) From Fragos, add support for XDR speed in IPoIB mlx5 netdev

5) Few more misc cleanups and trivial changes
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 27369c9c 79efecb4
...@@ -39,7 +39,7 @@ Contents: ...@@ -39,7 +39,7 @@ Contents:
intel/ice intel/ice
marvell/octeontx2 marvell/octeontx2
marvell/octeon_ep marvell/octeon_ep
mellanox/mlx5 mellanox/mlx5/index
microsoft/netvsc microsoft/netvsc
neterion/s2io neterion/s2io
netronome/nfp netronome/nfp
......
.. SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
.. include:: <isonum.txt>
=======
Devlink
=======
:Copyright: |copy| 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Contents
========
- `Info`_
- `Parameters`_
- `Health reporters`_
Info
====
The devlink info reports the running and stored firmware versions on device.
It also prints the device PSID which represents the HCA board type ID.
User command example::
$ devlink dev info pci/0000:00:06.0
pci/0000:00:06.0:
driver mlx5_core
versions:
fixed:
fw.psid MT_0000000009
running:
fw.version 16.26.0100
stored:
fw.version 16.26.0100
Parameters
==========
flow_steering_mode: Device flow steering mode
---------------------------------------------
The flow steering mode parameter controls the flow steering mode of the driver.
Two modes are supported:
1. 'dmfs' - Device managed flow steering.
2. 'smfs' - Software/Driver managed flow steering.
In DMFS mode, the HW steering entities are created and managed through the
Firmware.
In SMFS mode, the HW steering entities are created and managed though by
the driver directly into hardware without firmware intervention.
SMFS mode is faster and provides better rule insertion rate compared to default DMFS mode.
User command examples:
- Set SMFS flow steering mode::
$ devlink dev param set pci/0000:06:00.0 name flow_steering_mode value "smfs" cmode runtime
- Read device flow steering mode::
$ devlink dev param show pci/0000:06:00.0 name flow_steering_mode
pci/0000:06:00.0:
name flow_steering_mode type driver-specific
values:
cmode runtime value smfs
enable_roce: RoCE enablement state
----------------------------------
If the device supports RoCE disablement, RoCE enablement state controls device
support for RoCE capability. Otherwise, the control occurs in the driver stack.
When RoCE is disabled at the driver level, only raw ethernet QPs are supported.
To change RoCE enablement state, a user must change the driverinit cmode value
and run devlink reload.
User command examples:
- Disable RoCE::
$ devlink dev param set pci/0000:06:00.0 name enable_roce value false cmode driverinit
$ devlink dev reload pci/0000:06:00.0
- Read RoCE enablement state::
$ devlink dev param show pci/0000:06:00.0 name enable_roce
pci/0000:06:00.0:
name enable_roce type generic
values:
cmode driverinit value true
esw_port_metadata: Eswitch port metadata state
----------------------------------------------
When applicable, disabling eswitch metadata can increase packet rate
up to 20% depending on the use case and packet sizes.
Eswitch port metadata state controls whether to internally tag packets with
metadata. Metadata tagging must be enabled for multi-port RoCE, failover
between representors and stacked devices.
By default metadata is enabled on the supported devices in E-switch.
Metadata is applicable only for E-switch in switchdev mode and
users may disable it when NONE of the below use cases will be in use:
1. HCA is in Dual/multi-port RoCE mode.
2. VF/SF representor bonding (Usually used for Live migration)
3. Stacked devices
When metadata is disabled, the above use cases will fail to initialize if
users try to enable them.
- Show eswitch port metadata::
$ 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
- Disable eswitch port metadata::
$ devlink dev param set pci/0000:06:00.0 name esw_port_metadata value false cmode runtime
- Change eswitch mode to switchdev mode where after choosing the metadata value::
$ devlink dev eswitch set pci/0000:06:00.0 mode switchdev
Health reporters
================
tx reporter
-----------
The tx reporter is responsible for reporting and recovering of the following two error scenarios:
- tx timeout
Report on kernel tx timeout detection.
Recover by searching lost interrupts.
- tx error completion
Report on error tx completion.
Recover by flushing the tx queue and reset it.
tx reporter also support on demand diagnose callback, on which it provides
real time information of its send queues status.
User commands examples:
- Diagnose send queues status::
$ devlink health diagnose pci/0000:82:00.0 reporter tx
NOTE: This command has valid output only when interface is up, otherwise the command has empty output.
- Show number of tx errors indicated, number of recover flows ended successfully,
is autorecover enabled and graceful period from last recover::
$ devlink health show pci/0000:82:00.0 reporter tx
rx reporter
-----------
The rx reporter is responsible for reporting and recovering of the following two error scenarios:
- rx queues' initialization (population) timeout
Population of rx queues' descriptors on ring initialization is done
in napi context via triggering an irq. In case of a failure to get
the minimum amount of descriptors, a timeout would occur, and
descriptors could be recovered by polling the EQ (Event Queue).
- rx completions with errors (reported by HW on interrupt context)
Report on rx completion error.
Recover (if needed) by flushing the related queue and reset it.
rx reporter also supports on demand diagnose callback, on which it
provides real time information of its receive queues' status.
- Diagnose rx queues' status and corresponding completion queue::
$ devlink health diagnose pci/0000:82:00.0 reporter rx
NOTE: This command has valid output only when interface is up. Otherwise, the command has empty output.
- Show number of rx errors indicated, number of recover flows ended successfully,
is autorecover enabled, and graceful period from last recover::
$ devlink health show pci/0000:82:00.0 reporter rx
fw reporter
-----------
The fw reporter implements `diagnose` and `dump` callbacks.
It follows symptoms of fw error such as fw syndrome by triggering
fw core dump and storing it into the dump buffer.
The fw reporter diagnose command can be triggered any time by the user to check
current fw status.
User commands examples:
- Check fw heath status::
$ devlink health diagnose pci/0000:82:00.0 reporter fw
- Read FW core dump if already stored or trigger new one::
$ devlink health dump show pci/0000:82:00.0 reporter fw
NOTE: This command can run only on the PF which has fw tracer ownership,
running it on other PF or any VF will return "Operation not permitted".
fw fatal reporter
-----------------
The fw fatal reporter implements `dump` and `recover` callbacks.
It follows fatal errors indications by CR-space dump and recover flow.
The CR-space dump uses vsc interface which is valid even if the FW command
interface is not functional, which is the case in most FW fatal errors.
The recover function runs recover flow which reloads the driver and triggers fw
reset if needed.
On firmware error, the health buffer is dumped into the dmesg. The log
level is derived from the error's severity (given in health buffer).
User commands examples:
- Run fw recover flow manually::
$ devlink health recover pci/0000:82:00.0 reporter fw_fatal
- Read FW CR-space dump if already stored or trigger new one::
$ devlink health dump show pci/0000:82:00.1 reporter fw_fatal
NOTE: This command can run only on PF.
.. SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
.. include:: <isonum.txt>
Mellanox ConnectX(R) mlx5 core VPI Network Driver
=================================================
:Copyright: |copy| 2019, Mellanox Technologies LTD.
:Copyright: |copy| 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Contents:
.. toctree::
:maxdepth: 2
kconfig
devlink
switchdev
tracepoints
counters
.. only:: subproject and html
Indices
=======
* :ref:`genindex`
.. SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
.. include:: <isonum.txt>
=======================================
Enabling the driver and kconfig options
=======================================
:Copyright: |copy| 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
| mlx5 core is modular and most of the major mlx5 core driver features can be selected (compiled in/out)
| at build time via kernel Kconfig flags.
| Basic features, ethernet net device rx/tx offloads and XDP, are available with the most basic flags
| CONFIG_MLX5_CORE=y/m and CONFIG_MLX5_CORE_EN=y.
| For the list of advanced features, please see below.
**CONFIG_MLX5_BRIDGE=(y/n)**
| Enable :ref:`Ethernet Bridging (BRIDGE) offloading support <mlx5_bridge_offload>`.
| This will provide the ability to add representors of mlx5 uplink and VF
| ports to Bridge and offloading rules for traffic between such ports.
| Supports VLANs (trunk and access modes).
**CONFIG_MLX5_CORE=(y/m/n)** (module mlx5_core.ko)
| The driver can be enabled by choosing CONFIG_MLX5_CORE=y/m in kernel config.
| This will provide mlx5 core driver for mlx5 ulps to interface with (mlx5e, mlx5_ib).
**CONFIG_MLX5_CORE_EN=(y/n)**
| Choosing this option will allow basic ethernet netdevice support with all of the standard rx/tx offloads.
| mlx5e is the mlx5 ulp driver which provides netdevice kernel interface, when chosen, mlx5e will be
| built-in into mlx5_core.ko.
**CONFIG_MLX5_CORE_EN_DCB=(y/n)**:
| Enables `Data Center Bridging (DCB) Support <https://community.mellanox.com/s/article/howto-auto-config-pfc-and-ets-on-connectx-4-via-lldp-dcbx>`_.
**CONFIG_MLX5_CORE_IPOIB=(y/n)**
| IPoIB offloads & acceleration support.
| Requires CONFIG_MLX5_CORE_EN to provide an accelerated interface for the rdma
| IPoIB ulp netdevice.
**CONFIG_MLX5_CLS_ACT=(y/n)**
| Enables offload support for TC classifier action (NET_CLS_ACT).
| Works in both native NIC mode and Switchdev SRIOV mode.
| Flow-based classifiers, such as those registered through
| `tc-flower(8)`, are processed by the device, rather than the
| host. Actions that would then overwrite matching classification
| results would then be instant due to the offload.
**CONFIG_MLX5_EN_ARFS=(y/n)**
| Enables Hardware-accelerated receive flow steering (arfs) support, and ntuple filtering.
| https://community.mellanox.com/s/article/howto-configure-arfs-on-connectx-4
**CONFIG_MLX5_EN_IPSEC=(y/n)**
| Enables `IPSec XFRM cryptography-offload acceleration <https://support.mellanox.com/s/article/ConnectX-6DX-Bluefield-2-IPsec-HW-Full-Offload-Configuration-Guide>`_.
**CONFIG_MLX5_EN_MACSEC=(y/n)**
| Build support for MACsec cryptography-offload acceleration in the NIC.
**CONFIG_MLX5_EN_RXNFC=(y/n)**
| Enables ethtool receive network flow classification, which allows user defined
| flow rules to direct traffic into arbitrary rx queue via ethtool set/get_rxnfc API.
**CONFIG_MLX5_EN_TLS=(y/n)**
| TLS cryptography-offload acceleration.
**CONFIG_MLX5_ESWITCH=(y/n)**
| Ethernet SRIOV E-Switch support in ConnectX NIC. E-Switch provides internal SRIOV packet steering
| and switching for the enabled VFs and PF in two available modes:
| 1) `Legacy SRIOV mode (L2 mac vlan steering based) <https://community.mellanox.com/s/article/howto-configure-sr-iov-for-connectx-4-connectx-5-with-kvm--ethernet-x>`_.
| 2) `Switchdev mode (eswitch offloads) <https://www.mellanox.com/related-docs/prod_software/ASAP2_Hardware_Offloading_for_vSwitches_User_Manual_v4.4.pdf>`_.
**CONFIG_MLX5_FPGA=(y/n)**
| Build support for the Innova family of network cards by Mellanox Technologies.
| Innova network cards are comprised of a ConnectX chip and an FPGA chip on one board.
| If you select this option, the mlx5_core driver will include the Innova FPGA core and allow
| building sandbox-specific client drivers.
**CONFIG_MLX5_INFINIBAND=(y/n/m)** (module mlx5_ib.ko)
| Provides low-level InfiniBand/RDMA and `RoCE <https://community.mellanox.com/s/article/recommended-network-configuration-examples-for-roce-deployment>`_ support.
**CONFIG_MLX5_MPFS=(y/n)**
| Ethernet Multi-Physical Function Switch (MPFS) support in ConnectX NIC.
| MPFs is required for when `Multi-Host <http://www.mellanox.com/page/multihost>`_ configuration is enabled to allow passing
| user configured unicast MAC addresses to the requesting PF.
**CONFIG_MLX5_SF=(y/n)**
| Build support for subfunction.
| Subfunctons are more light weight than PCI SRIOV VFs. Choosing this option
| will enable support for creating subfunction devices.
**CONFIG_MLX5_SF_MANAGER=(y/n)**
| Build support for subfuction port in the NIC. A Mellanox subfunction
| port is managed through devlink. A subfunction supports RDMA, netdevice
| and vdpa device. It is similar to a SRIOV VF but it doesn't require
| SRIOV support.
**CONFIG_MLX5_SW_STEERING=(y/n)**
| Build support for software-managed steering in the NIC.
**CONFIG_MLX5_TC_CT=(y/n)**
| Support offloading connection tracking rules via tc ct action.
**CONFIG_MLX5_TC_SAMPLE=(y/n)**
| Support offloading sample rules via tc sample action.
**CONFIG_MLX5_VDPA=(y/n)**
| Support library for Mellanox VDPA drivers. Provides code that is
| common for all types of VDPA drivers. The following drivers are planned:
| net, block.
**CONFIG_MLX5_VDPA_NET=(y/n)**
| VDPA network driver for ConnectX6 and newer. Provides offloading
| of virtio net datapath such that descriptors put on the ring will
| be executed by the hardware. It also supports a variety of stateless
| offloads depending on the actual device used and firmware version.
**CONFIG_MLX5_VFIO_PCI=(y/n)**
| This provides migration support for MLX5 devices using the VFIO framework.
**External options** ( Choose if the corresponding mlx5 feature is required )
- CONFIG_MLXFW: When chosen, mlx5 firmware flashing support will be enabled (via devlink and ethtool).
- CONFIG_PTP_1588_CLOCK: When chosen, mlx5 ptp support will be enabled
- CONFIG_VXLAN: When chosen, mlx5 vxlan support will be enabled.
.. SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
.. include:: <isonum.txt>
===========
Tracepoints
===========
:Copyright: |copy| 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
mlx5 driver provides internal tracepoints for tracking and debugging using
kernel tracepoints interfaces (refer to Documentation/trace/ftrace.rst).
For the list of support mlx5 events, check `/sys/kernel/debug/tracing/events/mlx5/`.
tc and eswitch offloads tracepoints:
- mlx5e_configure_flower: trace flower filter actions and cookies offloaded to mlx5::
$ echo mlx5:mlx5e_configure_flower >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
tc-6535 [019] ...1 2672.404466: mlx5e_configure_flower: cookie=0000000067874a55 actions= REDIRECT
- mlx5e_delete_flower: trace flower filter actions and cookies deleted from mlx5::
$ echo mlx5:mlx5e_delete_flower >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
tc-6569 [010] .N.1 2686.379075: mlx5e_delete_flower: cookie=0000000067874a55 actions= NULL
- mlx5e_stats_flower: trace flower stats request::
$ echo mlx5:mlx5e_stats_flower >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
tc-6546 [010] ...1 2679.704889: mlx5e_stats_flower: cookie=0000000060eb3d6a bytes=0 packets=0 lastused=4295560217
- mlx5e_tc_update_neigh_used_value: trace tunnel rule neigh update value offloaded to mlx5::
$ echo mlx5:mlx5e_tc_update_neigh_used_value >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
kworker/u48:4-8806 [009] ...1 55117.882428: mlx5e_tc_update_neigh_used_value: netdev: ens1f0 IPv4: 1.1.1.10 IPv6: ::ffff:1.1.1.10 neigh_used=1
- mlx5e_rep_neigh_update: trace neigh update tasks scheduled due to neigh state change events::
$ echo mlx5:mlx5e_rep_neigh_update >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
kworker/u48:7-2221 [009] ...1 1475.387435: mlx5e_rep_neigh_update: netdev: ens1f0 MAC: 24:8a:07:9a:17:9a IPv4: 1.1.1.10 IPv6: ::ffff:1.1.1.10 neigh_connected=1
Bridge offloads tracepoints:
- mlx5_esw_bridge_fdb_entry_init: trace bridge FDB entry offloaded to mlx5::
$ echo mlx5:mlx5_esw_bridge_fdb_entry_init >> set_event
$ cat /sys/kernel/debug/tracing/trace
...
kworker/u20:9-2217 [003] ...1 318.582243: mlx5_esw_bridge_fdb_entry_init: net_device=enp8s0f0_0 addr=e4:fd:05:08:00:02 vid=0 flags=0 used=0
- mlx5_esw_bridge_fdb_entry_cleanup: trace bridge FDB entry deleted from mlx5::
$ echo mlx5:mlx5_esw_bridge_fdb_entry_cleanup >> set_event
$ cat /sys/kernel/debug/tracing/trace
...
ip-2581 [005] ...1 318.629871: mlx5_esw_bridge_fdb_entry_cleanup: net_device=enp8s0f0_1 addr=e4:fd:05:08:00:03 vid=0 flags=0 used=16
- mlx5_esw_bridge_fdb_entry_refresh: trace bridge FDB entry offload refreshed in
mlx5::
$ echo mlx5:mlx5_esw_bridge_fdb_entry_refresh >> set_event
$ cat /sys/kernel/debug/tracing/trace
...
kworker/u20:8-3849 [003] ...1 466716: mlx5_esw_bridge_fdb_entry_refresh: net_device=enp8s0f0_0 addr=e4:fd:05:08:00:02 vid=3 flags=0 used=0
- mlx5_esw_bridge_vlan_create: trace bridge VLAN object add on mlx5
representor::
$ echo mlx5:mlx5_esw_bridge_vlan_create >> set_event
$ cat /sys/kernel/debug/tracing/trace
...
ip-2560 [007] ...1 318.460258: mlx5_esw_bridge_vlan_create: vid=1 flags=6
- mlx5_esw_bridge_vlan_cleanup: trace bridge VLAN object delete from mlx5
representor::
$ echo mlx5:mlx5_esw_bridge_vlan_cleanup >> set_event
$ cat /sys/kernel/debug/tracing/trace
...
bridge-2582 [007] ...1 318.653496: mlx5_esw_bridge_vlan_cleanup: vid=2 flags=8
- mlx5_esw_bridge_vport_init: trace mlx5 vport assigned with bridge upper
device::
$ echo mlx5:mlx5_esw_bridge_vport_init >> set_event
$ cat /sys/kernel/debug/tracing/trace
...
ip-2560 [007] ...1 318.458915: mlx5_esw_bridge_vport_init: vport_num=1
- mlx5_esw_bridge_vport_cleanup: trace mlx5 vport removed from bridge upper
device::
$ echo mlx5:mlx5_esw_bridge_vport_cleanup >> set_event
$ cat /sys/kernel/debug/tracing/trace
...
ip-5387 [000] ...1 573713: mlx5_esw_bridge_vport_cleanup: vport_num=1
Eswitch QoS tracepoints:
- mlx5_esw_vport_qos_create: trace creation of transmit scheduler arbiter for vport::
$ echo mlx5:mlx5_esw_vport_qos_create >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
<...>-23496 [018] .... 73136.838831: mlx5_esw_vport_qos_create: (0000:82:00.0) vport=2 tsar_ix=4 bw_share=0, max_rate=0 group=000000007b576bb3
- mlx5_esw_vport_qos_config: trace configuration of transmit scheduler arbiter for vport::
$ echo mlx5:mlx5_esw_vport_qos_config >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
<...>-26548 [023] .... 75754.223823: mlx5_esw_vport_qos_config: (0000:82:00.0) vport=1 tsar_ix=3 bw_share=34, max_rate=10000 group=000000007b576bb3
- mlx5_esw_vport_qos_destroy: trace deletion of transmit scheduler arbiter for vport::
$ echo mlx5:mlx5_esw_vport_qos_destroy >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
<...>-27418 [004] .... 76546.680901: mlx5_esw_vport_qos_destroy: (0000:82:00.0) vport=1 tsar_ix=3
- mlx5_esw_group_qos_create: trace creation of transmit scheduler arbiter for rate group::
$ echo mlx5:mlx5_esw_group_qos_create >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
<...>-26578 [008] .... 75776.022112: mlx5_esw_group_qos_create: (0000:82:00.0) group=000000008dac63ea tsar_ix=5
- mlx5_esw_group_qos_config: trace configuration of transmit scheduler arbiter for rate group::
$ echo mlx5:mlx5_esw_group_qos_config >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
<...>-27303 [020] .... 76461.455356: mlx5_esw_group_qos_config: (0000:82:00.0) group=000000008dac63ea tsar_ix=5 bw_share=100 max_rate=20000
- mlx5_esw_group_qos_destroy: trace deletion of transmit scheduler arbiter for group::
$ echo mlx5:mlx5_esw_group_qos_destroy >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
<...>-27418 [006] .... 76547.187258: mlx5_esw_group_qos_destroy: (0000:82:00.0) group=000000007b576bb3 tsar_ix=1
SF tracepoints:
- mlx5_sf_add: trace addition of the SF port::
$ echo mlx5:mlx5_sf_add >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
devlink-9363 [031] ..... 24610.188722: mlx5_sf_add: (0000:06:00.0) port_index=32768 controller=0 hw_id=0x8000 sfnum=88
- mlx5_sf_free: trace freeing of the SF port::
$ echo mlx5:mlx5_sf_free >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
devlink-9830 [038] ..... 26300.404749: mlx5_sf_free: (0000:06:00.0) port_index=32768 controller=0 hw_id=0x8000
- mlx5_sf_activate: trace activation of the SF port::
$ echo mlx5:mlx5_sf_activate >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
devlink-29841 [008] ..... 3669.635095: mlx5_sf_activate: (0000:08:00.0) port_index=32768 controller=0 hw_id=0x8000
- mlx5_sf_deactivate: trace deactivation of the SF port::
$ echo mlx5:mlx5_sf_deactivate >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
devlink-29994 [008] ..... 4015.969467: mlx5_sf_deactivate: (0000:08:00.0) port_index=32768 controller=0 hw_id=0x8000
- mlx5_sf_hwc_alloc: trace allocating of the hardware SF context::
$ echo mlx5:mlx5_sf_hwc_alloc >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
devlink-9775 [031] ..... 26296.385259: mlx5_sf_hwc_alloc: (0000:06:00.0) controller=0 hw_id=0x8000 sfnum=88
- mlx5_sf_hwc_free: trace freeing of the hardware SF context::
$ echo mlx5:mlx5_sf_hwc_free >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
kworker/u128:3-9093 [046] ..... 24625.365771: mlx5_sf_hwc_free: (0000:06:00.0) hw_id=0x8000
- mlx5_sf_hwc_deferred_free: trace deferred freeing of the hardware SF context::
$ echo mlx5:mlx5_sf_hwc_deferred_free >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
devlink-9519 [046] ..... 24624.400271: mlx5_sf_hwc_deferred_free: (0000:06:00.0) hw_id=0x8000
- mlx5_sf_update_state: trace state updates for SF contexts::
$ echo mlx5:mlx5_sf_update_state >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
kworker/u20:3-29490 [009] ..... 4141.453530: mlx5_sf_update_state: (0000:08:00.0) port_index=32768 controller=0 hw_id=0x8000 state=2
- mlx5_sf_vhca_event: trace SF vhca event and state::
$ echo mlx5:mlx5_sf_vhca_event >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
kworker/u128:3-9093 [046] ..... 24625.365525: mlx5_sf_vhca_event: (0000:06:00.0) hw_id=0x8000 sfnum=88 vhca_state=1
- mlx5_sf_dev_add: trace SF device add event::
$ echo mlx5:mlx5_sf_dev_add>> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
kworker/u128:3-9093 [000] ..... 24616.524495: mlx5_sf_dev_add: (0000:06:00.0) sfdev=00000000fc5d96fd aux_id=4 hw_id=0x8000 sfnum=88
- mlx5_sf_dev_del: trace SF device delete event::
$ echo mlx5:mlx5_sf_dev_del >> /sys/kernel/debug/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace
...
kworker/u128:3-9093 [044] ..... 24624.400749: mlx5_sf_dev_del: (0000:06:00.0) sfdev=00000000fc5d96fd aux_id=4 hw_id=0x8000 sfnum=88
...@@ -454,6 +454,7 @@ struct mlx5e_txqsq { ...@@ -454,6 +454,7 @@ struct mlx5e_txqsq {
struct mlx5_clock *clock; struct mlx5_clock *clock;
struct net_device *netdev; struct net_device *netdev;
struct mlx5_core_dev *mdev; struct mlx5_core_dev *mdev;
struct mlx5e_channel *channel;
struct mlx5e_priv *priv; struct mlx5e_priv *priv;
/* control path */ /* control path */
......
...@@ -771,8 +771,8 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c) ...@@ -771,8 +771,8 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c)
if (test_bit(MLX5E_PTP_STATE_RX, c->state)) { if (test_bit(MLX5E_PTP_STATE_RX, c->state)) {
mlx5e_ptp_rx_set_fs(c->priv); mlx5e_ptp_rx_set_fs(c->priv);
mlx5e_activate_rq(&c->rq); mlx5e_activate_rq(&c->rq);
mlx5e_trigger_napi_sched(&c->napi);
} }
mlx5e_trigger_napi_sched(&c->napi);
} }
void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c) void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c)
......
...@@ -81,6 +81,10 @@ static int mlx5e_tx_reporter_err_cqe_recover(void *ctx) ...@@ -81,6 +81,10 @@ static int mlx5e_tx_reporter_err_cqe_recover(void *ctx)
sq->stats->recover++; sq->stats->recover++;
clear_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state); clear_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state);
mlx5e_activate_txqsq(sq); mlx5e_activate_txqsq(sq);
if (sq->channel)
mlx5e_trigger_napi_icosq(sq->channel);
else
mlx5e_trigger_napi_sched(sq->cq.napi);
return 0; return 0;
out: out:
......
...@@ -232,9 +232,9 @@ parse_mirred(struct mlx5e_tc_act_parse_state *parse_state, ...@@ -232,9 +232,9 @@ parse_mirred(struct mlx5e_tc_act_parse_state *parse_state,
parse_state->ifindexes[if_count] = out_dev->ifindex; parse_state->ifindexes[if_count] = out_dev->ifindex;
parse_state->if_count++; parse_state->if_count++;
is_uplink_rep = mlx5e_eswitch_uplink_rep(out_dev); is_uplink_rep = mlx5e_eswitch_uplink_rep(out_dev);
err = mlx5_lag_do_mirred(priv->mdev, out_dev);
if (err) if (mlx5_lag_mpesw_do_mirred(priv->mdev, out_dev, extack))
return err; return -EOPNOTSUPP;
out_dev = get_fdb_out_dev(uplink_dev, out_dev); out_dev = get_fdb_out_dev(uplink_dev, out_dev);
if (!out_dev) if (!out_dev)
......
...@@ -158,6 +158,11 @@ void mlx5e_ipsec_build_accel_xfrm_attrs(struct mlx5e_ipsec_sa_entry *sa_entry, ...@@ -158,6 +158,11 @@ void mlx5e_ipsec_build_accel_xfrm_attrs(struct mlx5e_ipsec_sa_entry *sa_entry,
attrs->family = x->props.family; attrs->family = x->props.family;
attrs->type = x->xso.type; attrs->type = x->xso.type;
attrs->reqid = x->props.reqid; attrs->reqid = x->props.reqid;
attrs->upspec.dport = ntohs(x->sel.dport);
attrs->upspec.dport_mask = ntohs(x->sel.dport_mask);
attrs->upspec.sport = ntohs(x->sel.sport);
attrs->upspec.sport_mask = ntohs(x->sel.sport_mask);
attrs->upspec.proto = x->sel.proto;
mlx5e_ipsec_init_limits(sa_entry, attrs); mlx5e_ipsec_init_limits(sa_entry, attrs);
} }
...@@ -221,6 +226,13 @@ static int mlx5e_xfrm_validate_state(struct mlx5_core_dev *mdev, ...@@ -221,6 +226,13 @@ static int mlx5e_xfrm_validate_state(struct mlx5_core_dev *mdev,
NL_SET_ERR_MSG_MOD(extack, "Cannot offload xfrm states with geniv other than seqiv"); NL_SET_ERR_MSG_MOD(extack, "Cannot offload xfrm states with geniv other than seqiv");
return -EINVAL; return -EINVAL;
} }
if (x->sel.proto != IPPROTO_IP &&
(x->sel.proto != IPPROTO_UDP || x->xso.dir != XFRM_DEV_OFFLOAD_OUT)) {
NL_SET_ERR_MSG_MOD(extack, "Device does not support upper protocol other than UDP, and only Tx direction");
return -EINVAL;
}
switch (x->xso.type) { switch (x->xso.type) {
case XFRM_DEV_OFFLOAD_CRYPTO: case XFRM_DEV_OFFLOAD_CRYPTO:
if (!(mlx5_ipsec_device_caps(mdev) & MLX5_IPSEC_CAP_CRYPTO)) { if (!(mlx5_ipsec_device_caps(mdev) & MLX5_IPSEC_CAP_CRYPTO)) {
...@@ -517,6 +529,12 @@ static int mlx5e_xfrm_validate_policy(struct xfrm_policy *x, ...@@ -517,6 +529,12 @@ static int mlx5e_xfrm_validate_policy(struct xfrm_policy *x,
return -EINVAL; return -EINVAL;
} }
if (x->selector.proto != IPPROTO_IP &&
(x->selector.proto != IPPROTO_UDP || x->xdo.dir != XFRM_DEV_OFFLOAD_OUT)) {
NL_SET_ERR_MSG_MOD(extack, "Device does not support upper protocol other than UDP, and only Tx direction");
return -EINVAL;
}
return 0; return 0;
} }
...@@ -537,6 +555,11 @@ mlx5e_ipsec_build_accel_pol_attrs(struct mlx5e_ipsec_pol_entry *pol_entry, ...@@ -537,6 +555,11 @@ mlx5e_ipsec_build_accel_pol_attrs(struct mlx5e_ipsec_pol_entry *pol_entry,
attrs->action = x->action; attrs->action = x->action;
attrs->type = XFRM_DEV_OFFLOAD_PACKET; attrs->type = XFRM_DEV_OFFLOAD_PACKET;
attrs->reqid = x->xfrm_vec[0].reqid; attrs->reqid = x->xfrm_vec[0].reqid;
attrs->upspec.dport = ntohs(sel->dport);
attrs->upspec.dport_mask = ntohs(sel->dport_mask);
attrs->upspec.sport = ntohs(sel->sport);
attrs->upspec.sport_mask = ntohs(sel->sport_mask);
attrs->upspec.proto = sel->proto;
} }
static int mlx5e_xfrm_add_policy(struct xfrm_policy *x, static int mlx5e_xfrm_add_policy(struct xfrm_policy *x,
......
...@@ -52,6 +52,14 @@ struct aes_gcm_keymat { ...@@ -52,6 +52,14 @@ struct aes_gcm_keymat {
u32 aes_key[256 / 32]; u32 aes_key[256 / 32];
}; };
struct upspec {
u16 dport;
u16 dport_mask;
u16 sport;
u16 sport_mask;
u8 proto;
};
struct mlx5_accel_esp_xfrm_attrs { struct mlx5_accel_esp_xfrm_attrs {
u32 esn; u32 esn;
u32 spi; u32 spi;
...@@ -68,6 +76,7 @@ struct mlx5_accel_esp_xfrm_attrs { ...@@ -68,6 +76,7 @@ struct mlx5_accel_esp_xfrm_attrs {
__be32 a6[4]; __be32 a6[4];
} daddr; } daddr;
struct upspec upspec;
u8 dir : 2; u8 dir : 2;
u8 esn_overlap : 1; u8 esn_overlap : 1;
u8 esn_trigger : 1; u8 esn_trigger : 1;
...@@ -181,6 +190,7 @@ struct mlx5_accel_pol_xfrm_attrs { ...@@ -181,6 +190,7 @@ struct mlx5_accel_pol_xfrm_attrs {
__be32 a6[4]; __be32 a6[4];
} daddr; } daddr;
struct upspec upspec;
u8 family; u8 family;
u8 action; u8 action;
u8 type : 2; u8 type : 2;
......
...@@ -467,6 +467,27 @@ static void setup_fte_reg_c0(struct mlx5_flow_spec *spec, u32 reqid) ...@@ -467,6 +467,27 @@ static void setup_fte_reg_c0(struct mlx5_flow_spec *spec, u32 reqid)
misc_parameters_2.metadata_reg_c_0, reqid); misc_parameters_2.metadata_reg_c_0, reqid);
} }
static void setup_fte_upper_proto_match(struct mlx5_flow_spec *spec, struct upspec *upspec)
{
if (upspec->proto != IPPROTO_UDP)
return;
spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS;
MLX5_SET_TO_ONES(fte_match_set_lyr_2_4, spec->match_criteria, ip_protocol);
MLX5_SET(fte_match_set_lyr_2_4, spec->match_value, ip_protocol, upspec->proto);
if (upspec->dport) {
MLX5_SET(fte_match_set_lyr_2_4, spec->match_criteria, udp_dport,
upspec->dport_mask);
MLX5_SET(fte_match_set_lyr_2_4, spec->match_value, udp_dport, upspec->dport);
}
if (upspec->sport) {
MLX5_SET(fte_match_set_lyr_2_4, spec->match_criteria, udp_dport,
upspec->sport_mask);
MLX5_SET(fte_match_set_lyr_2_4, spec->match_value, udp_dport, upspec->sport);
}
}
static int setup_modify_header(struct mlx5_core_dev *mdev, u32 val, u8 dir, static int setup_modify_header(struct mlx5_core_dev *mdev, u32 val, u8 dir,
struct mlx5_flow_act *flow_act) struct mlx5_flow_act *flow_act)
{ {
...@@ -654,6 +675,7 @@ static int tx_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry) ...@@ -654,6 +675,7 @@ static int tx_add_rule(struct mlx5e_ipsec_sa_entry *sa_entry)
setup_fte_addr6(spec, attrs->saddr.a6, attrs->daddr.a6); setup_fte_addr6(spec, attrs->saddr.a6, attrs->daddr.a6);
setup_fte_no_frags(spec); setup_fte_no_frags(spec);
setup_fte_upper_proto_match(spec, &attrs->upspec);
switch (attrs->type) { switch (attrs->type) {
case XFRM_DEV_OFFLOAD_CRYPTO: case XFRM_DEV_OFFLOAD_CRYPTO:
...@@ -728,6 +750,7 @@ static int tx_add_policy(struct mlx5e_ipsec_pol_entry *pol_entry) ...@@ -728,6 +750,7 @@ static int tx_add_policy(struct mlx5e_ipsec_pol_entry *pol_entry)
setup_fte_addr6(spec, attrs->saddr.a6, attrs->daddr.a6); setup_fte_addr6(spec, attrs->saddr.a6, attrs->daddr.a6);
setup_fte_no_frags(spec); setup_fte_no_frags(spec);
setup_fte_upper_proto_match(spec, &attrs->upspec);
err = setup_modify_header(mdev, attrs->reqid, XFRM_DEV_OFFLOAD_OUT, err = setup_modify_header(mdev, attrs->reqid, XFRM_DEV_OFFLOAD_OUT,
&flow_act); &flow_act);
......
...@@ -1470,6 +1470,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c, ...@@ -1470,6 +1470,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c,
sq->mkey_be = c->mkey_be; sq->mkey_be = c->mkey_be;
sq->netdev = c->netdev; sq->netdev = c->netdev;
sq->mdev = c->mdev; sq->mdev = c->mdev;
sq->channel = c;
sq->priv = c->priv; sq->priv = c->priv;
sq->ch_ix = c->ix; sq->ch_ix = c->ix;
sq->txq_ix = txq_ix; sq->txq_ix = txq_ix;
...@@ -2482,8 +2483,6 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c) ...@@ -2482,8 +2483,6 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c)
mlx5e_activate_xsk(c); mlx5e_activate_xsk(c);
else else
mlx5e_activate_rq(&c->rq); mlx5e_activate_rq(&c->rq);
mlx5e_trigger_napi_icosq(c);
} }
static void mlx5e_deactivate_channel(struct mlx5e_channel *c) static void mlx5e_deactivate_channel(struct mlx5e_channel *c)
...@@ -2575,13 +2574,19 @@ int mlx5e_open_channels(struct mlx5e_priv *priv, ...@@ -2575,13 +2574,19 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,
return err; return err;
} }
static void mlx5e_activate_channels(struct mlx5e_channels *chs) static void mlx5e_activate_channels(struct mlx5e_priv *priv, struct mlx5e_channels *chs)
{ {
int i; int i;
for (i = 0; i < chs->num; i++) for (i = 0; i < chs->num; i++)
mlx5e_activate_channel(chs->c[i]); mlx5e_activate_channel(chs->c[i]);
if (priv->htb)
mlx5e_qos_activate_queues(priv);
for (i = 0; i < chs->num; i++)
mlx5e_trigger_napi_icosq(chs->c[i]);
if (chs->ptp) if (chs->ptp)
mlx5e_ptp_activate_channel(chs->ptp); mlx5e_ptp_activate_channel(chs->ptp);
} }
...@@ -2888,9 +2893,7 @@ static void mlx5e_build_txq_maps(struct mlx5e_priv *priv) ...@@ -2888,9 +2893,7 @@ static void mlx5e_build_txq_maps(struct mlx5e_priv *priv)
void mlx5e_activate_priv_channels(struct mlx5e_priv *priv) void mlx5e_activate_priv_channels(struct mlx5e_priv *priv)
{ {
mlx5e_build_txq_maps(priv); mlx5e_build_txq_maps(priv);
mlx5e_activate_channels(&priv->channels); mlx5e_activate_channels(priv, &priv->channels);
if (priv->htb)
mlx5e_qos_activate_queues(priv);
mlx5e_xdp_tx_enable(priv); mlx5e_xdp_tx_enable(priv);
/* dev_watchdog() wants all TX queues to be started when the carrier is /* dev_watchdog() wants all TX queues to be started when the carrier is
......
...@@ -172,6 +172,7 @@ enum mlx5_ptys_rate { ...@@ -172,6 +172,7 @@ enum mlx5_ptys_rate {
MLX5_PTYS_RATE_EDR = 1 << 5, MLX5_PTYS_RATE_EDR = 1 << 5,
MLX5_PTYS_RATE_HDR = 1 << 6, MLX5_PTYS_RATE_HDR = 1 << 6,
MLX5_PTYS_RATE_NDR = 1 << 7, MLX5_PTYS_RATE_NDR = 1 << 7,
MLX5_PTYS_RATE_XDR = 1 << 8,
}; };
static inline int mlx5_ptys_rate_enum_to_int(enum mlx5_ptys_rate rate) static inline int mlx5_ptys_rate_enum_to_int(enum mlx5_ptys_rate rate)
...@@ -185,6 +186,7 @@ static inline int mlx5_ptys_rate_enum_to_int(enum mlx5_ptys_rate rate) ...@@ -185,6 +186,7 @@ static inline int mlx5_ptys_rate_enum_to_int(enum mlx5_ptys_rate rate)
case MLX5_PTYS_RATE_EDR: return 25000; case MLX5_PTYS_RATE_EDR: return 25000;
case MLX5_PTYS_RATE_HDR: return 50000; case MLX5_PTYS_RATE_HDR: return 50000;
case MLX5_PTYS_RATE_NDR: return 100000; case MLX5_PTYS_RATE_NDR: return 100000;
case MLX5_PTYS_RATE_XDR: return 200000;
default: return -1; default: return -1;
} }
} }
......
...@@ -22,7 +22,7 @@ static int type_show(struct seq_file *file, void *priv) ...@@ -22,7 +22,7 @@ static int type_show(struct seq_file *file, void *priv)
struct mlx5_lag *ldev; struct mlx5_lag *ldev;
char *mode = NULL; char *mode = NULL;
ldev = dev->priv.lag; ldev = mlx5_lag_dev(dev);
mutex_lock(&ldev->lock); mutex_lock(&ldev->lock);
if (__mlx5_lag_is_active(ldev)) if (__mlx5_lag_is_active(ldev))
mode = get_str_mode_type(ldev); mode = get_str_mode_type(ldev);
...@@ -41,7 +41,7 @@ static int port_sel_mode_show(struct seq_file *file, void *priv) ...@@ -41,7 +41,7 @@ static int port_sel_mode_show(struct seq_file *file, void *priv)
int ret = 0; int ret = 0;
char *mode; char *mode;
ldev = dev->priv.lag; ldev = mlx5_lag_dev(dev);
mutex_lock(&ldev->lock); mutex_lock(&ldev->lock);
if (__mlx5_lag_is_active(ldev)) if (__mlx5_lag_is_active(ldev))
mode = mlx5_get_str_port_sel_mode(ldev->mode, ldev->mode_flags); mode = mlx5_get_str_port_sel_mode(ldev->mode, ldev->mode_flags);
...@@ -61,7 +61,7 @@ static int state_show(struct seq_file *file, void *priv) ...@@ -61,7 +61,7 @@ static int state_show(struct seq_file *file, void *priv)
struct mlx5_lag *ldev; struct mlx5_lag *ldev;
bool active; bool active;
ldev = dev->priv.lag; ldev = mlx5_lag_dev(dev);
mutex_lock(&ldev->lock); mutex_lock(&ldev->lock);
active = __mlx5_lag_is_active(ldev); active = __mlx5_lag_is_active(ldev);
mutex_unlock(&ldev->lock); mutex_unlock(&ldev->lock);
...@@ -77,7 +77,7 @@ static int flags_show(struct seq_file *file, void *priv) ...@@ -77,7 +77,7 @@ static int flags_show(struct seq_file *file, void *priv)
bool shared_fdb; bool shared_fdb;
bool lag_active; bool lag_active;
ldev = dev->priv.lag; ldev = mlx5_lag_dev(dev);
mutex_lock(&ldev->lock); mutex_lock(&ldev->lock);
lag_active = __mlx5_lag_is_active(ldev); lag_active = __mlx5_lag_is_active(ldev);
if (!lag_active) if (!lag_active)
...@@ -108,7 +108,7 @@ static int mapping_show(struct seq_file *file, void *priv) ...@@ -108,7 +108,7 @@ static int mapping_show(struct seq_file *file, void *priv)
int num_ports; int num_ports;
int i; int i;
ldev = dev->priv.lag; ldev = mlx5_lag_dev(dev);
mutex_lock(&ldev->lock); mutex_lock(&ldev->lock);
lag_active = __mlx5_lag_is_active(ldev); lag_active = __mlx5_lag_is_active(ldev);
if (lag_active) { if (lag_active) {
...@@ -142,7 +142,7 @@ static int members_show(struct seq_file *file, void *priv) ...@@ -142,7 +142,7 @@ static int members_show(struct seq_file *file, void *priv)
struct mlx5_lag *ldev; struct mlx5_lag *ldev;
int i; int i;
ldev = dev->priv.lag; ldev = mlx5_lag_dev(dev);
mutex_lock(&ldev->lock); mutex_lock(&ldev->lock);
for (i = 0; i < ldev->ports; i++) { for (i = 0; i < ldev->ports; i++) {
if (!ldev->pf[i].dev) if (!ldev->pf[i].dev)
......
...@@ -1187,7 +1187,7 @@ static int __mlx5_lag_dev_add_mdev(struct mlx5_core_dev *dev) ...@@ -1187,7 +1187,7 @@ static int __mlx5_lag_dev_add_mdev(struct mlx5_core_dev *dev)
tmp_dev = mlx5_get_next_phys_dev_lag(dev); tmp_dev = mlx5_get_next_phys_dev_lag(dev);
if (tmp_dev) if (tmp_dev)
ldev = tmp_dev->priv.lag; ldev = mlx5_lag_dev(tmp_dev);
if (!ldev) { if (!ldev) {
ldev = mlx5_lag_dev_alloc(dev); ldev = mlx5_lag_dev_alloc(dev);
...@@ -1386,8 +1386,7 @@ bool mlx5_lag_is_shared_fdb(struct mlx5_core_dev *dev) ...@@ -1386,8 +1386,7 @@ bool mlx5_lag_is_shared_fdb(struct mlx5_core_dev *dev)
spin_lock_irqsave(&lag_lock, flags); spin_lock_irqsave(&lag_lock, flags);
ldev = mlx5_lag_dev(dev); ldev = mlx5_lag_dev(dev);
res = ldev && __mlx5_lag_is_sriov(ldev) && res = ldev && test_bit(MLX5_LAG_MODE_FLAG_SHARED_FDB, &ldev->mode_flags);
test_bit(MLX5_LAG_MODE_FLAG_SHARED_FDB, &ldev->mode_flags);
spin_unlock_irqrestore(&lag_lock, flags); spin_unlock_irqrestore(&lag_lock, flags);
return res; return res;
......
...@@ -50,19 +50,6 @@ struct lag_tracker { ...@@ -50,19 +50,6 @@ struct lag_tracker {
enum netdev_lag_hash hash_type; enum netdev_lag_hash hash_type;
}; };
enum mpesw_op {
MLX5_MPESW_OP_ENABLE,
MLX5_MPESW_OP_DISABLE,
};
struct mlx5_mpesw_work_st {
struct work_struct work;
struct mlx5_lag *lag;
enum mpesw_op op;
struct completion comp;
int result;
};
/* LAG data of a ConnectX card. /* LAG data of a ConnectX card.
* It serves both its phys functions. * It serves both its phys functions.
*/ */
...@@ -124,8 +111,6 @@ int mlx5_activate_lag(struct mlx5_lag *ldev, ...@@ -124,8 +111,6 @@ int mlx5_activate_lag(struct mlx5_lag *ldev,
int mlx5_lag_dev_get_netdev_idx(struct mlx5_lag *ldev, int mlx5_lag_dev_get_netdev_idx(struct mlx5_lag *ldev,
struct net_device *ndev); struct net_device *ndev);
bool mlx5_shared_fdb_supported(struct mlx5_lag *ldev); bool mlx5_shared_fdb_supported(struct mlx5_lag *ldev);
void mlx5_lag_del_mpesw_rule(struct mlx5_core_dev *dev);
int mlx5_lag_add_mpesw_rule(struct mlx5_core_dev *dev);
char *mlx5_get_str_port_sel_mode(enum mlx5_lag_mode mode, unsigned long flags); char *mlx5_get_str_port_sel_mode(enum mlx5_lag_mode mode, unsigned long flags);
void mlx5_infer_tx_enabled(struct lag_tracker *tracker, u8 num_ports, void mlx5_infer_tx_enabled(struct lag_tracker *tracker, u8 num_ports,
......
...@@ -28,13 +28,9 @@ static bool mlx5_lag_multipath_check_prereq(struct mlx5_lag *ldev) ...@@ -28,13 +28,9 @@ static bool mlx5_lag_multipath_check_prereq(struct mlx5_lag *ldev)
bool mlx5_lag_is_multipath(struct mlx5_core_dev *dev) bool mlx5_lag_is_multipath(struct mlx5_core_dev *dev)
{ {
struct mlx5_lag *ldev; struct mlx5_lag *ldev = mlx5_lag_dev(dev);
bool res;
ldev = mlx5_lag_dev(dev);
res = ldev && __mlx5_lag_is_multipath(ldev);
return res; return ldev && __mlx5_lag_is_multipath(ldev);
} }
/** /**
......
...@@ -58,7 +58,7 @@ static void mlx5_mpesw_work(struct work_struct *work) ...@@ -58,7 +58,7 @@ static void mlx5_mpesw_work(struct work_struct *work)
static int mlx5_lag_mpesw_queue_work(struct mlx5_core_dev *dev, static int mlx5_lag_mpesw_queue_work(struct mlx5_core_dev *dev,
enum mpesw_op op) enum mpesw_op op)
{ {
struct mlx5_lag *ldev = dev->priv.lag; struct mlx5_lag *ldev = mlx5_lag_dev(dev);
struct mlx5_mpesw_work_st *work; struct mlx5_mpesw_work_st *work;
int err = 0; int err = 0;
...@@ -96,25 +96,27 @@ int mlx5_lag_add_mpesw_rule(struct mlx5_core_dev *dev) ...@@ -96,25 +96,27 @@ int mlx5_lag_add_mpesw_rule(struct mlx5_core_dev *dev)
return mlx5_lag_mpesw_queue_work(dev, MLX5_MPESW_OP_ENABLE); return mlx5_lag_mpesw_queue_work(dev, MLX5_MPESW_OP_ENABLE);
} }
int mlx5_lag_do_mirred(struct mlx5_core_dev *mdev, struct net_device *out_dev) int mlx5_lag_mpesw_do_mirred(struct mlx5_core_dev *mdev,
struct net_device *out_dev,
struct netlink_ext_ack *extack)
{ {
struct mlx5_lag *ldev = mdev->priv.lag; struct mlx5_lag *ldev = mlx5_lag_dev(mdev);
if (!netif_is_bond_master(out_dev) || !ldev) if (!netif_is_bond_master(out_dev) || !ldev)
return 0; return 0;
if (ldev->mode == MLX5_LAG_MODE_MPESW) if (ldev->mode != MLX5_LAG_MODE_MPESW)
return -EOPNOTSUPP; return 0;
return 0; NL_SET_ERR_MSG_MOD(extack, "can't forward to bond in mpesw mode");
return -EOPNOTSUPP;
} }
bool mlx5_lag_mpesw_is_activated(struct mlx5_core_dev *dev) bool mlx5_lag_mpesw_is_activated(struct mlx5_core_dev *dev)
{ {
bool ret; struct mlx5_lag *ldev = mlx5_lag_dev(dev);
ret = dev->priv.lag && dev->priv.lag->mode == MLX5_LAG_MODE_MPESW; return ldev && ldev->mode == MLX5_LAG_MODE_MPESW;
return ret;
} }
void mlx5_lag_mpesw_init(struct mlx5_lag *ldev) void mlx5_lag_mpesw_init(struct mlx5_lag *ldev)
......
...@@ -12,8 +12,25 @@ struct lag_mpesw { ...@@ -12,8 +12,25 @@ struct lag_mpesw {
atomic_t mpesw_rule_count; atomic_t mpesw_rule_count;
}; };
int mlx5_lag_do_mirred(struct mlx5_core_dev *mdev, struct net_device *out_dev); enum mpesw_op {
MLX5_MPESW_OP_ENABLE,
MLX5_MPESW_OP_DISABLE,
};
struct mlx5_mpesw_work_st {
struct work_struct work;
struct mlx5_lag *lag;
enum mpesw_op op;
struct completion comp;
int result;
};
int mlx5_lag_mpesw_do_mirred(struct mlx5_core_dev *mdev,
struct net_device *out_dev,
struct netlink_ext_ack *extack);
bool mlx5_lag_mpesw_is_activated(struct mlx5_core_dev *dev); bool mlx5_lag_mpesw_is_activated(struct mlx5_core_dev *dev);
void mlx5_lag_del_mpesw_rule(struct mlx5_core_dev *dev);
int mlx5_lag_add_mpesw_rule(struct mlx5_core_dev *dev);
#if IS_ENABLED(CONFIG_MLX5_ESWITCH) #if IS_ENABLED(CONFIG_MLX5_ESWITCH)
void mlx5_lag_mpesw_init(struct mlx5_lag *ldev); void mlx5_lag_mpesw_init(struct mlx5_lag *ldev);
void mlx5_lag_mpesw_cleanup(struct mlx5_lag *ldev); void mlx5_lag_mpesw_cleanup(struct mlx5_lag *ldev);
......
...@@ -362,7 +362,7 @@ static int mlx5_ptp_adjphase(struct ptp_clock_info *ptp, s32 delta) ...@@ -362,7 +362,7 @@ static int mlx5_ptp_adjphase(struct ptp_clock_info *ptp, s32 delta)
return mlx5_ptp_adjtime(ptp, delta); return mlx5_ptp_adjtime(ptp, delta);
} }
static int mlx5_ptp_adjfreq_real_time(struct mlx5_core_dev *mdev, s32 freq) static int mlx5_ptp_freq_adj_real_time(struct mlx5_core_dev *mdev, long scaled_ppm)
{ {
u32 in[MLX5_ST_SZ_DW(mtutc_reg)] = {}; u32 in[MLX5_ST_SZ_DW(mtutc_reg)] = {};
...@@ -370,7 +370,15 @@ static int mlx5_ptp_adjfreq_real_time(struct mlx5_core_dev *mdev, s32 freq) ...@@ -370,7 +370,15 @@ static int mlx5_ptp_adjfreq_real_time(struct mlx5_core_dev *mdev, s32 freq)
return 0; return 0;
MLX5_SET(mtutc_reg, in, operation, MLX5_MTUTC_OPERATION_ADJUST_FREQ_UTC); MLX5_SET(mtutc_reg, in, operation, MLX5_MTUTC_OPERATION_ADJUST_FREQ_UTC);
MLX5_SET(mtutc_reg, in, freq_adjustment, freq);
if (MLX5_CAP_MCAM_FEATURE(mdev, mtutc_freq_adj_units)) {
MLX5_SET(mtutc_reg, in, freq_adj_units,
MLX5_MTUTC_FREQ_ADJ_UNITS_SCALED_PPM);
MLX5_SET(mtutc_reg, in, freq_adjustment, scaled_ppm);
} else {
MLX5_SET(mtutc_reg, in, freq_adj_units, MLX5_MTUTC_FREQ_ADJ_UNITS_PPB);
MLX5_SET(mtutc_reg, in, freq_adjustment, scaled_ppm_to_ppb(scaled_ppm));
}
return mlx5_set_mtutc(mdev, in, sizeof(in)); return mlx5_set_mtutc(mdev, in, sizeof(in));
} }
...@@ -385,7 +393,8 @@ static int mlx5_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) ...@@ -385,7 +393,8 @@ static int mlx5_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
int err; int err;
mdev = container_of(clock, struct mlx5_core_dev, clock); mdev = container_of(clock, struct mlx5_core_dev, clock);
err = mlx5_ptp_adjfreq_real_time(mdev, scaled_ppm_to_ppb(scaled_ppm));
err = mlx5_ptp_freq_adj_real_time(mdev, scaled_ppm);
if (err) if (err)
return err; return err;
......
...@@ -211,7 +211,8 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr, u32 function) ...@@ -211,7 +211,8 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr, u32 function)
n = find_first_bit(&fp->bitmask, 8 * sizeof(fp->bitmask)); n = find_first_bit(&fp->bitmask, 8 * sizeof(fp->bitmask));
if (n >= MLX5_NUM_4K_IN_PAGE) { if (n >= MLX5_NUM_4K_IN_PAGE) {
mlx5_core_warn(dev, "alloc 4k bug\n"); mlx5_core_warn(dev, "alloc 4k bug: fw page = 0x%llx, n = %u, bitmask: %lu, max num of 4K pages: %d\n",
fp->addr, n, fp->bitmask, MLX5_NUM_4K_IN_PAGE);
return -ENOENT; return -ENOENT;
} }
clear_bit(n, &fp->bitmask); clear_bit(n, &fp->bitmask);
......
...@@ -9925,6 +9925,11 @@ struct mlx5_ifc_mpegc_reg_bits { ...@@ -9925,6 +9925,11 @@ struct mlx5_ifc_mpegc_reg_bits {
u8 reserved_at_60[0x100]; u8 reserved_at_60[0x100];
}; };
enum {
MLX5_MTUTC_FREQ_ADJ_UNITS_PPB = 0x0,
MLX5_MTUTC_FREQ_ADJ_UNITS_SCALED_PPM = 0x1,
};
enum { enum {
MLX5_MTUTC_OPERATION_SET_TIME_IMMEDIATE = 0x1, MLX5_MTUTC_OPERATION_SET_TIME_IMMEDIATE = 0x1,
MLX5_MTUTC_OPERATION_ADJUST_TIME = 0x2, MLX5_MTUTC_OPERATION_ADJUST_TIME = 0x2,
...@@ -9932,7 +9937,9 @@ enum { ...@@ -9932,7 +9937,9 @@ enum {
}; };
struct mlx5_ifc_mtutc_reg_bits { struct mlx5_ifc_mtutc_reg_bits {
u8 reserved_at_0[0x1c]; u8 reserved_at_0[0x5];
u8 freq_adj_units[0x3];
u8 reserved_at_8[0x14];
u8 operation[0x4]; u8 operation[0x4];
u8 freq_adjustment[0x20]; u8 freq_adjustment[0x20];
...@@ -10005,7 +10012,8 @@ struct mlx5_ifc_pcam_reg_bits { ...@@ -10005,7 +10012,8 @@ struct mlx5_ifc_pcam_reg_bits {
}; };
struct mlx5_ifc_mcam_enhanced_features_bits { struct mlx5_ifc_mcam_enhanced_features_bits {
u8 reserved_at_0[0x51]; u8 reserved_at_0[0x50];
u8 mtutc_freq_adj_units[0x1];
u8 mtutc_time_adjustment_extended_range[0x1]; u8 mtutc_time_adjustment_extended_range[0x1];
u8 reserved_at_52[0xb]; u8 reserved_at_52[0xb];
u8 mcia_32dwords[0x1]; u8 mcia_32dwords[0x1];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment