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. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
20 lines
379 B
Makefile
20 lines
379 B
Makefile
# Makefile for net selftests
|
|
|
|
CC = $(CROSS_COMPILE)gcc
|
|
CFLAGS = -Wall -O2 -g
|
|
|
|
CFLAGS += -I../../../../usr/include/
|
|
|
|
NET_PROGS = socket psock_fanout psock_tpacket
|
|
|
|
all: $(NET_PROGS)
|
|
%: %.c
|
|
$(CC) $(CFLAGS) -o $@ $^
|
|
|
|
run_tests: all
|
|
@/bin/sh ./run_netsocktests || echo "sockettests: [FAIL]"
|
|
@/bin/sh ./run_afpackettests || echo "afpackettests: [FAIL]"
|
|
|
|
clean:
|
|
$(RM) $(NET_PROGS)
|