This parameter is supported only when 'enable_live_dev_reset' is
true. The purpose of this parameter is to allow the user on a
host to temporarily disable the live reset feature of the device.

For example, if a host is running a mission critical application,
a user from the host can set this parameter to false, to avoid
a potential live reset from disrupting it.

Cc: Jiri Pirko <j...@mellanox.com>
Cc: Jakub Kicinski <k...@kernel.org>
Signed-off-by: Vasundhara Volam <vasundhara-v.vo...@broadcom.com>
Signed-off-by: Michael Chan <michael.c...@broadcom.com>
---
 Documentation/networking/devlink/devlink-params.rst | 20 ++++++++++++++++++++
 include/net/devlink.h                               |  4 ++++
 net/core/devlink.c                                  |  5 +++++
 3 files changed, 29 insertions(+)

diff --git a/Documentation/networking/devlink/devlink-params.rst 
b/Documentation/networking/devlink/devlink-params.rst
index 8e12c83..450fe18 100644
--- a/Documentation/networking/devlink/devlink-params.rst
+++ b/Documentation/networking/devlink/devlink-params.rst
@@ -116,3 +116,23 @@ own name.
        For example, after flashing a new firmware image, this feature allows 
the
        user to initiate the reset immediately from a separate command, to load
        the new firmware without reloading the driver or resetting the system.
+
+       A user can set the 'allow_live_dev_reset' parameter to false to
+       momentarily disable the live reset capability.
+   * - ``allow_live_dev_reset``
+     - Boolean
+     - This parameter is supported only when 'enable_live_dev_reset' is true.
+       The purpose of this parameter is to allow the user on a host to
+       temporarily disable the live reset feature of the device. When this
+       parameter is set to true from all the hosts in a multi-host environment
+       for example, a user from any host can initiate live device reset from 
any
+       of the host drivers.
+
+       For the parameter to be true, all the loaded host drivers must support
+       the live reset and the parameter must be set to true for all the host
+       drivers. For example, if any of the host (in case of multi-host NIC) is
+       loaded with an old driver which is not aware of the feature, then the
+       value of the parameter will be false until the old driver is upgraded
+       or unloaded. Also if the user has set the parameter to false on one of
+       the host (say A), the parameter will be false for all the hosts until 
the
+       user sets the parameter to true in the host (A).
diff --git a/include/net/devlink.h b/include/net/devlink.h
index eb28fa1..d922033 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -407,6 +407,7 @@ enum devlink_param_generic_id {
        DEVLINK_PARAM_GENERIC_ID_RESET_DEV_ON_DRV_PROBE,
        DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
        DEVLINK_PARAM_GENERIC_ID_ENABLE_LIVE_DEV_RESET,
+       DEVLINK_PARAM_GENERIC_ID_ALLOW_LIVE_DEV_RESET,
 
        /* add new param generic ids above here*/
        __DEVLINK_PARAM_GENERIC_ID_MAX,
@@ -447,6 +448,9 @@ enum devlink_param_generic_id {
 #define DEVLINK_PARAM_GENERIC_ENABLE_LIVE_DEV_RESET_NAME 
"enable_live_dev_reset"
 #define DEVLINK_PARAM_GENERIC_ENABLE_LIVE_DEV_RESET_TYPE 
DEVLINK_PARAM_TYPE_BOOL
 
+#define DEVLINK_PARAM_GENERIC_ALLOW_LIVE_DEV_RESET_NAME "allow_live_dev_reset"
+#define DEVLINK_PARAM_GENERIC_ALLOW_LIVE_DEV_RESET_TYPE DEVLINK_PARAM_TYPE_BOOL
+
 #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate)     \
 {                                                                      \
        .id = DEVLINK_PARAM_GENERIC_ID_##_id,                           \
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 7b52b38..e36f6c4 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -3016,6 +3016,11 @@ static int devlink_nl_cmd_flash_update(struct sk_buff 
*skb,
                .name = DEVLINK_PARAM_GENERIC_ENABLE_LIVE_DEV_RESET_NAME,
                .type = DEVLINK_PARAM_GENERIC_ENABLE_LIVE_DEV_RESET_TYPE,
        },
+       {
+               .id = DEVLINK_PARAM_GENERIC_ID_ALLOW_LIVE_DEV_RESET,
+               .name = DEVLINK_PARAM_GENERIC_ALLOW_LIVE_DEV_RESET_NAME,
+               .type = DEVLINK_PARAM_GENERIC_ALLOW_LIVE_DEV_RESET_TYPE,
+       },
 };
 
 static int devlink_param_generic_verify(const struct devlink_param *param)
-- 
1.8.3.1

Reply via email to