linux-stable/tools/testing/selftests/net/toeplitz_client.sh
Coco Li 5ebfb4cc30 selftests/net: toeplitz test
To verify that this hash implements the Toeplitz hash function.

Additionally, provide a script toeplitz.sh to run the test in loopback mode
on a networking device of choice (see setup_loopback.sh). Since the
script modifies the NIC setup, it will not be run by selftests
automatically.

Tested:
./toeplitz.sh -i eth0 -irq_prefix <eth0_pattern> -t -6
carrier ready
rxq 0: cpu 14
rxq 1: cpu 20
rxq 2: cpu 17
rxq 3: cpu 23
cpu 14: rx_hash 0x69103ebc [saddr fda8::2 daddr fda8::1 sport 58938 dport 8000] OK rxq 0 (cpu 14)
...
cpu 20: rx_hash 0x257118b9 [saddr fda8::2 daddr fda8::1 sport 59258 dport 8000] OK rxq 1 (cpu 20)
count: pass=111 nohash=0 fail=0
Test Succeeded!

Signed-off-by: Coco Li <lixiaoyan@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-08-05 13:14:09 +01:00

28 lines
667 B
Bash
Executable file

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# A simple program for generating traffic for the toeplitz test.
#
# This program sends packets periodically for, conservatively, 20 seconds. The
# intent is for the calling program to kill this program once it is no longer
# needed, rather than waiting for the 20 second expiration.
send_traffic() {
expiration=$((SECONDS+20))
while [[ "${SECONDS}" -lt "${expiration}" ]]
do
if [[ "${PROTO}" == "-u" ]]; then
echo "msg $i" | nc "${IPVER}" -u -w 0 "${ADDR}" "${PORT}"
else
echo "msg $i" | nc "${IPVER}" -w 0 "${ADDR}" "${PORT}"
fi
sleep 0.001
done
}
PROTO=$1
IPVER=$2
ADDR=$3
PORT=$4
send_traffic