Add string to uint conversion for 'fw_load_policy' generic parameter.

Signed-off-by: Shalom Toledo <shal...@mellanox.com>
Reviewed-by: Jiri Pirko <j...@mellanox.com>
---
 devlink/devlink.c            | 13 ++++++++++++-
 include/uapi/linux/devlink.h |  5 +++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 1e3deb24d214..3651e90c1159 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -1972,7 +1972,18 @@ param_val_conv_str_get(const struct param_val_conv 
*param_val_conv,
        return -ENOENT;
 }
 
-static const struct param_val_conv param_val_conv[] = {};
+static const struct param_val_conv param_val_conv[] = {
+       {
+               .name = "fw_load_policy",
+               .vstr = "driver",
+               .vuint = DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DRIVER,
+       },
+       {
+               .name = "fw_load_policy",
+               .vstr = "flash",
+               .vuint = DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_FLASH,
+       },
+};
 
 #define PARAM_VAL_CONV_LEN ARRAY_SIZE(param_val_conv)
 
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 5ee0e7397591..d0a33d79dc22 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -163,6 +163,11 @@ enum devlink_param_cmode {
        DEVLINK_PARAM_CMODE_MAX = __DEVLINK_PARAM_CMODE_MAX - 1
 };
 
+enum devlink_param_fw_load_policy_value {
+       DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DRIVER,
+       DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_FLASH,
+};
+
 enum devlink_attr {
        /* don't change the order or add anything between, this is ABI! */
        DEVLINK_ATTR_UNSPEC,
-- 
2.17.2

Reply via email to