Linux 4.14.117
[linux/fpc-iii.git] / samples / pktgen / pktgen.conf-1-2
bloba85552760762431af61421b87ee38f01e672bbfe
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
4 #modprobe pktgen
7 function pgset() {
8 local result
10 echo $1 > $PGDEV
12 result=`cat $PGDEV | fgrep "Result: OK:"`
13 if [ "$result" = "" ]; then
14 cat $PGDEV | fgrep Result:
18 # Config Start Here -----------------------------------------------------------
21 # thread config
22 # One CPU means one thread. One CPU example. We add eth1, eth2 respectivly.
24 PGDEV=/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 "Adding eth2"
30 pgset "add_device eth2"
33 # device config
34 # delay 0 means maximum speed.
36 CLONE_SKB="clone_skb 1000000"
37 # NIC adds 4 bytes CRC
38 PKT_SIZE="pkt_size 60"
40 # COUNT 0 means forever
41 #COUNT="count 0"
42 COUNT="count 10000000"
43 DELAY="delay 0"
45 PGDEV=/proc/net/pktgen/eth1
46 echo "Configuring $PGDEV"
47 pgset "$COUNT"
48 pgset "$CLONE_SKB"
49 pgset "$PKT_SIZE"
50 pgset "$DELAY"
51 pgset "dst 10.10.11.2"
52 pgset "dst_mac 00:04:23:08:91:dc"
54 PGDEV=/proc/net/pktgen/eth2
55 echo "Configuring $PGDEV"
56 pgset "$COUNT"
57 pgset "$CLONE_SKB"
58 pgset "$PKT_SIZE"
59 pgset "$DELAY"
60 pgset "dst 192.168.2.2"
61 pgset "dst_mac 00:04:23:08:91:de"
63 # Time to run
64 PGDEV=/proc/net/pktgen/pgctrl
66 echo "Running... ctrl^C to stop"
67 trap true INT
68 pgset "start"
69 echo "Done"
70 cat /proc/net/pktgen/eth1 /proc/net/pktgen/eth2