From c8fd4852022ca8ae85ac4d30d05950eaf506b828 Mon Sep 17 00:00:00 2001 From: Igor Russkikh Date: Thu, 11 Mar 2021 11:32:53 +0100 Subject: samples: pktgen: new append mode To configure various complex flows we for sure can create custom pktgen init scripts, but sometimes thats not that easy. New "-a" (append) option in all the existing sample scripts allows to append more "devices" into pktgen threads. The most straightforward usecases for that are: - using multiple devices. We have to generate full linerate on all physical functions (ports) of our multiport device. - pushing multiple flows (with different packet options) Signed-off-by: Igor Russkikh Signed-off-by: David S. Miller --- samples/pktgen/pktgen_sample01_simple.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'samples/pktgen/pktgen_sample01_simple.sh') diff --git a/samples/pktgen/pktgen_sample01_simple.sh b/samples/pktgen/pktgen_sample01_simple.sh index c2ad1fa32d3f..a09f3422fbcc 100755 --- a/samples/pktgen/pktgen_sample01_simple.sh +++ b/samples/pktgen/pktgen_sample01_simple.sh @@ -37,11 +37,11 @@ UDP_SRC_MAX=109 # General cleanup everything since last run # (especially important if other threads were configured by other scripts) -pg_ctrl "reset" +[ -z "$APPEND" ] && pg_ctrl "reset" # Add remove all other devices and add_device $DEV to thread 0 thread=0 -pg_thread $thread "rem_device_all" +[ -z "$APPEND" ] && pg_thread $thread "rem_device_all" pg_thread $thread "add_device" $DEV # How many packets to send (zero means indefinitely) @@ -77,11 +77,15 @@ pg_set $DEV "flag UDPSRC_RND" pg_set $DEV "udp_src_min $UDP_SRC_MIN" pg_set $DEV "udp_src_max $UDP_SRC_MAX" -# start_run -echo "Running... ctrl^C to stop" >&2 -pg_ctrl "start" -echo "Done" >&2 +if [ -z "$APPEND" ]; then + # start_run + echo "Running... ctrl^C to stop" >&2 + pg_ctrl "start" + echo "Done" >&2 -# Print results -echo "Result device: $DEV" -cat /proc/net/pktgen/$DEV + # Print results + echo "Result device: $DEV" + cat /proc/net/pktgen/$DEV +else + echo "Append mode: config done. Do more or use 'pg_ctrl start' to run" +fi \ No newline at end of file -- cgit v1.2.3