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 5050441BB9; Fri, 3 Feb 2023 08:58:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5066E41611; Fri, 3 Feb 2023 08:58:07 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2124.outbound.protection.outlook.com [40.107.100.124]) by mails.dpdk.org (Postfix) with ESMTP id B0B7842D0D for ; Fri, 3 Feb 2023 08:58:05 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UKZfjeebhSPB3ricA0ZOkTwqUORfHgsYsWI4Zsa8cqrNQUOt6uYLh7L5V2NdCDcXSaOmICgQw91rcREnSHkmWEnwD4xduIYfd+cBuBKEWBh30xcnEzvTEeW6fhR6eaxaniSzwTkOyko+x5/OXWt10s/Ifu3iYYVhp/HPQyG9DrNc/PpreQrE8wiFBMqCVBALKBbgmiS1KwUJLewo6jP2MdGe4wPk3AWiWDLL1+mpn0ld+xaRJCCVop6yGC7JDFaXkbLlhh+RoHieacT4xG0rA/UqV+CqQRr4EvqzrA34e5RSwchvYYm5KxCZdlHMsxZTwzMjxlNCxChf44LDqKKDIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WYX7J5v+kYPMpV/x3NNfLGY7lubWXg+NaQc8+ID2azM=; b=JCKSrKJhtVu8x0DahyE3mzo1XHcD6YSFLsUyH5hkJ6Y1bu+xqd0Oj7GIBpxBQp7vIseeYYB4d9+9I1FBfNIlMae7JBD2Sq7blysUKdOe4nSs/74zjUOmtHDYGDdAAfVaVTDYi4ePnHt6/9ixK2Q1NcSacPILRe7pSHUPkUAYV6m25u4+kfte9Se5IUxelDf1i7qZnLZQDXZG0KHS49NAkLYYCHhaRxPpliqExICn3m9Nbhb77XAyvzqe+I4E87cBt10Mi7VHwjwZ0R7yJJFlQgc0iFXfYjj7GTsOOioF0LTPRiXXr3TlyTbCGHFmAEtBnSBIPhnQ712xuzEZD9lTfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WYX7J5v+kYPMpV/x3NNfLGY7lubWXg+NaQc8+ID2azM=; b=ZC6ATfMgQg/aem/9ZlXxY5UAnzcnsVh1wuxK3/03bz8wa/sxvc1ri9FWtprQalfbiJXAz7ud9hg8EViClBio0AScekt/RnrZS5IoWdhLKLF4msmovVJ7/f7UbtVdYW8wfomvCx6Djk1zgL9NQ9+3lTHRm7nSyyGu+FeDpO0Hc+c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by PH8PR13MB6292.namprd13.prod.outlook.com (2603:10b6:510:257::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27; Fri, 3 Feb 2023 07:58:04 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7ea4:e421:5dd5:9f4d%4]) with mapi id 15.20.6064.027; Fri, 3 Feb 2023 07:58:04 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, James Hershaw , Chaoyong He Subject: [PATCH 3/3] net/nfp: remove ASSERT() macro Date: Fri, 3 Feb 2023 15:57:36 +0800 Message-Id: <20230203075736.18616-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20230203075736.18616-1-chaoyong.he@corigine.com> References: <20230203075736.18616-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0014.apcprd01.prod.exchangelabs.com (2603:1096:4:191::17) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH8PR13MB6292:EE_ X-MS-Office365-Filtering-Correlation-Id: b29dfd03-f725-4134-ab46-08db05bc60c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N68WohMb5xHmzGalor4RrwrLSba4w3L703wRqiqxS4Q+Y/FPasP1cDbHHVPXvVLIhpR+bYyRWzuvqImMzMSEepx1B1C0zEaGBUuFb0G2cG4ypsJn6dhdfOjxZd38uwMlwBpFied7uTJgx8K539nbGHDsONnPTLzIVxHUPN92PUNGb76kvTFPbdyPcft/1BL3Y93+Z/DqYehLaKOuUYdOTzBaL2yTL+bqUVtmabWNxByYZYoJLHV1i8VL4qkShp2zJHZqT/EpLKRdEbMmhddmRr4s/Z0Vl123GWgqYisRubS0AFgPeGsE18TwT3KyPgRfMLTew05b4JLyMdaeLbq4OSuBcmEDDoBMNBwwt/KvrUnA/XQrWPyqKH4O+6MfHBWL4ajckiOlHYXXQCjgljJZadgSLfVUtnCjG3S7SEKYeSQ9B53gJ7/OWVOfjkdMNw9ki2OT1u2/lrvl6grcaPwPeK/D6Bv2RBGbRuS+Yc6OeR2+ypepqTEdGQ+oE26UYctObd7V0P1x/HAZWURuoDEX+uciUxCIwTh6BWEQwNDVqrRRIVn35ACHoPYcQ7hofo9EUvmRRcm+9KlpCIRdQRaRu2JyMD7y8AuMa5LI7YgdgyCmibUrLfI0tvf2vl8d6MxRXYrc1E7sm9ONZFLYPbBfNqPab0vzNq+ALt82vOtdBZz49KYk48uzzZKOJrBTYeM5gLBolhBfEr/f59eiTrw5IQPE+OYcKN9Ahf7acrjtnz/rNNAbD9qzBsS2SRarbyCE X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(346002)(366004)(39840400004)(136003)(376002)(396003)(451199018)(26005)(186003)(86362001)(6512007)(6506007)(1076003)(107886003)(6666004)(478600001)(6486002)(38100700002)(38350700002)(52116002)(2616005)(36756003)(2906002)(8936002)(5660300002)(44832011)(41300700001)(83380400001)(66556008)(66946007)(4326008)(66476007)(6916009)(8676002)(54906003)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R2w4ZnZkNVJTYkM4dHRVdTlRR04vajZ5OVRkOFQwSmtKcWxnV0s4Y0lrWmVq?= =?utf-8?B?b2t5OE9pTU5NR3BWZ2d2WTgvMVgrSWRJYm1WbDRIZnhRNGVkYTBYNFpTNkdx?= =?utf-8?B?UFBwMkgrR3paTUF0R1dqSFdLK0JUaHFxak8yL0RZZHJjbDFsVmZuQ0ZjT1Ni?= =?utf-8?B?ejFvN0RFdU42R1ZqWnJ6TlU5Rnc5Y0I3ZnJTVlNtWEhzZ0djUzhncTNvN3ZW?= =?utf-8?B?QWFNcEV4Uy9rMHkxa25UNVgyTzQzT3BILzR4VklDQjZMMFA1WHE5Qm9sTmJy?= =?utf-8?B?YWNLR3U5SXF2WTJ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tTMnJaUnF1NjJlQzY2b2ErRW1m?= =?utf-8?B?RU9ycG9OWlllbS9WVjdMZHlNUXYzSnFlWHRZaFU1bWN6NlhvSytJaG1PYW51?= =?utf-8?B?Q2c9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: b29dfd03-f725-4134-ab46-08db05bc60c5 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2023 07:58:04.0646 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xi6LaDLA09h7x60eXb18sGQm19RY/lGi3ML2w6PzjAb+aXLRVNM2+CzTywfIRlAAniTda01CR92bIP+biUPvpI5QKl2wM+tbcfHp68plImc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR13MB6292 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: James Hershaw Remove usage of the rte_panic() function from the nfp PMD. As the ASSERT(x) macro was only used twice in the PMD, it is better remove it altogether and rework the code where it was used as it is a very small change to make. Signed-off-by: James Hershaw Reviewed-by: Niklas Söderlund Reviewed-by: Chaoyong He --- drivers/net/nfp/flower/nfp_flower.c | 8 +++----- drivers/net/nfp/nfp_logs.h | 2 -- drivers/net/nfp/nfp_rxtx.c | 7 ++----- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index e0e94e0a36..f1424a010d 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -491,7 +491,7 @@ nfp_flower_pf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - int i = 0; + int i; int pkt_size; int dma_size; uint64_t dma_addr; @@ -522,7 +522,7 @@ nfp_flower_pf_xmit_pkts(void *tx_queue, issued_descs = 0; /* Sending packets */ - while ((i < nb_pkts) && free_descs) { + for (i = 0; i < nb_pkts && free_descs > 0; i++) { /* Grabbing the mbuf linked to the current descriptor */ lmbuf = &txq->txbufs[txq->wr_p].mbuf; /* Warming the cache for releasing the mbuf later on */ @@ -561,7 +561,7 @@ nfp_flower_pf_xmit_pkts(void *tx_queue, */ pkt_size = pkt->pkt_len; - while (pkt != NULL) { + while (pkt != NULL && free_descs > 0) { /* Copying TSO, VLAN and cksum info */ *txds = txd; @@ -583,7 +583,6 @@ nfp_flower_pf_xmit_pkts(void *tx_queue, txds->data_len = txd.data_len; txds->dma_addr_hi = (dma_addr >> 32) & 0xff; txds->dma_addr_lo = (dma_addr & 0xffffffff); - ASSERT(free_descs > 0); free_descs--; txq->wr_p++; @@ -607,7 +606,6 @@ nfp_flower_pf_xmit_pkts(void *tx_queue, lmbuf = &txq->txbufs[txq->wr_p].mbuf; issued_descs++; } - i++; } xmit_end: diff --git a/drivers/net/nfp/nfp_logs.h b/drivers/net/nfp/nfp_logs.h index 5da384e53f..b7632ee72c 100644 --- a/drivers/net/nfp/nfp_logs.h +++ b/drivers/net/nfp/nfp_logs.h @@ -24,10 +24,8 @@ extern int nfp_logtype_init; #ifdef RTE_ETHDEV_DEBUG_TX #define PMD_TX_LOG(level, fmt, args...) \ RTE_LOG(level, PMD, "%s() tx: " fmt "\n", __func__, ## args) -#define ASSERT(x) if (!(x)) rte_panic("NFP_NET: x") #else #define PMD_TX_LOG(level, fmt, args...) do { } while (0) -#define ASSERT(x) do { } while (0) #endif extern int nfp_logtype_cpp; diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 5f23128ac9..a5907cc428 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -968,12 +968,11 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk pkt = *tx_pkts; - i = 0; issued_descs = 0; PMD_TX_LOG(DEBUG, "queue: %u. Sending %u packets", txq->qidx, nb_pkts); /* Sending packets */ - while ((i < nb_pkts) && free_descs) { + for (i = 0; i < nb_pkts && free_descs > 0; i++) { memset(&meta_data, 0, sizeof(meta_data)); /* Grabbing the mbuf linked to the current descriptor */ lmbuf = &txq->txbufs[txq->wr_p].mbuf; @@ -1010,7 +1009,7 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk */ pkt_size = pkt->pkt_len; - while (pkt) { + while (pkt != NULL && free_descs > 0) { /* Copying TSO, VLAN and cksum info */ *txds = txd; @@ -1034,7 +1033,6 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk txds->data_len = txd.data_len; txds->dma_addr_hi = (dma_addr >> 32) & 0xff; txds->dma_addr_lo = (dma_addr & 0xffffffff); - ASSERT(free_descs > 0); free_descs--; txq->wr_p++; @@ -1061,7 +1059,6 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk lmbuf = &txq->txbufs[txq->wr_p].mbuf; issued_descs++; } - i++; } xmit_end: -- 2.29.3