Thread (36 messages) 36 messages, 7 authors, 2017-03-31

Re: [PATCH 1/5] net/fm10k: remove limit of fm10k_xmit_pkts_vec burst size

From: Bruce Richardson <hidden>
Date: 2017-02-24 09:33:00

On Fri, Feb 24, 2017 at 04:48:17PM +0800, Zhiyong Yang wrote:
quoted hunk ↗ jump to hunk
To add a wrapper function fm10k_xmit_pkts_vec_simple to remove
the limit of tx burst size. The patch makes fm10k vec function
an best effort to transmit the pkts in the consistent behavior
like fm10k_xmit_pkts does that.

Cc: Jing Chen <redacted>

Signed-off-by: Zhiyong Yang <redacted>
---
 drivers/net/fm10k/fm10k_ethdev.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index c4fe746..e9b6254 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2741,6 +2741,31 @@ fm10k_check_ftag(struct rte_devargs *devargs)
 	return 1;
 }
 
+static uint16_t
+fm10k_xmit_pkts_vec_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
+			   uint16_t nb_pkts)
+{
+	uint16_t nb_tx = 0;
+	struct fm10k_tx_queue *txq = (struct fm10k_tx_queue *)tx_queue;
+
+	if (likely(nb_pkts <= txq->rs_thresh))
+		return fm10k_xmit_pkts_vec(tx_queue, tx_pkts, nb_pkts);
+
+	/* transmit in chunks of at least txq->rs_thresh */
+	while (nb_pkts) {
+		uint16_t ret, num;
+
+		num = (uint16_t)RTE_MIN(nb_pkts, txq->rs_thresh);
+		ret = fm10k_xmit_pkts_vec(tx_queue, &tx_pkts[nb_tx], num);
+		nb_tx += ret;
+		nb_pkts -= ret;
+		if (ret < num)
+			break;
+	}
+
+	return nb_tx;
+}
+
 static void __attribute__((cold))
 fm10k_set_tx_function(struct rte_eth_dev *dev)
 {
@@ -2766,7 +2791,7 @@ fm10k_set_tx_function(struct rte_eth_dev *dev)
 			txq = dev->data->tx_queues[i];
 			fm10k_txq_vec_setup(txq);
 		}
-		dev->tx_pkt_burst = fm10k_xmit_pkts_vec;
+		dev->tx_pkt_burst = fm10k_xmit_pkts_vec_simple;
 		dev->tx_pkt_prepare = NULL;
 	} else {
The names of the functions do not look right to me. I don't think the
suffic "_simple" is suitable for describing the functionality of the
wrapper function vs the original function. I think instead that the
original function should be renamed to indicate that it is only handles
a fixed size burst of pkts, and the new wrapper function takes the
original name. For example:

	fm10k_xmit_fixed_burst_vec (original fn)
	fm10k_xmit_pkts_vec (new fn)

Regards,
/Bruce
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help