Skip to content

Commit

Permalink
pktgen: use common idle routine
Browse files Browse the repository at this point in the history
Simpler to have one place that spins and accounts for delays,
this will also make the last packet be detected faster for more
repeatable timing.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Aug 29, 2009
1 parent 2bc481c commit 64e8ff5
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -3458,16 +3458,10 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)

/* If pkt_dev->count is zero, then run forever */
if ((pkt_dev->count != 0) && (pkt_dev->sofar >= pkt_dev->count)) {
if (atomic_read(&(pkt_dev->skb->users)) != 1) {
ktime_t idle_start = ktime_now();
while (atomic_read(&(pkt_dev->skb->users)) != 1) {
if (signal_pending(current)) {
break;
}
schedule();
}
pkt_dev->idle_acc += ktime_to_ns(ktime_sub(ktime_now(),
idle_start));
while (atomic_read(&(pkt_dev->skb->users)) != 1) {
if (signal_pending(current))
break;
idle(pkt_dev);
}

/* Done with this */
Expand Down

0 comments on commit 64e8ff5

Please sign in to comment.