netdev-dpdk: Set current timestamp when flushing TX queue.
authorRyan Wilson <wryan@nicira.com>
Fri, 27 Jun 2014 00:41:46 +0000 (17:41 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Mon, 30 Jun 2014 17:53:58 +0000 (10:53 -0700)
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 <wryan@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
lib/netdev-dpdk.c

index d520958..bdd2abc 100644 (file)
@@ -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);
         }