aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netdevsim/bpf.c
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2018-07-11 23:36:41 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2018-07-13 14:26:35 -0400
commita25717d2b604347d9af8da81deea7b08e8c94220 (patch)
treeb7397a15ecf41c12d4b968e858216a190057c89c /drivers/net/netdevsim/bpf.c
parent05296620f6d14dce0030b87e1e57891a770fb65c (diff)
xdp: support simultaneous driver and hw XDP attachment
Split the query of HW-attached program from the software one. Introduce new .ndo_bpf command to query HW-attached program. This will allow drivers to install different programs in HW and SW at the same time. Netlink can now also carry multiple programs on dump (in which case mode will be set to XDP_ATTACHED_MULTI and user has to check per-attachment point attributes, IFLA_XDP_PROG_ID will not be present). We reuse IFLA_XDP_PROG_ID skb space for second mode, so rtnl_xdp_size() doesn't need to be updated. Note that the installation side is still not there, since all drivers currently reject installing more than one program at the time. 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/bpf.c')
-rw-r--r--drivers/net/netdevsim/bpf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c
index c485d97b5df4..5544c9b51173 100644
--- a/drivers/net/netdevsim/bpf.c
+++ b/drivers/net/netdevsim/bpf.c
@@ -561,6 +561,12 @@ int nsim_bpf(struct net_device *dev, struct netdev_bpf *bpf)
561 nsim_bpf_destroy_prog(bpf->offload.prog); 561 nsim_bpf_destroy_prog(bpf->offload.prog);
562 return 0; 562 return 0;
563 case XDP_QUERY_PROG: 563 case XDP_QUERY_PROG:
564 if (ns->xdp_prog_mode != XDP_ATTACHED_DRV)
565 return 0;
566 return xdp_attachment_query(&ns->xdp, bpf);
567 case XDP_QUERY_PROG_HW:
568 if (ns->xdp_prog_mode != XDP_ATTACHED_HW)
569 return 0;
564 return xdp_attachment_query(&ns->xdp, bpf); 570 return xdp_attachment_query(&ns->xdp, bpf);
565 case XDP_SETUP_PROG: 571 case XDP_SETUP_PROG:
566 err = nsim_setup_prog_checks(ns, bpf); 572 err = nsim_setup_prog_checks(ns, bpf);