From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B7E5243C4B; Tue, 5 Mar 2024 12:42:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 834E240270; Tue, 5 Mar 2024 12:42:37 +0100 (CET) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 3FCED4026B for ; Tue, 5 Mar 2024 12:42:36 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TptsT2PZdz2BfKt; Tue, 5 Mar 2024 19:40:13 +0800 (CST) Received: from dggpeml500024.china.huawei.com (unknown [7.185.36.10]) by mail.maildlp.com (Postfix) with ESMTPS id 9EC0E1A016E; Tue, 5 Mar 2024 19:42:33 +0800 (CST) Received: from [10.67.121.161] (10.67.121.161) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 5 Mar 2024 19:42:33 +0800 Subject: Re: [PATCH] examples/dma: fix max-frame-size cannot be zero To: "thomas@monjalon.net" References: <20240220023153.29793-1-fengchengwen@huawei.com> CC: "Jiang, YuX" , "dev@dpdk.org" , "Richardson, Bruce" , "Laatz, Kevin" From: fengchengwen Message-ID: <08f6b115-83ba-362d-711f-9240892619ac@huawei.com> Date: Tue, 5 Mar 2024 19:42:33 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.161] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500024.china.huawei.com (7.185.36.10) 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 Hi Thomas, This commit fix bug "Bug 1387 - [dpdk24.03] cbdma: Failed to launch dpdk-dma app" [1] Should I send v2 to add the following line in commit log? Bugzilla ID: 1387 [1] https://bugs.dpdk.org/show_bug.cgi?id=1387 Thanks On 2024/2/21 14:51, Jiang, YuX wrote: >> -----Original Message----- >> From: Chengwen Feng >> Sent: Tuesday, February 20, 2024 10:32 AM >> To: thomas@monjalon.net; dev@dpdk.org; Jiang, YuX ; >> Richardson, Bruce ; Laatz, Kevin >> >> Subject: [PATCH] examples/dma: fix max-frame-size cannot be zero >> >> In the original implementation, the max_frame_size could be zero, but commit >> ("examples/dma: replace getopt with argparse") treat zero as an error. This >> commit fixes it. >> >> Also, since unsigned doesn't < 0, adjust "<= 0" judgement to "== 0". >> >> Fixes: 8d85afb19af7 ("examples/dma: replace getopt with argparse") >> >> Reported-by: Jiang, YuX >> Signed-off-by: Chengwen Feng >> --- >> examples/dma/dmafwd.c | 10 +++++----- >> 1 file changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c index >> f4a0bff06e..acceae6b7b 100644 >> --- a/examples/dma/dmafwd.c >> +++ b/examples/dma/dmafwd.c >> @@ -695,23 +695,23 @@ dma_parse_args(int argc, char **argv, unsigned int >> nb_ports) >> return ret; >> >> /* check argument's value which parsing by autosave. */ >> - if (dma_batch_sz <= 0 || dma_batch_sz > MAX_PKT_BURST) { >> + if (dma_batch_sz == 0 || dma_batch_sz > MAX_PKT_BURST) { >> printf("Invalid dma batch size, %d.\n", dma_batch_sz); >> return -1; >> } >> >> - if (max_frame_size <= 0 || max_frame_size > >> RTE_ETHER_MAX_JUMBO_FRAME_LEN) { >> + if (max_frame_size > RTE_ETHER_MAX_JUMBO_FRAME_LEN) { >> printf("Invalid max frame size, %d.\n", max_frame_size); >> return -1; >> } >> >> - if (nb_queues <= 0 || nb_queues > MAX_RX_QUEUES_COUNT) { >> + if (nb_queues == 0 || nb_queues > MAX_RX_QUEUES_COUNT) { >> printf("Invalid RX queues number %d. Max %u\n", >> nb_queues, MAX_RX_QUEUES_COUNT); >> return -1; >> } >> >> - if (ring_size <= 0) { >> + if (ring_size == 0) { >> printf("Invalid ring size, %d.\n", ring_size); >> return -1; >> } >> @@ -721,7 +721,7 @@ dma_parse_args(int argc, char **argv, unsigned int >> nb_ports) >> ring_size = MBUF_RING_SIZE; >> } >> >> - if (stats_interval <= 0) { >> + if (stats_interval == 0) { >> printf("Invalid stats interval, setting to 1\n"); >> stats_interval = 1; /* set to default */ >> } >> -- >> 2.17.1 > > Tested-by: Yu Jiang > > Best regards, > Yu Jiang > . >