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 BE68A42B42; Fri, 19 May 2023 05:00:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E78B742D4A; Fri, 19 May 2023 05:00:24 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2118.outbound.protection.outlook.com [40.107.92.118]) by mails.dpdk.org (Postfix) with ESMTP id 6E51842D4A for ; Fri, 19 May 2023 05:00:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hm6078yD4duj+aNSUQjacMBbXDzDjZv7k91EMSFVNkRmsc8JSANJK6IK8faeAOipARnTxetWC3x+29AxJP69XAyF+cZsIvkR+U8ULL63yXG+IAO/K3ilLwasw4huTWcteV/O0xXcB9OwQ+KPJdN3rKblA3vB8DqXaIyiNXcJSDkmkvo36s4ZuClyfbPlLGPCMIGvjWc+SRaGsfZVZuy2HKAjQv7LqDFmAWC5JI5vG8W7IIQOcY6+CF7BmxJLYyr2NCtLi662rIUg0JfvN7/d6iREG8Y/XYh7g4SNgCUCRHRKeajEeaXOW9hfWhmg/zo4tWEw7KXFkty4TFftkv3g3g== 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=ToHuNOugHxj2ko1g8FeYGq0F4MlDT1IHCY7gTRkOwYU=; b=DLn2emaB2Ou9DhhiL3TQrPixYGuH+S1ajl3ND2EPstQW1LiD4hKlYDpuk87UMoHG876s42IwbqA4tOSyMCQ25zJ9ye9zY564GeGJAL80b0Zx4OkbxA6WBUGSkktkd09ZaSAF4Q7BtEVvjLWf8eqZbaCoeYBRn5q5lth/eigHS+eCnZGBtasJYlgJlTBiHnXlbgt+8WOZ3L7RV8COZOv1e0OqhRAUU+6S+ZqAMWjwG9tdt7UZCy7X/m71VB/6/fMbSoGug/bXNRkdJvbViMXncfX9aZbcSAQBgIdEi1Sig21G7sjZkutDwIwMR4EH1t/7QZpp0tL7IPIGLeNJiaJCNw== 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=ToHuNOugHxj2ko1g8FeYGq0F4MlDT1IHCY7gTRkOwYU=; b=ALtigWkQmB0Gyh55Pn+X63jIXyo+Lf1CJZ9pIkgXOF1mN0+ZLLRAMlCyiH1OJ0+ZsLrpMBucBYIONRafSyzsploWjKlC8UliMEOKFA6ZZ+zlPuR65bJLVmvZl+gi/1nikyMYqichnaFdJJRcJbKzfzaUOUkzVwOk+Iu3NA/xPCw= 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 SJ0PR13MB5769.namprd13.prod.outlook.com (2603:10b6:a03:40c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Fri, 19 May 2023 03:00:21 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ac2e:52b6:82ec:4994]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ac2e:52b6:82ec:4994%3]) with mapi id 15.20.6411.017; Fri, 19 May 2023 03:00:21 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 5/8] net/nfp: remove the custom round macro Date: Fri, 19 May 2023 10:59:47 +0800 Message-Id: <20230519025950.1642943-6-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230519025950.1642943-1-chaoyong.he@corigine.com> References: <20230519025950.1642943-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0005.apcprd01.prod.exchangelabs.com (2603:1096:4:191::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SJ0PR13MB5769:EE_ X-MS-Office365-Filtering-Correlation-Id: 2d1584db-f823-4ccf-539b-08db58152f6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ewT0OEw5d6OBTqpdn+NAlhRF0c9rzaOhcGqk6tBFTTgM5XLB9RIMCFL+5dkc41mCvOovlBecKOooMhj/583xv44NEs44hh80sVr1p6hfPSYXfJaPr/lg1rp9BRubXeseDgEaVOAJBpGMVFsGa3FgATyeWa/XPYQhy+mp9OTnZf3N1ecsIEo6nABQM/o0KOUm4wl/pVOAfVjVSmFQyyWxLA8LGCV2fUdTPKy3zGK1jxU/t/4CPxf240WT6DWGU1/ypaAE/7hisXTUGNDp8XplZIe2i3qwWDhqke49Iru2D/QU7HXr18mFpeQG+4IxcIzLmOKea+VoKR7aUGB6jOL2gUGTV9bSp3sLp9CihIa//LGQ3ykMUcZOgAarRnVH00Q4UwN1ZMMcKjCfi+gzG1hDMgFwQbttNrBuewayhY/boFd5DAdsLrsNx7CJQVbPGyijQiL2L5POZoJYS41BNRDrAzoSNcGCFFFyaHkja1lkPRwLFvuEfw76wR3EdKLb9RPGgkxdy6dgcbevC7J6ENMFQcz57av4yedqAa3BLSflKIxghWHMtdGcnwosh0pcW43kQj+j2jGVFYQqsPJNkmeOHTRCqvjVTGhny5Z7ykDNYEaj/BFpyxPTwpAnXjHDcO8U 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:(13230028)(4636009)(366004)(346002)(136003)(376002)(39840400004)(396003)(451199021)(6916009)(66476007)(66574015)(2616005)(6666004)(6512007)(41300700001)(2906002)(6486002)(83380400001)(478600001)(66556008)(107886003)(52116002)(66946007)(26005)(6506007)(1076003)(186003)(5660300002)(4326008)(316002)(8676002)(8936002)(44832011)(86362001)(38100700002)(36756003)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?V0Y4dnFVUTFoVWF5bHZWZTd0a3E5VnR6Qkt2aVpLTVdZeUozSWlZVndFUmRm?= =?utf-8?B?L3ZpckhhOFpna2gyUUE3NTZYZFJ0U3hpS3I4Sk5zejRhNkJ4TGNqMkJpVm43?= =?utf-8?B?TTFnbmpXTWhlbFN3QVdpL3dYWFZ2NzBZWDVtYkhhaVZkcGpXYkdiKzJQOStC?= =?utf-8?B?YTBoZDlFejRHdTJ6WW9tb3R1Qm9tMnJJVk5MeWg0V1p6ejJJR1k4bER4NHcz?= =?utf-8?B?UW5pejlVRGFHZWZYRTIrYUM1c2h1VjFMZm9lUWUzV1c0MDg4d0lTNzlOVmdk?= =?utf-8?B?TWkzVFFpSk5kVmhKM3htZEJPVC9aQnpYMGxzRTg1Z2dUTmZxOU0wS3B3eGdu?= =?utf-8?B?TGNGYyswcnNhWHJBam5pMEE4dTJJc3ArOWZvYjdQQTBOdjJvZURscktYYm0x?= =?utf-8?B?TlBmMkh0aGt5Yjl3UWpvUktUUnF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db-f823-4ccf-539b-08db58152f6a X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 03:00:21.8383 (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: UnTgeKj/8WU2ZXKyum9G+P+03VWTPraOkUTav+DZZv2KoFTiwOioDVb6Qog9bhvDlQvPojJuEW9MrhrOKTfLBPUPOOrLFC6ITUIyReljLrk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR13MB5769 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 Remove the custom round macro, use the macro provide by the DPDK. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfdk/nfp_nfdk_dp.c | 9 +++++---- drivers/net/nfp/nfpcore/nfp_rtsym.c | 4 ++-- drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 ------------------- 3 files changed, 7 insertions(+), 25 deletions(-) diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c index b35aa9a610..9b815800bb 100644 --- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c +++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c @@ -70,8 +70,8 @@ nfp_net_nfdk_tx_maybe_close_block(struct nfp_net_txq *txq, n_descs++; /* Don't count metadata descriptor, for the round down to work out */ - if (round_down(txq->wr_p, NFDK_TX_DESC_BLOCK_CNT) != - round_down(txq->wr_p + n_descs, NFDK_TX_DESC_BLOCK_CNT)) + if (RTE_ALIGN_FLOOR(txq->wr_p, NFDK_TX_DESC_BLOCK_CNT) != + RTE_ALIGN_FLOOR(txq->wr_p + n_descs, NFDK_TX_DESC_BLOCK_CNT)) goto close_block; if (txq->data_pending + pkt->pkt_len > NFDK_TX_MAX_DATA_PER_BLOCK) @@ -293,8 +293,9 @@ nfp_net_nfdk_xmit_pkts(void *tx_queue, } used_descs = ktxds - txq->ktxds - txq->wr_p; - if (round_down(txq->wr_p, NFDK_TX_DESC_BLOCK_CNT) != - round_down(txq->wr_p + used_descs - 1, NFDK_TX_DESC_BLOCK_CNT)) { + if (RTE_ALIGN_FLOOR(txq->wr_p, NFDK_TX_DESC_BLOCK_CNT) != + RTE_ALIGN_FLOOR(txq->wr_p + used_descs - 1, + NFDK_TX_DESC_BLOCK_CNT)) { PMD_TX_LOG(INFO, "Used descs cross block boundary"); goto xmit_end; } diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c index 850667adf8..9713605580 100644 --- a/drivers/net/nfp/nfpcore/nfp_rtsym.c +++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c @@ -113,8 +113,8 @@ __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip) return NULL; /* Align to 64 bits */ - symtab_size = round_up(symtab_size, 8); - strtab_size = round_up(strtab_size, 8); + symtab_size = RTE_ALIGN_CEIL(symtab_size, 8); + strtab_size = RTE_ALIGN_CEIL(strtab_size, 8); rtsymtab = malloc(symtab_size); if (rtsymtab == NULL) diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.h b/drivers/net/nfp/nfpcore/nfp_rtsym.h index d2856e19c3..8b494211bc 100644 --- a/drivers/net/nfp/nfpcore/nfp_rtsym.h +++ b/drivers/net/nfp/nfpcore/nfp_rtsym.h @@ -15,25 +15,6 @@ #define NFP_RTSYM_TARGET_LMEM -1 #define NFP_RTSYM_TARGET_EMU_CACHE -7 -/* - * This looks more complex than it should be. But we need to get the type for - * the ~ right in round_down (it needs to be as wide as the result!), and we - * want to evaluate the macro arguments just once each. - */ -#define __round_mask(x, y) ((__typeof__(x))((y) - 1)) - -#define round_up(x, y) \ - (__extension__ ({ \ - typeof(x) _x = (x); \ - ((((_x) - 1) | __round_mask(_x, y)) + 1); \ - })) - -#define round_down(x, y) \ - (__extension__ ({ \ - typeof(x) _x = (x); \ - ((_x) & ~__round_mask(_x, y)); \ - })) - /* * Structure describing a run-time NFP symbol. * -- 2.39.1