Linux Documentation
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] devlink: support the enable_rdma param in runtime cmode for cxgb4, mlx5 and ice
@ 2026-11-30 22:09 Stefan Metzmacher
  2026-11-30 22:09 ` [PATCH net-next 1/3] cxgb4: support the enable_rdma devlink param in runtime cmode Stefan Metzmacher
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Metzmacher @ 2026-11-30 22:09 UTC (permalink / raw)
  To: netdev
  Cc: metze, Jiri Pirko, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Willem de Bruijn, Andrew Lunn,
	Potnuri Bharat Teja, Jason Gunthorpe, Tony Nguyen,
	Przemek Kitszel, Tatyana Nikolova, Jacob Moroni, Saeed Mahameed,
	Tariq Toukan, Mark Bloch, Leon Romanovsky, Jonathan Corbet,
	intel-wired-lan, linux-rdma, linux-doc, linux-kernel, Shuah Khan,
	Randy Dunlap

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/3] cxgb4: support the enable_rdma devlink param in runtime cmode
  2026-11-30 22:09 [PATCH net-next 0/3] devlink: support the enable_rdma param in runtime cmode for cxgb4, mlx5 and ice Stefan Metzmacher
@ 2026-11-30 22:09 ` Stefan Metzmacher
  2026-11-30 22:09 ` [PATCH net-next 2/3] net/mlx5: " Stefan Metzmacher
  2026-11-30 22:10 ` [PATCH net-next 3/3] ice: " Stefan Metzmacher
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Metzmacher @ 2026-11-30 22:09 UTC (permalink / raw)
  To: netdev
  Cc: metze, Potnuri Bharat Teja, Jason Gunthorpe, Leon Romanovsky,
	linux-rdma, linux-kernel, Jiri Pirko, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
	Willem de Bruijn, Jonathan Corbet, Shuah Khan, Randy Dunlap,
	Andrew Lunn, linux-doc

The RDMA upper layer driver (iw_cxgb4) can only be detached from an
adapter by unloading iw_cxgb4, which affects all adapters. This is
needed e.g. to use siw on the ports of the adapter instead.

Register a devlink instance for adapters with offload support, with
the generic enable_rdma param in runtime cmode:

  devlink dev param set pci/0000:08:00.4 name enable_rdma \
          value false cmode runtime

This detaches the RDMA ULD from this adapter, like unloading
iw_cxgb4, but only for this adapter, the netdevs and their
configuration stay. While disabled, loading iw_cxgb4 doesn't attach it
to this adapter. Enabling it attaches the RDMA ULD again if iw_cxgb4
is loaded, otherwise iw_cxgb4 attaches once it's loaded. If attaching
fails, -EIO is returned and the param stays false.

iw_cxgb4 can't disassociate user contexts, so ib_unregister_device()
would wait until all user space applications closed the RDMA device,
while holding uld_mutex, which blocks all adapters. So disabling is
refused with -EBUSY while iw_cxgb4 is in use, like unloading it. For
that iw_cxgb4 sets the new owner field of struct cxgb4_uld_info. The
module refcount covers the RDMA devices of all adapters, so an
application using the RDMA device of another adapter also makes
disabling fail.

Without "RDMA/cxgb4: reuse the uld context when attached to an adapter
again", sent separately to linux-rdma, every disable/enable cycle leaks
a uld context of iw_cxgb4 until iw_cxgb4 is unloaded.

There's one RDMA device for all ports of an adapter, so it can't be
done per port.

Cc: Potnuri Bharat Teja <bharat@chelsio.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: netdev@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
---
 Documentation/networking/devlink/cxgb4.rst    | 31 +++++++
 Documentation/networking/devlink/index.rst    |  1 +
 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 +
 10 files changed, 217 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/networking/devlink/cxgb4.rst
 create mode 100644 drivers/net/ethernet/chelsio/cxgb4/cxgb4_devlink.c

