aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorJohn Fastabend <john.fastabend@gmail.com>2017-07-17 12:27:07 -0400
committerDavid S. Miller <davem@davemloft.net>2017-07-17 12:48:05 -0400
commit814abfabef3ceed390c10d06a0cc69a86454b6cf (patch)
treefe6ae9f9007124e1ddd76efd152f5d60db0a5bd9 /include/linux/netdevice.h
parentd445516966dcb2924741b13b27738b54df2af01a (diff)
xdp: add bpf_redirect helper function
This adds support for a bpf_redirect helper function to the XDP infrastructure. For now this only supports redirecting to the egress path of a port. In order to support drivers handling a xdp_buff natively this patches uses a new ndo operation ndo_xdp_xmit() that takes pushes a xdp_buff to the specified device. If the program specifies either (a) an unknown device or (b) a device that does not support the operation a BPF warning is thrown and the XDP_ABORTED error code is returned. Signed-off-by: John Fastabend <john.fastabend@gmail.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 779b23595596..77f5376005e6 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -66,6 +66,7 @@ struct mpls_dev;
66/* UDP Tunnel offloads */ 66/* UDP Tunnel offloads */
67struct udp_tunnel_info; 67struct udp_tunnel_info;
68struct bpf_prog; 68struct bpf_prog;
69struct xdp_buff;
69 70
70void netdev_set_default_ethtool_ops(struct net_device *dev, 71void netdev_set_default_ethtool_ops(struct net_device *dev,
71 const struct ethtool_ops *ops); 72 const struct ethtool_ops *ops);
@@ -1138,6 +1139,9 @@ struct xfrmdev_ops {
1138 * int (*ndo_xdp)(struct net_device *dev, struct netdev_xdp *xdp); 1139 * int (*ndo_xdp)(struct net_device *dev, struct netdev_xdp *xdp);
1139 * This function is used to set or query state related to XDP on the 1140 * This function is used to set or query state related to XDP on the
1140 * netdevice. See definition of enum xdp_netdev_command for details. 1141 * netdevice. See definition of enum xdp_netdev_command for details.
1142 * int (*ndo_xdp_xmit)(struct net_device *dev, struct xdp_buff *xdp);
1143 * This function is used to submit a XDP packet for transmit on a
1144 * netdevice.
1141 * 1145 *
1142 */ 1146 */
1143struct net_device_ops { 1147struct net_device_ops {
@@ -1323,6 +1327,8 @@ struct net_device_ops {
1323 int needed_headroom); 1327 int needed_headroom);
1324 int (*ndo_xdp)(struct net_device *dev, 1328 int (*ndo_xdp)(struct net_device *dev,
1325 struct netdev_xdp *xdp); 1329 struct netdev_xdp *xdp);
1330 int (*ndo_xdp_xmit)(struct net_device *dev,
1331 struct xdp_buff *xdp);
1326}; 1332};
1327 1333
1328/** 1334/**