selftests/bpf: Xsk selftests framework
authorWeqaar Janjua <weqaar.janjua@gmail.com>
Mon, 7 Dec 2020 21:53:29 +0000 (21:53 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 9 Dec 2020 15:44:44 +0000 (16:44 +0100)
commita89052572ebbf4bcee7c39390640e92b60eaa653
tree4e326920722773b04dddc55c68edb0bd79dcdaea
parentb60da4955f53d1f50e44351a9c3a37a92503079e
selftests/bpf: Xsk selftests framework

This patch adds AF_XDP selftests framework under selftests/bpf.

Topology:
---------
     -----------           -----------
     |  xskX   | --------- |  xskY   |
     -----------     |     -----------
          |          |          |
     -----------     |     ----------
     |  vethX  | --------- |  vethY |
     -----------   peer    ----------
          |          |          |
     namespaceX      |     namespaceY

Prerequisites setup by script test_xsk.sh:

   Set up veth interfaces as per the topology shown ^^:
   * setup two veth interfaces and one namespace
   ** veth<xxxx> in root namespace
   ** veth<yyyy> in af_xdp<xxxx> namespace
   ** namespace af_xdp<xxxx>
   * create a spec file veth.spec that includes this run-time configuration
   *** xxxx and yyyy are randomly generated 4 digit numbers used to avoid
       conflict with any existing interface
   * tests the veth and xsk layers of the topology

Signed-off-by: Weqaar Janjua <weqaar.a.janjua@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Yonghong Song <yhs@fb.com>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/bpf/20201207215333.11586-2-weqaar.a.janjua@intel.com
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/test_xsk.sh [new file with mode: 0755]
tools/testing/selftests/bpf/xsk_prereqs.sh [new file with mode: 0755]