aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netdevsim/netdevsim.h
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2017-12-01 15:09:01 -0800
committerDaniel Borkmann <daniel@iogearbox.net>2017-12-03 00:27:58 +0100
commit79579220566cd33fe3b15ce8249c57e10251b258 (patch)
tree459abfe0795c867ddc395ba8b97cd5dcff090d87 /drivers/net/netdevsim/netdevsim.h
parentselftests/bpf: add offload test based on netdevsim (diff)
downloadlinux-dev-79579220566cd33fe3b15ce8249c57e10251b258.tar.xz
linux-dev-79579220566cd33fe3b15ce8249c57e10251b258.zip
netdevsim: add SR-IOV functionality
dummy driver was extended with VF-related netdev APIs for testing SR-IOV-related software. netdevsim did not exist back then. Implement SR-IOV functionality in netdevsim. Notable difference is that since netdevsim has no module parameters, we will actually create a device with sriov_numvfs attribute for each netdev. The zero MAC address is accepted as some HW use it to mean any address is allowed. Link state is also now validated. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'drivers/net/netdevsim/netdevsim.h')
-rw-r--r--drivers/net/netdevsim/netdevsim.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h
index 8779e6a8f885..32270de9395a 100644
--- a/drivers/net/netdevsim/netdevsim.h
+++ b/drivers/net/netdevsim/netdevsim.h
@@ -13,6 +13,7 @@
* THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
*/
+#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/netdevice.h>
@@ -26,6 +27,7 @@
struct bpf_prog;
struct dentry;
+struct nsim_vf_config;
struct netdevsim {
struct net_device *netdev;
@@ -34,8 +36,13 @@ struct netdevsim {
u64 tx_bytes;
struct u64_stats_sync syncp;
+ struct device dev;
+
struct dentry *ddir;
+ unsigned int num_vfs;
+ struct nsim_vf_config *vfconfigs;
+
struct bpf_prog *bpf_offloaded;
u32 bpf_offloaded_id;
@@ -64,3 +71,8 @@ int nsim_bpf(struct net_device *dev, struct netdev_bpf *bpf);
int nsim_bpf_disable_tc(struct netdevsim *ns);
int nsim_bpf_setup_tc_block_cb(enum tc_setup_type type,
void *type_data, void *cb_priv);
+
+static inline struct netdevsim *to_nsim(struct device *ptr)
+{
+ return container_of(ptr, struct netdevsim, dev);
+}