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 <wr...@nicira.com> --- 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 084e8cd..6e1d293 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -581,6 +581,7 @@ dpdk_queue_flush__(struct netdev_dpdk *dev, int qid) (txq->count - nb_tx)); } txq->count = 0; + txq->tsc = rte_get_timer_cycles(); } static void @@ -626,7 +627,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; @@ -644,11 +644,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); } -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev