diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-10-01 09:29:45 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-01 09:29:45 -0700 |
commit | 417bc4b855f04dd4ad27a7cabe3e7996a7b78ddb (patch) | |
tree | 75752bd8823f98b27957d02ea95ae582ff1e6a84 /net | |
parent | a00d2102ce01df5f0a8892814ecd26d130d47e7d (diff) | |
download | kernel_samsung_tuna-417bc4b855f04dd4ad27a7cabe3e7996a7b78ddb.zip kernel_samsung_tuna-417bc4b855f04dd4ad27a7cabe3e7996a7b78ddb.tar.gz kernel_samsung_tuna-417bc4b855f04dd4ad27a7cabe3e7996a7b78ddb.tar.bz2 |
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/pktgen.c | 6 |
1 files changed, 4 insertions, 2 deletions
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) |