blob: 752f112bd9e6666b3083e201e77b19ea546787fd [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
17function pg() {
18 echo inject > $PGDEV
19 cat $PGDEV
20}
21
22# Config Start Here -----------------------------------------------------------
23
24
25# thread config
26# Each CPU has own thread. Two CPU exammple. We add eth1, eth2 respectivly.
27# IPv6. Note increase in minimal packet length
28
29PGDEV=/proc/net/pktgen/kpktgend_0
30 echo "Removing all devices"
31 pgset "rem_device_all"
32 echo "Adding eth1"
33 pgset "add_device eth1"
34 echo "Setting max_before_softirq 10000"
35 pgset "max_before_softirq 10000"
36
37
38# device config
39# delay 0
40
41CLONE_SKB="clone_skb 1000000"
42# NIC adds 4 bytes CRC
43PKT_SIZE="pkt_size 66"
44
45# COUNT 0 means forever
46#COUNT="count 0"
47COUNT="count 10000000"
48DELAY="delay 0"
49
50PGDEV=/proc/net/pktgen/eth1
51 echo "Configuring $PGDEV"
52 pgset "$COUNT"
53 pgset "$CLONE_SKB"
54 pgset "$PKT_SIZE"
55 pgset "$DELAY"
56 pgset "dst6 fec0::1"
57 pgset "src6 fec0::2"
58 pgset "dst_mac 00:04:23:08:91:dc"
59
60# Time to run
61PGDEV=/proc/net/pktgen/pgctrl
62
63 echo "Running... ctrl^C to stop"
64 pgset "start"
65 echo "Done"
66
67# Result can be vieved in /proc/net/pktgen/eth1