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 CC8D1A0548; Thu, 2 Jun 2022 03:55:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CDAAA42B8A; Thu, 2 Jun 2022 03:55:08 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2116.outbound.protection.outlook.com [40.107.223.116]) by mails.dpdk.org (Postfix) with ESMTP id AF14842B95 for ; Thu, 2 Jun 2022 03:55:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CM0kg6GCcF97b0Qc17K5GcNS3AsA6BOm51wB8pphbzjMgEYUQYa4ICbb9WXDATLhgCP7F4N1kNNCGrBZiMtODsJODyYlDMj6kfPDxk9DjExSQ1YVw9kU4mlgQszASWlXXjVCcYqDUz3lmgPfxTCBa9zbzYHXC9day5bTzRZMfihm5pWssctws6SnLaYbH3CcqGRA68mxvPZ/YPf8TxNy/Gju4eG8rhiCpctScCarrBLnDsPRbLknf1RnNpxXKN5kQNNOlCuxNM6RSvyu2wwVLaSVoMs6ggsbEF4UH5fws7nKTR809E6l5cXD0FSZUtkVqOjgW8I55a5nCAGxZA3R+w== 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=5Dpz7mHmlxmK4+oMt3BICnonh8updNF6eGGVKPTqxis=; b=Ap7tajpUgdBS3w0knptiDQLbxjAPu7y2zzGGSCWhl2jc2EzY/EV+GA3AUyvMJiTJGbRFjuElZD+vULBk9m9ijZuESPWbUQrATiKABzHL6etE372nCMBd2B+T1oPD7s4GfAoaaeIxQILLPTmzpxVGRuGRQXH7bHvJ/mvjNuOGnfVq6Yw7FHZBWN8icmuwslQqet+Bji3jEf7zOsYYC797PGWd9w3dQNWgshAemt2VTY3/Kx3pqkGUYiqKk33XUmcbL9z2tOYjm8OlDZ+EttZ0r5nEawbwaD0mPzXvGOysJUw0rCkIM3iyg8yfomQL6S+crVXw6UTm4VBUHS93dUuouw== 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=5Dpz7mHmlxmK4+oMt3BICnonh8updNF6eGGVKPTqxis=; b=t465QIIsYlvG0Z5YWZqmlq2N7ocJ0tsSsmOqO+jAVkk8g8ApuuuYMhZC4bLu7ja8PRG/j3TNwl63cFx8kBXrNExt/aLlJkYyKlyYVp4sPrxdJZgTwXwtgXTgr90CrAS4cze64CmQwkUfnXyPsgItR+HJj4bp018E3uaeGtYdkYk= 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 DM4PR13MB5858.namprd13.prod.outlook.com (2603:10b6:8:46::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.11; Thu, 2 Jun 2022 01:55:05 +0000 Received: from DM6PR13MB3004.namprd13.prod.outlook.com ([fe80::d902:ed7d:82bb:c753]) by DM6PR13MB3004.namprd13.prod.outlook.com ([fe80::d902:ed7d:82bb:c753%4]) with mapi id 15.20.5314.013; Thu, 2 Jun 2022 01:55:05 +0000 From: Jin Liu To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Jin Liu , Diana Wang , Peng Zhang , Chaoyong He Subject: [PATCH 12/14] net/nfp: move macro from C file to head file Date: Thu, 2 Jun 2022 03:53:02 +0200 Message-Id: <20220602015304.710197-13-jin.liu@corigine.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220602015304.710197-1-jin.liu@corigine.com> References: <20220602015304.710197-1-jin.liu@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0457.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1aa::12) 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: d418ddea-359b-4a02-ca6b-08da443ae9e5 X-MS-TrafficTypeDiagnostic: DM4PR13MB5858: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: hsT+59CyXBcOq/yVnzLq6gXHXReAXD5j/yNs/1Iko8ug88i7s38XKbzwCSIMOrSPcINXcgKMS0Ff3tSBS19x/AjwOgmfpxs2NuUYV1VRjkCMvedtv7jP7WhFYMWZ7xGYYTyN5tQ4myaefu8vGAja1ezTnYcIvqzw0g0k+gbxqOYQFkTrV+6P2b08mJjL34zN7FkN4cezoWtjdVrsbxqTZvKZl8HQRVF0Rt6EbZChsOEwoht9QahJ+dpmYGC5+RktJMfqMk3D69XdoGiT0F9YSdi6Qvmut939+foLdVaRmCCj2NWkQvPE4fUZtE6a6puTFiNk+rfxJck76oT/VaHN/G7+vr6ocJvz6yhY7t3Li+GwRxu53bPG80/cfiWNNn+fV59uTzv8ikMuPhWwb8mEa7J05m5mSJMWNuVUPUCv67Q3+Vd9WN9p0peNgC5AqA/LgZqehbxkiSTm2ekXMNX1AbFKg9wRYgDvsvEyfzQDbs1oa8xIjHDwtzVny4G/HDWzASqp1ygWQZI+kMfhqfpDJxeoLDpi44makt6g6DcvirGelNwDXPmS35JguR1GXF83zSSNxgvQKb2kUnZDqiOedrzrBCIKNzeycynscgpnFhpPcnP6q5s1QOTng1HpCGlvKSfspLP1c1gGgnaAkZQzZiKA7fZ8PWNIp24D6l9qku4bp+cqKxZcLbjqLLYB/whmTi6kjzIHS2A7JyeVceRNIw== 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:(13230001)(4636009)(346002)(366004)(396003)(136003)(376002)(39840400004)(36756003)(186003)(83380400001)(5660300002)(4326008)(44832011)(8936002)(2906002)(6916009)(54906003)(1076003)(107886003)(6506007)(316002)(2616005)(41300700001)(8676002)(66946007)(66476007)(6666004)(66556008)(26005)(6512007)(52116002)(38100700002)(38350700002)(86362001)(6486002)(508600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Q1o5L3dHcjExTDg2SU5JdURGVDdMZjY3d3QyRHpiclRVRjYyLzdPY2JnMWhU?= =?utf-8?B?bDRCMndBbjd1U3l4KytnZHdmMGk2aU5lMXpHTkFSUFVQOGZjYkxJbGxRbTc5?= =?utf-8?B?WVFRclkvcXpVRWlQRXp0dk1DWllDV1lrdnlyWWdtWFg2WDMyVVBUMGZFWWdO?= =?utf-8?B?M25YLzhVM2lPVWVIWWc3N2Y2UVJSTG1LaExFN3dPMVI1bE9NUm5jZ2xtK3FS?= =?utf-8?B?ODRrMW1sMzZJV0lFQXJIQWhCV2MxSWRtQkMxWjQ4NW5HT1dtVnA1cjJiQzcy?= =?utf-8?B?U09WUy80L3ZCUitJMThDNFNwNEpDMHdJY1l0a1MyNTd2VUQ5QW5QMVJrU3c3?= =?utf-8?B?T3hmRi83eWpjUlgxY0d3aDJ4aHlYQ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GFj?= =?utf-8?B?YzY5NEtQcHd0YjRsRkRIY0g0RWp6L3BGTFl3RS9hc21kZndHZ0o2SzdVTFdY?= =?utf-8?B?azVhVlpVeWV6bE0xK0QwK3B3L2QzVVJKQmhBV2d1c0lCdyt0NGExRlQzTVAr?= =?utf-8?B?UmZGamZtOGJBMEpaWXBxTGMvOHJLVk1DSlhmd3hWQnFma3BkOTV4UT09?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: d418ddea-359b-4a02-ca6b-08da443ae9e5 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB3004.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2022 01:55:05.1789 (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: 13RpMSH82mFJU07e90HiBKh6EQub0WZxUnNMAFqTIaVxkpylCEOTJYGNKisY+PSd45nHTGWde+0nYVRvuUs2pA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR13MB5858 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 nfdk firmware. 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