netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Cong Wang <cwang@twopensource.com>
Cc: netdev <netdev@vger.kernel.org>,
	Daniel Borkmann <borkmann@iogearbox.net>,
	Alexei Starovoitov <ast@plumgrid.com>,
	Robert Olsson <robert@herjulf.se>,
	Ben Greear <greearb@candelatech.com>,
	brouer@redhat.com
Subject: Re: [net-next PATCH 09/10] pktgen: add sample script pktgen_sample03_burst_single_flow.sh
Date: Thu, 21 May 2015 11:47:35 +0200	[thread overview]
Message-ID: <20150521114735.4e2ea1a1@redhat.com> (raw)
In-Reply-To: <CAHA+R7NVB8EaiSMQeEw9atPy_7hz0YrBSazMK9zwDEJC5CpB2w@mail.gmail.com>

On Wed, 20 May 2015 14:33:42 -0700
Cong Wang <cwang@twopensource.com> wrote:

> On Tue, May 19, 2015 at 2:36 PM, Jesper Dangaard Brouer
> <brouer@redhat.com> wrote:
> > +# Threads are specified with parameter -t value in $THREADS
> > +for ((thread = 0; thread < $THREADS; thread++)); do
> > +    dev=${DEV}@${thread}
> > +
> > +    # Add remove all other devices and add_device $dev to thread
> > +    pg_thread $thread "rem_device_all"
> > +    pg_thread $thread "add_device" $dev
> > +
> > +    # Base config
> > +    pg_set $dev "flag QUEUE_MAP_CPU"
> > +    pg_set $dev "count $COUNT"
> > +    pg_set $dev "clone_skb $CLONE_SKB"
> > +    pg_set $dev "pkt_size $PKT_SIZE"
> > +    pg_set $dev "delay $DELAY"
> > +    pg_set $dev "flag NO_TIMESTAMP"
> > +
> > +    # Destination
> > +    pg_set $dev "dst_mac $DST_MAC"
> > +    pg_set $dev "dst $DEST_IP"
> > +
> > +    # Setup burst, for easy testing -b 0 disable bursting
> > +    # (internally in pktgen default and minimum burst=1)
> > +    if [[ ${BURST} != 0 ]]; then
> 
> 
> Nit: probably you mean: [[ ${BURST} -ne 0 ]]

With bash this still works (comparing it as a string), but I guess it
is more correct as you propose to compare it as a number.

You do realize that this cause $BURST to be evaluated as an arithmetic
expression, thus input like "10-10" will also disable bursting.

In bash it's also possible to write as: (( $BURST != 0 )) to be more
explicit that this is an arithmetic expression, and then we don't use
the -eq, -ne etc.

I'm fine with taking your proposal, as it also works with single "["
(although it does not fall for the arithmetic expansion).


> > +       pg_set $dev "burst $BURST"
> > +    else
> > +       info "$dev: Not using burst"
> > +    fi
> > +done



-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Sr. Network Kernel Developer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer

  reply	other threads:[~2015-05-21  9:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19 21:35 [net-next PATCH 00/10] pktgen: cleanups and introducing new samples/pktgen scripts Jesper Dangaard Brouer
2015-05-19 21:35 ` [net-next PATCH 01/10] pktgen: remove obsolete "max_before_softirq" from pktgen doc Jesper Dangaard Brouer
2015-05-19 21:35 ` [net-next PATCH 02/10] pktgen: adjust spacing in proc file interface output Jesper Dangaard Brouer
2015-05-19 21:35 ` [net-next PATCH 03/10] pktgen: doc were missing several config options Jesper Dangaard Brouer
2015-05-19 21:35 ` [net-next PATCH 04/10] pktgen: document ability to add same device to several threads Jesper Dangaard Brouer
2015-05-19 21:54   ` Alexei Starovoitov
2015-05-19 21:35 ` [net-next PATCH 05/10] pktgen: make /proc/net/pktgen/pgctrl report fail on invalid input Jesper Dangaard Brouer
2015-05-19 21:36 ` [net-next PATCH 06/10] pktgen: new pktgen helper functions for samples scripts Jesper Dangaard Brouer
2015-05-20 21:23   ` Cong Wang
2015-05-21  9:18     ` Jesper Dangaard Brouer
2015-05-19 21:36 ` [net-next PATCH 07/10] pktgen: add sample script pktgen_sample01_simple.sh Jesper Dangaard Brouer
2015-05-19 21:36 ` [net-next PATCH 08/10] pktgen: add sample script pktgen_sample02_multiqueue.sh Jesper Dangaard Brouer
2015-05-19 21:36 ` [net-next PATCH 09/10] pktgen: add sample script pktgen_sample03_burst_single_flow.sh Jesper Dangaard Brouer
2015-05-20 21:33   ` Cong Wang
2015-05-21  9:47     ` Jesper Dangaard Brouer [this message]
2015-05-19 21:36 ` [net-next PATCH 10/10] pktgen: add benchmark script pktgen_bench_xmit_mode_netif_receive.sh Jesper Dangaard Brouer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150521114735.4e2ea1a1@redhat.com \
    --to=brouer@redhat.com \
    --cc=ast@plumgrid.com \
    --cc=borkmann@iogearbox.net \
    --cc=cwang@twopensource.com \
    --cc=greearb@candelatech.com \
    --cc=netdev@vger.kernel.org \
    --cc=robert@herjulf.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).