From patchwork Mon Nov 25 09:00:53 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: 63267 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 759D5A04C2; Mon, 25 Nov 2019 10:01:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E3D562952; Mon, 25 Nov 2019 10:01:08 +0100 (CET) Received: from smtp.tom.com (smtprz15.163.net [106.3.154.248]) by dpdk.org (Postfix) with ESMTP id 3C225235 for ; Mon, 25 Nov 2019 10:01:07 +0100 (CET) Received: from my-app01.tom.com (my-app01.tom.com [127.0.0.1]) by freemail01.tom.com (Postfix) with ESMTP id A05FC1C816C6 for ; Mon, 25 Nov 2019 17:01:15 +0800 (CST) Received: from my-app01.tom.com (HELO smtp.tom.com) ([127.0.0.1]) by my-app01 (TOM SMTP Server) with SMTP ID 1863435607 for ; Mon, 25 Nov 2019 17:01:15 +0800 (CST) Received: from antispam1.tom.com (unknown [172.25.16.55]) by freemail01.tom.com (Postfix) with ESMTP id 8DB9D1C8162D for ; Mon, 25 Nov 2019 17:01:15 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tom.com; s=201807; t=1574672475; bh=P8PvFnWS8NW334NVDKuRy1zVGXfil/0l0NsmlICE6Lg=; h=From:To:Cc:Subject:Date:From; b=cQSbVsxa9QOnWsBJIHyG85LjVY/i0ju5/iPJJ2vWbHxbL+BE5PBIGnaBBk9WwUoYo PsnNdsBxi+0WINYC/v3kFy8O3Lz1yF6cgw/EysbGWJeM4ixR6JAZme2FecdfDMLqcT zDv7Av+QiueugcBhBR+hrX6fb3fcmYUSTqKVJ5oo= Received: from antispam1.tom.com (antispam1.tom.com [127.0.0.1]) by antispam1.tom.com (Postfix) with ESMTP id 444FA10014C6 for ; Mon, 25 Nov 2019 17:00:35 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam1.tom.com Received: from antispam1.tom.com ([127.0.0.1]) by antispam1.tom.com (antispam1.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GfZQbiq4T2Jy for ; Mon, 25 Nov 2019 17:00:31 +0800 (CST) Received: from localhost.localdomain (unknown [203.160.91.226]) by antispam1.tom.com (Postfix) with ESMTPA id E20411001640; Mon, 25 Nov 2019 17:00:29 +0800 (CST) From: "Wei Hu (Xavier)" To: dev@dpdk.org, stable@dpdk.org Cc: huwei87@hisilicon.com Date: Mon, 25 Nov 2019 17:00:53 +0800 Message-Id: <20191125090053.974-1-xavier.huwei@tom.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] net/hns3: fix checking enough Tx BDs 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)" In .tx_pkt_burst ops implementation function of hns3 PMD driver, there is one check whether there are enough BDs in the TX queue. If not, driver will stop sending the packets. Currently in the 'for' process loop, the next_to_use member of TX queue is not updated in time after processing BDs of one packet, which results in the invalid action of checking whether there are enough BDs and failure in sending packets. This patch fixes it by moving the assignment statment of the next_to_use member of TX queue to the place after porcessing TX BDs in the 'for' loop. Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") Cc: stable@dpdk.org Signed-off-by: Hongbo Zheng Signed-off-by: Huisong Li Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 34cb7faf9..816644713 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -1649,6 +1649,7 @@ hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) } while (m_seg != NULL); nb_hold += i; + txq->next_to_use = tx_next_use; } end_of_tx: @@ -1656,7 +1657,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->next_to_use = tx_next_use; txq->tx_bd_ready = tx_bd_ready - nb_hold; }