Commit 32ac15d8 authored by Dmytro Linkin's avatar Dmytro Linkin Committed by David S. Miller

netdevsim: Disable VFs on nsim_dev_reload_destroy() call

Move VFs disabling from device release() to nsim_dev_reload_destroy() to
make VFs disabling and ports removal simultaneous.
This is a requirement for VFs ports implemented in next patches.
Signed-off-by: default avatarDmytro Linkin <dlinkin@nvidia.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d3953819
...@@ -37,7 +37,7 @@ static int nsim_bus_dev_vfs_enable(struct nsim_bus_dev *nsim_bus_dev, ...@@ -37,7 +37,7 @@ static int nsim_bus_dev_vfs_enable(struct nsim_bus_dev *nsim_bus_dev,
return 0; return 0;
} }
static void nsim_bus_dev_vfs_disable(struct nsim_bus_dev *nsim_bus_dev) void nsim_bus_dev_vfs_disable(struct nsim_bus_dev *nsim_bus_dev)
{ {
nsim_bus_dev->num_vfs = 0; nsim_bus_dev->num_vfs = 0;
} }
...@@ -233,9 +233,6 @@ static const struct attribute_group *nsim_bus_dev_attr_groups[] = { ...@@ -233,9 +233,6 @@ static const struct attribute_group *nsim_bus_dev_attr_groups[] = {
static void nsim_bus_dev_release(struct device *dev) static void nsim_bus_dev_release(struct device *dev)
{ {
struct nsim_bus_dev *nsim_bus_dev = to_nsim_bus_dev(dev);
nsim_bus_dev_vfs_disable(nsim_bus_dev);
} }
static struct device_type nsim_bus_dev_type = { static struct device_type nsim_bus_dev_type = {
......
...@@ -1182,6 +1182,12 @@ static void nsim_dev_reload_destroy(struct nsim_dev *nsim_dev) ...@@ -1182,6 +1182,12 @@ static void nsim_dev_reload_destroy(struct nsim_dev *nsim_dev)
if (devlink_is_reload_failed(devlink)) if (devlink_is_reload_failed(devlink))
return; return;
debugfs_remove(nsim_dev->take_snapshot); debugfs_remove(nsim_dev->take_snapshot);
mutex_lock(&nsim_dev->nsim_bus_dev->vfs_lock);
if (nsim_dev->nsim_bus_dev->num_vfs)
nsim_bus_dev_vfs_disable(nsim_dev->nsim_bus_dev);
mutex_unlock(&nsim_dev->nsim_bus_dev->vfs_lock);
nsim_dev_port_del_all(nsim_dev); nsim_dev_port_del_all(nsim_dev);
nsim_dev_psample_exit(nsim_dev); nsim_dev_psample_exit(nsim_dev);
nsim_dev_health_exit(nsim_dev); nsim_dev_health_exit(nsim_dev);
......
...@@ -276,6 +276,7 @@ ssize_t nsim_bus_dev_max_vfs_read(struct file *file, ...@@ -276,6 +276,7 @@ ssize_t nsim_bus_dev_max_vfs_read(struct file *file,
ssize_t nsim_bus_dev_max_vfs_write(struct file *file, ssize_t nsim_bus_dev_max_vfs_write(struct file *file,
const char __user *data, const char __user *data,
size_t count, loff_t *ppos); size_t count, loff_t *ppos);
void nsim_bus_dev_vfs_disable(struct nsim_bus_dev *nsim_bus_dev);
#if IS_ENABLED(CONFIG_XFRM_OFFLOAD) #if IS_ENABLED(CONFIG_XFRM_OFFLOAD)
void nsim_ipsec_init(struct netdevsim *ns); void nsim_ipsec_init(struct netdevsim *ns);
......
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