[iproute2-next,2/2] devlink: Add support for 'fw_load_policy' generic parameter

Message ID 20181204101353.40459-3-shalomt@mellanox.com
State Accepted
Delegated to: David Ahern
Headers show
Series
  • devlink: Add support for 'fw_load_policy' generic parameter
Related show

Commit Message

Shalom Toledo Dec. 4, 2018, 10:14 a.m.
Add string to uint conversion for 'fw_load_policy' generic parameter.

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

Patch

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,