[dpdk-dev] [PATCH v5 2/4] net/ice: cleanup Tx buffers

Yang, Qiming qiming.yang at intel.com
Mon Dec 30 04:29:17 CET 2019



-----Original Message-----
From: Di, ChenxuX 
Sent: Friday, December 27, 2019 11:45
To: dev at dpdk.org
Cc: Yang, Qiming <qiming.yang at intel.com>; Xing, Beilei <beilei.xing at intel.com>; Di, ChenxuX <chenxux.di at intel.com>
Subject: [PATCH v5 2/4] net/ice: cleanup Tx buffers

Add support to the ice driver for the API rte_eth_tx_done_cleanup to force free consumed buffers on Tx ring.

Signed-off-by: Chenxu Di <chenxux.di at intel.com>
---
 drivers/net/ice/ice_ethdev.c |   1 +
 drivers/net/ice/ice_rxtx.c   | 123 +++++++++++++++++++++++++++++++++++
 drivers/net/ice/ice_rxtx.h   |   1 +
 3 files changed, 125 insertions(+)

.......

+	/*
+	 * Loop through each packet. For each packet, verify that an
+	 * mbuf exists and that the last segment is free. If so, free
+	 * it and move on.
+	 */
+	while (1) {
+		tx_last = sw_ring[tx_id].last_id;
+
+		if (sw_ring[tx_last].mbuf) {
+			if ((txr[tx_last].cmd_type_offset_bsz &
+				rte_cpu_to_le_64(ICE_TXD_QW1_DTYPE_M)) ==
+				rte_cpu_to_le_64(ICE_TX_DESC_DTYPE_DESC_DONE)) {
+				/* Get the start of the next packet. */
+				tx_next = sw_ring[tx_last].next_id;
+
+				/*
+				 * Loop through all segments in a
+				 * packet.
+				 */
+				do {
+					rte_pktmbuf_free_seg(sw_ring[tx_id].mbuf);
+					sw_ring[tx_id].mbuf = NULL;
+					sw_ring[tx_id].last_id = tx_id;
+
+					/* Move to next segment. */
+					tx_id = sw_ring[tx_id].next_id;
+
+				} while (tx_id != tx_next);
+
+				/*
+				 * Increment the number of packets
+				 * freed.
+				 */
+				count++;
+
+				if (unlikely(count == (int)free_cnt))
+					break;
+			} else {
+				/*
+				 * mbuf still in use, nothing left to
+				 * free.
+				 */
+				break;

Same comment as patch 1

+			}

.....


More information about the dev mailing list