Skip to content

Commit c0e9422

Browse files
claudiajkangdavem330
authored andcommitted
samples: pktgen: fix to print when terminated normally
Currently, most pktgen samples print the execution result when the program is terminated normally. However, sample03 doesn't work appropriately. This is results of samples: # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample04_many_flows.sh -n 1 Running... ctrl^C to stop Device: eth0@0 Result: OK: 19(c5+d13) usec, 1 (60byte,0frags) 51762pps 24Mb/sec (24845760bps) errors: 0 # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample03_burst_single_flow.sh -n 1 Running... ctrl^C to stop The reason why it doesn't print the execution result when the program is terminated usually is that sample03 doesn't call the function which prints the result, unlike other samples. So, this commit solves this issue by calling the function before termination. Also, this commit changes control_c function to print_result to maintain consistency with other samples. Signed-off-by: Juhee Kang <claudiajkang@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9270c56 commit c0e9422

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎samples/pktgen/pktgen_sample03_burst_single_flow.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
8585
done
8686

8787
# Run if user hits control-c
88-
function control_c() {
88+
function print_result() {
8989
# Print results
9090
for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do
9191
dev=${DEV}@${thread}
@@ -94,11 +94,13 @@ function control_c() {
9494
done
9595
}
9696
# trap keyboard interrupt (Ctrl-C)
97-
trap control_c SIGINT
97+
trap true SIGINT
9898

9999
if [ -z "$APPEND" ]; then
100100
echo "Running... ctrl^C to stop" >&2
101101
pg_ctrl "start"
102+
103+
print_result
102104
else
103105
echo "Append mode: config done. Do more or use 'pg_ctrl start' to run"
104106
fi

0 commit comments

Comments
 (0)