mirror of https://gitee.com/openkylin/linux.git
netdevsim: register port netdevices into net of device
Register newly created port netdevice into net namespace that the parent device belongs to. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
75ba029f3c
commit
90d299138d
|
@ -290,6 +290,7 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port)
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
dev_net_set(dev, nsim_dev_net(nsim_dev));
|
||||||
ns = netdev_priv(dev);
|
ns = netdev_priv(dev);
|
||||||
ns->netdev = dev;
|
ns->netdev = dev;
|
||||||
ns->nsim_dev = nsim_dev;
|
ns->nsim_dev = nsim_dev;
|
||||||
|
|
|
@ -164,6 +164,11 @@ struct nsim_dev {
|
||||||
struct devlink_region *dummy_region;
|
struct devlink_region *dummy_region;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline struct net *nsim_dev_net(struct nsim_dev *nsim_dev)
|
||||||
|
{
|
||||||
|
return devlink_net(priv_to_devlink(nsim_dev));
|
||||||
|
}
|
||||||
|
|
||||||
int nsim_dev_init(void);
|
int nsim_dev_init(void);
|
||||||
void nsim_dev_exit(void);
|
void nsim_dev_exit(void);
|
||||||
int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev);
|
int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev);
|
||||||
|
|
Loading…
Reference in New Issue