[dpdk-dev] [PATCH 2/5] net/i40e: remove limit of i40e_xmit_pkts_vec burst size

Zhiyong Yang zhiyong.yang at intel.com
Fri Feb 24 09:48:18 CET 2017


To add a wrapper function i40e_xmit_pkts_vec_simple to remove the
limit of tx burst size. The patch makes i40e vec function an best
effort to transmit the pkts in the consistent behavior like
i40e_xmit_pkts_simple and i40e_xmit_pkts do that.

Cc: Helin Zhang <helin.zhang at intel.com>
Cc: Jingjing Wu <jingjing.wu at intel.com>

Signed-off-by: Zhiyong Yang <zhiyong.yang at intel.com>
---
 drivers/net/i40e/i40e_rxtx.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 48429cc..819d1d4 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1426,6 +1426,31 @@ i40e_xmit_pkts_simple(void *tx_queue,
 	return nb_tx;
 }
 
+static uint16_t
+i40e_xmit_pkts_vec_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
+			  uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
+
+	if (likely(nb_pkts <= txq->tx_rs_thresh))
+		return i40e_xmit_pkts_vec(tx_queue, tx_pkts, nb_pkts);
+
+	/* transmit in chunks of at least txq->tx_rs_thresh */
+	while (nb_pkts) {
+		uint16_t ret, num;
+
+		num = (uint16_t)RTE_MIN(nb_pkts, txq->tx_rs_thresh);
+		ret = i40e_xmit_pkts_vec(tx_queue, &tx_pkts[nb_tx], num);
+		nb_tx += ret;
+		nb_pkts -= ret;
+		if (ret < num)
+			break;
+	}
+
+	return nb_tx;
+}
+
 /*********************************************************************
  *
  *  TX prep functions
@@ -2840,7 +2865,7 @@ i40e_set_tx_function(struct rte_eth_dev *dev)
 	if (ad->tx_simple_allowed) {
 		if (ad->tx_vec_allowed) {
 			PMD_INIT_LOG(DEBUG, "Vector tx finally be used.");
-			dev->tx_pkt_burst = i40e_xmit_pkts_vec;
+			dev->tx_pkt_burst = i40e_xmit_pkts_vec_simple;
 		} else {
 			PMD_INIT_LOG(DEBUG, "Simple tx finally be used.");
 			dev->tx_pkt_burst = i40e_xmit_pkts_simple;
-- 
2.7.4



More information about the dev mailing list