netdevsim: add bus attributes to add new and delete devices

Add a way to add new netdevsim device on netdevsim bus and also to
delete existing netdevsim device from the bus. Track the bus devices
in using a list.

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:48 +02:00
committed by David S. Miller
parent 57ce977495
commit f9d9db47d3
3 changed files with 99 additions and 4 deletions

View File

@@ -196,11 +196,13 @@ struct nsim_vf_config {
struct nsim_bus_dev {
struct device dev;
struct list_head list;
unsigned int port_count;
unsigned int num_vfs;
struct nsim_vf_config *vfconfigs;
};
struct nsim_bus_dev *nsim_bus_dev_new(void);
struct nsim_bus_dev *nsim_bus_dev_new(unsigned int id, unsigned int port_count);
void nsim_bus_dev_del(struct nsim_bus_dev *nsim_bus_dev);
int nsim_bus_init(void);
void nsim_bus_exit(void);