blob: ad98e5f40776211fe201da3ea64b24bae4741506 [file] [log] [blame]
Ben Hutchingsdb72aba2015-02-24 02:32:59 +00001#!/bin/bash
Ben Hutchings7c95a9d2015-02-24 02:32:07 +00002
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
Ben Hutchings2ad1cdf2015-02-24 02:32:37 +000021# Each CPU has its own thread. One CPU example. We add eth1.
Ben Hutchings7c95a9d2015-02-24 02:32:07 +000022# 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"
Ben Hutchings7c95a9d2015-02-24 02:32:07 +000029
30
31# device config
32# delay 0 means maximum speed.
33
34# We need to do alloc for every skb since we cannot clone here.
35CLONE_SKB="clone_skb 0"
36
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_min fec0::1"
52 pgset "dst6_max fec0::FFFF:FFFF"
53
54 pgset "dst_mac 00:04:23:08:91:dc"
55
56# Time to run
57PGDEV=/proc/net/pktgen/pgctrl
58
59 echo "Running... ctrl^C to stop"
Ben Hutchings16b5d0c2015-02-24 02:33:08 +000060 trap true INT
Ben Hutchings7c95a9d2015-02-24 02:32:07 +000061 pgset "start"
62 echo "Done"
Ben Hutchings4062bd22015-02-24 02:33:20 +000063 cat /proc/net/pktgen/eth1