blob: cf0e86f8b43c24dbf74baa6cd843a23f24556b9e [file] [log] [blame]
Ben Hutchings7c95a9d2015-02-24 02:32:07 +00001#! /bin/sh
2
3#modprobe pktgen
4
5
6function pgset() {
7 local result
8
9 echo $1 > $PGDEV
10
11 result=`cat $PGDEV | fgrep "Result: OK:"`
12 if [ "$result" = "" ]; then
13 cat $PGDEV | fgrep Result:
14 fi
15}
16
Ben Hutchings7c95a9d2015-02-24 02:32:07 +000017# Config Start Here -----------------------------------------------------------
18
19
20# thread config
21# Each CPU has own thread. Two CPU exammple. We add eth1, eth2 respectivly.
22# IPv6. Note increase in minimal packet length
23
24PGDEV=/proc/net/pktgen/kpktgend_0
25 echo "Removing all devices"
26 pgset "rem_device_all"
27 echo "Adding eth1"
28 pgset "add_device eth1"
29 echo "Setting max_before_softirq 10000"
30 pgset "max_before_softirq 10000"
31
32
33# device config
34# delay 0
35
36CLONE_SKB="clone_skb 1000000"
37# NIC adds 4 bytes CRC
38PKT_SIZE="pkt_size 66"
39
40# COUNT 0 means forever
41#COUNT="count 0"
42COUNT="count 10000000"
43DELAY="delay 0"
44
45PGDEV=/proc/net/pktgen/eth1
46 echo "Configuring $PGDEV"
47 pgset "$COUNT"
48 pgset "$CLONE_SKB"
49 pgset "$PKT_SIZE"
50 pgset "$DELAY"
51 pgset "dst6 fec0::1"
52 pgset "src6 fec0::2"
53 pgset "dst_mac 00:04:23:08:91:dc"
54
55# Time to run
56PGDEV=/proc/net/pktgen/pgctrl
57
58 echo "Running... ctrl^C to stop"
59 pgset "start"
60 echo "Done"
61
62# Result can be vieved in /proc/net/pktgen/eth1