]> git.baikalelectronics.ru Git - kernel.git/commit
samples/bpf: xdp_redirect load XDP dummy prog on TX device
authorJesper Dangaard Brouer <brouer@redhat.com>
Tue, 29 Aug 2017 14:38:06 +0000 (16:38 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 Aug 2017 17:51:29 +0000 (10:51 -0700)
commit66227ee8122cdce3b8aedad704e2fe9152dc033b
tree76ba2be2cdb8d5a01fa43270a66fdbf758837f99
parent9ba97e1deb76dcdb17bacee9b0c826c57af610f9
samples/bpf: xdp_redirect load XDP dummy prog on TX device

For supporting XDP_REDIRECT, a device driver must (obviously)
implement the "TX" function ndo_xdp_xmit().  An additional requirement
is you cannot TX out a device, unless it also have a xdp bpf program
attached. This dependency is caused by the driver code need to setup
XDP resources before it can ndo_xdp_xmit.

Update bpf samples xdp_redirect and xdp_redirect_map to automatically
attach a dummy XDP program to the configured ifindex_out device.  Use
the XDP flag XDP_FLAGS_UPDATE_IF_NOEXIST on the dummy load, to avoid
overriding an existing XDP prog on the device.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
samples/bpf/xdp_redirect_kern.c
samples/bpf/xdp_redirect_map_kern.c
samples/bpf/xdp_redirect_map_user.c
samples/bpf/xdp_redirect_user.c