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 2D52744060; Wed, 12 Jun 2024 18:25:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CDA1C4111C; Wed, 12 Jun 2024 18:25:22 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2086.outbound.protection.outlook.com [40.107.243.86]) by mails.dpdk.org (Postfix) with ESMTP id BC6934275B for ; Wed, 12 Jun 2024 18:25:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PaChoAKydrcYzlsxnKkuSXPcpgMilyzafZtQZj7esvhWBf21N7XiIG6vMzUvyeQ4JLXoF0pNrkYABpm3rnBEKwJzkCoS+IyI0BaFJ1X2saTBFVKxMr6V8KiPFtk2g+ejJCFTpfygIai/YPJNCiu3dDQgv8HcE6FmfkWnWiuLctDBecXaY4iEXwrOcuO5Gnrcdm0OcGH9IegqJKSrwr1xcI7E4wx76cHGYFLKcL5Ma0Eilmp/Wnn5glxNMY0JmgkuOfxqiD2lo9Mi48U2hq2SJ7iOh+bloRwYm+eN70490z1X7Y2BPl7S497kWYGhenaiRx5MeYG5mC7rDYVz2Rp54A== 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=XEXsyfR7IoJsd+fSFxHIoK5/EYa64Ey4BJJYKNphsUo=; b=NUmOMspQQXAWT58uPZBmRMbvdF/lStKkarVmWCMpAMZhEgspQ5Sf6AUoZgQHQeyVnReR60gjNhwVF6zk9tavpFTBe5hMkXQPa8T1m3UAoytoifecujh7ynznBCsJNj4/SZt33oltKI7kazB8gpfD3hSR6LwWcCdlxT8nylUb7RZg8w5Yq/OzPjR/V6IE/+bUS3R51H67WUTqdNCS3+HDyspkTXTbbtefmYVX8Ue7sHEGj2+Z7Rjk9GIuAp74H3SKiPaCAnI1l2s2fwHyjhq5c94ap3g6hpmUCVM78eIbyMe8bjx2E1LkKS+523Ok+0nNszoWS7G+/rWVe0BF6seOMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XEXsyfR7IoJsd+fSFxHIoK5/EYa64Ey4BJJYKNphsUo=; b=CldkEa1TwRVVbMl/HC91utWIeDwbgUUdted/Fz46AuBV7Kn6oOd3yQI6fLpFUE74H61yHiFzNMEVB7Mas4UTi65Z3325+k4ZqbesxDhN4igkFY4lDt9qMuXocSWDVhGax3jPiZLx8yjDCGTEqyAVkwTuaQ26I4/YyRA0FLpLNJN6KKbtSlGKykqjgavXhGhNWj/kbYPjmVdDfNKnnDo7mGMDPlvDDfsjRW4Hxfwl1DKJnyzcQ0zAnp6U6BT3MZNbiKXMWK5eg2sZak9H1R4HPif2ThX3fhASXDA/LHzxIZRMWHOUdHaG04nGu0x1InFm5pa8oeDSd0+Py/fPjpgvzg== Received: from BY5PR17CA0024.namprd17.prod.outlook.com (2603:10b6:a03:1b8::37) by SN7PR12MB7881.namprd12.prod.outlook.com (2603:10b6:806:34a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Wed, 12 Jun 2024 16:25:17 +0000 Received: from SJ5PEPF000001D1.namprd05.prod.outlook.com (2603:10b6:a03:1b8:cafe::e8) by BY5PR17CA0024.outlook.office365.com (2603:10b6:a03:1b8::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.20 via Frontend Transport; Wed, 12 Jun 2024 16:25:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by SJ5PEPF000001D1.mail.protection.outlook.com (10.167.242.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Wed, 12 Jun 2024 16:25:17 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 12 Jun 2024 09:25:03 -0700 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 12 Jun 2024 09:25:02 -0700 From: Dariusz Sosnowski To: Viacheslav Ovsiienko , Ori Kam , Suanming Mou , Matan Azrad CC: Subject: [PATCH v2 7/8] common/mlx5: add debug mode indicator Date: Wed, 12 Jun 2024 18:24:25 +0200 Message-ID: <20240612162426.978117-8-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240612162426.978117-1-dsosnowski@nvidia.com> References: <20240605183419.489323-1-dsosnowski@nvidia.com> <20240612162426.978117-1-dsosnowski@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D1:EE_|SN7PR12MB7881:EE_ X-MS-Office365-Filtering-Correlation-Id: 07de7a43-8af9-40a3-f163-08dc8afc3f0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230034|376008|82310400020|1800799018|36860700007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?oDUbuYIiQTfHWmMvhvmf3imyjBWVQWT4eeaRdS7n5OxDv+Uov0sLa3r5KDKC?= =?us-ascii?Q?VdlvtMfRDcYO/hPZv6Y6ebKFfOIDEET9u+O4NQeSuWiq1JHT2odazWhsqQC/?= =?us-ascii?Q?qtMi2tsceahktlhZZ2N44Ft4sH5MFMAV4ouFxxOtJTUJtT+EqPcboTCBgLxp?= =?us-ascii?Q?E1UcSF+X3Qnzy/nMM0GrsoGErTuWuU0ibALb1/tIcVZlmiOLn7Vrd6PpYZKK?= =?us-ascii?Q?9XFGwntcXZb4p2cak7JkM6qiM3CnnAqwl/KjQx4DpL/hr3pj74y8Yanq/Ocz?= =?us-ascii?Q?5Hk0FatLpOAYUVYFzmYfRqNf9EER8lh0BLCVQB4ac0xxhlCPCvpHp+UDENZF?= =?us-ascii?Q?Pl58G6I8s8sxAQl/Gm9znS+yJGH43H5DmVIKXfSamXYIWrPoSP/tdiyC3R+X?= =?us-ascii?Q?ks990qI344IS8G1esDLgLjRWFtoXh8VI0AknXKo3kRREWWs/U2x21+E5e2K2?= =?us-ascii?Q?hoSnuO56kQlf7Y4B9bSq4uWZr15JI2Qcs0VA37AcpaA0X6aztEpIq/eehyk6?= =?us-ascii?Q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EAP/vkyhJGR/hhCZow=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230034)(376008)(82310400020)(1800799018)(36860700007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2024 16:25:17.3594 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07de7a43-8af9-40a3-f163-08dc8afc3f0b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7881 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 Add mlx5_fp_debug_enabled() function which: - returns true if RTE_LIBRTE_MLX5_DEBUG is defined, - returns false otherwise. This allows for conditional execution of code meant to be executed only when mlx5 debug mode is enabled, without adding conditional compilation guards inside source code. When mlx5 debug mode is disabled, any code running if mlx5_fp_debug_enabled() returns true will be removed by optimizing compiler due to dead code elimination. Signed-off-by: Dariusz Sosnowski Acked-by: Ori Kam --- drivers/common/mlx5/mlx5_common.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index 14c70edbef..1abd1e8239 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -109,6 +109,19 @@ pmd_drv_log_basename(const char *s) #endif /* RTE_LIBRTE_MLX5_DEBUG */ +/** + * Returns true if debug mode is enabled for fast path operations. + */ +static inline bool +mlx5_fp_debug_enabled(void) +{ +#ifdef RTE_LIBRTE_MLX5_DEBUG + return true; +#else + return false; +#endif +} + /* Allocate a buffer on the stack and fill it with a printf format string. */ #define MKSTR(name, ...) \ int mkstr_size_##name = snprintf(NULL, 0, "" __VA_ARGS__); \ -- 2.39.2