diff mbox series

[3/8] net/qede: assume txq->sw_tx_ring[idx] is never null in qede_free_tx_pkt

Message ID f6a6da02426b8f3c62c13837918b61e914a49a5b.1614938727.git.bnemeth@redhat.com (mailing list archive)
State Changes Requested
Delegated to: Jerin Jacob
Headers show
Series Optimize qede use of rx/tx_entries | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Balazs Nemeth March 5, 2021, 1:14 p.m. UTC
The ring txq->sw_tx_ring is managed with txq->sw_tx_cons. As long as
txq->sw_tx_cons is correct, there is no need to check if
txq->sw_tx_ring[idx] is null explicitly.

Signed-off-by: Balazs Nemeth <bnemeth@redhat.com>
---
 drivers/net/qede/qede_rxtx.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index 1308c71db..c5e12ac6b 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -890,25 +890,20 @@  qede_free_tx_pkt(struct qede_tx_queue *txq)
 
 	idx = TX_CONS(txq);
 	mbuf = txq->sw_tx_ring[idx];
-	if (mbuf) {
-		nb_segs = mbuf->nb_segs;
-		PMD_TX_LOG(DEBUG, txq, "nb_segs to free %u\n", nb_segs);
+	RTE_ASSERT(mbuf);
+	nb_segs = mbuf->nb_segs;
+	PMD_TX_LOG(DEBUG, txq, "nb_segs to free %u\n", nb_segs);
 
-		ret = nb_segs;
-		while (nb_segs) {
-			/* It's like consuming rxbuf in recv() */
-			ecore_chain_consume(&txq->tx_pbl);
-			nb_segs--;
-		}
-
-		rte_pktmbuf_free(mbuf);
-		txq->sw_tx_ring[idx] = NULL;
-		txq->sw_tx_cons++;
-		PMD_TX_LOG(DEBUG, txq, "Freed tx packet\n");
-	} else {
+	ret = nb_segs;
+	while (nb_segs) {
+		/* It's like consuming rxbuf in recv() */
 		ecore_chain_consume(&txq->tx_pbl);
-		ret = 1;
+		nb_segs--;
 	}
+
+	rte_pktmbuf_free(mbuf);
+	txq->sw_tx_cons++;
+	PMD_TX_LOG(DEBUG, txq, "Freed tx packet\n");
 	return ret;
 }