aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-dpdk/test/example/l3fwd/pktio_env
blob: c9e35f09a85eb9af2c16319f9303ba98336e6499 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
#
# Copyright (c) 2020, Marvell
# Copyright (c) 2020, Nokia
# All rights reserved.
#
# SPDX-License-Identifier:	BSD-3-Clause
#
# Script to setup interfaces used for running application on linux-dpdk.
#
# For linux-dpdk the default behavior is to create two pcap interfaces of which
# the first one uses udp64.pcap to inject traffic. An output pcap file is
# generated by the second interface.
#
# Network set-up
# IF0 <---> IF1

PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit`
PCAP_OUT="pcapout.pcap"
PCAP_EMPTY=`find . ${TEST_DIR} $(dirname $0) -name empty.pcap -print -quit`
PCAP_IN_SIZE=`stat -c %s ${PCAP_IN}`
IF0=0
IF1=1

export ODP_PLATFORM_PARAMS="--no-pci \
--vdev net_pcap0,rx_pcap=${PCAP_IN},tx_pcap=/dev/null \
--vdev net_pcap1,rx_pcap=${PCAP_EMPTY},tx_pcap=${PCAP_OUT}"

echo "Using PCAP_IN = ${PCAP_IN}, PCAP_OUT = ${PCAP_OUT}"

if [ "$0" = "$BASH_SOURCE" ]; then
	echo "Error: Platform specific env file has to be sourced."
fi

validate_result()
{
	PCAP_OUT_SIZE=`stat -c %s ${PCAP_OUT}`
	if [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then
		echo "in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"
		exit 1
	fi

	echo "Pass: in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}"
	rm -f pcapout.pcap
}

setup_interfaces()
{
	echo "pktio: setting up test interfaces $IF0, $IF1."
	return 0
}

cleanup_interfaces()
{
	echo "pktio: cleaning up test interfaces $IF0, $IF1."
	return 0
}