From: Eric Dumazet <eric.dumazet@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>,
"David S. Miller" <davem@davemloft.net>
Cc: Jesper Dangaard Brouer <jdb@comx.dk>,
Robert Olsson <robert@herjulf.net>,
netdev@vger.kernel.org
Subject: Re: [PATCH] pktgen: Fix delay handling
Date: Thu, 01 Oct 2009 12:04:41 +0200 [thread overview]
Message-ID: <4AC47EB9.6070809@gmail.com> (raw)
In-Reply-To: <4AC47AB6.9000501@gmail.com>
Eric Dumazet a écrit :
> After last pktgen changes, delay handling is wrong.
>
> pktgen actually sends packets at full line speed.
>
> Fix is to update pkt_dev->next_tx even if spin() returns early,
> so that next spin() calls have a chance to see a positive delay.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Oh well, I hit this bug on linux-2.6 git tree, but I did the patch on net-next-2.6
But it appears net/core/pktgen.c is different on net-next-2.6
Stephen, David, I am a bit lost here, something went wrong in a merge process ?
In any case, here is the patch against Linus tree, where bug is present.
Thanks
[PATCH] pktgen: Fix delay handling
After last pktgen changes, delay handling is wrong.
pktgen actually sends packets at full line speed.
Fix is to update pkt_dev->next_tx even if spin() returns early,
so that next spin() calls have a chance to see a positive delay.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 4d11c28..b694552 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2105,15 +2105,17 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until)
{
ktime_t start_time, end_time;
- s32 remaining;
+ s64 remaining;
struct hrtimer_sleeper t;
hrtimer_init_on_stack(&t.timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
hrtimer_set_expires(&t.timer, spin_until);
remaining = ktime_to_us(hrtimer_expires_remaining(&t.timer));
- if (remaining <= 0)
+ if (remaining <= 0) {
+ pkt_dev->next_tx = ktime_add_ns(spin_until, pkt_dev->delay);
return;
+ }
start_time = ktime_now();
if (remaining < 100)
next prev parent reply other threads:[~2009-10-01 10:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-23 5:49 pktgen: tricks Stephen Hemminger
2009-09-24 0:41 ` Stephen Hemminger
2009-09-24 1:05 ` Rick Jones
2009-09-24 10:10 ` Denys Fedoryschenko
2009-09-24 10:32 ` Eric Dumazet
2009-09-30 23:03 ` [PATCH] pktgen: Avoid dirtying skb->users when txq is full Eric Dumazet
2009-10-01 0:25 ` Stephen Hemminger
2009-10-01 9:47 ` [PATCH] pktgen: Fix delay handling Eric Dumazet
2009-10-01 10:04 ` Eric Dumazet [this message]
2009-10-01 16:29 ` David Miller
2009-10-01 16:32 ` Eric Dumazet
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=4AC47EB9.6070809@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=jdb@comx.dk \
--cc=netdev@vger.kernel.org \
--cc=robert@herjulf.net \
--cc=shemminger@vyatta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.