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 B9CDFA0093; Fri, 17 Jun 2022 11:36:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EFCCE42B8F; Fri, 17 Jun 2022 11:35:43 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2113.outbound.protection.outlook.com [40.107.94.113]) by mails.dpdk.org (Postfix) with ESMTP id 8EAF042B83 for ; Fri, 17 Jun 2022 11:35:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eo1DbEP4Pz+lCPMlRhu8/z4bF8pQt6/ia4y9NamMOw97+HgPj0B41/EScQ6+pCVemmsUGi9qhCtX/X9wv+Ca/XiWaqTPaHzFrD/wxMINUJ9xWocgYXObKyEzSk/NPYcGad77j56cdmwj2UGmDsCOVttvLggm4yhDXnjh2YnfLNO3+udSSjxwHXF4gEIATWX7bL654p010XfgL9froDOQI0nuKAVogfmzhJgKO6Q4PbF6NCeC76ebSF+x4o4DS8pwYmAzF3TO6oebm/Vx9pQ+dvR8tfgtvf15LPkyArVg5GyMdj1RWsgXX4eN7icYCl0wMLOfbCWKukH9Z3zBRH05lQ== 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=qSG3E8RYAvM0H42u7IYQmlBNIHDtskhEYNNda8yu5oY=; b=K84Xpxk70uIKkZ3aaN9etpXcV9icDc3WaRYxAoByviik9kddnS+Ks2/BZ+GXeTqBMjJDWKhackj6S5hlUmdBfW9GbLOzsI1eXZWsnSgDpGzuquDN+N6THcdbyQ9ZBeDmG8aKPSmRFGTYgrmNZKR4hfkRog3hGgG2pPBauqxNCNYn8KkEOyXBFbGamUGqT4S1RaNgs4UCNepg2lbBWapnwLrnI3dT8Utrx9+HB+mxvo9pICtG796cUNvUKYFU+Tmk2eMtyGLGuX6VGjwDJcD+d39pL8xOj9LsnGXdqIJM7GkWIiVsH0Q5VBRIl8cCO8n7JezC//dTe33wsofLWlE5Cg== 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=qSG3E8RYAvM0H42u7IYQmlBNIHDtskhEYNNda8yu5oY=; b=B7t0yhT2qjbbgNr+rsvqijh8A6IOwy76U5DrXga+oETy2Iv/fLeg8JPcck7NVF8NyjXEszg4wglmHFEwGiBl7cDKzn4vnCMBGWzlK3rhioiduc4tQeqHbkp1YlGTLufCqrTyagoaTrpoRpTGai3MCmKI7MLQypPBiFZ4J288a/M= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from DM6PR13MB3004.namprd13.prod.outlook.com (2603:10b6:5:191::21) by CO3PR13MB5671.namprd13.prod.outlook.com (2603:10b6:303:17a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.9; Fri, 17 Jun 2022 09:35:38 +0000 Received: from DM6PR13MB3004.namprd13.prod.outlook.com ([fe80::ac31:a36a:cc15:cd35]) by DM6PR13MB3004.namprd13.prod.outlook.com ([fe80::ac31:a36a:cc15:cd35%7]) with mapi id 15.20.5373.009; Fri, 17 Jun 2022 09:35:38 +0000 From: Jin Liu To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Jin Liu , Diana Wang , Peng Zhang , Chaoyong He Subject: [PATCH v3 11/13] net/nfp: move macro from C file to head file Date: Fri, 17 Jun 2022 11:34:42 +0200 Message-Id: <20220617093444.2004000-12-jin.liu@corigine.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220617093444.2004000-1-jin.liu@corigine.com> References: <20220616023939.1798769-1-jin.liu@corigine.com> <20220617093444.2004000-1-jin.liu@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0192.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a4::17) To DM6PR13MB3004.namprd13.prod.outlook.com (2603:10b6:5:191::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aa69fc83-9f7b-4ea9-7cdd-08da5044bcb3 X-MS-TrafficTypeDiagnostic: CO3PR13MB5671:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VI+9NRSckqsLTNVBzoj+orI397hMx0tqq6t/BdqUgwlYx2muhb9mvleU35sB/JMuHW/dxJgBQ1J42xhrcI+hoAdnG73MJFlQEiKxrhjrPL8vALS0g4JRnFsKeAp8CV1aXBSc4Tshe9/ND9Xl3yCB2O3GrOMr66egy23AWIkP77JU22YFn107JpBH9pTUuMtv/ndG+Bd2+g+O+EbCf4rV/Zr7fxqkWKnAjAg3U7/MpcdgPwwMtHNU2ExpeqI52VkQLXBXqoH7fGfD0QVNzfx/svqWlNKAhEDXhGijOQKOCZjK76xoXo10T2wT5Wqz5lEj3kw9tB0j6Hc1n6h5xV2FMOWXOlqqi82cxhbvmgPfTsfnysHPoQryQPIgrvYXOFzu64f0CJ739FFe+E9vh4r5bI1fnnZPKkGhIcl+4cQ0c7g2QwQpcYPdLiPX81Us6cv955/7XeuBJgoqBLojfExgtaLfYdLsMQGKk0LIYTcL8EWlEnHEGgjtFxP8lNJ1BDEHFCb55PMCQ04fKNeRJlY0wIXo1U0x2CUzo3R/nlZriO0ARddiinVIdfnX9A+Iy/lTHfiZy6t4Ci+67hM1Nw050EYod4s/Ctcd7WKfaqa8MuczScog/6ZaiUn1AJd0oCQ4+dLeQ6+R+b6TH01/G0ckKUzgD8fga3oggeI9KPlpfBwj8Rx4xIHuuYuOVEWzEv94GoaXFFNmzjWqfGfPNEUyWmnRolVAXrVDsuE1zW8IM3/vrm56/+TUuHPvgx8Ihaex X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR13MB3004.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(346002)(136003)(366004)(396003)(39840400004)(66476007)(66556008)(26005)(8676002)(6666004)(107886003)(66946007)(6506007)(6916009)(44832011)(2906002)(316002)(4326008)(38350700002)(186003)(508600001)(54906003)(5660300002)(6486002)(6512007)(1076003)(8936002)(2616005)(36756003)(52116002)(83380400001)(86362001)(38100700002)(41300700001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QzBFV05OU1ZIUEFOSEZXVjU3SytvTEtURklneGdnZkcyZ3ViTXM0Z2lycnhz?= =?utf-8?B?b0tYQU8xOGFUTmc2aHZGeE9tbWxETXpRbnI3MWoxU3MwNmx5bmdNUlVyRFFZ?= =?utf-8?B?MXpiaW5GaXc5bEVDVDBDakE2WnBSUFRQdkJKbWlneWliVnhZOEZ6dlgzdkkx?= =?utf-8?B?ODB4dE1tY25jbjVsN0l3M2FPNElaK2dLMnQ5bUVPcG8zOW5LMWdTeTdxMWI0?= =?utf-8?B?SzN3U09mWXBBNUpscXpzNlJsNkxMMG45WnVwRkhkUnJLWkhwNXpIZ1YvaWtZ?= =?utf-8?B?akg5M2tRdmph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dER3dnODlUNzFPUHp0Z3l3?= =?utf-8?B?a0JvcHJrRHFWdmFKVUdLL2ZTTnNSa09XNUpobkk1WWtjK1poWmxUWmZGSlZw?= =?utf-8?B?M2gxOVBxQ1lxSFE1YUFSbGR2OHZwVzZUZXEvVm1uRjdCeEtsckF1OFk1UG9L?= =?utf-8?B?bFg0dUM1czdyUjlRS1hkbTI2N0xNZHpGZlBWRUhPeGpuMGxyZk1Hck90dURR?= =?utf-8?B?UWUycUh0VVdTUGNQd0ZrN1hCTFprNDN2NUJ0UzdwN0YwdGw1RjBmdz09?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa69fc83-9f7b-4ea9-7cdd-08da5044bcb3 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB3004.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 09:35:38.2724 (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: 4lM5G69u6PBOdAbZt/LH2NT5th0hl/EM8s5TFyQBFxTFlK3zECU5ZDgfFfY2va7R489YVC9i8KK+EAYlIIStyQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO3PR13MB5671 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 Move macro __round_mask, round_up and round_down from C file to corresponding head file, will be used by TX function of nfp net firmware with NFDk. Signed-off-by: Jin Liu Signed-off-by: Diana Wang Signed-off-by: Peng Zhang Signed-off-by: Chaoyong He Signed-off-by: Niklas Söderlund --- drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 ------------------- drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c index 2feca2ed81..56bbf05cd8 100644 --- a/drivers/net/nfp/nfpcore/nfp_rtsym.c +++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c @@ -94,25 +94,6 @@ nfp_rtsym_table_read(struct nfp_cpp *cpp) return rtbl; } -/* - * 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)); \ - })) - struct nfp_rtsym_table * __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip) { diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.h b/drivers/net/nfp/nfpcore/nfp_rtsym.h index 8b494211bc..d2856e19c3 100644 --- a/drivers/net/nfp/nfpcore/nfp_rtsym.h +++ b/drivers/net/nfp/nfpcore/nfp_rtsym.h @@ -15,6 +15,25 @@ #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.27.0