Commit 1276534c authored by Moshe Shemesh's avatar Moshe Shemesh Committed by David S. Miller

devlink: Fix param cmode driverinit for string type

Driverinit configuration mode value is held by devlink to enable the
driver fetch the value after reload command. In case the param type is
string devlink should copy the value from driver string buffer to
devlink string buffer on devlink_param_driverinit_value_set() and
vice-versa on devlink_param_driverinit_value_get().

Fixes: ec01aeb1 ("devlink: Add support for get/set driverinit value")
Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f355cfcd
...@@ -3105,6 +3105,9 @@ static int devlink_nl_cmd_param_set_doit(struct sk_buff *skb, ...@@ -3105,6 +3105,9 @@ static int devlink_nl_cmd_param_set_doit(struct sk_buff *skb,
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (cmode == DEVLINK_PARAM_CMODE_DRIVERINIT) { if (cmode == DEVLINK_PARAM_CMODE_DRIVERINIT) {
if (param->type == DEVLINK_PARAM_TYPE_STRING)
strcpy(param_item->driverinit_value.vstr, value.vstr);
else
param_item->driverinit_value = value; param_item->driverinit_value = value;
param_item->driverinit_value_valid = true; param_item->driverinit_value_valid = true;
} else { } else {
...@@ -4545,6 +4548,9 @@ int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id, ...@@ -4545,6 +4548,9 @@ int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
DEVLINK_PARAM_CMODE_DRIVERINIT)) DEVLINK_PARAM_CMODE_DRIVERINIT))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (param_item->param->type == DEVLINK_PARAM_TYPE_STRING)
strcpy(init_val->vstr, param_item->driverinit_value.vstr);
else
*init_val = param_item->driverinit_value; *init_val = param_item->driverinit_value;
return 0; return 0;
...@@ -4576,6 +4582,9 @@ int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id, ...@@ -4576,6 +4582,9 @@ int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
DEVLINK_PARAM_CMODE_DRIVERINIT)) DEVLINK_PARAM_CMODE_DRIVERINIT))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (param_item->param->type == DEVLINK_PARAM_TYPE_STRING)
strcpy(param_item->driverinit_value.vstr, init_val.vstr);
else
param_item->driverinit_value = init_val; param_item->driverinit_value = init_val;
param_item->driverinit_value_valid = true; param_item->driverinit_value_valid = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment