drm/panfrost: perfcnt: Reserve/use the AS attached to the perfcnt MMU context
[linux/fpc-iii.git] / samples / pktgen / pktgen_bench_xmit_mode_queue_xmit.sh
blobe607cb369b20bd5a33636810b964a2d55d1fc6cc
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
4 # Benchmark script:
5 # - developed for benchmarking egress qdisc path, derived (more
6 # like cut'n'pasted) from ingress benchmark script.
8 # Script for injecting packets into egress qdisc path of the stack
9 # with pktgen "xmit_mode queue_xmit".
11 basedir=`dirname $0`
12 source ${basedir}/functions.sh
13 root_check_run_with_sudo "$@"
15 # Parameter parsing via include
16 source ${basedir}/parameters.sh
17 if [ -z "$DEST_IP" ]; then
18 [ -z "$IP6" ] && DEST_IP="198.18.0.42" || DEST_IP="FD00::1"
20 [ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
22 # Burst greater than 1 are invalid for queue_xmit mode
23 if [[ -n "$BURST" ]]; then
24 err 1 "Bursting not supported for this mode"
26 [ -z "$COUNT" ] && COUNT="10000000" # Zero means indefinitely
27 if [ -n "$DEST_IP" ]; then
28 validate_addr${IP6} $DEST_IP
29 read -r DST_MIN DST_MAX <<< $(parse_addr${IP6} $DEST_IP)
31 if [ -n "$DST_PORT" ]; then
32 read -r UDP_DST_MIN UDP_DST_MAX <<< $(parse_ports $DST_PORT)
33 validate_ports $UDP_DST_MIN $UDP_DST_MAX
36 # Base Config
37 DELAY="0" # Zero means max speed
39 # General cleanup everything since last run
40 pg_ctrl "reset"
42 # Threads are specified with parameter -t value in $THREADS
43 for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
44 # The device name is extended with @name, using thread number to
45 # make then unique, but any name will do.
46 dev=${DEV}@${thread}
48 # Add remove all other devices and add_device $dev to thread
49 pg_thread $thread "rem_device_all"
50 pg_thread $thread "add_device" $dev
52 # Base config of dev
53 pg_set $dev "flag QUEUE_MAP_CPU"
54 pg_set $dev "count $COUNT"
55 pg_set $dev "pkt_size $PKT_SIZE"
56 pg_set $dev "delay $DELAY"
57 pg_set $dev "flag NO_TIMESTAMP"
59 # Destination
60 pg_set $dev "dst_mac $DST_MAC"
61 pg_set $dev "dst${IP6}_min $DST_MIN"
62 pg_set $dev "dst${IP6}_max $DST_MAX"
64 if [ -n "$DST_PORT" ]; then
65 # Single destination port or random port range
66 pg_set $dev "flag UDPDST_RND"
67 pg_set $dev "udp_dst_min $UDP_DST_MIN"
68 pg_set $dev "udp_dst_max $UDP_DST_MAX"
71 # Inject packet into TX qdisc egress path of stack
72 pg_set $dev "xmit_mode queue_xmit"
73 done
75 # start_run
76 echo "Running... ctrl^C to stop" >&2
77 pg_ctrl "start"
78 echo "Done" >&2
80 # Print results
81 for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
82 dev=${DEV}@${thread}
83 echo "Device: $dev"
84 cat /proc/net/pktgen/$dev | grep -A2 "Result:"
85 done