diff options
author | Jiri Pirko <jiri@mellanox.com> | 2019-04-25 15:59:53 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-26 01:52:02 -0400 |
commit | 8320d145912738655cf631d27aa1829d8b17804e (patch) | |
tree | 6e7f4ea830549254a04ee3028d6b97f4d60f30dc /drivers/net/netdevsim/netdevsim.h | |
parent | ab1d0cc004d706523dcad7cdad97a2b94eecf169 (diff) | |
download | linux-8320d145912738655cf631d27aa1829d8b17804e.tar.bz2 |
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.h | 16 |
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); |