• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /usr/bin/env bash
2
3if [ ! -x "$(command -v ip)" ]; then
4	echo "Need ip installed"
5	exit 77
6fi
7if [ ! -x "$(command -v ethtool)" ]; then
8	echo "Need ethool installed"
9	exit 77
10fi
11
12function clean_namespaces {
13	ip netns del iou-nscl
14	ip netns del iou-nsserv
15}
16trap clean_namespaces EXIT
17
18ip link add iou-ptp-cl type veth peer name iou-ptp-serv
19
20ip netns add iou-nscl
21ip link set iou-ptp-cl netns iou-nscl
22ip netns exec iou-nscl ip addr add '10.10.10.10/24' dev iou-ptp-cl
23ip netns exec iou-nscl ethtool -K iou-ptp-cl tcp-segmentation-offload off
24ip netns exec iou-nscl ethtool -K iou-ptp-cl generic-receive-offload on
25ip netns exec iou-nscl ip link set dev iou-ptp-cl up
26
27ip netns add iou-nsserv
28ip link set iou-ptp-serv netns iou-nsserv
29ip netns exec iou-nsserv ip addr add '10.10.10.20/24' dev iou-ptp-serv
30ip netns exec iou-nsserv ethtool -K iou-ptp-serv tcp-segmentation-offload off
31ip netns exec iou-nsserv ethtool -K iou-ptp-serv generic-receive-offload on
32ip netns exec iou-nsserv ip link set dev iou-ptp-serv up
33
34# test basic init, defer_taskrun, and sqpoll
35QUEUE_FLAGS="0x0 0x3000 0x2"
36for flags in $QUEUE_FLAGS; do
37	if [ -f "napi-test.t" ]; then
38		NAPI_TEST="./napi-test.t"
39	elif [ -f "test/napi-test.t" ]; then
40		NAPI_TEST="test/napi-test.t"
41	else
42		echo "Can't find napi-test.t"
43		exit 77
44	fi
45	ip netns exec iou-nsserv $NAPI_TEST receive $flags &
46	ip netns exec iou-nscl $NAPI_TEST send $flags
47	wait
48done
49