#!/bin/bash

#modprobe pktgen


function pgset() {
    local result

    echo $1 > $PGDEV

    result=`cat $PGDEV | fgrep "Result: OK:"`
    if [ "$result" = "" ]; then
         cat $PGDEV | fgrep Result:
    fi
}

# Config Start Here -----------------------------------------------------------


# thread config
# Each CPU has its own thread. One CPU example. We add eth1.
# IPv6. Note increase in minimal packet length

PGDEV=/proc/net/pktgen/kpktgend_0
  echo "Removing all devices"
 pgset "rem_device_all"
  echo "Adding eth1"
 pgset "add_device eth1"


# device config
# delay 0 means maximum speed.

# We need to do alloc for every skb since we cannot clone here.
CLONE_SKB="clone_skb 0"

# NIC adds 4 bytes CRC
PKT_SIZE="pkt_size 66"

# COUNT 0 means forever
#COUNT="count 0"
COUNT="count 10000000"
DELAY="delay 0"

PGDEV=/proc/net/pktgen/eth1
  echo "Configuring $PGDEV"
 pgset "$COUNT"
 pgset "$CLONE_SKB"
 pgset "$PKT_SIZE"
 pgset "$DELAY"
 pgset "dst6_min fec0::1"
 pgset "dst6_max fec0::FFFF:FFFF"

 pgset "dst_mac  00:04:23:08:91:dc"

# Time to run
PGDEV=/proc/net/pktgen/pgctrl

 echo "Running... ctrl^C to stop"
 trap true INT
 pgset "start"
 echo "Done"
 cat /proc/net/pktgen/eth1
oop-back</option>
<option value='packet-rx-pump-back'>packet-rx-pump-back</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/?h=nds-private-remove'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?h=nds-private-remove&amp;id=7243a1af37a4dc9225004546d9d0756c529ad3ce'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/tools/perf/util/group.h?h=nds-private-remove'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/tools/perf/util/group.h?h=nds-private-remove&amp;id=7243a1af37a4dc9225004546d9d0756c529ad3ce'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/tools/perf/util/group.h?h=nds-private-remove&amp;id=7243a1af37a4dc9225004546d9d0756c529ad3ce'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/tools/perf/util/group.h?h=nds-private-remove&amp;id=7243a1af37a4dc9225004546d9d0756c529ad3ce'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/tools/perf/util/group.h'>
<input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='7243a1af37a4dc9225004546d9d0756c529ad3ce'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?h=nds-private-remove&amp;id=7243a1af37a4dc9225004546d9d0756c529ad3ce'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools?h=nds-private-remove&amp;id=7243a1af37a4dc9225004546d9d0756c529ad3ce'>tools</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf?h=nds-private-remove&amp;id=7243a1af37a4dc9225004546d9d0756c529ad3ce'>perf</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/util?h=nds-private-remove&amp;id=7243a1af37a4dc9225004546d9d0756c529ad3ce'>util</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/util/group.h?h=nds-private-remove&amp;id=7243a1af37a4dc9225004546d9d0756c529ad3ce'>group.h</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/util/group.h?h=nds-private-remove&amp;id=7243a1af37a4dc9225004546d9d0756c529ad3ce&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>