License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-block.git] / samples / pktgen / pktgen.conf-1-2
CommitLineData
db72aba3 1#!/bin/bash
b2441318 2# SPDX-License-Identifier: GPL-2.0
7c95a9d9
BH
3
4#modprobe pktgen
5
6
7function pgset() {
8 local result
9
10 echo $1 > $PGDEV
11
12 result=`cat $PGDEV | fgrep "Result: OK:"`
13 if [ "$result" = "" ]; then
14 cat $PGDEV | fgrep Result:
15 fi
16}
17
7c95a9d9
BH
18# Config Start Here -----------------------------------------------------------
19
20
21# thread config
2ad1cdf2 22# One CPU means one thread. One CPU example. We add eth1, eth2 respectivly.
7c95a9d9
BH
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"
29 echo "Adding eth2"
30 pgset "add_device eth2"
7c95a9d9
BH
31
32
33# device config
34# delay 0 means maximum speed.
35
36CLONE_SKB="clone_skb 1000000"
37# NIC adds 4 bytes CRC
38PKT_SIZE="pkt_size 60"
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 "dst 10.10.11.2"
52 pgset "dst_mac 00:04:23:08:91:dc"
53
54PGDEV=/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"
62
63# Time to run
64PGDEV=/proc/net/pktgen/pgctrl
65
66 echo "Running... ctrl^C to stop"
16b5d0c4 67 trap true INT
7c95a9d9
BH
68 pgset "start"
69 echo "Done"
4062bd25 70 cat /proc/net/pktgen/eth1 /proc/net/pktgen/eth2