On Wed, 14 Jun 2017 14:10:37 +0300 Tariq Toukan <tar...@mellanox.com> wrote:
> >> +export L_THREAD="$THREADS + $F_THREAD - 1" > >> + > > > > This is sort of bad-shell coding. This will first get expanded at the > > usage point. The way you use it, it will work, because of the for loop > > uses an expansion like "((xxx))". > > > > If you echo the $L_THREAD variable you will see: "1 + 0 - 1" > > > > IMHO the right thing is to use: > > > > export L_THREAD=$(( THREADS + F_THREAD - 1 )) > > > > (I tested this also works for dash + ksh + zsh) > > > Thanks, I'll use the suggested command. > > > >> diff --git a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh > >> b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh > >> index d2694a12de61..e5bfe759a0fb 100755 > >> --- a/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh > >> +++ b/samples/pktgen/pktgen_bench_xmit_mode_netif_receive.sh > >> @@ -48,7 +48,7 @@ DELAY="0" # Zero means max speed > >> pg_ctrl "reset" > >> > >> # Threads are specified with parameter -t value in $THREADS > >> -for ((thread = 0; thread < $THREADS; thread++)); do > >> +for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do > >> # The device name is extended with @name, using thread number to > >> # make then unique, but any name will do. > >> dev=${DEV}@${thread} > > > > The expansion/use of $L_THREAD only works because "for-loop" expanded > > it by using ""(("" arithmetic evaluation. > > > After changing the one above, this one should still be OK, right? Yes, this part is still correct. -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer