From 844f2d749ab02b59218e869483e78725869c199f Mon Sep 17 00:00:00 2001 From: Ryan Wilson Date: Thu, 26 Jun 2014 17:41:46 -0700 Subject: [PATCH] netdev-dpdk: Set current timestamp when flushing TX queue. The current timestamp should be set every time the queue is flushed. Thus, if DRAIN_TSC timer cycles have passed since the last timestamp, the send queue should be flushed again. Signed-off-by: Ryan Wilson Acked-by: Pravin B Shelar --- lib/netdev-dpdk.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index d520958fc..bdd2abc34 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -584,6 +584,7 @@ dpdk_queue_flush__(struct netdev_dpdk *dev, int qid) (txq->count - nb_tx)); } txq->count = 0; + txq->tsc = rte_get_timer_cycles(); } static inline void @@ -629,7 +630,6 @@ dpdk_queue_pkts(struct netdev_dpdk *dev, int qid, { struct dpdk_tx_queue *txq = &dev->tx_q[qid]; uint64_t diff_tsc; - uint64_t cur_tsc; int i = 0; @@ -647,11 +647,7 @@ dpdk_queue_pkts(struct netdev_dpdk *dev, int qid, if (txq->count == MAX_TX_QUEUE_LEN) { dpdk_queue_flush__(dev, qid); } - cur_tsc = rte_get_timer_cycles(); - if (txq->count == 1) { - txq->tsc = cur_tsc; - } - diff_tsc = cur_tsc - txq->tsc; + diff_tsc = rte_get_timer_cycles() - txq->tsc; if (diff_tsc >= DRAIN_TSC) { dpdk_queue_flush__(dev, qid); } -- 2.20.1