net: devlink: split reload op into two
In order to properly implement failure indication during reload, split the reload op into two ops, one for down phase and one for up phase. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
35c7ff349a
commit
97691069dc
@@ -2672,12 +2672,17 @@ devlink_resources_validate(struct devlink *devlink,
|
||||
return err;
|
||||
}
|
||||
|
||||
static bool devlink_reload_supported(struct devlink *devlink)
|
||||
{
|
||||
return devlink->ops->reload_down && devlink->ops->reload_up;
|
||||
}
|
||||
|
||||
static int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
int err;
|
||||
|
||||
if (!devlink->ops->reload)
|
||||
if (!devlink_reload_supported(devlink))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
err = devlink_resources_validate(devlink, NULL, info);
|
||||
@@ -2685,7 +2690,10 @@ static int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info)
|
||||
NL_SET_ERR_MSG_MOD(info->extack, "resources size validation failed");
|
||||
return err;
|
||||
}
|
||||
return devlink->ops->reload(devlink, info->extack);
|
||||
err = devlink->ops->reload_down(devlink, info->extack);
|
||||
if (err)
|
||||
return err;
|
||||
return devlink->ops->reload_up(devlink, info->extack);
|
||||
}
|
||||
|
||||
static int devlink_nl_flash_update_fill(struct sk_buff *msg,
|
||||
@@ -7150,7 +7158,7 @@ __devlink_param_driverinit_value_set(struct devlink *devlink,
|
||||
int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
|
||||
union devlink_param_value *init_val)
|
||||
{
|
||||
if (!devlink->ops->reload)
|
||||
if (!devlink_reload_supported(devlink))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return __devlink_param_driverinit_value_get(&devlink->param_list,
|
||||
@@ -7197,7 +7205,7 @@ int devlink_port_param_driverinit_value_get(struct devlink_port *devlink_port,
|
||||
{
|
||||
struct devlink *devlink = devlink_port->devlink;
|
||||
|
||||
if (!devlink->ops->reload)
|
||||
if (!devlink_reload_supported(devlink))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return __devlink_param_driverinit_value_get(&devlink_port->param_list,
|
||||
|
Reference in New Issue
Block a user