This commit refactors the __netdev_dpdk_vhost_send() and enables intermediate queue where in the packets are buffered till the threshold 'INTERIM_QUEUE_BURST_THRESHOLD[32] is hit and eventually gets transmitted.
This commit improves the throughput as reported below in simple Physical to virtual testcase with higher flows @10G Line rate. Num Flow Master Commit ======== ========= ========= 10 5945899 7833914 32 3872211 6530133 50 3283713 6618711 100 3132540 5857226 500 2964499 5273006 1000 2931952 5178038 Latency stats: MASTER ------- Pkt size min(ns) avg(ns) max(ns) 512 10,011 12,100 281,915 1024 7,870 9,313 193,116 1280 7,862 9,036 194,439 1518 8,215 9,417 204,782 MASTER + COMMIT --------------- Pkt size min(ns) avg(ns) max(ns) 512 10,492 13,655 281,538 1024 8,407 9,784 205,095 1280 8,399 9,750 194,888 1518 8,367 9,722 196,973 Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-May/332271.html [By Eelco Chaudron <echau...@redhat.com>] Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodire...@intel.com> Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com> Co-authored-by: Antonio Fischetti <antonio.fische...@intel.com> --- lib/netdev-dpdk.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index dfaa3cd..765718e 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1784,16 +1784,21 @@ __netdev_dpdk_vhost_send(struct netdev *netdev, int qid, struct rte_mbuf **cur_pkts = (struct rte_mbuf **) pkts; unsigned int total_pkts = cnt; unsigned int dropped = 0; - int i, retries = 0; + int i; qid = dev->tx_q[qid % netdev->n_txq].map; + struct dpdk_tx_queue *txq = &dev->tx_q[qid]; if (OVS_UNLIKELY(!is_vhost_running(dev) || qid < 0 || !(dev->flags & NETDEV_UP))) { rte_spinlock_lock(&dev->stats_lock); dev->stats.tx_dropped+= cnt; rte_spinlock_unlock(&dev->stats_lock); - goto out; + + for (i = 0; i < total_pkts; i++) { + dp_packet_delete(pkts[i]); + } + return; } rte_spinlock_lock(&dev->tx_q[qid].tx_lock); @@ -1803,34 +1808,21 @@ __netdev_dpdk_vhost_send(struct netdev *netdev, int qid, cnt = netdev_dpdk_qos_run(dev, cur_pkts, cnt); dropped = total_pkts - cnt; - do { - int vhost_qid = qid * VIRTIO_QNUM + VIRTIO_RXQ; - unsigned int tx_pkts; - - tx_pkts = rte_vhost_enqueue_burst(netdev_dpdk_get_vid(dev), - vhost_qid, cur_pkts, cnt); - if (OVS_LIKELY(tx_pkts)) { - /* Packets have been sent.*/ - cnt -= tx_pkts; - /* Prepare for possible retry.*/ - cur_pkts = &cur_pkts[tx_pkts]; - } else { - /* No packets sent - do not retry.*/ - break; + int idx = 0; + while (idx < cnt) { + txq->pkts[txq->vhost_pkt_cnt++] = pkts[idx++]; + + if (txq->vhost_pkt_cnt >= INTERIM_QUEUE_BURST_THRESHOLD) { + dropped += netdev_dpdk_vhost_tx_burst(dev, qid); } - } while (cnt && (retries++ <= VHOST_ENQ_RETRY_NUM)); + } rte_spinlock_unlock(&dev->tx_q[qid].tx_lock); rte_spinlock_lock(&dev->stats_lock); netdev_dpdk_vhost_update_tx_counters(&dev->stats, pkts, total_pkts, - cnt + dropped); + dropped); rte_spinlock_unlock(&dev->stats_lock); - -out: - for (i = 0; i < total_pkts - dropped; i++) { - dp_packet_delete(pkts[i]); - } } /* Tx function. Transmit packets indefinitely */ -- 2.4.11 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev