Merge tag 'ntb-4.13' of git://github.com/jonmason/ntb
[linux/fpc-iii.git] / samples / pktgen / pktgen_bench_xmit_mode_queue_xmit.sh
blob1ad878e955391de33f9bad4b8da2e4bd8fbb935b
1 #!/bin/bash
3 # Benchmark script:
4 # - developed for benchmarking egress qdisc path, derived (more
5 # like cut'n'pasted) from ingress benchmark script.
7 # Script for injecting packets into egress qdisc path of the stack
8 # with pktgen "xmit_mode queue_xmit".
10 basedir=`dirname $0`
11 source ${basedir}/functions.sh
12 root_check_run_with_sudo "$@"
14 # Parameter parsing via include
15 source ${basedir}/parameters.sh
16 if [ -z "$DEST_IP" ]; then
17 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
19 [ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
21 # Burst greater than 1 are invalid for queue_xmit mode
22 if [[ -n "$BURST" ]]; then
23 err 1 "Bursting not supported for this mode"
25 [ -z "$COUNT" ] && COUNT="10000000" # Zero means indefinitely
27 # Base Config
28 DELAY="0" # Zero means max speed
30 # General cleanup everything since last run
31 pg_ctrl "reset"
33 # Threads are specified with parameter -t value in $THREADS
34 for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
35 # The device name is extended with @name, using thread number to
36 # make then unique, but any name will do.
37 dev=${DEV}@${thread}
39 # Add remove all other devices and add_device $dev to thread
40 pg_thread $thread "rem_device_all"
41 pg_thread $thread "add_device" $dev
43 # Base config of dev
44 pg_set $dev "flag QUEUE_MAP_CPU"
45 pg_set $dev "count $COUNT"
46 pg_set $dev "pkt_size $PKT_SIZE"
47 pg_set $dev "delay $DELAY"
48 pg_set $dev "flag NO_TIMESTAMP"
50 # Destination
51 pg_set $dev "dst_mac $DST_MAC"
52 pg_set $dev "dst$IP6 $DEST_IP"
54 # Inject packet into TX qdisc egress path of stack
55 pg_set $dev "xmit_mode queue_xmit"
56 done
58 # start_run
59 echo "Running... ctrl^C to stop" >&2
60 pg_ctrl "start"
61 echo "Done" >&2
63 # Print results
64 for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
65 dev=${DEV}@${thread}
66 echo "Device: $dev"
67 cat /proc/net/pktgen/$dev | grep -A2 "Result:"
68 done