devlink: Add enable_remote_dev_reset generic parameter
authorMoshe Shemesh <moshe@mellanox.com>
Wed, 7 Oct 2020 06:00:53 +0000 (09:00 +0300)
committerJakub Kicinski <kuba@kernel.org>
Fri, 9 Oct 2020 19:06:53 +0000 (12:06 -0700)
The enable_remote_dev_reset devlink param flags that the host admin
allows device resets that can be initiated by other hosts. This
parameter is useful for setups where a device is shared by different
hosts, such as multi-host setup. Once the user set this parameter to
false, the driver should NACK any attempt to reset the device while the
driver is loaded.

Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/networking/devlink/devlink-params.rst
include/net/devlink.h
net/core/devlink.c

index d075fd0..54c9f10 100644 (file)
@@ -108,3 +108,9 @@ own name.
    * - ``region_snapshot_enable``
      - Boolean
      - Enable capture of ``devlink-region`` snapshots.
+   * - ``enable_remote_dev_reset``
+     - Boolean
+     - Enable device reset by remote host. When cleared, the device driver
+       will NACK any attempt of other host to reset the device. This parameter
+       is useful for setups where a device is shared by different hosts, such
+       as multi-host setup.
index d2771e5..b01bb9b 100644 (file)
@@ -469,6 +469,7 @@ enum devlink_param_generic_id {
        DEVLINK_PARAM_GENERIC_ID_FW_LOAD_POLICY,
        DEVLINK_PARAM_GENERIC_ID_RESET_DEV_ON_DRV_PROBE,
        DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
+       DEVLINK_PARAM_GENERIC_ID_ENABLE_REMOTE_DEV_RESET,
 
        /* add new param generic ids above here*/
        __DEVLINK_PARAM_GENERIC_ID_MAX,
@@ -506,6 +507,9 @@ enum devlink_param_generic_id {
 #define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_NAME "enable_roce"
 #define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_TYPE DEVLINK_PARAM_TYPE_BOOL
 
+#define DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_NAME "enable_remote_dev_reset"
+#define DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_TYPE DEVLINK_PARAM_TYPE_BOOL
+
 #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate)     \
 {                                                                      \
        .id = DEVLINK_PARAM_GENERIC_ID_##_id,                           \
index dd88933..a578634 100644 (file)
@@ -3521,6 +3521,11 @@ static const struct devlink_param devlink_param_generic[] = {
                .name = DEVLINK_PARAM_GENERIC_ENABLE_ROCE_NAME,
                .type = DEVLINK_PARAM_GENERIC_ENABLE_ROCE_TYPE,
        },
+       {
+               .id = DEVLINK_PARAM_GENERIC_ID_ENABLE_REMOTE_DEV_RESET,
+               .name = DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_NAME,
+               .type = DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_TYPE,
+       },
 };
 
 static int devlink_param_generic_verify(const struct devlink_param *param)