samples/bpf: make xdp_fwd more practically usable via devmap lookup
authorJesper Dangaard Brouer <brouer@redhat.com>
Thu, 8 Aug 2019 16:17:42 +0000 (18:17 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 9 Aug 2019 16:05:03 +0000 (18:05 +0200)
commita32a32cb26eb6291125e4eb49b569874ca9a53b5
treec581f37cf8c26549b17f14eb81757d18562a182d
parent3783d43752eab247ed296ac8d5022484ed969151
samples/bpf: make xdp_fwd more practically usable via devmap lookup

This address the TODO in samples/bpf/xdp_fwd_kern.c, which points out
that the chosen egress index should be checked for existence in the
devmap. This can now be done via taking advantage of Toke's work in
commit 0cdbb4b09a06 ("devmap: Allow map lookups from eBPF").

This change makes xdp_fwd more practically usable, as this allows for
a mixed environment, where IP-forwarding fallback to network stack, if
the egress device isn't configured to use XDP.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
samples/bpf/xdp_fwd_kern.c
samples/bpf/xdp_fwd_user.c