Bluetooth: hci_ldisc: Initialize hci_dev before open()
[linux/fpc-iii.git] / samples / pktgen / pktgen_bench_xmit_mode_queue_xmit.sh
blobe1ee54465def803bc8f558d9e0781c44d9ef9fac
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
28 # Base Config
29 DELAY="0" # Zero means max speed
31 # General cleanup everything since last run
32 pg_ctrl "reset"
34 # Threads are specified with parameter -t value in $THREADS
35 for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
36 # The device name is extended with @name, using thread number to
37 # make then unique, but any name will do.
38 dev=${DEV}@${thread}
40 # Add remove all other devices and add_device $dev to thread
41 pg_thread $thread "rem_device_all"
42 pg_thread $thread "add_device" $dev
44 # Base config of dev
45 pg_set $dev "flag QUEUE_MAP_CPU"
46 pg_set $dev "count $COUNT"
47 pg_set $dev "pkt_size $PKT_SIZE"
48 pg_set $dev "delay $DELAY"
49 pg_set $dev "flag NO_TIMESTAMP"
51 # Destination
52 pg_set $dev "dst_mac $DST_MAC"
53 pg_set $dev "dst$IP6 $DEST_IP"
55 # Inject packet into TX qdisc egress path of stack
56 pg_set $dev "xmit_mode queue_xmit"
57 done
59 # start_run
60 echo "Running... ctrl^C to stop" >&2
61 pg_ctrl "start"
62 echo "Done" >&2
64 # Print results
65 for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
66 dev=${DEV}@${thread}
67 echo "Device: $dev"
68 cat /proc/net/pktgen/$dev | grep -A2 "Result:"
69 done