diff --git a/Documentation/networking/devlink/cxgb4.rst b/Documentation/networking/devlink/cxgb4.rst
new file mode 100644
index 000000000000..13323b45f1a2
--- /dev/null
+++ b/Documentation/networking/devlink/cxgb4.rst
@@ -0,0 +1,31 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+=====================
+cxgb4 devlink support
+=====================
+
+This document describes the devlink features implemented by the ``cxgb4``
+device driver.
+
+Parameters
+==========
+
+.. list-table:: Generic parameters implemented
+   :widths: 5 5 90
+
+   * - Name
+     - Mode
+     - Notes
+   * - ``enable_rdma``
+     - runtime
+     - Controls whether the RDMA upper layer driver (iw_cxgb4) is attached
+       to the adapter. Disabling it has the same effect as unloading
+       iw_cxgb4, but only for this adapter, the netdevs and their
+       configuration stay. There's one RDMA device for all ports of the
+       adapter. If iw_cxgb4 isn't loaded, enabling it lets iw_cxgb4 attach
+       once it's loaded. Disabling it is refused while user space
+       applications use an RDMA device of iw_cxgb4, as iw_cxgb4 can't detach
+       them, also if they use the RDMA device of another adapter; an
+       application opening the device during the detach makes it wait until
+       the device is closed. Only available for adapters with offload
+       support.
diff --git a/Documentation/networking/devlink/index.rst b/Documentation/networking/devlink/index.rst
index be0d59cbaa3c..9e8e45e94f60 100644
--- a/Documentation/networking/devlink/index.rst
+++ b/Documentation/networking/devlink/index.rst
@@ -81,6 +81,7 @@ parameters, info versions, and other features it supports.
 
    am65-nuss-cpsw-switch
    bnxt
