Intel-Wired-Lan Archive on lore.kernel.org
 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:10 ` [PATCH net-next 3/3] ice: support the enable_rdma devlink param in runtime cmode Stefan Metzmacher
  0 siblings, 1 reply; 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 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:10 ` Stefan Metzmacher
  2026-12-01 13:36   ` Przemek Kitszel
  2026-12-01 22:10   ` sashiko-bot
  0 siblings, 2 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

* Re: [PATCH net-next 3/3] ice: support the enable_rdma devlink param in runtime cmode
  2026-11-30 22:10 ` [PATCH net-next 3/3] ice: support the enable_rdma devlink param in runtime cmode Stefan Metzmacher
@ 2026-12-01 13:36   ` Przemek Kitszel
  2026-12-01 22:10   ` sashiko-bot
  1 sibling, 0 replies; 4+ messages in thread
From: Przemek Kitszel @ 2026-12-01 13:36 UTC (permalink / raw)
  To: Stefan Metzmacher, netdev
  Cc: Tony Nguyen, 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

On 11/30/26 11:10 PM, Stefan Metzmacher wrote:
> 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.

Looks nice, thank you. Given your test scenario from cover letter,
I think it "works enough" for ice to consider a pure improvement :)

Acked-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

(please carry the tag if you happen to change things slightly due
to other feedback, like flag rename, additional locking dance, etc)

sidenote: you could keep CC list from the commit msg under "---"
section to achieve the same w/o inflating the (merged) commit msg

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

* Re: [PATCH net-next 3/3] ice: support the enable_rdma devlink param in runtime cmode
  2026-11-30 22:10 ` [PATCH net-next 3/3] ice: support the enable_rdma devlink param in runtime cmode Stefan Metzmacher
  2026-12-01 13:36   ` Przemek Kitszel
@ 2026-12-01 22:10   ` sashiko-bot
  1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-12-01 22:10 UTC (permalink / raw)
  To: Stefan Metzmacher; +Cc: intel-wired-lan, linux-rdma

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ice: race between ice_devlink_enable_rdma_set() and
  concurrent plug or reset
It also noticed 1 related pre-existing issue this patch does not
introduce:
- [High] ice: NULL pointer dereference in
  ice_devlink_enable_iw_validate() [1]
--

commit 5131a328af0137c04875bae323e3ebe30dcdfd51
Author: Stefan Metzmacher <metze@samba.org>

ice: support the enable_rdma devlink param in runtime cmode

This commit adds runtime configuration mode support for the enable_rdma
devlink parameter so the RDMA auxiliary device can be plugged or unplugged
without reloading the PF netdev.

> diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/drivers/net/ethernet/intel/ice/devlink/devlink.c
> index 5a69f0f8a7bc4..8d816631df69f 100644
> --- a/drivers/net/ethernet/intel/ice/devlink/devlink.c
> +++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c
[ ... ]
> @@ -1626,6 +1629,62 @@ ice_devlink_msix_min_pf_validate(struct devlink *devlink, u32 id,
[ ... ]
> +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;
> +}

[Severity: Medium]
Can ice_devlink_enable_rdma_set() race with ice_plug_aux_dev() or a PF
reset running on pf->serv_task?

ice_devlink_enable_rdma_set() runs under devl_lock(devlink), while
ice_service_task() and PF reset/rebuild call ice_plug_aux_dev() and
ice_unplug_aux_dev() without holding devl_lock(devlink), and
pf->adev_mutex only covers the cdev->adev assignment:

CPU0                                     CPU1 (pf->serv_task)
                                         ice_plug_aux_dev()
                                           test_bit(ICE_FLAG_RDMA_RUNTIME_DIS,
                                                    ...) -> 0
                                           ...
ice_devlink_enable_rdma_set()
  set_bit(ICE_FLAG_RDMA_RUNTIME_DIS,
          ...)
  ice_unplug_aux_dev()
    test_and_clear_bit(
      ICE_FLAG_AUX_DEV_CREATED, ...)
      -> 0 (returns early)
                                           auxiliary_device_add(adev)
                                           set_bit(ICE_FLAG_AUX_DEV_CREATED,
                                                   ...)
                                             <-- aux dev stays plugged

The auxiliary device remains registered while ICE_FLAG_RDMA_RUNTIME_DIS is
set and ice_devlink_enable_rdma_get() reports false.  In addition, if
ice_devlink_enable_rdma_set() enables RDMA while a PF reset is in progress
between ice_prepare_for_reset() and ice_rebuild(), it plugs the auxiliary
device mid-reset and ice_rebuild() -> ice_rdma_finalize_setup() then calls
ice_plug_aux_dev() a second time.

> @@ -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),
>  };

[Severity: High]
This problem wasn't introduced by this patch, but can
ice_devlink_enable_iw_validate() [1] trigger a NULL pointer
dereference on pf->cdev_info when enable_rdma is false in driverinit
cmode?

When enable_rdma is disabled in driverinit cmode and the PF is reloaded,
ice_deinit_rdma() frees and clears pf->cdev_info, ice_set_pf_caps() still
sets ICE_FLAG_RDMA_ENA, and ice_init_rdma() returns early because
ice_is_rdma_ena() is false.  Unlike ice_devlink_enable_rdma_set() and
ice_devlink_enable_roce_validate(), ice_devlink_enable_iw_validate() only
checks ICE_FLAG_RDMA_ENA before dereferencing pf->cdev_info:

drivers/net/ethernet/intel/ice/devlink/devlink.c:ice_devlink_enable_iw_validate() {
	struct ice_pf *pf = devlink_priv(devlink);

	if (!test_bit(ICE_FLAG_RDMA_ENA, pf->flags))
		return -EOPNOTSUPP;

	if (pf->cdev_info->rdma_protocol & IIDC_RDMA_PROTOCOL_ROCEV2) {
    ...
}

Setting enable_iwarp in that state dereferences a NULL pf->cdev_info.

[1] https://sashiko.dev/#/bug/linux-aab1240e-86ed-43b4-be4c-d5891c480f23

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796076486.git.metze@samba.org?part=3

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

end of thread, other threads:[~2026-12-01 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:10 ` [PATCH net-next 3/3] ice: support the enable_rdma devlink param in runtime cmode Stefan Metzmacher
2026-12-01 13:36   ` Przemek Kitszel
2026-12-01 22:10   ` sashiko-bot

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