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 | # Each CPU has its own thread. One CPU example. We add eth1. |
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" | |
7c95a9d9 BH |
28 | |
29 | ||
30 | # device config | |
31 | # delay 0 | |
32 | # We need to do alloc for every skb since we cannot clone here. | |
33 | ||
34 | CLONE_SKB="clone_skb 0" | |
35 | # NIC adds 4 bytes CRC | |
36 | PKT_SIZE="pkt_size 60" | |
37 | ||
38 | # COUNT 0 means forever | |
39 | #COUNT="count 0" | |
40 | COUNT="count 10000000" | |
41 | DELAY="delay 0" | |
42 | ||
43 | PGDEV=/proc/net/pktgen/eth1 | |
44 | echo "Configuring $PGDEV" | |
45 | pgset "$COUNT" | |
46 | pgset "$CLONE_SKB" | |
47 | pgset "$PKT_SIZE" | |
48 | pgset "$DELAY" | |
49 | # Random address with in the min-max range | |
50 | pgset "flag IPDST_RND" | |
51 | pgset "dst_min 10.0.0.0" | |
52 | pgset "dst_max 10.255.255.255" | |
53 | ||
54 | # 8k Concurrent flows at 4 pkts | |
55 | pgset "flows 8192" | |
56 | pgset "flowlen 4" | |
57 | ||
58 | pgset "dst_mac 00:04:23:08:91:dc" | |
59 | ||
60 | # Time to run | |
61 | PGDEV=/proc/net/pktgen/pgctrl | |
62 | ||
63 | echo "Running... ctrl^C to stop" | |
16b5d0c4 | 64 | trap true INT |
7c95a9d9 BH |
65 | pgset "start" |
66 | echo "Done" | |
4062bd25 | 67 | cat /proc/net/pktgen/eth1 |