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