]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ice: enable_rdma devlink param
authorMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tue, 3 Dec 2024 06:58:15 +0000 (07:58 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 5 Feb 2025 17:04:57 +0000 (09:04 -0800)
Implement enable_rdma devlink parameter to allow user to turn RDMA
feature on and off.

It is useful when there is no enough interrupts and user doesn't need
RDMA feature.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jan Sokolowski <jan.sokolowski@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/devlink/devlink.c
drivers/net/ethernet/intel/ice/ice_lib.c

index 81de5fbc130eaae2820b3271af19e892d6402389..504aaf4b885517a1839e61d050e71ecd392f6133 100644 (file)
@@ -1576,6 +1576,19 @@ ice_devlink_msix_min_pf_validate(struct devlink *devlink, u32 id,
        return 0;
 }
 
+static int ice_devlink_enable_rdma_validate(struct devlink *devlink, u32 id,
+                                           union devlink_param_value val,
+                                           struct netlink_ext_ack *extack)
+{
+       struct ice_pf *pf = devlink_priv(devlink);
+       bool new_state = val.vbool;
+
+       if (new_state && !test_bit(ICE_FLAG_RDMA_ENA, pf->flags))
+               return -EOPNOTSUPP;
+
+       return 0;
+}
+
 enum ice_param_id {
        ICE_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
        ICE_DEVLINK_PARAM_ID_TX_SCHED_LAYERS,
@@ -1591,6 +1604,8 @@ 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),
 };
 
 static const struct devlink_param ice_dvl_msix_params[] = {
@@ -1731,6 +1746,12 @@ int ice_devlink_register_params(struct ice_pf *pf)
        devl_param_driverinit_value_set(devlink,
                                        DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
                                        value);
+
+       value.vbool = test_bit(ICE_FLAG_RDMA_ENA, pf->flags);
+       devl_param_driverinit_value_set(devlink,
+                                       DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA,
+                                       value);
+
        return 0;
 
 unregister_msix_params:
index 1827f1f20ce857653e5fc982a490ed799f89b047..16c419809849c4c73aaf0dca7a2c85cb8183e462 100644 (file)
@@ -833,7 +833,13 @@ bool ice_is_safe_mode(struct ice_pf *pf)
  */
 bool ice_is_rdma_ena(struct ice_pf *pf)
 {
-       return test_bit(ICE_FLAG_RDMA_ENA, pf->flags);
+       union devlink_param_value value;
+       int err;
+
+       err = devl_param_driverinit_value_get(priv_to_devlink(pf),
+                                             DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA,
+                                             &value);
+       return err ? test_bit(ICE_FLAG_RDMA_ENA, pf->flags) : value.vbool;
 }
 
 /**