OSDN Git Service

net/mlx5: Lag, add debugfs to query hardware lag state
authorMark Bloch <mbloch@nvidia.com>
Tue, 15 Mar 2022 16:56:50 +0000 (16:56 +0000)
committerSaeed Mahameed <saeedm@nvidia.com>
Tue, 10 May 2022 05:54:04 +0000 (22:54 -0700)
commit7f46a0b7327ae261f9981888708dbca22c283900
tree2f85a28934d8250d6ab7063a9e94cfaea62a5db6
parent352899f384d4aefa77ede6310d08c1b515612a8f
net/mlx5: Lag, add debugfs to query hardware lag state

Lag state has become very complicated with many modes, flags, types and
port selections methods and future work will add additional features.

Add a debugfs to query the current lag state. A new directory named "lag"
will be created under the mlx5 debugfs directory. As the driver has
debugfs per pci function the location will be: <debugfs>/mlx5/<BDF>/lag

For example:
/sys/kernel/debug/mlx5/0000:08:00.0/lag

The following files are exposed:

- state: Returns "active" or "disabled". If "active" it means hardware
         lag is active.

- members: Returns the BDFs of all the members of lag object.

- type: Returns the type of the lag currently configured. Valid only
if hardware lag is active.
* "roce" - Members are bare metal PFs.
* "switchdev" - Members are in switchdev mode.
* "multipath" - ECMP offloads.

- port_sel_mode: Returns the egress port selection method, valid
 only if hardware lag is active.
 * "queue_affinity" - Egress port is selected by
   the QP/SQ affinity.
 * "hash" - Egress port is selected by hash done on
   each packet. Controlled by: xmit_hash_policy of the
   bond device.
- flags: Returns flags that are specific per lag @type. Valid only if
 hardware lag is active.
 * "shared_fdb" - "on" or "off", if "on" single FDB is used.

- mapping: Returns the mapping which is used to select egress port.
   Valid only if hardware lag is active.
   If @port_sel_mode is "hash" returns the active egress ports.
   The hash result will select only active ports.
   if @port_sel_mode is "queue_affinity" returns the mapping
   between the configured port affinity of the QP/SQ and actual
   egress port. For example:
   * 1:1 - Mapping means if the configured affinity is port 1
           traffic will egress via port 1.
   * 1:2 - Mapping means if the configured affinity is port 1
   traffic will egress via port 2. This can happen
   if port 1 is down or in active/backup mode and port 1
   is backup.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/Makefile
drivers/net/ethernet/mellanox/mlx5/core/lag/debugfs.c [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.h
include/linux/mlx5/driver.h