[PATCH net-next 0/3] devlink: support the enable_rdma param in runtime cmode for cxgb4, mlx5 and ice

From: Stefan Metzmacher

Date: Mon Nov 30 2026 - 17:10:38 EST


Hi,

today the RDMA function of a NIC can only be detached by unloading
the RDMA driver (iw_cxgb4, mlx5_ib, irdma), which affects all
adapters, or with a devlink reload of enable_rdma in driverinit
cmode, which also unregisters the netdev, so its addresses, routes
and other configuration are lost.

This series adds the runtime cmode of the generic enable_rdma devlink
param to cxgb4, mlx5 and ice:

devlink dev param set pci/0000:03:00.0 name enable_rdma value false cmode runtime

It only unplugs (or plugs again) the RDMA part of the function and
leaves the netdev alone. This is useful e.g. to run a software RDMA
provider (siw or rxe) on the same port, or to test how RDMA
consumers handle a device going away and coming back.

- cxgb4 gets a devlink instance for adapters with offload support,
the param detaches/attaches the RDMA ULD of that adapter (there is
one RDMA device for all ports of an adapter). Disabling it is
refused while user space applications use the RDMA device, as
iw_cxgb4 can't disassociate them.

- mlx5 adds the runtime cmode next to the existing driverinit one,
it unplugs/plugs the RDMA auxiliary device of the function and
disables the RoCE state of the NIC vport again, so RoCEv2 packets
reach the netdev. It's refused in switchdev/multiport mode and
while LAG is active.

- ice adds the runtime cmode next to the existing driverinit one,
unlike setting enable_roce and enable_iwarp to false the selected
RDMA protocol is kept and the auxiliary device stays unplugged
across resets.

For mlx5 and ice enabling it at runtime requires it to be enabled in
driverinit cmode, and a reload resets it to the driverinit value.

A related iw_cxgb4 change, which reuses the uld context when attached
again, is sent separately to linux-rdma.

These patches were developed with the help of Claude (Anthropic),
which was used for code analysis, writing parts of the code and the
commit messages. I reviewed all changes and take full responsibility
for them.

Testing: the series is part of the kernel of our RDMA test setup since
v7.4-rc1, currently v7.4-rc4 based, two hosts with Chelsio T520-BT
(cxgb4/iw_cxgb4), ConnectX (mlx5) and Intel E810 (ice/irdma). Its
setup scripts use the runtime cmode regularly to detach and attach the
hardware RDMA of the cxgb4 and mlx5 ports, e.g. to use siw or rxe on
the same port instead. For ice the off/on cycle was done on the
v7.4-rc4 based kernel on both PFs, one in RoCEv2 and one in iWARP mode:
the irdma device went away and came back, the netdev kept its addresses
and routes, and the RDMA device was usable again (SMB over RDMA with
RoCEv2, rping with iWARP). On netdev-next/main the series was only
build tested.

Base: netdev-next/main (02e8a63b4685)

Stefan Metzmacher (3):
cxgb4: support the enable_rdma devlink param in runtime cmode
net/mlx5: support the enable_rdma devlink param in runtime cmode
ice: support the enable_rdma devlink param in runtime cmode

Documentation/networking/devlink/cxgb4.rst | 31 +++++++
Documentation/networking/devlink/ice.rst | 7 ++
Documentation/networking/devlink/index.rst | 1 +
Documentation/networking/devlink/mlx5.rst | 11 +++
drivers/infiniband/hw/cxgb4/device.c | 1 +
drivers/net/ethernet/chelsio/Kconfig | 1 +
drivers/net/ethernet/chelsio/cxgb4/Makefile | 2 +-
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 7 ++
.../ethernet/chelsio/cxgb4/cxgb4_devlink.c | 93 +++++++++++++++++++
.../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 6 ++
.../net/ethernet/chelsio/cxgb4/cxgb4_uld.c | 74 +++++++++++++++
.../net/ethernet/chelsio/cxgb4/cxgb4_uld.h | 2 +
.../net/ethernet/intel/ice/devlink/devlink.c | 66 ++++++++++++-
drivers/net/ethernet/intel/ice/ice.h | 1 +
drivers/net/ethernet/intel/ice/ice_idc.c | 5 +-
drivers/net/ethernet/mellanox/mlx5/core/dev.c | 10 +-
.../net/ethernet/mellanox/mlx5/core/devlink.c | 70 +++++++++++++-
.../ethernet/mellanox/mlx5/core/mlx5_core.h | 1 +
include/linux/mlx5/driver.h | 2 +
19 files changed, 383 insertions(+), 8 deletions(-)
create mode 100644 Documentation/networking/devlink/cxgb4.rst
create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_devlink.c

--
2.43.0