• Hangbin Liu's avatar
    selftests/bpf: Add xdp_redirect_multi test · d2329247
    Hangbin Liu authored
    Add a bpf selftest for new helper xdp_redirect_map_multi(). In this
    test there are 3 forward groups and 1 exclude group. The test will
    redirect each interface's packets to all the interfaces in the forward
    group, and exclude the interface in exclude map.
    
    Two maps (DEVMAP, DEVMAP_HASH) and two xdp modes (generic, drive) will
    be tested. XDP egress program will also be tested by setting pkt src MAC
    to egress interface's MAC address.
    
    For more test details, you can find it in the test script. Here is
    the test result.
    ]# time ./test_xdp_redirect_multi.sh
    Pass: xdpgeneric arp(F_BROADCAST) ns1-1
    Pass: xdpgeneric arp(F_BROADCAST) ns1-2
    Pass: xdpgeneric arp(F_BROADCAST) ns1-3
    Pass: xdpgeneric IPv4 (F_BROADCAST|F_EXCLUDE_INGRESS) ns1-1
    Pass: xdpgeneric IPv4 (F_BROADCAST|F_EXCLUDE_INGRESS) ns1-2
    Pass: xdpgeneric IPv4 (F_BROADCAST|F_EXCLUDE_INGRESS) ns1-3
    Pass: xdpgeneric IPv6 (no flags) ns1-1
    Pass: xdpgeneric IPv6 (no flags) ns1-2
    Pass: xdpdrv arp(F_BROADCAST) ns1-1
    Pass: xdpdrv arp(F_BROADCAST) ns1-2
    Pass: xdpdrv arp(F_BROADCAST) ns1-3
    Pass: xdpdrv IPv4 (F_BROADCAST|F_EXCLUDE_INGRESS) ns1-1
    Pass: xdpdrv IPv4 (F_BROADCAST|F_EXCLUDE_INGRESS) ns1-2
    Pass: xdpdrv IPv4 (F_BROADCAST|F_EXCLUDE_INGRESS) ns1-3
    Pass: xdpdrv IPv6 (no flags) ns1-1
    Pass: xdpdrv IPv6 (no flags) ns1-2
    Pass: xdpegress mac ns1-2
    Pass: xdpegress mac ns1-3
    Summary: PASS 18, FAIL 0
    
    real    1m18.321s
    user    0m0.123s
    sys     0m0.350s
    Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Acked-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
    Link: https://lore.kernel.org/bpf/20210519090747.1655268-5-liuhangbin@gmail.com
    d2329247
Makefile 19.6 KB