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 E6F7E43BA7; Thu, 7 Mar 2024 11:19:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2E2442D26; Thu, 7 Mar 2024 11:19:48 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2084.outbound.protection.outlook.com [40.107.223.84]) by mails.dpdk.org (Postfix) with ESMTP id D16E940E50; Thu, 7 Mar 2024 11:19:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CkXd2BjRc1WAI8nd6/UrBdQo3v1algs6d8zAIihq5WJeC2BZolIAqCOSeZVnSazIMVKqHq5CRBmf7NCFWryDmZTgjcKK9AKeyBLBfyM0rbTZ85IasLJY2wzfb3j/Ai9iVaH3ZOrZrIEmOVPofmKwEe18KNmfutFvsyl7dOuQqFnCWI3+T7WIc24+A/D/710EN447SZuW5GB36n5M0NirtfyxyRIV27Vp73JtGY9FYkdwplgN2g1S3rer8KtseK+S/TgLrezCj+rXZ0v4Q0BE25xMVnO9uidGqmdAyFzESGB+ROqoMwCC2slRo5g9uBreqCm0yIzy7nOe1ZEUO05P1Q== 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=FQ6COwgA7EDugiDitjOB2+j6se8K2sbrNMBNWEv1Kd0=; b=TK6xdGJl6DkSi3TgwAguy67gX1eDN/zOyyublYYPNkP2+uZ+6vFrE6wBetzFfFYqSQU0Xr1ii73I5YxxFjOIB/nBzOfBhDa6kaOEgBjq7uMZgYsskOmAhxIIzukBjo1UPUEpXgslCHJz1+vzGHom8TyZCBHgdeWFLfLDy9Sn2PYJ/67wVWCxwe5k8/STDkTz9PlusjXOi9OLqYrI5OoiHDf2ydDiA00GtaOs8ExAxzYvW8fnFqpaa6YBC7YRxxbhVJxZBt/CPRM7BKMLCJC1FEkYxQW7nWWu1S+SjDXvU+N0zYDxeFSq3Xc/DlvRsc+q1YmVCJ5+h8cuGL7ZnXvf1Q== 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=FQ6COwgA7EDugiDitjOB2+j6se8K2sbrNMBNWEv1Kd0=; b=sCCrYMrgnTI/SJIZps0c9X7bR+69igGEIg1PB/xqDs5Ry4SzLQTeqOjJ4s45vMG/Clkzucaqu70sHWrO0GyGnQn4j8/9STaD00TMMcvuUTBrEbhmFLDS1E3PLulcA9Kr9Q7c18vJW2ptqDKCBvwQlL999eriFQ5sBBKaUp74FTd4KrV32+MosBpnvwjV0SSjkc0OmuShqmSba9J6t+9Rc8q6b0+JoyfDk17RTt+6LIr2+kSQtWySQyZEqETPBbc0Jjoan7geMMDWi4NCQN380Ym4QZX29Z3UmzRhhu+jg2kvvDe3WiWZGe8HAq//h7vL380JOdeYQaKZSQXeKrJaLQ== Received: from CH0PR08CA0007.namprd08.prod.outlook.com (2603:10b6:610:33::12) by CYXPR12MB9337.namprd12.prod.outlook.com (2603:10b6:930:d8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.26; Thu, 7 Mar 2024 10:19:45 +0000 Received: from CH2PEPF0000009A.namprd02.prod.outlook.com (2603:10b6:610:33:cafe::60) by CH0PR08CA0007.outlook.office365.com (2603:10b6:610:33::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.26 via Frontend Transport; Thu, 7 Mar 2024 10:19:45 +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 CH2PEPF0000009A.mail.protection.outlook.com (10.167.244.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Thu, 7 Mar 2024 10:19:45 +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.986.41; Thu, 7 Mar 2024 02:19:30 -0800 Received: from nvidia.com (10.126.231.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.1258.12; Thu, 7 Mar 2024 02:19:26 -0800 From: Gregory Etelson To: CC: , , , , Dariusz Sosnowski , "Viacheslav Ovsiienko" , Ori Kam , Suanming Mou , Matan Azrad , Alexander Kozyrev Subject: [PATCH v2 1/3] net/mlx5: fix HWS meter actions availability Date: Thu, 7 Mar 2024 12:19:08 +0200 Message-ID: <20240307101910.1135720-2-getelson@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240307101910.1135720-1-getelson@nvidia.com> References: <20240229105614.593391-1-getelson@nvidia.com> <20240307101910.1135720-1-getelson@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000009A:EE_|CYXPR12MB9337:EE_ X-MS-Office365-Filtering-Correlation-Id: 0441a003-9c00-4f7c-9a6e-08dc3e901c94 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aaG82xtkg5d4v7ZnQU+8Q77dZ+fVIJDVtjM/uhlwxUOoUXLDApulEDb7Xbnph6FuQ2pibkhrSylmEFcrLg9PLLdCmiVPBUoPhRdxmrWKoOTL0yacpQHoLLPEcUBtNl1h4Ocf872jTyPCvaEORBaQOk3xUiAfUm5h22g3zwoStTTmj9kDsZ91ncGElscXP7re8/oPPP38E0xOh6FvJgU5M9S/Trrp161Mjm+OXKuZ+yk0DqaGiPQgWuJN+NLHlhzUyHGNkfPCdNQ7qRM7b0EBvOOowVTybNgTT9y/PRsi6u6fUkaDAH54QMRYROQSY8KJ9T9hF5GoLPBjaqmxJ9UMzFGQpnGexfqA1ebGyww8E9idx80y8qtIesEgfebtfTXCbCVCxkLhCbmlS6Olrbh9n+xpuPfRoU1vANdrPHY/iieMVm9qgkrBvQxmze0tNzIsqw2MHRrgh/1eVm+aJuCcZEsDMncrcvifSQA95lVbZXbIvO0O9PzA2G6qVnuaNQn3c7BMJ6e9cjSaPsssOZPBU042s4isZOZU8BwnPjLkO9ytMkYwYfFtApC9EtjpVuMG5Hsw4HFn3WXzLm0RIefotMDSpZuHAybaV9WgMv2kgznzJEnpr4NXRcHchdrGatLV1FGXZtwBBTEQxuObLl0oaC669NRTrLFMUEbanoz28IGqXmkFwvL/tf7bzCaj79uEDervn+ffeYoVudLXP0tv/cWfq5lT/J4hAxjNxnTVpAsd69izB+7mLAamoH/V0tXN 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:(13230031)(376005)(82310400014)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2024 10:19:45.3762 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0441a003-9c00-4f7c-9a6e-08dc3e901c94 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: CH2PEPF0000009A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9337 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 Allow compilation of HWS meter code only on platforms that support HWS. Fixes: 24865366e495 ("net/mlx5: support flow meter action for HWS") Cc: stable@dpdk.org Signed-off-by: Gregory Etelson Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5_flow_meter.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c index c0578ce6e9..57de95b4b9 100644 --- a/drivers/net/mlx5/mlx5_flow_meter.c +++ b/drivers/net/mlx5/mlx5_flow_meter.c @@ -896,6 +896,7 @@ mlx5_flow_meter_profile_get(struct rte_eth_dev *dev, meter_profile_id); } +#if defined(HAVE_MLX5_HWS_SUPPORT) /** * Callback to add MTR profile with HWS. * @@ -981,6 +982,7 @@ mlx5_flow_meter_profile_hws_delete(struct rte_eth_dev *dev, memset(fmp, 0, sizeof(struct mlx5_flow_meter_profile)); return 0; } +#endif /** * Find policy by id. @@ -1123,6 +1125,7 @@ mlx5_flow_meter_policy_validate(struct rte_eth_dev *dev, return 0; } +#if defined(HAVE_MLX5_HWS_SUPPORT) /** * Callback to check MTR policy action validate for HWS * @@ -1159,6 +1162,7 @@ mlx5_flow_meter_policy_hws_validate(struct rte_eth_dev *dev, } return 0; } +#endif static int __mlx5_flow_meter_policy_delete(struct rte_eth_dev *dev, @@ -1485,6 +1489,7 @@ mlx5_flow_meter_policy_get(struct rte_eth_dev *dev, &policy_idx); } +#if defined(HAVE_MLX5_HWS_SUPPORT) /** * Callback to delete MTR policy for HWS. * @@ -1807,7 +1812,7 @@ mlx5_flow_meter_policy_hws_add(struct rte_eth_dev *dev, RTE_MTR_ERROR_TYPE_UNSPECIFIED, NULL, "Failed to create meter policy."); } - +#endif /** * Check meter validation. * @@ -2177,6 +2182,7 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id, NULL, "Failed to create devx meter."); } +#if defined(HAVE_MLX5_HWS_SUPPORT) /** * Create meter rules. * @@ -2260,6 +2266,7 @@ mlx5_flow_meter_hws_create(struct rte_eth_dev *dev, uint32_t meter_id, __atomic_fetch_add(&policy->ref_cnt, 1, __ATOMIC_RELAXED); return 0; } +#endif static int mlx5_flow_meter_params_flush(struct rte_eth_dev *dev, @@ -2744,6 +2751,7 @@ static const struct rte_mtr_ops mlx5_flow_mtr_ops = { .stats_read = mlx5_flow_meter_stats_read, }; +#if defined(HAVE_MLX5_HWS_SUPPORT) static const struct rte_mtr_ops mlx5_flow_mtr_hws_ops = { .capabilities_get = mlx5_flow_mtr_cap_get, .meter_profile_add = mlx5_flow_meter_profile_hws_add, @@ -2762,6 +2770,7 @@ static const struct rte_mtr_ops mlx5_flow_mtr_hws_ops = { .stats_update = NULL, .stats_read = NULL, }; +#endif /** * Get meter operations. @@ -2777,12 +2786,16 @@ static const struct rte_mtr_ops mlx5_flow_mtr_hws_ops = { int mlx5_flow_meter_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg) { +#if defined(HAVE_MLX5_HWS_SUPPORT) struct mlx5_priv *priv = dev->data->dev_private; if (priv->sh->config.dv_flow_en == 2) *(const struct rte_mtr_ops **)arg = &mlx5_flow_mtr_hws_ops; else *(const struct rte_mtr_ops **)arg = &mlx5_flow_mtr_ops; +#else + *(const struct rte_mtr_ops **)arg = &mlx5_flow_mtr_ops; +#endif return 0; } @@ -3161,7 +3174,6 @@ mlx5_flow_meter_flush(struct rte_eth_dev *dev, struct rte_mtr_error *error) struct mlx5_flow_meter_profile *fmp; struct mlx5_legacy_flow_meter *legacy_fm; struct mlx5_flow_meter_info *fm; - struct mlx5_flow_meter_policy *policy; struct mlx5_flow_meter_sub_policy *sub_policy; void *tmp; uint32_t i, mtr_idx, policy_idx; @@ -3229,15 +3241,20 @@ mlx5_flow_meter_flush(struct rte_eth_dev *dev, struct rte_mtr_error *error) mlx5_l3t_destroy(priv->policy_idx_tbl); priv->policy_idx_tbl = NULL; } +#if defined(HAVE_MLX5_HWS_SUPPORT) if (priv->mtr_policy_arr) { + struct mlx5_flow_meter_policy *policy; + for (i = 0; i < priv->mtr_config.nb_meter_policies; i++) { policy = mlx5_flow_meter_policy_find(dev, i, &policy_idx); - if (policy->initialized) + if (policy->initialized) { mlx5_flow_meter_policy_hws_delete(dev, i, error); + } } } +#endif if (priv->mtr_profile_tbl) { MLX5_L3T_FOREACH(priv->mtr_profile_tbl, i, entry) { fmp = entry; @@ -3251,14 +3268,17 @@ mlx5_flow_meter_flush(struct rte_eth_dev *dev, struct rte_mtr_error *error) mlx5_l3t_destroy(priv->mtr_profile_tbl); priv->mtr_profile_tbl = NULL; } +#if defined(HAVE_MLX5_HWS_SUPPORT) if (priv->mtr_profile_arr) { for (i = 0; i < priv->mtr_config.nb_meter_profiles; i++) { fmp = mlx5_flow_meter_profile_find(priv, i); - if (fmp->initialized) + if (fmp->initialized) { mlx5_flow_meter_profile_hws_delete(dev, i, error); + } } } +#endif /* Delete default policy table. */ mlx5_flow_destroy_def_policy(dev); if (priv->sh->refcnt == 1) -- 2.39.2