diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-10-31 02:15:02 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-11-01 16:29:41 +0300 |
commit | 5e388f3dc38c72da2880549e68374c3b6ba7c589 (patch) | |
tree | 7f9299b4a6f2511bb22ad59739bc755ac1f5991c /drivers/net/netdevsim/netdevsim.h | |
parent | 26c37d89f61d84dda55feefeafb4907f2a7cd944 (diff) | |
download | linux-5e388f3dc38c72da2880549e68374c3b6ba7c589.tar.xz |
netdevsim: move vfconfig to nsim_dev
When netdevsim got split into the faux bus vfconfig ended
up in the bus device (think pci_dev) which is strange because
it contains very networky not to say netdevy information.
Move it to nsim_dev, which is the driver "priv" structure
for the device.
To make sure we don't race with probe/remove take
the device lock (much like PCI).
While at it remove the NULL-checking of vfconfigs.
It appears to be pointless.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
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 | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h index ec9939fba534..b4b287cdfe77 100644 --- a/drivers/net/netdevsim/netdevsim.h +++ b/drivers/net/netdevsim/netdevsim.h @@ -217,6 +217,19 @@ struct nsim_dev_port { struct netdevsim *ns; }; +struct nsim_vf_config { + int link_state; + u16 min_tx_rate; + u16 max_tx_rate; + u16 vlan; + __be16 vlan_proto; + u16 qos; + u8 vf_mac[ETH_ALEN]; + bool spoofchk_enabled; + bool trusted; + bool rss_query_enabled; +}; + struct nsim_dev { struct nsim_bus_dev *nsim_bus_dev; struct nsim_fib_data *fib_data; @@ -225,6 +238,10 @@ struct nsim_dev { struct dentry *ports_ddir; struct dentry *take_snapshot; struct dentry *nodes_ddir; + + struct mutex vfs_lock; /* Protects vfconfigs */ + struct nsim_vf_config *vfconfigs; + struct bpf_offload_dev *bpf_dev; bool bpf_bind_accept; bool bpf_bind_verifier_accept; @@ -293,6 +310,8 @@ int nsim_dev_port_del(struct nsim_bus_dev *nsim_bus_dev, enum nsim_dev_port_type type, unsigned int port_index); +unsigned int nsim_dev_get_vfs(struct nsim_dev *nsim_dev); + struct nsim_fib_data *nsim_fib_create(struct devlink *devlink, struct netlink_ext_ack *extack); void nsim_fib_destroy(struct devlink *devlink, struct nsim_fib_data *fib_data); @@ -335,19 +354,6 @@ static inline bool nsim_ipsec_tx(struct netdevsim *ns, struct sk_buff *skb) } #endif -struct nsim_vf_config { - int link_state; - u16 min_tx_rate; - u16 max_tx_rate; - u16 vlan; - __be16 vlan_proto; - u16 qos; - u8 vf_mac[ETH_ALEN]; - bool spoofchk_enabled; - bool trusted; - bool rss_query_enabled; -}; - struct nsim_bus_dev { struct device dev; struct list_head list; @@ -358,8 +364,6 @@ struct nsim_bus_dev { */ unsigned int max_vfs; unsigned int num_vfs; - struct mutex vfs_lock; /* Protects vfconfigs */ - struct nsim_vf_config *vfconfigs; /* Lock for devlink->reload_enabled in netdevsim module */ struct mutex nsim_bus_reload_lock; bool in_reload; |