selftests: net: add PF_PACKET TPACKET v1/v2/v3 selftests
Subsystems (3)
PATCH 1/1 selftests: net: add PF_PACKET TPACKET v1/v2/v3 selftests
This patch adds a simple test case that probes the packet socket's TPACKET_V1, TPACKET_V2 and TPACKET_V3 behavior regarding mmap(2)'ed I/O for a small burst of 100 packets. The test currently runs for ...
TPACKET_V1: RX_RING, TX_RING
TPACKET_V2: RX_RING, TX_RING
TPACKET_V3: RX_RING
... and will output on success:
test: TPACKET_V1 with PACKET_RX_RING .................... 100 pkts (9600 bytes)
test: TPACKET_V1 with PACKET_TX_RING .................... 100 pkts (9600 bytes)
test: TPACKET_V2 with PACKET_RX_RING .................... 100 pkts (9600 bytes)
test: TPACKET_V2 with PACKET_TX_RING .................... 100 pkts (9600 bytes)
test: TPACKET_V3 with PACKET_RX_RING .................... 100 pkts (9600 bytes) OK. All tests passed
Reusable parts of psock_fanout.c have been put into a psock_lib.h file for common usage. Test case successfully tested on x86_64.
--- tools/testing/selftests/net/Makefile | 4 +- tools/testing/selftests/net/psock_fanout.c | 88 +-- tools/testing/selftests/net/psock_lib.h | 127 ++++ tools/testing/selftests/net/psock_tpacket.c | 824 ++++++++++++++++++++++++++ tools/testing/selftests/net/run_afpackettests | 10 + 5 files changed, 966 insertions(+), 87 deletions(-) create mode 100644 tools/testing/selftests/net/psock_lib.h create mode 100644 tools/testing/selftests/net/psock_tpacket.c
tools/testing/selftests/net/Makefile +2 -2
@@ -1,11 +1,11 @@ # Makefile for net selftests CC = $(CROSS_COMPILE)gcc -CFLAGS = -Wall +CFLAGS = -Wall -O2 -g CFLAGS += -I../../../../usr/include/ -NET_PROGS = socket psock_fanout +NET_PROGS = socket psock_fanout psock_tpacket all: $(NET_PROGS) %: %.c
tools/testing/selftests/net/psock_fanout.c +3 -85
101 lines not on this page · raw message
tools/testing/selftests/net/psock_lib.h new file +127 -0
127 lines not on this page · raw message
tools/testing/selftests/net/psock_tpacket.c new file +824 -0
824 lines not on this page · raw message
tools/testing/selftests/net/run_afpackettests +10 -0
@@ -14,3 +14,13 @@ if [ $? -ne 0 ]; then else echo "[PASS]" fi + +echo "--------------------" +echo "running psock_tpacket test" +echo "--------------------" +./psock_tpacket +if [ $? -ne 0 ]; then + echo "[FAIL]" +else + echo "[PASS]" +fi
Signature · 1 line
1.7.11.7