From patchwork Fri Oct 27 06:09:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 133472 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A3D8543212; Fri, 27 Oct 2023 08:13:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A186B40A6C; Fri, 27 Oct 2023 08:13:54 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 8303C4029A for ; Fri, 27 Oct 2023 08:13:51 +0200 (CEST) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SGsjV12bBzrTXj; Fri, 27 Oct 2023 14:10:54 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 27 Oct 2023 14:13:48 +0800 From: Jie Hai To: , Yisen Zhuang , "Wei Hu (Xavier)" , Hao Chen , Chunsong Feng , Ferruh Yigit , "Min Hu (Connor)" CC: , , , Subject: [PATCH 2/8] net/hns3: fix unchecked Rx free threshold Date: Fri, 27 Oct 2023 14:09:40 +0800 Message-ID: <20231027060947.3183983-3-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231027060947.3183983-1-haijie1@huawei.com> References: <20231027060947.3183983-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500020.china.huawei.com (7.221.188.8) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Dengdui Huang To reduce the frequency of updating the head pointer of Rx queue, driver just updates this pointer when the number of processed descriptors is greater than the Rx free threshold. If the Rx free threshold is set to a value greater than or equal to the number of descriptors in Rx queue, the driver does not update this pointer. As a result, the hardware cannot receive more packets. This patch fix it by adding Rx free threshold check. Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") Cc: stable@dpdk.org Signed-off-by: Dengdui Huang --- drivers/net/hns3/hns3_rxtx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index f3c3b38c55d1..13214d02d536 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -1785,6 +1785,12 @@ hns3_rx_queue_conf_check(struct hns3_hw *hw, const struct rte_eth_rxconf *conf, return -EINVAL; } + if (conf->rx_free_thresh >= nb_desc) { + hns3_err(hw, "rx_free_thresh (%u) must be less than %u", + conf->rx_free_thresh, nb_desc); + return -EINVAL; + } + if (conf->rx_drop_en == 0) hns3_warn(hw, "if no descriptors available, packets are always " "dropped and rx_drop_en (1) is fixed on");