Commit | Line | Data |
---|---|---|
db72aba3 | 1 | #!/bin/bash |
7c95a9d9 BH |
2 | |
3 | #modprobe pktgen | |
4 | ||
5 | ||
6 | function 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 | ||
7c95a9d9 BH |
17 | # Config Start Here ----------------------------------------------------------- |
18 | ||
19 | ||
20 | # thread config | |
2ad1cdf2 | 21 | # One CPU means one thread. One CPU example. We add eth1, eth2 respectivly. |
7c95a9d9 BH |
22 | |
23 | PGDEV=/proc/net/pktgen/kpktgend_0 | |
24 | echo "Removing all devices" | |
25 | pgset "rem_device_all" | |
26 | echo "Adding eth1" | |
27 | pgset "add_device eth1" | |
28 | echo "Adding eth2" | |
29 | pgset "add_device eth2" | |
7c95a9d9 BH |
30 | |
31 | ||
32 | # device config | |
33 | # delay 0 means maximum speed. | |
34 | ||
35 | CLONE_SKB="clone_skb 1000000" | |
36 | # NIC adds 4 bytes CRC | |
37 | PKT_SIZE="pkt_size 60" | |
38 | ||
39 | # COUNT 0 means forever | |
40 | #COUNT="count 0" | |
41 | COUNT="count 10000000" | |
42 | DELAY="delay 0" | |
43 | ||
44 | PGDEV=/proc/net/pktgen/eth1 | |
45 | echo "Configuring $PGDEV" | |
46 | pgset "$COUNT" | |
47 | pgset "$CLONE_SKB" | |
48 | pgset "$PKT_SIZE" | |
49 | pgset "$DELAY" | |
50 | pgset "dst 10.10.11.2" | |
51 | pgset "dst_mac 00:04:23:08:91:dc" | |
52 | ||
53 | PGDEV=/proc/net/pktgen/eth2 | |
54 | echo "Configuring $PGDEV" | |
55 | pgset "$COUNT" | |
56 | pgset "$CLONE_SKB" | |
57 | pgset "$PKT_SIZE" | |
58 | pgset "$DELAY" | |
59 | pgset "dst 192.168.2.2" | |
60 | pgset "dst_mac 00:04:23:08:91:de" | |
61 | ||
62 | # Time to run | |
63 | PGDEV=/proc/net/pktgen/pgctrl | |
64 | ||
65 | echo "Running... ctrl^C to stop" | |
16b5d0c4 | 66 | trap true INT |
7c95a9d9 BH |
67 | pgset "start" |
68 | echo "Done" | |
4062bd25 | 69 | cat /proc/net/pktgen/eth1 /proc/net/pktgen/eth2 |