Skip to content

Commit

Permalink
pktgen: avoid calling gettimeofday
Browse files Browse the repository at this point in the history
If not using delay then no need to update next_tx after
each packet sent. This allows pktgen to send faster especially
on systems with slower clock sources.

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 5b8db2f commit 5c9d191
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -3450,15 +3450,17 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
pkt_dev->last_ok = 0;
}

pkt_dev->next_tx_us = getCurUs();
pkt_dev->next_tx_ns = 0;
if (pkt_dev->delay_us || pkt_dev->delay_ns) {
pkt_dev->next_tx_us = getCurUs();
pkt_dev->next_tx_ns = 0;

pkt_dev->next_tx_us += pkt_dev->delay_us;
pkt_dev->next_tx_ns += pkt_dev->delay_ns;
pkt_dev->next_tx_us += pkt_dev->delay_us;
pkt_dev->next_tx_ns += pkt_dev->delay_ns;

if (pkt_dev->next_tx_ns > 1000) {
pkt_dev->next_tx_us++;
pkt_dev->next_tx_ns -= 1000;
if (pkt_dev->next_tx_ns > 1000) {
pkt_dev->next_tx_us++;
pkt_dev->next_tx_ns -= 1000;
}
}
}
__netif_tx_unlock_bh(txq);
Expand Down

0 comments on commit 5c9d191

Please sign in to comment.