From patchwork Sat Dec 21 10:32:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei Hu (Xavier)" X-Patchwork-Id: 64104 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B972FA04B3; Sat, 21 Dec 2019 11:34:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1883D1BF8D; Sat, 21 Dec 2019 11:33:20 +0100 (CET) Received: from incedge.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id A1B7C37B0 for ; Sat, 21 Dec 2019 11:33:06 +0100 (CET) X-ASG-Debug-ID: 1576924379-0a3dd11b2f40d90009-TfluYd Received: from mail.chinasoftinc.com (inccas002.ito.icss [10.168.0.52]) by incedge.chinasoftinc.com with ESMTP id CY1N2U9Z3TZ0lFG3 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 21 Dec 2019 18:33:02 +0800 (CST) X-Barracuda-Envelope-From: huwei013@chinasoftinc.com X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.52 X-ASG-Whitelist: Client Received: from localhost.localdomain (114.119.4.74) by INCCAS002.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.439.0; Sat, 21 Dec 2019 18:33:02 +0800 From: "Wei Hu (Xavier)" X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.60 To: Date: Sat, 21 Dec 2019 18:32:52 +0800 X-ASG-Orig-Subj: [PATCH v3 8/9] net/hns3: remove the unnecessary assignment Message-ID: <20191221103253.30746-9-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191221103253.30746-1-huwei013@chinasoftinc.com> References: <20191221103253.30746-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 X-Originating-IP: [114.119.4.74] X-Barracuda-Connect: inccas002.ito.icss[10.168.0.52] X-Barracuda-Start-Time: 1576924382 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://spam.chinasoftinc.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at chinasoftinc.com X-Barracuda-Scan-Msg-Size: 2244 Subject: [dpdk-dev] [PATCH v3 8/9] net/hns3: remove the unnecessary assignment X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: "Wei Hu (Xavier)" This patch removes the unncessary assignment in the '.tx_pkt_burst' ops implementation function to avoid performance loss. Signed-off-by: Wei Hu (Xavier) Signed-off-by: Yisen Zhuang --- drivers/net/hns3/hns3_rxtx.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) 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; }