summaryrefslogtreecommitdiffstats
path: root/drivers/net/netdevsim/netdevsim.h
diff options
context:
space:
mode:
authorJiri Pirko2019-04-25 15:59:55 +0200
committerDavid S. Miller2019-04-26 07:52:03 +0200
commite05b2d141fef22cfac1928cf0eb6890e5dae4216 (patch)
tree055d8c4330e6e9002a2bf4e9829febe8df84d59f /drivers/net/netdevsim/netdevsim.h
parentnetdevsim: extend device attrs to support port addition and deletion (diff)
downloadkernel-qcow2-linux-e05b2d141fef22cfac1928cf0eb6890e5dae4216.tar.gz
kernel-qcow2-linux-e05b2d141fef22cfac1928cf0eb6890e5dae4216.tar.xz
kernel-qcow2-linux-e05b2d141fef22cfac1928cf0eb6890e5dae4216.zip
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>
Diffstat (limited to 'drivers/net/netdevsim/netdevsim.h')
-rw-r--r--drivers/net/netdevsim/netdevsim.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h
index 6b60589cab91..3f398797c2bc 100644
--- a/drivers/net/netdevsim/netdevsim.h
+++ b/drivers/net/netdevsim/netdevsim.h
@@ -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);