netdev
[Top] [All Lists]

Re: inter-packet gap in pktgen

To: Ben Greear <greearb@xxxxxxxxxxxxxxx>
Subject: Re: inter-packet gap in pktgen
From: Lennert Buytenhek <buytenh@xxxxxxxxxxxxxx>
Date: Wed, 8 Dec 2004 08:38:58 +0100
Cc: Robert Olsson <Robert.Olsson@xxxxxxxxxxx>, hadi@xxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <41B632F3.1090104@xxxxxxxxxxxxxxx>
References: <20041207222522.GA30266@xxxxxxxxxxxxxxxxx> <41B632F3.1090104@xxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4.1i
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

<Prev in Thread] Current Thread [Next in Thread>