summaryrefslogtreecommitdiffstats
path: root/drivers/net/netdevsim/netdevsim.h
diff options
context:
space:
mode:
authorJiri Pirko2019-04-25 15:59:53 +0200
committerDavid S. Miller2019-04-26 07:52:02 +0200
commit8320d145912738655cf631d27aa1829d8b17804e (patch)
tree6e7f4ea830549254a04ee3028d6b97f4d60f30dc /drivers/net/netdevsim/netdevsim.h
parentnetdevsim: change debugfs tree topology (diff)
downloadkernel-qcow2-linux-8320d145912738655cf631d27aa1829d8b17804e.tar.gz
kernel-qcow2-linux-8320d145912738655cf631d27aa1829d8b17804e.tar.xz
kernel-qcow2-linux-8320d145912738655cf631d27aa1829d8b17804e.zip
netdevsim: implement dev probe/remove skeleton with port initialization
Implement netdevsim bus probing of netdevsim devices. For every probed device create a devlink instance. According to the user-passed value, create a number of ports represented by devlink port instances. 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.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h
index e951b1ccc3f2..0e6ca85e5487 100644
--- a/drivers/net/netdevsim/netdevsim.h
+++ b/drivers/net/netdevsim/netdevsim.h
@@ -18,6 +18,7 @@
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/u64_stats_sync.h>
+#include <net/devlink.h>
#include <net/xdp.h>
#define DRV_NAME "netdevsim"
@@ -130,6 +131,13 @@ enum nsim_resource_id {
NSIM_RESOURCE_IPV6_FIB_RULES,
};
+struct nsim_dev_port {
+ struct list_head list;
+ struct devlink_port devlink_port;
+ unsigned int port_index;
+ struct dentry *ddir;
+};
+
struct nsim_dev {
struct nsim_bus_dev *nsim_bus_dev;
struct nsim_fib_data *fib_data;
@@ -143,14 +151,13 @@ struct nsim_dev {
struct list_head bpf_bound_progs;
struct list_head bpf_bound_maps;
struct netdev_phys_item_id switch_id;
+ struct list_head port_list;
};
-struct nsim_dev *
-nsim_dev_create_with_ns(struct nsim_bus_dev *nsim_bus_dev,
- struct netdevsim *ns);
-void nsim_dev_destroy(struct nsim_dev *nsim_dev);
int nsim_dev_init(void);
void nsim_dev_exit(void);
+int nsim_dev_probe(struct nsim_bus_dev *nsim_bus_dev);
+void nsim_dev_remove(struct nsim_bus_dev *nsim_bus_dev);
struct nsim_fib_data *nsim_fib_create(void);
void nsim_fib_destroy(struct nsim_fib_data *fib_data);
@@ -201,6 +208,7 @@ struct nsim_bus_dev {
};
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);