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 516AEA00C3; Fri, 13 May 2022 09:33:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E724427F1; Fri, 13 May 2022 09:33:34 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2064.outbound.protection.outlook.com [40.107.94.64]) by mails.dpdk.org (Postfix) with ESMTP id E836442832 for ; Fri, 13 May 2022 09:33:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ue14VoyPURECe2EL9kPR5+WELpOGamVCes/JpWCAsQRl0XXwykth32CnpANsHvaJKYnHCIfwBz/vLCRsHGRGFK3j4Y2x1sLn7EIk+vwGd/78Lj59/MqFnnCUTfhN0BseWj/S3r7EnqlOSvfMOqMeJF+I3dbky5nN6GD/BbFeWjI/JYVLqTk/obllDg6foJgaYoumLuin9LZbTgxtAB+77XSf7HEfxUMCPKGEE52wcAg9RxplxzEUjnvOQIxXB1OfH6DZ0YYINurv18V6VQX9ygUIb2nl7mBWaxxIeyfVKvGnBEHSBf8WczLpbiE93Zi+ZJzknhYzTYV7N7wq2nDJ3w== 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=31eNjWUrqh5AQNl4Hy8ZERV2JfbfG8ZZuLn6zHFHhQ4=; b=BCW6I8AHF9HyLIkYK/YQW0MUJ3nZE+SAe953NYV1mkBCDjrFpwrRFRav0J+ZIJqNjNFskmXILPigPp5XBE9b4brNZocwi/NaUpcjSYLNsAU0BQQqBHJtcevao75ZOvR3Z4TKoKevqVXVzH2E6rwFggelJE9JXWHxajx85oY1sapkPNH0f9cbOpUmuVgyDoxyefXCvTydpPw+4c3g2Aec4/eeyuNaxY6vtdlip5CN3Sx1vOoJUi6MC4RxtYYoieyIoTv69GvXvpTVpGgx6aPdCDCTn5vX70IW8bjEXEzqYnIH8hfCq7o3wypGbUda1h/gzDYe/SmucuwxhYy4q7bq/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) 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 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=31eNjWUrqh5AQNl4Hy8ZERV2JfbfG8ZZuLn6zHFHhQ4=; b=Icl8I0TixzHLowasXO8l6dGnDK28TjBors/uZD+EZDDdLpBnymOs8fRz33sgPxzab2lmLJ7B6nH/RkASFouSxTkj0dx1cW8iUa8XMMlPGq0gbdTr3F4bCPWNNO2b/TAztBPTZiyPo/d9meUW5SS6I2VlKoPDt4AYpTfawyN9Q7CiZ9JANoWl+mKZFKhMQlKijpqst432k+eOEQ8qQ5k1gWqIv+VxKWDzyBextwfN+jEwqxWaM7bR7u38BAia3Ts2WT/fE49ef+R+e24qWA8VCpsh4y3REgNBTtnk+NM1U/iLh0dFgldWC9e6gpD/ObQNjn7grURFW0SZG7Idwjodvw== Received: from BN9PR03CA0627.namprd03.prod.outlook.com (2603:10b6:408:106::32) by BN8PR12MB2866.namprd12.prod.outlook.com (2603:10b6:408:68::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.23; Fri, 13 May 2022 07:33:29 +0000 Received: from BN8NAM11FT041.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::43) by BN9PR03CA0627.outlook.office365.com (2603:10b6:408:106::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.13 via Frontend Transport; Fri, 13 May 2022 07:33:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT041.mail.protection.outlook.com (10.13.177.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5250.13 via Frontend Transport; Fri, 13 May 2022 07:33:29 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Fri, 13 May 2022 07:33:28 +0000 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.986.22; Fri, 13 May 2022 00:33:26 -0700 From: Shun Hao To: , , CC: , Subject: [PATCH v1 1/4] net/mlx5: support previous meter color aware Date: Fri, 13 May 2022 10:33:05 +0300 Message-ID: <20220513073308.10762-2-shunh@nvidia.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20220513073308.10762-1-shunh@nvidia.com> References: <20220513073308.10762-1-shunh@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.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-Office365-Filtering-Correlation-Id: 4708a241-f642-4baf-0b5f-08da34b2e032 X-MS-TrafficTypeDiagnostic: BN8PR12MB2866: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: se3q0zXXmG0eQpYEYy1scWtmuvceZI6tFa8j+o2/gr2Ln7zCAijYB9xUDnOaQF6nIJHo7poV47KqiALRcT7Zd39Tpp0ai6tqmwi7sVA3bC7p5/4mRiGeHbdX/B/4HYavbSTiCCQlYeQC5wWd5F3pTFrkxK3lEOAT/S9bf4cymg6fMF7QxTjOleCvl3kC7kj6OYkc4nBFOEdRYcdMdzx1zwKuojssmPjAVAWa+x+9IiKgYs/l5e018Ja2Iw4hK3ig0dwPpcfSB9m7+Pw7nCEzD2EbWfgLYXltcvvkK9s02/wRG3deH0rwhzyj+TaylRZd5vMLSGwQ6Qe7Tba7bfkKJWkJnNsuNumguMCEW5Obcy7LlHx3aOtk+7N7egDLeF/YfJLt81R1wo7SJlJLkK8iAR9QMUY/RK3N3etx0oyEsr2XSvDyuD5E/7uFo/1kA+1MPPJkwothjgDnUrirVnm2lez1FaxAuesbsbq8YQz2fbYs/gj7+qZDT1E+ndpReZhnOVlSD45kSBpivas95k+ZlXfez5XcOyr5SRhwAr7vCFZ0Q3ZIpJzqZWiXO7cuwiLbK/G7i5EOSEGujq97UUrFWus+eskoVtVmhQ5BXuKoB50+P0/sIYHnOxVBFyTy2rJbpwScZJiP63UmkSCWOqu7ik6erMEHppaTmTqJe6gYv4fPiglz+fAonQCeAxWuXL3/3JyfMT2fir0pY0CgyLqxy5yfjlVTtRsoqPeKr1JlTX8= X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(7696005)(16526019)(5660300002)(2906002)(6666004)(82310400005)(426003)(336012)(47076005)(1076003)(83380400001)(186003)(107886003)(36860700001)(55016003)(316002)(6286002)(356005)(81166007)(26005)(8676002)(70586007)(36756003)(70206006)(4326008)(40460700003)(54906003)(110136005)(8936002)(508600001)(6636002)(2616005)(86362001)(36900700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2022 07:33:29.4983 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4708a241-f642-4baf-0b5f-08da34b2e032 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT041.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2866 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 This patch adds the support for previous color aware for meter. Start_color setting is set to UNDEFINED when creating meter object that is color aware. Signed-off-by: Shun Hao Acked-by: Matan Azard --- drivers/net/mlx5/mlx5.h | 2 ++ drivers/net/mlx5/mlx5_flow_aso.c | 19 +++++++++++-------- drivers/net/mlx5/mlx5_flow_meter.c | 3 ++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 23a28f6e52..c92ce6b527 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -859,6 +859,8 @@ struct mlx5_flow_meter_info { uint32_t transfer:1; uint32_t def_policy:1; /* Meter points to default policy. */ + uint32_t color_aware:1; + /* Meter is color aware mode. */ void *drop_rule[MLX5_MTR_DOMAIN_MAX]; /* Meter drop rule in drop table. */ uint32_t drop_cnt; diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index eb7fc43da3..4129e3a9e0 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -652,6 +652,7 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_dev_ctx_shared *sh, uint16_t res; uint32_t dseg_idx = 0; struct mlx5_aso_mtr_pool *pool = NULL; + uint32_t param_le; rte_spinlock_lock(&sq->sqsl); res = size - (uint16_t)(sq->head - sq->tail); @@ -688,15 +689,14 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_dev_ctx_shared *sh, wqe->aso_dseg.mtrs[dseg_idx].ebs_eir = 0; } fmp = fm->profile; - if (fmp->profile.packet_mode) - wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm = - RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) | - (MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET) | - (MLX5_METER_MODE_PKT << ASO_DSEG_MTR_MODE)); + param_le = (1 << ASO_DSEG_VALID_OFFSET); + if (fm->color_aware) + param_le |= (MLX5_FLOW_COLOR_UNDEFINED << ASO_DSEG_SC_OFFSET); else - wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm = - RTE_BE32((1 << ASO_DSEG_VALID_OFFSET) | - (MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET)); + param_le |= (MLX5_FLOW_COLOR_GREEN << ASO_DSEG_SC_OFFSET); + if (fmp->profile.packet_mode) + param_le |= (MLX5_METER_MODE_PKT << ASO_DSEG_MTR_MODE); + wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm = RTE_BE32(param_le); switch (fmp->profile.alg) { case RTE_MTR_SRTCM_RFC2697: /* Only needed for RFC2697. */ @@ -709,6 +709,9 @@ mlx5_aso_mtr_sq_enqueue_single(struct mlx5_dev_ctx_shared *sh, RTE_BE32(1 << ASO_DSEG_BBOG_OFFSET); break; case RTE_MTR_TRTCM_RFC4115: + wqe->aso_dseg.mtrs[dseg_idx].v_bo_sc_bbog_mm |= + RTE_BE32(1 << ASO_DSEG_BO_OFFSET); + break; default: break; } diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c index a3d1f2c08d..b52de70afa 100644 --- a/drivers/net/mlx5/mlx5_flow_meter.c +++ b/drivers/net/mlx5/mlx5_flow_meter.c @@ -1005,7 +1005,7 @@ mlx5_flow_meter_validate(struct mlx5_priv *priv, uint32_t meter_id, RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL, "Meter object params null."); /* Previous meter color is not supported. */ - if (params->use_prev_mtr_color) + if (params->use_prev_mtr_color && !priv->sh->meter_aso_en) return -rte_mtr_error_set(error, ENOTSUP, RTE_MTR_ERROR_TYPE_MTR_PARAMS, NULL, @@ -1293,6 +1293,7 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id, fm->active_state = 1; /* Config meter starts as active. */ fm->is_enable = params->meter_enable; fm->shared = !!shared; + fm->color_aware = !!params->use_prev_mtr_color; __atomic_add_fetch(&fm->profile->ref_cnt, 1, __ATOMIC_RELAXED); if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) { fm->def_policy = 1; -- 2.20.0