Skip to content

devlink: Add port function attribute to enable/disable roce

Daniel Jurgens netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2devlink: Expose port function commands to control roceDocumentation/networking/devlink/devlink-port.rst include/net/devlink.h include/uapi/linux/devlink.h +1 more+86 -11 reply
2/2net/mlx5: E-Switch, Implement devlink port function cmds to control roceDocumentation/networking/device_drivers/ethernet/mellanox/mlx5.rst drivers/net/ethernet/mellanox/mlx5/core/devlink.c drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +4 more+205 -10 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchParav PanditJiri Pirko
1/2R-b R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] devlink: Add port function attribute to enable/disable roce

Currently mlx5 PCI VF and SF are enabled by default for RoCE functionality.

Currently a user does not have the ability to disable RoCE for a PCI VF/SF device before such device is enumerated by the driver.

User is also incapable to do such setting from smartnic scenario for a VF from the smartnic.

Current 'enable_roce' device knob is limited to do setting only at driverinit time. By this time device is already created and firmware has already allocated necessary system memory for supporting RoCE.

This is a hyper visor level control, to restrict the functionality of devices passed through to guests.

This is achieved by extending existing 'port function' object to control capabilities of a function. This enables users to control capability of the device before enumeration.

Examples when user prefers to disable RoCE for a VF when using switchdev mode:

$ devlink port show pci/0000:06:00.0/1
pci/0000:06:00.0/1: type eth netdev pf0vf0 flavour pcivf controller 0
pfnum 0 vfnum 0 external false splittable false
  function:
    hw_addr 00:00:00:00:00:00 roce on
$ devlink port function set pci/0000:06:00.0/1 roce off
$ devlink port show pci/0000:06:00.0/1
pci/0000:06:00.0/1: type eth netdev pf0vf0 flavour pcivf controller 0
pfnum 0 vfnum 0 external false splittable false
  function:
    hw_addr 00:00:00:00:00:00 roce off

FAQs:
-----
1. What does roce on/off do?
Ans: It disables RoCE capability of the function before its enumerated, so when driver reads the capability from the device firmware, it is disabled.
At this point RDMA stack will not be able to create UD, QP1, RC, XRC type of QPs. When RoCE is disabled, the GID table of all ports of the device is disabled in the device and software stack.

2. How is the roce 'port function' option different from existing devlink param?
Ans: RoCE attribute at the port function level disables the RoCE capability at the specific function level; while enable_roce only does at the software level.

3. Why is this option for disabling only RoCE and not the whole RDMA device?
Ans: Because user still wants to use the RDMA device for non RoCE commands in more memory efficient way.

Patch summary:
Patch-1 adds devlink attribute to control roce Patch-2 implements mlx5 callbacks for roce control

Yishai Hadas (2):
devlink: Expose port function commands to control roce net/mlx5: E-Switch, Implement devlink port function cmds to control
roce

 .../device_drivers/ethernet/mellanox/mlx5.rst |  32 ++++++
 .../networking/devlink/devlink-port.rst       |   5 +-
 .../net/ethernet/mellanox/mlx5/core/devlink.c |   2 +
 .../net/ethernet/mellanox/mlx5/core/eswitch.c |  34 ++++++
 .../net/ethernet/mellanox/mlx5/core/eswitch.h |   8 +-
 .../mellanox/mlx5/core/eswitch_offloads.c     | 105 ++++++++++++++++++
 .../ethernet/mellanox/mlx5/core/mlx5_core.h   |   2 +
 .../net/ethernet/mellanox/mlx5/core/vport.c   |  23 ++++
 include/net/devlink.h                         |  20 ++++
 include/uapi/linux/devlink.h                  |   1 +
 net/core/devlink.c                            |  61 ++++++++++
 11 files changed, 291 insertions(+), 2 deletions(-)
Signature · 1 line
2.27.0