netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lennert Buytenhek <buytenh@wantstofly.org>
To: Ben Greear <greearb@candelatech.com>
Cc: Robert Olsson <Robert.Olsson@data.slu.se>,
	hadi@cyberus.ca, netdev@oss.sgi.com
Subject: Re: inter-packet gap in pktgen
Date: Wed, 8 Dec 2004 08:38:58 +0100	[thread overview]
Message-ID: <20041208073858.GA4027@xi.wantstofly.org> (raw)
In-Reply-To: <41B632F3.1090104@candelatech.com>

On Tue, Dec 07, 2004 at 02:47:15PM -0800, Ben Greear wrote:

> >By tweaking the 'ipg' parameter I can generate pretty much any packet rate
> >I want, as long as I set ipg=(1e9/rate)-496 instead of something possibly
> >more straightforward.
> 
> That 496 will also change with load on the system, at least on average.  I
> dealt with this by having a user-space app sample the rate and adjust the 
> ipg to keep the average rate where I want it.
> 
> So, I'd suggest leaving the ipg as it is, and use external tools to get
> the exact pps that you are looking for.

Just because it's possible that way doesn't mean that it's the only
way or even _the_ way of doing it.

Another option is:

	next_tx = get_time_in_ns();
	while (--count) {
		tx_packet();
		next_tx += 1e9/intended_pps;
		nanospin(next_tx - get_time_in_ns());
	}

This should be relatively independent of system load.  OK, I know,
time to show some code.


--L

  reply	other threads:[~2004-12-08  7:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-07 22:25 inter-packet gap in pktgen Lennert Buytenhek
2004-12-07 22:47 ` Ben Greear
2004-12-08  7:38   ` Lennert Buytenhek [this message]
2004-12-08 10:21     ` Robert Olsson
2004-12-08 11:15       ` Lennert Buytenhek
2004-12-08 19:32       ` Ben Greear
2004-12-10 22:29         ` Lennert Buytenhek
2004-12-10 23:01           ` Ben Greear

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=20041208073858.GA4027@xi.wantstofly.org \
    --to=buytenh@wantstofly.org \
    --cc=Robert.Olsson@data.slu.se \
    --cc=greearb@candelatech.com \
    --cc=hadi@cyberus.ca \
    --cc=netdev@oss.sgi.com \
    /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).