diff mbox series

[v3,8/9] net/hns3: remove the unnecessary assignment

Message ID 20191221103253.30746-9-huwei013@chinasoftinc.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series updates for hns3 PMD driver | expand

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Wei Hu (Xavier) Dec. 21, 2019, 10:32 a.m. UTC
From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>

This patch removes the unncessary assignment in the '.tx_pkt_burst' ops
implementation function to avoid performance loss.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com>
---
 drivers/net/hns3/hns3_rxtx.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index d9219d123..003a5bde4 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -1181,8 +1181,7 @@  hns3_tx_free_useless_buffer(struct hns3_tx_queue *txq)
 		(tx_next_use != tx_next_clean || tx_bd_ready < tx_bd_max)) {
 		mbuf = tx_bak_pkt->mbuf;
 		if (mbuf) {
-			mbuf->next = NULL;
-			rte_pktmbuf_free(mbuf);
+			rte_pktmbuf_free_seg(mbuf);
 			tx_bak_pkt->mbuf = NULL;
 		}
 
@@ -1600,9 +1599,7 @@  hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	struct rte_mbuf *new_pkt;
 	struct rte_mbuf *tx_pkt;
 	struct rte_mbuf *m_seg;
-	struct rte_mbuf *temp;
 	uint32_t nb_hold = 0;
-	uint16_t tx_next_clean;
 	uint16_t tx_next_use;
 	uint16_t tx_bd_ready;
 	uint16_t tx_pkt_num;
@@ -1617,11 +1614,8 @@  hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	if (tx_bd_ready == 0)
 		return 0;
 
-	tx_next_clean = txq->next_to_clean;
 	tx_next_use   = txq->next_to_use;
 	tx_bd_max     = txq->nb_tx_desc;
-	tx_bak_pkt = &txq->sw_ring[tx_next_clean];
-
 	tx_pkt_num = (tx_bd_ready < nb_pkts) ? tx_bd_ready : nb_pkts;
 
 	/* send packets */
@@ -1676,9 +1670,8 @@  hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		i = 0;
 		do {
 			fill_desc(txq, tx_next_use, m_seg, (i == 0), 0);
-			temp = m_seg->next;
 			tx_bak_pkt->mbuf = m_seg;
-			m_seg = temp;
+			m_seg = m_seg->next;
 			tx_next_use++;
 			tx_bak_pkt++;
 			if (tx_next_use >= tx_bd_max) {
@@ -1697,7 +1690,6 @@  hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 	if (likely(nb_tx)) {
 		hns3_queue_xmit(txq, nb_hold);
-		txq->next_to_clean = tx_next_clean;
 		txq->tx_bd_ready   = tx_bd_ready - nb_hold;
 	}