aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netdevsim/netdevsim.h
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2019-04-25 15:59:45 +0200
committerDavid S. Miller <davem@davemloft.net>2019-04-26 01:52:02 -0400
commit40e4fe4ce115c409c3e2fbb247085103ef1cc755 (patch)
treebad9c42265ee5187263de8c2a118c2def41fe7d7 /drivers/net/netdevsim/netdevsim.h
parentnetdevsim: put netdevsim bus code into separate file (diff)
downloadlinux-dev-40e4fe4ce115c409c3e2fbb247085103ef1cc755.tar.xz
linux-dev-40e4fe4ce115c409c3e2fbb247085103ef1cc755.zip
netdevsim: move device registration and related code to bus.c
Move netdevsim device registration into bus.c and alongside with that the related sysfs attributes. Introduce new struct nsim_bus_dev to represent a netdevsim device on netdevsim bus. 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.h31
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h
index 7a144aa7965a..528d1e7d3e6b 100644
--- a/drivers/net/netdevsim/netdevsim.h
+++ b/drivers/net/netdevsim/netdevsim.h
@@ -85,14 +85,11 @@ struct netdevsim {
u64 tx_bytes;
struct u64_stats_sync syncp;
- struct device dev;
+ struct nsim_bus_dev *nsim_bus_dev;
struct netdevsim_shared_dev *sdev;
struct dentry *ddir;
- unsigned int num_vfs;
- struct nsim_vf_config *vfconfigs;
-
struct bpf_prog *bpf_offloaded;
u32 bpf_offloaded_id;
@@ -184,14 +181,26 @@ static inline bool nsim_ipsec_tx(struct netdevsim *ns, struct sk_buff *skb)
}
#endif
-static inline struct netdevsim *to_nsim(struct device *ptr)
-{
- return container_of(ptr, struct netdevsim, dev);
-}
-
-int nsim_num_vf(struct device *dev);
+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;
+};
-extern struct bus_type nsim_bus;
+struct nsim_bus_dev {
+ struct device dev;
+ unsigned int num_vfs;
+ struct nsim_vf_config *vfconfigs;
+};
+struct nsim_bus_dev *nsim_bus_dev_new(void);
+void nsim_bus_dev_del(struct nsim_bus_dev *nsim_bus_dev);
int nsim_bus_init(void);
void nsim_bus_exit(void);