diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-08-27 09:55:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-29 02:32:09 -0400 |
commit | 5c9d191c166233e723e632e79bcca2127a5fece9 (patch) | |
tree | 425324ef55119bb7420b4ab199e0a0821a3f157b /net/core/pktgen.c | |
parent | 5b8db2f568c4ee2a436f0e1c1416153e2878f869 (diff) |
pktgen: avoid calling gettimeofday
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>
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r-- | net/core/pktgen.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index bce9bf4b4a62..b7302e18764a 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -3450,15 +3450,17 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3450 | pkt_dev->last_ok = 0; | 3450 | pkt_dev->last_ok = 0; |
3451 | } | 3451 | } |
3452 | 3452 | ||
3453 | pkt_dev->next_tx_us = getCurUs(); | 3453 | if (pkt_dev->delay_us || pkt_dev->delay_ns) { |
3454 | pkt_dev->next_tx_ns = 0; | 3454 | pkt_dev->next_tx_us = getCurUs(); |
3455 | pkt_dev->next_tx_ns = 0; | ||
3455 | 3456 | ||
3456 | pkt_dev->next_tx_us += pkt_dev->delay_us; | 3457 | pkt_dev->next_tx_us += pkt_dev->delay_us; |
3457 | pkt_dev->next_tx_ns += pkt_dev->delay_ns; | 3458 | pkt_dev->next_tx_ns += pkt_dev->delay_ns; |
3458 | 3459 | ||
3459 | if (pkt_dev->next_tx_ns > 1000) { | 3460 | if (pkt_dev->next_tx_ns > 1000) { |
3460 | pkt_dev->next_tx_us++; | 3461 | pkt_dev->next_tx_us++; |
3461 | pkt_dev->next_tx_ns -= 1000; | 3462 | pkt_dev->next_tx_ns -= 1000; |
3463 | } | ||
3462 | } | 3464 | } |
3463 | } | 3465 | } |
3464 | __netif_tx_unlock_bh(txq); | 3466 | __netif_tx_unlock_bh(txq); |