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 4783DA0545; Thu, 23 Jun 2022 04:28:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 060AB42B8F; Thu, 23 Jun 2022 04:27:28 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2103.outbound.protection.outlook.com [40.107.94.103]) by mails.dpdk.org (Postfix) with ESMTP id 193C042B88 for ; Thu, 23 Jun 2022 04:27:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZqkQHKwOaFIeAb0UjF7WnxYRNsjdJWa96suQVfBtmwfwFVqeZA6pnmzmhUgc5SoK7+JULPq8oERZ6+EZk1fRP3U2XlWIxnKv7wueG6QmY0FrPmbaxxQFZF6Rs6VDaispGYL4nbNjRghLL0/dsra3CP+3BZ7+rOHNWOsbJ5BHfhpynD/RMr3I9720UVPnWnv3F2eyYuq7Syd4jeaDqWocL7UNm528DEy8BmCa6Q5PwyKazGvZ4sSMFrLF7jDXoFpZRNKpyBSb4FI7ZC+r72YOq1ft+GXMQFeR9dm0wutoJLuFCkHMJbN03/WCq7JC6IVw2D6ae6QZWmT4JwcYCHxMLA== 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=bbOzv/E+sKyYSpcRe/M9Ys1cJsXKnnGq4dWBVriX06zXdCSMIkCct40nvpA6croTcc0LZiuKoLXFEhsmPmx4+MBZ9MlgAdFDEek2xy1hFLvIZM+pgg4H85uFO3kV1jsr5ZJNyEgCLTltuICVEgU/UjPN8g34XpuIoNLXQ3sGuifB4PTeOhqsbp6owzY4DlLLKpe7ExdTZFfDFmadqGwZfHID9fZplfF9P9KWQVdLc1phoCGjHmFI31PxtWE7xVBQ8tHHKORivOMwX+prKDGSUkSnw90vH8mscte9zROrlD2TNprnLAXZaUphMgojiXYQcnEeHEWn+hJ/Xa3aSw6x4Q== 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=qu+yBX+DR+5MJ5nr+4uK+0KjQaPF8U8r0k6eF7l/k9fp2a/lop5wXFjLTf39SnvvyP8uDZoqKs23NGuDN9M1ek/X2Ee5muDIBclffiT30+A4TxvyQDxa89xf1VV+UQTnjxLjyU2YHDhrNUDR/LOFcSBs0APVyFi5HHggqRgqnLk= 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 MN2PR13MB3535.namprd13.prod.outlook.com (2603:10b6:208:169::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Thu, 23 Jun 2022 02:27:21 +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.015; Thu, 23 Jun 2022 02:27:21 +0000 From: Jin Liu To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Jin Liu , Diana Wang , Peng Zhang , Chaoyong He Subject: [PATCH v4 11/13] net/nfp: move macro from C file to head file Date: Thu, 23 Jun 2022 04:26:13 +0200 Message-Id: <20220623022615.3628093-12-jin.liu@corigine.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220623022615.3628093-1-jin.liu@corigine.com> References: <20220617093444.2004000-1-jin.liu@corigine.com> <20220623022615.3628093-1-jin.liu@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P265CA0222.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:33a::10) 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: b1e7843c-4617-4086-e4b2-08da54bfe6c2 X-MS-TrafficTypeDiagnostic: MN2PR13MB3535: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: bVQheshHaeqWpB38+gRAXIgl+g1HqHC9BilQvIe4Az+kYHFD75EoWR7Q16DEHwE/Mti43sBG6ZP6Lxthykn+2b+mBzWwqG++ReLNE6c6OgcITrIHlZM6PsadsDCANJfsR25qLjMf3M1AeEumrlF+IgYZSpIdoZaPVVSpXp2vL8LBiPniVGIQx3KtTYwYjWpI3Uyfd8rKHGAbuNcSck36LlmltuAd+jPXXZ77NjhoFrJn4/AOjWyfaycwBOoxxPXYXa9G34J4EeMlPCVPvu3L34MCB7ux2mplqMnTZp+CQGDfl7l15EajV3TOEFF9BW81I5A33O5gyZesxKjd4UrttqU0w/cXP573BG3FSF7LvRig+onRS6QnF/tKv768EE4piN1CMdzKe+ICYmSSaghISNbM/LNyATomgmunJGR8omVdO77F/KhvN8UR//KQqjkGMXgAweoWZ0Rn0uuwrVO/4KL3VfRo5KrApR0T3MThoyiePIsz7LhH4dnosWOlQ+6Rv5af/Zyp4jwG1ECVd2Ax1SZnXKRqm3og4nlHf5yTAFXh3dG79uhZrC2Vk4eCMsjPaNo0o0L3wDCxl5CZ9CidVDH4k7t095+TvLtILE577NvmKQ5F9f1uhyDqNb8shbJK8SF59cIOCThDjlg0dAuphcHUMKcrztN/Ys+ruQzM8yup5891C13P6hd0bjjcFGM14UX1H/gpCrGjQu+Vo0H9h+ytnqnEAeRXsnSQKZEBUFIuOTivlGH96w6qZ6jsG51+vBpd2+0bPVluMi12r1/kRMnaahZtNzGd/e1I7+JSsT0zD6JOsFW6U0uAC88xGKXW 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)(376002)(366004)(346002)(136003)(396003)(39830400003)(6666004)(107886003)(1076003)(38100700002)(38350700002)(6486002)(36756003)(8936002)(54906003)(2616005)(6916009)(5660300002)(316002)(66556008)(52116002)(6506007)(186003)(66946007)(8676002)(4326008)(66476007)(41300700001)(86362001)(6512007)(26005)(83380400001)(478600001)(2906002)(44832011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TVJCbW0xeWc5di9TWjFzeHR2NUdUNSt1Z3FpM3g0RVRCLzM3ZHdiZGxZWTNx?= =?utf-8?B?NERPTmxIVkthUzlRZXFUMU5wN1hjTzFxUnpoQlk0ckg5QS9zL2ZvejVkdEVp?= =?utf-8?B?SXIrRk96OGtBZTZZVFArekJpclErTDNWWHRreHpWbUF3cktTYUpBZ2ptNHo2?= =?utf-8?B?YmZhWEdCdVhEWVltZ2NUdzJlWU5reTdJUmNOU1UxRlNKcDVicHcvQ21uK0kx?= =?utf-8?B?cDNjRVkrbXFTeDBWVDZ0cEkxQVhlTWxlOHZtbThJ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mlmKzY3cFVNS0Z0U0JlRzhGZkhwQkNPTitubHFhSURYcitlUWo1UXlN?= =?utf-8?Q?gPu9cTO8e3IyFV/1VSA3KcTd6?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1e7843c-4617-4086-e4b2-08da54bfe6c2 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB3004.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2022 02:27:21.5865 (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: G+JxFXW/vTtxUK5z5SW7pmF/4rV1ONkBZs8Dbl7TsbbdXSEesL1RY0YXG/jHzZQmBB5OFrSzL3/sDNXbkyQfZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3535 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