netdevsim: move netdev creation/destruction to dev probe

Remove the existing way to create netdevsim over rtnetlink and move the
netdev creation/destruction to dev probe, so for every probed port,
a netdevsim-netdev instance is created.

Adjust selftests to work with new interface.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Pirko
2019-04-25 15:59:55 +02:00
کامیت شده توسط David S. Miller
والد 794b2c05ca
کامیت e05b2d141f
8فایلهای تغییر یافته به همراه238 افزوده شده و 197 حذف شده

مشاهده پرونده

@@ -51,6 +51,7 @@ struct nsim_ipsec {
struct netdevsim {
struct net_device *netdev;
struct nsim_dev *nsim_dev;
struct nsim_dev_port *nsim_dev_port;
u64 tx_packets;
u64 tx_bytes;
@@ -58,8 +59,6 @@ struct netdevsim {
struct nsim_bus_dev *nsim_bus_dev;
struct dentry *ddir;
struct bpf_prog *bpf_offloaded;
u32 bpf_offloaded_id;
@@ -75,6 +74,10 @@ struct netdevsim {
struct nsim_ipsec ipsec;
};
struct netdevsim *
nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port);
void nsim_destroy(struct netdevsim *ns);
#ifdef CONFIG_BPF_SYSCALL
int nsim_bpf_dev_init(struct nsim_dev *nsim_dev);
void nsim_bpf_dev_exit(struct nsim_dev *nsim_dev);
@@ -136,6 +139,7 @@ struct nsim_dev_port {
struct devlink_port devlink_port;
unsigned int port_index;
struct dentry *ddir;
struct netdevsim *ns;
};
struct nsim_dev {
@@ -212,8 +216,5 @@ struct nsim_bus_dev {
struct nsim_vf_config *vfconfigs;
};
struct nsim_bus_dev *nsim_bus_dev_new(unsigned int id, unsigned int port_count);
struct nsim_bus_dev *nsim_bus_dev_new_with_ns(struct netdevsim *ns);
void nsim_bus_dev_del(struct nsim_bus_dev *nsim_bus_dev);
int nsim_bus_init(void);
void nsim_bus_exit(void);