+   cxgb4
    etas_es58x
    hns3
    i40e
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index 24ac9871ce67..43d1c76a43f7 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -1503,6 +1503,7 @@ static int c4iw_uld_control(void *handle, enum cxgb4_control control, ...)
 
 static struct cxgb4_uld_info c4iw_uld_info = {
 	.name = DRV_NAME,
+	.owner = THIS_MODULE,
 	.nrxq = MAX_ULD_QSETS,
 	.ntxq = MAX_ULD_QSETS,
 	.rxq_size = 511,
diff --git a/drivers/net/ethernet/chelsio/Kconfig b/drivers/net/ethernet/chelsio/Kconfig
index 96d7779cd2f0..1e2927ec25b3 100644
--- a/drivers/net/ethernet/chelsio/Kconfig
+++ b/drivers/net/ethernet/chelsio/Kconfig
@@ -72,6 +72,7 @@ config CHELSIO_T4
 	depends on PTP_1588_CLOCK_OPTIONAL
 	select FW_LOADER
 	select MDIO
+	select NET_DEVLINK
 	select ZLIB_DEFLATE
 	help
 	  This driver supports Chelsio T4, T5 & T6 based gigabit, 10Gb Ethernet
diff --git a/drivers/net/ethernet/chelsio/cxgb4/Makefile b/drivers/net/ethernet/chelsio/cxgb4/Makefile
index a4b4d475abf8..3b73ada29ce7 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/Makefile
+++ b/drivers/net/ethernet/chelsio/cxgb4/Makefile
@@ -9,7 +9,7 @@ cxgb4-objs := cxgb4_main.o l2t.o smt.o t4_hw.o sge.o clip_tbl.o cxgb4_ethtool.o
 	      cxgb4_uld.o srq.o sched.o cxgb4_filter.o cxgb4_tc_u32.o \
 	      cxgb4_ptp.o cxgb4_tc_flower.o cxgb4_cudbg.o cxgb4_mps.o \
 	      cudbg_common.o cudbg_lib.o cudbg_zlib.o cxgb4_tc_mqprio.o \
-	      cxgb4_tc_matchall.o
+	      cxgb4_tc_matchall.o cxgb4_devlink.o
 cxgb4-$(CONFIG_CHELSIO_T4_DCB) +=  cxgb4_dcb.o
 cxgb4-$(CONFIG_CHELSIO_T4_FCOE) +=  cxgb4_fcoe.o
 cxgb4-$(CONFIG_DEBUG_FS) += cxgb4_debugfs.o
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index f20f4bc58492..c1115a6330ee 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -1018,6 +1018,7 @@ struct sge {
 #define for_each_ofldtxq(sge, i) for (i = 0; i < (sge)->ofldqsets; i++)
 
 struct l2t_data;
+struct devlink;
 
 #ifdef CONFIG_PCI_IOV
 
@@ -1151,6 +1152,9 @@ struct adapter {
 	unsigned int num_uld;
 	unsigned int num_ofld_uld;
 	struct list_head list_node;
+	struct devlink *devlink;
+	/* the RDMA ULD is detached, see cxgb4_uld_set_rdma() */
+	bool rdma_disabled;
 	struct list_head rcu_node;
 	struct list_head mac_hlist; /* list of MAC addresses in MPS Hash */
 	struct list_head mps_ref;
@@ -2088,6 +2092,9 @@ void t4_tp_mib_read(struct adapter *adap, u32 *buff, u32 nregs,
 void t4_uld_mem_free(struct adapter *adap);
 int t4_uld_mem_alloc(struct adapter *adap);
 void t4_uld_clean_up(struct adapter *adap);
+int cxgb4_uld_set_rdma(struct adapter *adap, bool enable);
+int cxgb4_devlink_register(struct adapter *adap);
+void cxgb4_devlink_unregister(struct adapter *adap);
 void t4_register_netevent_notifier(void);
 int t4_i2c_rd(struct adapter *adap, unsigned int mbox, int port,
 	      unsigned int devid, unsigned int offset,
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_devlink.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_devlink.c
new file mode 100644
index 000000000000..e0d0500cac4f
--- /dev/null
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_devlink.c
@@ -0,0 +1,93 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * devlink support for cxgb4
+ */
+
+#include <net/devlink.h>
+
+#include "cxgb4.h"
+
+struct cxgb4_devlink {
+	struct adapter *adap;
+};
+
+static const struct devlink_ops cxgb4_devlink_ops = {
+};
+
+static int cxgb4_devlink_enable_rdma_get(struct devlink *devlink, u32 id,
+					 struct devlink_param_gset_ctx *ctx,
+					 struct netlink_ext_ack *extack)
+{
+	struct cxgb4_devlink *priv = devlink_priv(devlink);
+
+	ctx->val.vbool = !priv->adap->rdma_disabled;
+
+	return 0;
+}
+
+/*
+ * The RDMA ULD (iw_cxgb4) is detached or attached again for this
+ * adapter, which has the same effect as unloading or loading iw_cxgb4,
+ * but the other adapters and the netdevs stay. There's one RDMA device
+ * for all ports of the adapter.
+ */
+static int cxgb4_devlink_enable_rdma_set(struct devlink *devlink, u32 id,
+					 struct devlink_param_gset_ctx *ctx,
+					 struct netlink_ext_ack *extack)
+{
+	struct cxgb4_devlink *priv = devlink_priv(devlink);
+	int ret;
+
+	ret = cxgb4_uld_set_rdma(priv->adap, ctx->val.vbool);
+	if (ret == -EBUSY)
+		NL_SET_ERR_MSG_MOD(extack,
+				   "The RDMA device is in use by user space applications");
+	return ret;
+}
+
+static const struct devlink_param cxgb4_devlink_params[] = {
+	DEVLINK_PARAM_GENERIC(ENABLE_RDMA, BIT(DEVLINK_PARAM_CMODE_RUNTIME),
+			      cxgb4_devlink_enable_rdma_get,
+			      cxgb4_devlink_enable_rdma_set, NULL),
+};
+
+int cxgb4_devlink_register(struct adapter *adap)
+{
+	struct cxgb4_devlink *priv;
+	struct devlink *devlink;
+	int ret;
+
+	devlink = devlink_alloc(&cxgb4_devlink_ops, sizeof(*priv),
+				adap->pdev_dev);
+	if (!devlink)
+		return -ENOMEM;
+
+	priv = devlink_priv(devlink);
+	priv->adap = adap;
+
+	ret = devlink_params_register(devlink, cxgb4_devlink_params,
+				      ARRAY_SIZE(cxgb4_devlink_params));
+	if (ret) {
+		devlink_free(devlink);
+		return ret;
+	}
+
+	devlink_register(devlink);
+	adap->devlink = devlink;
+
+	return 0;
+}
+
+void cxgb4_devlink_unregister(struct adapter *adap)
+{
+	struct devlink *devlink = adap->devlink;
+
+	if (!devlink)
+		return;
+
+	devlink_unregister(devlink);
+	devlink_params_unregister(devlink, cxgb4_devlink_params,
+				  ARRAY_SIZE(cxgb4_devlink_params));
+	devlink_free(devlink);
+	adap->devlink = NULL;
+}
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index e21162a86f38..d4fdd5fbeb34 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -7033,6 +7033,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (is_uld(adapter))
 		cxgb4_uld_enable(adapter);
 
+	if (is_offload(adapter) && cxgb4_devlink_register(adapter))
+		dev_warn(&pdev->dev, "could not register devlink\n");
+
 	if (!is_t4(adapter->params.chip))
 		cxgb4_ptp_init(adapter);
 
@@ -7088,6 +7091,9 @@ static void remove_one(struct pci_dev *pdev)
 	if (adapter->pf == 4) {
 		int i;
 
+		/* no more changes of enable_rdma */
+		cxgb4_devlink_unregister(adapter);
+
 		/* Tear down per-adapter Work Queue first since it can contain
 		 * references to our adapter data structure.
 		 */
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
index 23244cdfc1bc..f66899b4f932 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
@@ -732,6 +732,8 @@ static void cxgb4_uld_alloc_resources(struct adapter *adap,
 		return;
 	if (type == CXGB4_ULD_ISCSIT && is_t4(adap->params.chip))
 		return;
+	if (type == CXGB4_ULD_RDMA && adap->rdma_disabled)
+		return;
 	ret = cfg_queues_uld(adap, type, p);
 	if (ret)
 		goto out;
@@ -771,6 +773,78 @@ static void cxgb4_uld_alloc_resources(struct adapter *adap,
 		 "ULD registration failed for uld type %d\n", type);
 }
 
+/**
+ * cxgb4_uld_set_rdma - detach or attach the RDMA ULD of an adapter
+ * @adap: the adapter
+ * @enable: attach (true) or detach (false) the RDMA ULD
+ *
+ * Detaching has the same effect as unloading iw_cxgb4, but only for
+ * this adapter, the netdevs stay. While detached, loading iw_cxgb4
+ * doesn't attach it to this adapter. If iw_cxgb4 isn't loaded,
+ * attaching only allows it to attach once it's loaded. Used for the
+ * enable_rdma devlink param.
+ *
+ * iw_cxgb4 doesn't support disassociating user contexts, so detaching
+ * waits in ib_unregister_device() until all user space applications
+ * closed the RDMA device, while holding uld_mutex. So detaching is
+ * refused with -EBUSY while iw_cxgb4 is in use, like unloading it. The
+ * module refcount covers the RDMA devices of all adapters, so an
+ * application using the RDMA device of another adapter also makes
+ * detaching fail. An application opening the device right after that
+ * check still makes detaching wait until it's closed.
+ */
+int cxgb4_uld_set_rdma(struct adapter *adap, bool enable)
+{
+	struct cxgb4_uld_list *uld_entry;
+	int ret = 0;
+
+	if (!is_offload(adap))
+		return -EOPNOTSUPP;
+
+	mutex_lock(&uld_mutex);
+	if (adap->flags & CXGB4_SHUTTING_DOWN) {
+		ret = -ESHUTDOWN;
+		goto out;
+	}
+	if (adap->rdma_disabled == !enable)
+		goto out;
+
+	if (!enable && adap->uld[CXGB4_ULD_RDMA].handle) {
+		list_for_each_entry(uld_entry, &uld_list, list_node) {
+			struct module *owner = uld_entry->uld_info.owner;
+
+			if (uld_entry->uld_type == CXGB4_ULD_RDMA &&
+			    owner && module_refcount(owner) > 0) {
+				ret = -EBUSY;
+				goto out;
+			}
+		}
+	}
+	adap->rdma_disabled = !enable;
+
+	if (!enable) {
+		if (adap->uld[CXGB4_ULD_RDMA].handle)
+			adap->uld[CXGB4_ULD_RDMA].state_change(adap->uld[CXGB4_ULD_RDMA].handle,
+							       CXGB4_STATE_DETACH);
+		cxgb4_shutdown_uld_adapter(adap, CXGB4_ULD_RDMA);
+		goto out;
+	}
+
+	list_for_each_entry(uld_entry, &uld_list, list_node) {
+		if (uld_entry->uld_type != CXGB4_ULD_RDMA)
+			continue;
+		cxgb4_uld_alloc_resources(adap, CXGB4_ULD_RDMA,
+					  &uld_entry->uld_info);
+		if (!adap->uld[CXGB4_ULD_RDMA].handle) {
+			adap->rdma_disabled = true;
+			ret = -EIO;
+		}
+	}
+out:
+	mutex_unlock(&uld_mutex);
+	return ret;
+}
+
 void cxgb4_uld_enable(struct adapter *adap)
 {
 	struct cxgb4_uld_list *uld_entry;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
index d7713038386c..0ec0f6c515ad 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
@@ -472,6 +472,8 @@ struct cxgb4_lld_info {
 
 struct cxgb4_uld_info {
 	char name[IFNAMSIZ];
+	/* for the enable_rdma devlink param, see cxgb4_uld_set_rdma() */
+	struct module *owner;
 	void *handle;
 	unsigned int nrxq;
 	unsigned int rxq_size;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/3] net/mlx5: support the enable_rdma devlink param in runtime cmode
  2026-11-30 22:09 [PATCH net-next 0/3] devlink: support the enable_rdma param in runtime cmode for cxgb4, mlx5 and ice Stefan Metzmacher
  2026-11-30 22:09 ` [PATCH net-next 1/3] cxgb4: support the enable_rdma devlink param in runtime cmode Stefan Metzmacher
@ 2026-11-30 22:09 ` Stefan Metzmacher
  2026-11-30 22:10 ` [PATCH net-next 3/3] ice: " Stefan Metzmacher
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Metzmacher @ 2026-11-30 22:09 UTC (permalink / raw)
  To: netdev
  Cc: metze, Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
	linux-rdma, Jiri Pirko, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Willem de Bruijn,
	Jonathan Corbet, Shuah Khan, Randy Dunlap, Andrew Lunn, linux-doc

The enable_rdma devlink param controls whether the RDMA auxiliary
device (mlx5_ib) is instantiated for a function, but only in
driverinit cmode. Changing it requires a devlink reload, which also
unregisters the netdev, so its addresses, routes and other
configuration are lost.

Add the runtime cmode, which unplugs or plugs only the RDMA auxiliary
device of the function and leaves the netdev alone:

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

This has the same effect as unloading mlx5_ib, but only for this
function, i.e. port. For an Ethernet port the RoCE state of the NIC
vport is disabled again, so RoCEv2 packets reach the netdev and e.g.
rxe can be used on it. It also works for a port in InfiniBand mode.

Enabling it at runtime requires it to be enabled in driverinit cmode,
and a reload resets it to the driverinit value. The state is kept in
the new dev->priv.rdma_runtime_disabled, which mlx5_devlink_reload_up()
resets. The runtime cmode is refused in switchdev or multiport mode,
where the RDMA device isn't the plain one of this function, and while
LAG is active. A RoCE LAG activated later isn't affected by it.

Cc: Saeed Mahameed <saeedm@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Tariq Toukan <tariqt@nvidia.com>
Cc: Mark Bloch <mbloch@nvidia.com>
Cc: netdev@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
---
 Documentation/networking/devlink/mlx5.rst     | 11 +++
 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 +
 5 files changed, 91 insertions(+), 3 deletions(-)

diff --git a/Documentation/networking/devlink/mlx5.rst b/Documentation/networking/devlink/mlx5.rst
index 9421c89951a0..382383d05b64 100644
--- a/Documentation/networking/devlink/mlx5.rst
+++ b/Documentation/networking/devlink/mlx5.rst
@@ -23,6 +23,17 @@ Parameters
        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.
+   * - ``enable_rdma``
+     - driverinit, runtime
+     - Boolean
+     - Controls whether the RDMA auxiliary device (mlx5_ib) is instantiated
+       for the function. In runtime mode it is unplugged or plugged again
+       without reloading the function, so the netdev and its configuration
+       stay. Enabling it in runtime mode requires it to be enabled in
+       driverinit mode, and a reload resets the runtime mode to the
+       driverinit value. Not supported in switchdev or multiport mode or
+       while LAG is active. A RoCE LAG activated later is not affected by
+       the runtime value of its functions.
    * - ``io_eq_size``
      - driverinit
      - The range is between 64 and 4096.
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
index df2e3ad01819..a9aa12dabb70 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
@@ -193,7 +193,7 @@ bool mlx5_rdma_supported(struct mlx5_core_dev *dev)
 	return true;
 }
 
-static bool is_ib_enabled(struct mlx5_core_dev *dev)
+bool mlx5_rdma_driverinit_enabled(struct mlx5_core_dev *dev)
 {
 	union devlink_param_value val;
 	int err;
@@ -204,6 +204,14 @@ static bool is_ib_enabled(struct mlx5_core_dev *dev)
 	return err ? false : val.vbool;
 }
 
+static bool is_ib_enabled(struct mlx5_core_dev *dev)
+{
+	if (dev->priv.rdma_runtime_disabled)
+		return false;
+
+	return mlx5_rdma_driverinit_enabled(dev);
+}
+
 static bool is_dpll_supported(struct mlx5_core_dev *dev)
 {
 	if (!IS_ENABLED(CONFIG_MLX5_DPLL))
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
index 30a97e48dda7..94bab50cf22c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
@@ -250,6 +250,8 @@ static int mlx5_devlink_reload_up(struct devlink *devlink, enum devlink_reload_a
 	*actions_performed = BIT(action);
 	switch (action) {
 	case DEVLINK_RELOAD_ACTION_DRIVER_REINIT:
+		/* a reload resets enable_rdma to its driverinit value */
+		dev->priv.rdma_runtime_disabled = false;
 		if (mlx5_dev_is_lightweight(dev)) {
 			mlx5_fw_reporters_create(dev);
 			return mlx5_init_one_devl_locked(dev);
@@ -261,6 +263,7 @@ static int mlx5_devlink_reload_up(struct devlink *devlink, enum devlink_reload_a
 			break;
 		/* On fw_activate action, also driver is reloaded and reinit performed */
 		*actions_performed |= BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT);
+		dev->priv.rdma_runtime_disabled = false;
 		ret = mlx5_load_one_devl_locked(dev, true);
 		if (ret)
 			return ret;
@@ -793,9 +796,72 @@ static int mlx5_devlink_enable_rdma_validate(struct devlink *devlink, u32 id,
 	return 0;
 }
 
+static int mlx5_devlink_enable_rdma_get(struct devlink *devlink, u32 id,
+					struct devlink_param_gset_ctx *ctx,
+					struct netlink_ext_ack *extack)
+{
+	struct mlx5_core_dev *dev = devlink_priv(devlink);
+
+	ctx->val.vbool = mlx5_rdma_driverinit_enabled(dev) &&
+			 !dev->priv.rdma_runtime_disabled;
+
+	return 0;
+}
+
+/*
+ * In runtime cmode the RDMA auxiliary device of this function is
+ * unplugged or plugged again, without reloading the function, so the
+ * netdev and its configuration stay. Unplugging it has the same effect
+ * as unloading mlx5_ib for this function only, e.g. the RoCE state of
+ * the NIC vport is disabled, so RoCEv2 packets reach the netdev.
+ *
+ * A reload resets it to the value of the driverinit cmode, see
+ * mlx5_devlink_reload_up().
+ */
+static int mlx5_devlink_enable_rdma_set(struct devlink *devlink, u32 id,
+					struct devlink_param_gset_ctx *ctx,
+					struct netlink_ext_ack *extack)
+{
+	struct mlx5_core_dev *dev = devlink_priv(devlink);
+	bool disable = !ctx->val.vbool;
+	int err;
+
+	if (!disable && !mlx5_rdma_driverinit_enabled(dev)) {
+		NL_SET_ERR_MSG_MOD(extack,
+				   "RDMA is disabled in driverinit cmode, enable it there and reload");
+		return -EOPNOTSUPP;
+	}
+
+	if (dev->priv.rdma_runtime_disabled == disable)
+		return 0;
+	if (!mlx5_rdma_supported(dev)) {
+		NL_SET_ERR_MSG_MOD(extack,
+				   "RDMA can't be changed at runtime in switchdev or multiport mode");
+		return -EOPNOTSUPP;
+	}
+	if (mlx5_lag_is_active(dev)) {
+		NL_SET_ERR_MSG_MOD(extack, "RDMA can't be changed at runtime while LAG is active");
+		return -EBUSY;
+	}
+
+	mlx5_devcom_comp_lock(dev->priv.hca_devcom_comp);
+	dev->priv.rdma_runtime_disabled = disable;
+	err = mlx5_rescan_drivers_locked(dev);
+	if (err && !disable) {
+		dev->priv.rdma_runtime_disabled = true;
+		mlx5_rescan_drivers_locked(dev);
+	}
+	mlx5_devcom_comp_unlock(dev->priv.hca_devcom_comp);
+
+	return err;
+}
+
 static const struct devlink_param mlx5_devlink_rdma_params[] = {
-	DEVLINK_PARAM_GENERIC(ENABLE_RDMA, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
-			      NULL, NULL, mlx5_devlink_enable_rdma_validate),
+	DEVLINK_PARAM_GENERIC(ENABLE_RDMA, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT) |
+			      BIT(DEVLINK_PARAM_CMODE_RUNTIME),
+			      mlx5_devlink_enable_rdma_get,
+			      mlx5_devlink_enable_rdma_set,
+			      mlx5_devlink_enable_rdma_validate),
 };
 
 static int mlx5_devlink_rdma_params_register(struct devlink *devlink)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
index d84d0424d04e..08bb86d649a9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
@@ -473,6 +473,7 @@ static inline u32 mlx5_sriov_get_vf_total_msix(struct pci_dev *pdev)
 
 bool mlx5_eth_supported(struct mlx5_core_dev *dev);
 bool mlx5_rdma_supported(struct mlx5_core_dev *dev);
+bool mlx5_rdma_driverinit_enabled(struct mlx5_core_dev *dev);
 bool mlx5_vnet_supported(struct mlx5_core_dev *dev);
 bool mlx5_same_hw_devs(struct mlx5_core_dev *dev, struct mlx5_core_dev *peer_dev);
 int mlx5_cmd_allow_other_vhca_access(struct mlx5_core_dev *dev,
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index b6efc01a8e36..b62d519eba8c 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -615,6 +615,8 @@ struct mlx5_priv {
 	struct mlx5_core_sriov	sriov;
 	struct mlx5_lag		*lag;
 	u32			flags;
+	/* RDMA disabled via devlink enable_rdma in runtime cmode */
+	bool			rdma_runtime_disabled;
 	struct mlx5_devcom_dev	*devc;
 	struct mlx5_devcom_comp_dev *hca_devcom_comp;
 	struct mlx5_fw_reset	*fw_reset;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 3/3] ice: support the enable_rdma devlink param in runtime cmode
  2026-11-30 22:09 [PATCH net-next 0/3] devlink: support the enable_rdma param in runtime cmode for cxgb4, mlx5 and ice Stefan Metzmacher
  2026-11-30 22:09 ` [PATCH net-next 1/3] cxgb4: support the enable_rdma devlink param in runtime cmode Stefan Metzmacher
  2026-11-30 22:09 ` [PATCH net-next 2/3] net/mlx5: " Stefan Metzmacher
@ 2026-11-30 22:10 ` Stefan Metzmacher
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Metzmacher @ 2026-11-30 22:10 UTC (permalink / raw)
  To: netdev
  Cc: metze, Tony Nguyen, Przemek Kitszel, Tatyana Nikolova,
	Jacob Moroni, Jiri Pirko, Leon Romanovsky, intel-wired-lan,
	linux-rdma, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Willem de Bruijn, Jonathan Corbet,
	Shuah Khan, Randy Dunlap, Andrew Lunn, linux-doc

The enable_rdma devlink param controls whether the RDMA auxiliary
device (irdma) is instantiated, but only in driverinit cmode. Changing
it requires a devlink reload, which also unregisters the netdev, so
its addresses, routes and other configuration are lost.

Add the runtime cmode, which only unplugs or plugs the RDMA auxiliary
device and leaves the netdev alone:

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

Unlike setting both enable_roce and enable_iwarp to false, the
selected RDMA protocol is kept, and the auxiliary device stays
unplugged after a reset or when switching between RoCEv2 and iWARP,
as ice_plug_aux_dev() checks the new ICE_FLAG_RDMA_RUNTIME_DIS.

Enabling it at runtime requires it to be enabled in driverinit cmode
and enable_roce or enable_iwarp to be set, and a reload resets it to
the driverinit value, like for mlx5.

Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Cc: Jacob Moroni <jmoroni@google.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org
Cc: linux-rdma@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
---
 Documentation/networking/devlink/ice.rst      |  7 ++
 .../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 +-
 4 files changed, 75 insertions(+), 4 deletions(-)

diff --git a/Documentation/networking/devlink/ice.rst b/Documentation/networking/devlink/ice.rst
index 792e9f8c846a..0db36e85e522 100644
--- a/Documentation/networking/devlink/ice.rst
+++ b/Documentation/networking/devlink/ice.rst
@@ -22,6 +22,13 @@ Parameters
    * - ``enable_iwarp``
      - runtime
      - mutually exclusive with ``enable_roce``
+   * - ``enable_rdma``
+     - driverinit, runtime
+     - Controls whether the RDMA auxiliary device (irdma) is instantiated.
+       In runtime mode it is unplugged or plugged again without reloading
+       the PF, so the netdev and its configuration stay. Enabling it in
+       runtime mode requires it to be enabled in driverinit mode, and a
+       reload resets the runtime mode to the driverinit value.
    * - ``tx_scheduling_layers``
      - permanent
      - The ice hardware uses hierarchical scheduling for Tx with a fixed
diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/drivers/net/ethernet/intel/ice/devlink/devlink.c
index 5a69f0f8a7bc..8d816631df69 100644
--- a/drivers/net/ethernet/intel/ice/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c
@@ -1268,6 +1268,9 @@ static int ice_devlink_reinit_up(struct ice_pf *pf)
 	if (err)
 		goto unroll_pf_init;
 
+	/* a reload resets enable_rdma to its driverinit value */
+	clear_bit(ICE_FLAG_RDMA_RUNTIME_DIS, pf->flags);
+
 	/* No need to take devl_lock, it's already taken by devlink API */
 	err = ice_load(pf);
 	if (err)
@@ -1626,6 +1629,62 @@ ice_devlink_msix_min_pf_validate(struct devlink *devlink, u32 id,
 	return 0;
 }
 
+static int ice_devlink_enable_rdma_get(struct devlink *devlink, u32 id,
+				       struct devlink_param_gset_ctx *ctx,
+				       struct netlink_ext_ack *extack)
+{
+	struct ice_pf *pf = devlink_priv(devlink);
+
+	ctx->val.vbool = ice_is_rdma_ena(pf) &&
+			 !test_bit(ICE_FLAG_RDMA_RUNTIME_DIS, pf->flags);
+
+	return 0;
+}
+
+/*
+ * In runtime cmode the RDMA auxiliary device is unplugged or plugged
+ * again, without reloading the PF, so the netdev and its configuration
+ * stay. While it is disabled, ice_plug_aux_dev() does nothing, e.g. after
+ * a reset or when switching between RoCEv2 and iWARP. A reload resets it
+ * to the value of the driverinit cmode.
+ */
+static int ice_devlink_enable_rdma_set(struct devlink *devlink, u32 id,
+				       struct devlink_param_gset_ctx *ctx,
+				       struct netlink_ext_ack *extack)
+{
+	struct ice_pf *pf = devlink_priv(devlink);
+	bool disable = !ctx->val.vbool;
+	int ret;
+
+	if (!disable && !ice_is_rdma_ena(pf)) {
+		NL_SET_ERR_MSG_MOD(extack,
+				   "RDMA is disabled in driverinit cmode, enable it there and reload");
+		return -EOPNOTSUPP;
+	}
+
+	if (test_bit(ICE_FLAG_RDMA_RUNTIME_DIS, pf->flags) == disable)
+		return 0;
+
+	if (disable) {
+		set_bit(ICE_FLAG_RDMA_RUNTIME_DIS, pf->flags);
+		ice_unplug_aux_dev(pf);
+		return 0;
+	}
+
+	if (!pf->cdev_info || !pf->cdev_info->rdma_protocol) {
+		NL_SET_ERR_MSG_MOD(extack,
+				   "Neither enable_roce nor enable_iwarp is set");
+		return -EOPNOTSUPP;
+	}
+
+	clear_bit(ICE_FLAG_RDMA_RUNTIME_DIS, pf->flags);
+	ret = ice_plug_aux_dev(pf);
+	if (ret)
+		set_bit(ICE_FLAG_RDMA_RUNTIME_DIS, pf->flags);
+
+	return ret;
+}
+
 static int ice_devlink_enable_rdma_validate(struct devlink *devlink, u32 id,
 					    union devlink_param_value *val,
 					    struct netlink_ext_ack *extack)
@@ -1654,8 +1713,11 @@ static const struct devlink_param ice_dvl_rdma_params[] = {
 			      ice_devlink_enable_iw_get,
 			      ice_devlink_enable_iw_set,
 			      ice_devlink_enable_iw_validate),
-	DEVLINK_PARAM_GENERIC(ENABLE_RDMA, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
-			      NULL, NULL, ice_devlink_enable_rdma_validate),
+	DEVLINK_PARAM_GENERIC(ENABLE_RDMA, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT) |
+			      BIT(DEVLINK_PARAM_CMODE_RUNTIME),
+			      ice_devlink_enable_rdma_get,
+			      ice_devlink_enable_rdma_set,
+			      ice_devlink_enable_rdma_validate),
 };
 
 static const struct devlink_param ice_dvl_msix_params[] = {
diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index 432da05c48c0..98555265fbaa 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -526,6 +526,7 @@ enum ice_pf_flags {
 	ICE_FLAG_GNSS,			/* GNSS successfully initialized */
 	ICE_FLAG_DPLL,			/* SyncE/PTP dplls initialized */
 	ICE_FLAG_LLDP_AQ_FLTR,
+	ICE_FLAG_RDMA_RUNTIME_DIS,	/* enable_rdma disabled in runtime cmode */
 	ICE_PF_FLAGS_NBITS		/* must be last */
 };
 
diff --git a/drivers/net/ethernet/intel/ice/ice_idc.c b/drivers/net/ethernet/intel/ice/ice_idc.c
index 102d63c3018b..01a14b9f8f6a 100644
--- a/drivers/net/ethernet/intel/ice/ice_idc.c
+++ b/drivers/net/ethernet/intel/ice/ice_idc.c
@@ -299,9 +299,10 @@ int ice_plug_aux_dev(struct ice_pf *pf)
 	int ret;
 
 	/* if this PF doesn't support a technology that requires auxiliary
-	 * devices, then gracefully exit
+	 * devices, or it was disabled via enable_rdma in runtime cmode,
+	 * then gracefully exit
 	 */
-	if (!ice_is_rdma_ena(pf))
+	if (!ice_is_rdma_ena(pf) || test_bit(ICE_FLAG_RDMA_RUNTIME_DIS, pf->flags))
 		return 0;
 
 	cdev = pf->cdev_info;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-30 22:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 22:09 [PATCH net-next 0/3] devlink: support the enable_rdma param in runtime cmode for cxgb4, mlx5 and ice Stefan Metzmacher
2026-11-30 22:09 ` [PATCH net-next 1/3] cxgb4: support the enable_rdma devlink param in runtime cmode Stefan Metzmacher
2026-11-30 22:09 ` [PATCH net-next 2/3] net/mlx5: " Stefan Metzmacher
2026-11-30 22:10 ` [PATCH net-next 3/3] ice: " Stefan Metzmacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox