xdp: pass XDP flags into install handlers
authorJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 22 Jun 2017 01:25:03 +0000 (18:25 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Jun 2017 17:42:18 +0000 (13:42 -0400)
Pass XDP flags to the xdp ndo.  This will allow drivers to look
at the mode flags and make decisions about offload.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/core/dev.c

index 7c7118b3bd692831e1c58e22c017d6985169b301..b194817631ded71ce77e84c0127b73878fd3cea4 100644 (file)
@@ -820,6 +820,7 @@ struct netdev_xdp {
        union {
                /* XDP_SETUP_PROG */
                struct {
+                       u32 flags;
                        struct bpf_prog *prog;
                        struct netlink_ext_ack *extack;
                };
index df7637733e3caa08dbe4017fa6ba786faf5aa119..09f9e99f4a3ee6df6a7e44f01c28a5dce806402b 100644 (file)
@@ -6951,7 +6951,7 @@ bool __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op,
 }
 
 static int dev_xdp_install(struct net_device *dev, xdp_op_t xdp_op,
-                          struct netlink_ext_ack *extack,
+                          struct netlink_ext_ack *extack, u32 flags,
                           struct bpf_prog *prog)
 {
        struct netdev_xdp xdp;
@@ -6959,6 +6959,7 @@ static int dev_xdp_install(struct net_device *dev, xdp_op_t xdp_op,
        memset(&xdp, 0, sizeof(xdp));
        xdp.command = XDP_SETUP_PROG;
        xdp.extack = extack;
+       xdp.flags = flags;
        xdp.prog = prog;
 
        return xdp_op(dev, &xdp);
@@ -7003,7 +7004,7 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
                        return PTR_ERR(prog);
        }
 
-       err = dev_xdp_install(dev, xdp_op, extack, prog);
+       err = dev_xdp_install(dev, xdp_op, extack, flags, prog);
        if (err < 0 && prog)
                bpf_prog_put(prog);