summaryrefslogtreecommitdiffstats
path: root/recipes-test/ddt-runner/files/scripts/acp3448v2/pci-express
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/acp3448v2/pci-express')
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/acp3448v2/pci-express109
1 files changed, 109 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/acp3448v2/pci-express b/recipes-test/ddt-runner/files/scripts/acp3448v2/pci-express
new file mode 100755
index 0000000..b04485f
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/acp3448v2/pci-express
@@ -0,0 +1,109 @@
1#!/bin/sh
2
3ethernet_interface="eth0"
4ethernet_ping_ipaddr="172.21.3.22"
5ethernet_ipaddr=$1
6
7#Intel Corporation 82574L Gigabit Network Card (intel e1000e)
8vendor_id="8086"
9product_id="10d3"
10
11#find vendor id & product id
12lspci -nn |grep $vendor_id:$product_id
13if [ $? -ne 0 ]; then
14 echo "FAIL: pci-e ethernet card device does not exist"
15 exit 1
16else
17 echo "PASS: got pci-e ethernet card device"
18fi
19
20setpci -v -d $vendor_id:$product_id latency_timer=b0
21if [ $? -ne 0 ]; then
22 echo "FAIL: parameter changes to pci config space failed"
23 exit 1
24else
25 echo "PASS: parameter changes to pci config space success"
26fi
27
28IFCONFIG=`which ifconfig`
29
30$IFCONFIG $ethernet_interface up
31$IFCONFIG | grep $ethernet_interface
32if [ $? -ne 0 ]; then
33 echo "FAIL: pci-e ethernet card device $ethernet_interface is not up"
34 exit 1
35else
36 echo "PASS: pci-e ethernet card device $ethernet_interface is up"
37fi
38
39if [ "x$ethernet_ipaddr" != "x" ]; then
40 $IFCONFIG $ethernet_interface $ethernet_ipaddr
41fi
42
43$IFCONFIG $ethernet_interface |grep 'inet addr:' |sed -e 's@inet addr:@@' |sed q | awk '{print $1}'
44if [ $? -ne 0 ]; then
45 echo "FAIL: ipaddr of pci-e ethernet card device $ethernet_interface setup failed"
46 exit 1
47else
48 echo "PASS: ipaddr of pci-e ethernet card device $ethernet_interface setup success"
49fi
50
51mindatasize=56
52maxdatasize=650
53stepsize=100
54iteration=1
55datasize=$mindatasize
56logfile=`/bin/mktemp`
57statistics=`/bin/mktemp`
58error=0
59
60trap cleanup SIGHUP SIGINT SIGTERM
61
62clean_tasks() {
63 echo "Executing clean up tasks"
64 rm -f $logfile $statistics
65}
66
67cleanup() {
68 echo "Aborting script execution"
69 clean_tasks
70 exit 0
71}
72
73echo "start ping test for pci-e ethernet card device $ethernet_interface..."
74
75while [ $datasize -le $maxdatasize ]; do
76 for i in `seq 1 $iteration`; do
77 ping -c 1 -s $datasize $ethernet_ping_ipaddr > $statistics
78 ping_err=`echo $?`
79 echo "" && cat $statistics | grep -r "PING"
80 cat $statistics | grep -r "received"
81 [ `echo $?` -eq 0 ] || packets_received=0 && \
82 packets_received=`cat $statistics | \
83 grep -r "received" | awk '{print$4}'`
84
85 # Evaluate possible errors on the ping operation
86 if [ $ping_err -ne 0 ] || [ $packets_received -eq 0 ]; then
87 error=1
88 echo -e `cat $statistics | grep -r PING` >> $logfile
89 echo -e "Size: $datasize Iteration: $i\n" >> $logfile
90 fi
91 done
92 let datasize=$datasize+$stepsize
93done
94
95# Report failures
96if [ $error -eq 1 ]; then
97 echo -e "=================== error report ===================\n"
98 cat $logfile
99 echo -e "====================================================\n"
100 clean_tasks
101 echo -e "FAIL: ping test for pci-e ethernet card device $ethernet_interface failed\n"
102 exit 1
103else
104 clean_tasks
105 echo -e "PASS: ping test for pci-e ethernet card device $ethernet_interface success\n"
106fi
107
108echo "PASS: pci express test passed"
109exit 0