lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 30 Oct 2020 12:13:42 +0000
From:   Weqaar Janjua <weqaar.janjua@...il.com>
To:     bpf@...r.kernel.org, netdev@...r.kernel.org, daniel@...earbox.net,
        ast@...nel.org, magnus.karlsson@...il.com, bjorn.topel@...el.com
Cc:     Weqaar Janjua <weqaar.a.janjua@...el.com>, shuah@...nel.org,
        skhan@...uxfoundation.org, linux-kselftest@...r.kernel.org,
        anders.roxell@...aro.org, jonathan.lemon@...il.com
Subject: [PATCH bpf-next 0/5] selftests/xsk: xsk selftests

This patch set adds AF_XDP selftests based on veth to selftests/xsk/.

# Topology:
# ---------
#                 -----------
#               _ | Process | _
#              /  -----------  \
#             /        |        \
#            /         |         \
#      -----------     |     -----------
#      | Thread1 |     |     | Thread2 |
#      -----------     |     -----------
#           |          |          |
#      -----------     |     -----------
#      |  xskX   |     |     |  xskY   |
#      -----------     |     -----------
#           |          |          |
#      -----------     |     ----------
#      |  vethX  | --------- |  vethY |
#      -----------   peer    ----------
#           |          |          |
#      namespaceX      |     namespaceY

These selftests test AF_XDP SKB and Native/DRV modes using veth Virtual
Ethernet interfaces.

The test program contains two threads, each thread is single socket with
a unique UMEM. It validates in-order packet delivery and packet content
by sending packets to each other.

Prerequisites setup by script TEST_PREREQUISITES.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
     that is read by test scripts - filenames prefixed with TEST_XSK
   *** xxxx and yyyy are randomly generated 4 digit numbers used to avoid
       conflict with any existing interface.

The following tests are provided:

1. AF_XDP SKB mode
   Generic mode XDP is driver independent, used when the driver does
   not have support for XDP. Works on any netdevice using sockets and
   generic XDP path. XDP hook from netif_receive_skb().
   a. nopoll - soft-irq processing
   b. poll - using poll() syscall
   c. Socket Teardown
      Create a Tx and a Rx socket, Tx from one socket, Rx on another.
      Destroy both sockets, then repeat multiple times. Only nopoll mode
	  is used
   d. Bi-directional Sockets
      Configure sockets as bi-directional tx/rx sockets, sets up fill
	  and completion rings on each socket, tx/rx in both directions.
	  Only nopoll mode is used

2. AF_XDP DRV/Native mode
   Works on any netdevice with XDP_REDIRECT support, driver dependent.
   Processes packets before SKB allocation. Provides better performance
   than SKB. Driver hook available just after DMA of buffer descriptor.
   a. nopoll
   b. poll
   c. Socket Teardown
   d. Bi-directional Sockets
   * Only copy mode is supported because veth does not currently support
     zero-copy mode

Total tests: 8.

Flow:
* Single process spawns two threads: Tx and Rx
* Each of these two threads attach to a veth interface within their
  assigned namespaces
* Each thread creates one AF_XDP socket connected to a unique umem
  for each veth interface
* Tx thread transmits 10k packets from veth<xxxx> to veth<yyyy>
* Rx thread verifies if all 10k packets were received and delivered
  in-order, and have the right content

Structure of the patch set:

Patch 1: This patch adds XSK Selftests framework under
         tools/testing/selftests/xsk, and README
Patch 2: Adds tests: SKB poll and nopoll mode, mac-ip-udp debug,
         and README updates
Patch 3: Adds tests: DRV poll and nopoll mode, and README updates
Patch 4: Adds tests: SKB and DRV Socket Teardown, and README updates
Patch 5: Adds tests: SKB and DRV Bi-directional Sockets, and README
         updates

Thanks: Weqaar

