History

xdp: pass XDP flags into install handlers

Pass XDP flags to the xdp ndo. This will allow drivers to look at the mode flags and make decisions about offload.

Jakub Kicinski committed 9 years ago

Commit 32d60271 parent 9bd780f2 files · +4 −2Browse files

Unified · Split

2 files
  1. include/linux/netdevice.h +1 −0
  2. net/core/dev.c +3 −2
include/linux/netdevice.h+1−0
@@ -820,6 +820,7 @@ struct netdev_xdp { · 819 unmodified lines
820 union {820 union {
821 /* XDP_SETUP_PROG */821 /* XDP_SETUP_PROG */
822 struct {822 struct {
823 u32 flags;
823 struct bpf_prog *prog;824 struct bpf_prog *prog;
824 struct netlink_ext_ack *extack;825 struct netlink_ext_ack *extack;
825 };826 };
net/core/dev.c+3−2
@@ -6951,7 +6951,7 @@ bool __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op, · 6950 unmodified lines
6951}6951}
6952 6952
6953static int dev_xdp_install(struct net_device *dev, xdp_op_t xdp_op,6953static int dev_xdp_install(struct net_device *dev, xdp_op_t xdp_op,
6954 struct netlink_ext_ack *extack,6954 struct netlink_ext_ack *extack, u32 flags,
6955 struct bpf_prog *prog)6955 struct bpf_prog *prog)
6956{6956{
6957 struct netdev_xdp xdp;6957 struct netdev_xdp xdp;
@@ -6959,6 +6959,7 @@ static int dev_xdp_install(struct net_device *dev, xdp_op_t xdp_op, · 1 unmodified line
6959 memset(&xdp, 0, sizeof(xdp));6959 memset(&xdp, 0, sizeof(xdp));
6960 xdp.command = XDP_SETUP_PROG;6960 xdp.command = XDP_SETUP_PROG;
6961 xdp.extack = extack;6961 xdp.extack = extack;
6962 xdp.flags = flags;
6962 xdp.prog = prog;6963 xdp.prog = prog;
6963 6964
6964 return xdp_op(dev, &xdp);6965 return xdp_op(dev, &xdp);
@@ -7003,7 +7004,7 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, · 38 unmodified lines
7003 return PTR_ERR(prog);7004 return PTR_ERR(prog);
7004 }7005 }
7005 7006
7006 err = dev_xdp_install(dev, xdp_op, extack, prog);7007 err = dev_xdp_install(dev, xdp_op, extack, flags, prog);
7007 if (err < 0 && prog)7008 if (err < 0 && prog)
7008 bpf_prog_put(prog);7009 bpf_prog_put(prog);
7009 7010