]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: xdp: report flags program was installed with on query
authorJakub Kicinski <jakub.kicinski@netronome.com>
Fri, 1 Dec 2017 23:08:56 +0000 (15:08 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Sat, 2 Dec 2017 23:27:57 +0000 (00:27 +0100)
Some drivers enforce that flags on program replacement and
removal must match the flags passed on install.  This leaves
the possibility open to enable simultaneous loading
of XDP programs both to HW and DRV.

Allow such drivers to report the flags back to the stack.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
include/linux/netdevice.h

index 1a603fdd9e802d1344e37bcfa719404b69312e43..ea6bbf1efefc5749b891c88af6e60bbe81b6cceb 100644 (file)
@@ -3392,6 +3392,7 @@ static int nfp_net_xdp(struct net_device *netdev, struct netdev_bpf *xdp)
                if (nn->dp.bpf_offload_xdp)
                        xdp->prog_attached = XDP_ATTACHED_HW;
                xdp->prog_id = nn->xdp_prog ? nn->xdp_prog->aux->id : 0;
+               xdp->flags = nn->xdp_prog ? nn->xdp_flags : 0;
                return 0;
        case BPF_OFFLOAD_VERIFIER_PREP:
                return nfp_app_bpf_verifier_prep(nn->app, nn, xdp);
index 667bdd3ad33eb5ce83d0de1101e3be001381c67d..cc4ce7456e38198f53f555fd82b67ef604957618 100644 (file)
@@ -820,6 +820,8 @@ struct netdev_bpf {
                struct {
                        u8 prog_attached;
                        u32 prog_id;
+                       /* flags with which program was installed */
+                       u32 prog_flags;
                };
                /* BPF_OFFLOAD_VERIFIER_PREP */
                struct {