]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - samples/pktgen/pktgen_sample04_many_flows.sh
x86/cpufeatures: Disentangle MSR_SPEC_CTRL enumeration from IBRS
[mirror_ubuntu-artful-kernel.git] / samples / pktgen / pktgen_sample04_many_flows.sh
CommitLineData
15f2cbbd
JDB
1#!/bin/bash
2#
3# Script example for many flows testing
4#
5# Number of simultaneous flows limited by variable $FLOWS
6# and number of packets per flow controlled by variable $FLOWLEN
7#
8basedir=`dirname $0`
9source ${basedir}/functions.sh
10root_check_run_with_sudo "$@"
11
12# Parameter parsing via include
13source ${basedir}/parameters.sh
14# Set some default params, if they didn't get set
15[ -z "$DEST_IP" ] && DEST_IP="198.18.0.42"
16[ -z "$DST_MAC" ] && DST_MAC="90:e2:ba:ff:ff:ff"
17[ -z "$CLONE_SKB" ] && CLONE_SKB="0"
69137ea6 18[ -z "$COUNT" ] && COUNT="0" # Zero means indefinitely
15f2cbbd
JDB
19
20# NOTICE: Script specific settings
21# =======
22# Limiting the number of concurrent flows ($FLOWS)
23# and also set how many packets each flow contains ($FLOWLEN)
24#
25[ -z "$FLOWS" ] && FLOWS="8000"
26[ -z "$FLOWLEN" ] && FLOWLEN="10"
27
28# Base Config
29DELAY="0" # Zero means max speed
15f2cbbd
JDB
30
31if [[ -n "$BURST" ]]; then
32 err 1 "Bursting not supported for this mode"
33fi
34
35# General cleanup everything since last run
36pg_ctrl "reset"
37
38# Threads are specified with parameter -t value in $THREADS
e0e16672 39for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
15f2cbbd
JDB
40 dev=${DEV}@${thread}
41
42 # Add remove all other devices and add_device $dev to thread
43 pg_thread $thread "rem_device_all"
44 pg_thread $thread "add_device" $dev
45
46 # Base config
47 pg_set $dev "flag QUEUE_MAP_CPU"
48 pg_set $dev "count $COUNT"
49 pg_set $dev "clone_skb $CLONE_SKB"
50 pg_set $dev "pkt_size $PKT_SIZE"
51 pg_set $dev "delay $DELAY"
52 pg_set $dev "flag NO_TIMESTAMP"
53
54 # Single destination
55 pg_set $dev "dst_mac $DST_MAC"
56 pg_set $dev "dst $DEST_IP"
57
58 # Randomize source IP-addresses
59 pg_set $dev "flag IPSRC_RND"
60 pg_set $dev "src_min 198.18.0.0"
61 pg_set $dev "src_max 198.19.255.255"
62
63 # Limit number of flows (max 65535)
64 pg_set $dev "flows $FLOWS"
65 #
66 # How many packets a flow will send, before flow "entry" is
67 # re-generated/setup.
68 pg_set $dev "flowlen $FLOWLEN"
69 #
70 # Flag FLOW_SEQ will cause $FLOWLEN packets from the same flow
71 # being send back-to-back, before next flow is selected
72 # incrementally. This helps lookup caches, and is more realistic.
73 #
74 pg_set $dev "flag FLOW_SEQ"
75
76done
77
78# Run if user hits control-c
79function print_result() {
80 # Print results
e0e16672 81 for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
15f2cbbd
JDB
82 dev=${DEV}@${thread}
83 echo "Device: $dev"
84 cat /proc/net/pktgen/$dev | grep -A2 "Result:"
85 done
86}
87# trap keyboard interrupt (Ctrl-C)
88trap true SIGINT
89
90echo "Running... ctrl^C to stop" >&2
91pg_ctrl "start"
92
93print_result