bpf/xdp: non-map redirect can avoid calling ndo_xdp_flush
authorJesper Dangaard Brouer <brouer@redhat.com>
Thu, 31 May 2018 09:00:18 +0000 (11:00 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 3 Jun 2018 15:11:35 +0000 (08:11 -0700)
commit1e67575a5840908e33502b210a22509fe5d6ca53
tree77bedf3a0ece5c85b36ae0f8eac6f8cfc6a93cf1
parent73de5717eb30ceedef6abf9da4bc2194f25d92ca
bpf/xdp: non-map redirect can avoid calling ndo_xdp_flush

This is the first real user of the XDP_XMIT_FLUSH flag.

As pointed out many times, XDP_REDIRECT without using BPF maps is
significant slower than the map variant.  This is primary due to the
lack of bulking, as the ndo_xdp_flush operation is required after each
frame (to avoid frames hanging on the egress device).

It is still possible to optimize this case.  Instead of invoking two
NDO indirect calls, which are very expensive with CONFIG_RETPOLINE,
instead instruct ndo_xdp_xmit to flush via XDP_XMIT_FLUSH flag.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
net/core/filter.c