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 445F7A0547; Thu, 16 Jun 2022 04:42:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6CA5D42BFE; Thu, 16 Jun 2022 04:41:27 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2135.outbound.protection.outlook.com [40.107.94.135]) by mails.dpdk.org (Postfix) with ESMTP id D2A9142C12 for ; Thu, 16 Jun 2022 04:41:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PMmt35brVMOBPdxUo5PobOVjCy2+REO8+t3H02CQiiGAQ/MZGMvBG3OSKnXY3medAn52pL8tn+IsFvOMR/y3y9C2IDyeI0VSwv6qb6xRQHuhgItrNS2UHGyt1uDcbn/rpPG7IX/IOG00Hv4DZDLf58TkFp/RdhKrgFt1pzOonX9Ot4dJB7KY+J494PNU0ylRorpD2LtkMAaI2ejN9R7u04DlyIu/6LV8uhMBtYgFwai/WrX4FMCIDRY6tFfGYj8Y+IXwYhoGcPO9aQt280W33juwZHhVfUE63nyOYlnSjapzeRf9ctA68T5qd2k9nkAj4A6KRNOXxQ79ZWh2F3Gdrg== 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=CUUo+nAzQcLnfdWJjdUVLE22a4xoVz5kZ50nzMdOEcO38KmZSuT76ncebhHVNY9HS+aE7NjvKy3W63kq/seu1omyXgmrvukai3mv9aFVpytOCU+yIgBpjRhdtxL0MSmorfR3zkKQ/EwZtYjOrJiuv5hVloScUJd9R7Af1wVSlqe7szfwqF9XtYcZRH5pDEgZQw+ZjjYTwwX6RvZl5OXIFEnf/+AbJjwKLMSGulGyN90FtfGXGEyB/fqbLoHm3I1rWNiv3jSkSjYag0XgAx0TWkhnpi15wjRngnEF4O7c++Xp793OTmDx8gzPqpLrLio0ewhwI1/6XKXE3MRPSi7GOA== 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=Elr0CbKvl+I/Lq/kHhadBPfgvWvZRvjlT9C0vGLefXa3zhjSk+g3R1p/idNJBjbRrxBjS6easF4+3L4MXuu/0Cf9Ck82lmpvCXuyXMJdiIMxF8LLYf32+tCP0Oht2Tb7VheTaxFfA73u9eRB5XIbzWtUhnt6FjKxbqkkdu2EGZ4= 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 DM6PR13MB2345.namprd13.prod.outlook.com (2603:10b6:5:be::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.9; Thu, 16 Jun 2022 02:41:23 +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.5353.011; Thu, 16 Jun 2022 02:41:23 +0000 From: Jin Liu To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Jin Liu , Diana Wang , Peng Zhang , Chaoyong He Subject: [PATCH v2 13/15] net/nfp: move macro from C file to head file Date: Thu, 16 Jun 2022 04:39:37 +0200 Message-Id: <20220616023939.1798769-14-jin.liu@corigine.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220616023939.1798769-1-jin.liu@corigine.com> References: <20220602015304.710197-1-jin.liu@corigine.com> <20220616023939.1798769-1-jin.liu@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0087.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:190::20) 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: 635b1522-9843-4a9b-3028-08da4f41b3c4 X-MS-TrafficTypeDiagnostic: DM6PR13MB2345: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: cp3jc2EkSpS9FE6ID7hxlRObPvMITnRGHo+mSJpkmkERkI1AOa1fmvFuS/Tk68vcOQYXRBO2iSb6weWIcL71+ws5Uc5exLyzjgrtBmreCcit8qZuGcS1X8dfYE9TB9d7ft16+n9xm21Atx14mu5kel0Uqjx2qF9kgmESg1eS2jDgfGSt3bDlUJoza81MLk6meO9cY2/zcFjoZwjI8uDxc3l1jYYJr2YvLnzYxf+OHi6ts+UzXNCOCsIkRJ8kau3glx+H0LtN5kXQD6K+x7Yo0DKLnvTjdReGRd2BULx+8dDfARR6vBdkmD+0WA6MyAnKvTpMq+HPTBZYVVepBhxUyMZe+MZBoSzWyCe9pjnYsloi1CuHBA/oY2MkoIFQiHw5AeVHeRsqsCcUQqXYNljw7A4bfIAN4hLyg10/8EGPFj+vbAj4bQYUsqZcj8zv9AdZhqXOX9FS6rZ9iR8BzzFwLBcngOwUaiNRKfdJ8r2rVlvU9xgnRsOmB7ZXJHh2IQIW2ga49d7PQnGQ8NgjbyrlFR4jlsp2KTqH6j2ysvKV1J4Xq5JAdCSrRAucXSa/L+5K0u2PkBe6X/QWA/D26ZyPh9mE7124E+KOOkD1hDQ6MlFPrOnoknRczo3S4xmPLgCxVUULyNgwtVg5IMgXlwfsxZLVAWmGCP2HmpbMWQnx53bQHDvG4gZPnt/vVnBXtBzr8tKAwHs97o1bEjQDgHuuBw== 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)(396003)(366004)(39830400003)(136003)(6506007)(6666004)(26005)(316002)(186003)(107886003)(6486002)(508600001)(41300700001)(2616005)(83380400001)(1076003)(36756003)(54906003)(6916009)(66556008)(8676002)(2906002)(4326008)(44832011)(38350700002)(6512007)(52116002)(5660300002)(66476007)(66946007)(86362001)(8936002)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eEMvaFF1ei9MTk41TGY3UlU3R1V5bkFzWUc3dyt4V2ZWSXZ5ZTlzbXg1WDg1?= =?utf-8?B?YXBuYVN1TXFtS0lNczl6ZVZPVFAvaUgxMzRyLzU5Z3BmRVpjVnY3OXRWN2V0?= =?utf-8?B?WnljbEZHa3hpTGwxbDNFUU5BYnY1b0J4dWJMaHIvbXhIb1M4QTdUd2NaVklF?= =?utf-8?B?WHV3Wm1kWERhRkVYQ2ExMWlmK0dpenZGeUNZY0EvSnBmWVNpZFVzWCt2ZVZV?= =?utf-8?B?NjRRNEIvU09vWE1ZQUdMdzllTXVaalJLVzVrS3lMTFl0UTF3YllIaEV3T0pL?= =?utf-8?B?eVI5dS81N3V6dWVuYXVkRzRMWG9wdWlMVHJFd2wr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vdU9MTTdlaWRnODl2WEdWYjRBSDZpbXltTkEwcDBmK28wdzg0czh4?= =?utf-8?B?R0tGdWl2MEZ4Q0RKUzhXa0lDQWp4V1Mwa09GTFNNMTBkUm9FbWlWOUNiZVJG?= =?utf-8?B?RFBMTTllODNnZlFNWHVTNnZoeVhGUUlXTCtMWGNCNGpiN05kQWE1dHFqQmxq?= =?utf-8?B?L0NRVHlhS1JackJyWkloaE12T2dXbm5lckpQbUh5QzA2eGl4MUtYQT09?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 635b1522-9843-4a9b-3028-08da4f41b3c4 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB3004.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 02:41:23.6450 (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: bX5q+OCGdMkwNHZC3vr0UCOoFl9+p1SUWbI5eq299mgHHGnqxuMS3ZEFbUIuYS4EwaqQM+JeJ3FQfeA0YngZ9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB2345 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