Weqaar Janjua (5):
  selftests/xsk: xsk selftests framework
  selftests/xsk: xsk selftests - SKB POLL, NOPOLL
  selftests/xsk: xsk selftests - DRV POLL, NOPOLL
  selftests/xsk: xsk selftests - Socket Teardown - SKB, DRV
  selftests/xsk: xsk selftests - Bi-directional Sockets - SKB, DRV

 MAINTAINERS                                   |    1 +
 tools/testing/selftests/Makefile              |    1 +
 tools/testing/selftests/xsk/Makefile          |   34 +
 tools/testing/selftests/xsk/README            |  125 +++
 .../selftests/xsk/TEST_PREREQUISITES.sh       |   53 +
 tools/testing/selftests/xsk/TEST_XSK.sh       |   15 +
 .../xsk/TEST_XSK_DRV_BIDIRECTIONAL.sh         |   22 +
 .../selftests/xsk/TEST_XSK_DRV_NOPOLL.sh      |   18 +
 .../selftests/xsk/TEST_XSK_DRV_POLL.sh        |   18 +
 .../selftests/xsk/TEST_XSK_DRV_TEARDOWN.sh    |   18 +
 .../xsk/TEST_XSK_SKB_BIDIRECTIONAL.sh         |   19 +
 .../selftests/xsk/TEST_XSK_SKB_NOPOLL.sh      |   18 +
 .../selftests/xsk/TEST_XSK_SKB_POLL.sh        |   18 +
 .../selftests/xsk/TEST_XSK_SKB_TEARDOWN.sh    |   18 +
 tools/testing/selftests/xsk/config            |   12 +
 tools/testing/selftests/xsk/prereqs.sh        |  119 ++
 tools/testing/selftests/xsk/xdpprogs/Makefile |   64 ++
 .../selftests/xsk/xdpprogs/Makefile.target    |   68 ++
 .../selftests/xsk/xdpprogs/xdpxceiver.c       | 1000 +++++++++++++++++
 .../selftests/xsk/xdpprogs/xdpxceiver.h       |  159 +++
 tools/testing/selftests/xsk/xskenv.sh         |   33 +
 21 files changed, 1833 insertions(+)
 create mode 100644 tools/testing/selftests/xsk/Makefile
 create mode 100644 tools/testing/selftests/xsk/README
 create mode 100755 tools/testing/selftests/xsk/TEST_PREREQUISITES.sh
 create mode 100755 tools/testing/selftests/xsk/TEST_XSK.sh
 create mode 100755 tools/testing/selftests/xsk/TEST_XSK_DRV_BIDIRECTIONAL.sh
 create mode 100755 tools/testing/selftests/xsk/TEST_XSK_DRV_NOPOLL.sh
 create mode 100755 tools/testing/selftests/xsk/TEST_XSK_DRV_POLL.sh
 create mode 100755 tools/testing/selftests/xsk/TEST_XSK_DRV_TEARDOWN.sh
 create mode 100755 tools/testing/selftests/xsk/TEST_XSK_SKB_BIDIRECTIONAL.sh
 create mode 100755 tools/testing/selftests/xsk/TEST_XSK_SKB_NOPOLL.sh
 create mode 100755 tools/testing/selftests/xsk/TEST_XSK_SKB_POLL.sh
 create mode 100755 tools/testing/selftests/xsk/TEST_XSK_SKB_TEARDOWN.sh
 create mode 100644 tools/testing/selftests/xsk/config
 create mode 100755 tools/testing/selftests/xsk/prereqs.sh
 create mode 100644 tools/testing/selftests/xsk/xdpprogs/Makefile
 create mode 100644 tools/testing/selftests/xsk/xdpprogs/Makefile.target
 create mode 100644 tools/testing/selftests/xsk/xdpprogs/xdpxceiver.c
 create mode 100644 tools/testing/selftests/xsk/xdpprogs/xdpxceiver.h
 create mode 100755 tools/testing/selftests/xsk/xskenv.sh

-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