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 58E1443238; Sun, 29 Oct 2023 17:33:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 51BEE40E25; Sun, 29 Oct 2023 17:32:58 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2079.outbound.protection.outlook.com [40.107.93.79]) by mails.dpdk.org (Postfix) with ESMTP id 76F1140A7D for ; Sun, 29 Oct 2023 17:32:56 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DadMTaOkuxInQai6cQS92eAzJzBaMo6jfGXYVIqK3LYlFWgNvfupAqc7aXF0hGPIfCg2YaGR2+7f5Bps6EfZujkWs3l1im1V/2Wfz1zqLQ9SXWHuFV5+HrRuIrou7UJqgJYS/OheV0lAzEt2znZSlsnmrzFlt+2UAICKwlz9NSVtSvDLmAZYtol/F8vO9faQ113P9LrXlxbJ6gM4aoZXxyiCapJs8ChIK0APxVb1dkBxLAo05CmJBhzfYwRWtAVx8pQw7sL/ApeqE8E+ctsZaD688M7nOFLfaobltCh5ldYHOcUbvPWiIBk8ML/0SCPvY+A3qEuafaPqM00EOqsOKQ== 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=kA+8BGFW+sYYfFi4qsd5vsQ1KKyL3DH5BApj2ai3VFg=; b=aBFjnlnWhbiE4LpST4k1GYR/KJFvH5uH14c6PXX5pHGWAP7FcHo7vjeyp1UqBMrf/qpvAc1R53l5XnnxxnbHH2mGl0mpy7NGK34zDZkajXGKgSAV6HuNF+y11B4uQ+++5qZ+ONtkMf0pUbVEC0BcXSPedJnaPiVZFZ81UhCG57GiPslZqmgcjRRSI87GF62AUX04U8ibATVhdmbTlhV071tI4NHxi5Ou+6eXWtjEJCpvpT5JJDmYtb3VPG8oTLi4lW/G4co1FCdJTDFeZkc7UdF70XFRrtan4pJGiX4VqKOuA+IKgJAhxg1UIY0S2ecUXEBnNJ+g7XAlDppU/xT1+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=kA+8BGFW+sYYfFi4qsd5vsQ1KKyL3DH5BApj2ai3VFg=; b=CP59ANpOb2qKBGchrGc3sp7DENswM1FIU/6GTKXx1+9DAOo0J6k9HoXTmOY09Ysakb2+g1p7O3PyvQNMRWRBRS9ZvfAqOoCsxCrtEY688ktkllZHpX3y/d4bSIlJzcuA+J/XzReXCu8S91P5gNjEEpmypM7lWEfba19+5oxsH37unR6HweUzYr9aZQqpibLJSmOfmIKjri0qf1dgk0pMyDITLHP+bD18kEPpQDvVZJ8ydeSdvKOLKK4LZFn9a129o9sAaZ7+10ILmGinVkcBTGbEEn5uNldViCAPIWts6fiTOnrGbTDU1b9IThOthzHj2dZxNKJsASJPKUvnV3o7jQ== Received: from BL1PR13CA0337.namprd13.prod.outlook.com (2603:10b6:208:2c6::12) by IA1PR12MB8466.namprd12.prod.outlook.com (2603:10b6:208:44b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.24; Sun, 29 Oct 2023 16:32:53 +0000 Received: from BL02EPF0001A0FB.namprd03.prod.outlook.com (2603:10b6:208:2c6:cafe::f0) by BL1PR13CA0337.outlook.office365.com (2603:10b6:208:2c6::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.14 via Frontend Transport; Sun, 29 Oct 2023 16:32:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF0001A0FB.mail.protection.outlook.com (10.167.242.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.15 via Frontend Transport; Sun, 29 Oct 2023 16:32:53 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 29 Oct 2023 09:32:35 -0700 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.41; Sun, 29 Oct 2023 09:32:32 -0700 From: Gregory Etelson To: CC: , , , "Ori Kam" , Matan Azrad , Viacheslav Ovsiienko , Suanming Mou Subject: [PATCH 06/30] net/mlx5: merge REG_C aliases Date: Sun, 29 Oct 2023 18:31:38 +0200 Message-ID: <20231029163202.216450-6-getelson@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231029163202.216450-1-getelson@nvidia.com> References: <20231029163202.216450-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: 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: BL02EPF0001A0FB:EE_|IA1PR12MB8466:EE_ X-MS-Office365-Filtering-Correlation-Id: 71311350-c685-4017-94d1-08dbd89cb327 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aV1FL1jDNgUIfICvp96Je7h2wBE6i4SJINflwHkoaVINKUcERfIZl6TezTBlt+yJ02SDC5a6t18QQnC639EKkBG5lnN9qee3EwKAFNcWvVs0NgZyzBK3zkEL06mhknat9ogy4QvMK0BZqdJKtbu8oKgmcFIsNKkm6n2w5umsLvaC/5mz5evdSkgimLCa4UCoEMZFG2xYbibqCM7lML0y1T5hOCI2bJLNO5d75fAUuOAD+sNBtwWBBjuEdndGeILhIaquXhnIhOsxyzOv2NxBNvDsssFmRICZKThgz+Al0cnOOHjcBKibFbICq6IGOTf1lDGPUBzrFdI7qkBuVaGcQBGXTbqKjzNYnhEHTy2KaseQ0Sl6kdFcYrNqxYYqBoO2GWO7OXza7+8gJfY7cgWretcQxQnsuuZQyS6W93TEYJewQtXdPQljtXwa8MRcbXRyLwAFerJfCyauaW43dZkrBawjfe+/0oH8gitLcLLcHnBwUFKG/U0NOO/uMrg0CGumR/xZ70Ujpxup1v1IBs40ij33V8xYLuKqlIueTOMWGlcUeuos/mccg5FzobecolV+QBlh1akxab4a6eJ4zvVM2FtaDIDIq2YPj75O0lBtWg52HRMnzfb6lNnr7bcZ27VILelbpGe2VQ0hDYpXxosLYYxt2DoHIPI1nfmQ13IEmcmBa3gD9JGJUlYXFa7VWXXO1QpYxKHeIhH0oUxXaJTMFGjSqa8TmsfWBQihAIzrEpvG8PunaorTvvbgkgHSwYEP X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(346002)(39860400002)(136003)(396003)(376002)(230922051799003)(82310400011)(1800799009)(186009)(451199024)(64100799003)(46966006)(40470700004)(36840700001)(40460700003)(54906003)(478600001)(7696005)(83380400001)(107886003)(2616005)(6916009)(5660300002)(41300700001)(6286002)(26005)(70586007)(16526019)(426003)(2906002)(1076003)(70206006)(316002)(8936002)(4326008)(8676002)(36756003)(86362001)(36860700001)(356005)(82740400003)(47076005)(7636003)(336012)(40480700001)(55016003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2023 16:32:53.3239 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71311350-c685-4017-94d1-08dbd89cb327 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A0FB.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8466 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 Merge `mtr_color_reg` and `mlx5_flow_hw_aso_tag` into `aso_reg` Signed-off-by: Gregory Etelson Acked-by: Ori Kam --- drivers/net/mlx5/linux/mlx5_os.c | 10 +++++----- drivers/net/mlx5/mlx5.h | 3 +-- drivers/net/mlx5/mlx5_flow.c | 16 ++++++++-------- drivers/net/mlx5/mlx5_flow.h | 3 +-- drivers/net/mlx5/mlx5_flow_dv.c | 7 ++++--- drivers/net/mlx5/mlx5_flow_hw.c | 3 +-- drivers/net/mlx5/mlx5_flow_meter.c | 4 ++-- 7 files changed, 22 insertions(+), 24 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 96d32d11d8..ed273e14cf 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1328,14 +1328,14 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, * Prefer REG_C_3 if it is available. */ if (reg_c_mask & (1 << (REG_C_3 - REG_C_0))) - sh->registers.mtr_color_reg = REG_C_3; + sh->registers.aso_reg = REG_C_3; else - sh->registers.mtr_color_reg = + sh->registers.aso_reg = ffs(reg_c_mask) - 1 + REG_C_0; priv->mtr_en = 1; priv->mtr_reg_share = hca_attr->qos.flow_meter; DRV_LOG(DEBUG, "The REG_C meter uses is %d", - sh->registers.mtr_color_reg); + sh->registers.aso_reg); } } if (hca_attr->qos.sup && hca_attr->qos.flow_meter_aso_sup) { @@ -1360,7 +1360,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, sh->tunnel_header_2_3 = 1; #endif #ifdef HAVE_MLX5_DR_CREATE_ACTION_ASO - if (hca_attr->flow_hit_aso && sh->registers.mtr_color_reg == REG_C_3) { + if (hca_attr->flow_hit_aso && sh->registers.aso_reg == REG_C_3) { sh->flow_hit_aso_en = 1; err = mlx5_flow_aso_age_mng_init(sh); if (err) { @@ -1374,7 +1374,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, defined (HAVE_MLX5_DR_ACTION_ASO_CT) /* HWS create CT ASO SQ based on HWS configure queue number. */ if (sh->config.dv_flow_en != 2 && - hca_attr->ct_offload && sh->registers.mtr_color_reg == REG_C_3) { + hca_attr->ct_offload && sh->registers.aso_reg == REG_C_3) { err = mlx5_flow_aso_ct_mng_init(sh); if (err) { err = -err; diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 01cb21fc93..99a2ad88ed 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1376,8 +1376,7 @@ struct mlx5_hws_cnt_svc_mng { #define MLX5_FLOW_HW_TAGS_MAX 8 struct mlx5_dev_registers { - enum modify_reg mlx5_flow_hw_aso_tag; - enum modify_reg mtr_color_reg; /* Meter color match REG_C. */ + enum modify_reg aso_reg; enum modify_reg hw_avl_tags[MLX5_FLOW_HW_TAGS_MAX]; }; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 3ddc3ba772..ad9a2f2273 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1364,23 +1364,23 @@ mlx5_flow_get_reg_id(struct rte_eth_dev *dev, * should use the meter color register for match. */ if (priv->mtr_reg_share) - return reg->mtr_color_reg; + return reg->aso_reg; else - return reg->mtr_color_reg != REG_C_2 ? REG_C_2 : + return reg->aso_reg != REG_C_2 ? REG_C_2 : REG_C_3; case MLX5_MTR_COLOR: case MLX5_ASO_FLOW_HIT: case MLX5_ASO_CONNTRACK: case MLX5_SAMPLE_ID: /* All features use the same REG_C. */ - MLX5_ASSERT(reg->mtr_color_reg != REG_NON); - return reg->mtr_color_reg; + MLX5_ASSERT(reg->aso_reg != REG_NON); + return reg->aso_reg; case MLX5_COPY_MARK: /* * Metadata COPY_MARK register using is in meter suffix sub * flow while with meter. It's safe to share the same register. */ - return reg->mtr_color_reg != REG_C_2 ? REG_C_2 : REG_C_3; + return reg->aso_reg != REG_C_2 ? REG_C_2 : REG_C_3; case MLX5_APP_TAG: /* * If meter is enable, it will engage the register for color @@ -1389,7 +1389,7 @@ mlx5_flow_get_reg_id(struct rte_eth_dev *dev, * match. * If meter is disable, free to use all available registers. */ - start_reg = reg->mtr_color_reg != REG_C_2 ? REG_C_2 : + start_reg = reg->aso_reg != REG_C_2 ? REG_C_2 : (priv->mtr_reg_share ? REG_C_3 : REG_C_4); skip_mtr_reg = !!(priv->mtr_en && start_reg == REG_C_2); if (id > (uint32_t)(REG_C_7 - start_reg)) @@ -1407,7 +1407,7 @@ mlx5_flow_get_reg_id(struct rte_eth_dev *dev, * color register. */ if (skip_mtr_reg && priv->sh->flow_mreg_c - [id + start_reg - REG_C_0] >= reg->mtr_color_reg) { + [id + start_reg - REG_C_0] >= reg->aso_reg) { if (id >= (uint32_t)(REG_C_7 - start_reg)) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -6480,7 +6480,7 @@ flow_sample_split_prep(struct rte_eth_dev *dev, * metadata regC is REG_NON, back to use application tag * index 0. */ - if (unlikely(priv->sh->registers.mtr_color_reg == REG_NON)) + if (unlikely(priv->sh->registers.aso_reg == REG_NON)) ret = mlx5_flow_get_reg_id(dev, MLX5_APP_TAG, 0, error); else ret = mlx5_flow_get_reg_id(dev, MLX5_SAMPLE_ID, 0, error); diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 011db1fb75..250d9eb1fc 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1663,7 +1663,6 @@ flow_hw_get_wire_port(struct ibv_context *ibctx) * Convert metadata or tag to the actual register. * META: Can only be used to match in the FDB in this stage, fixed C_1. * TAG: C_x expect meter color reg and the reserved ones. - * TODO: Per port / device, FDB or NIC for Meta matching. */ static __rte_always_inline int flow_hw_get_reg_id(struct rte_eth_dev *dev, @@ -1692,7 +1691,7 @@ flow_hw_get_reg_id(struct rte_eth_dev *dev, return REG_A; case RTE_FLOW_ITEM_TYPE_CONNTRACK: case RTE_FLOW_ITEM_TYPE_METER_COLOR: - return reg->mlx5_flow_hw_aso_tag; + return reg->aso_reg; case RTE_FLOW_ITEM_TYPE_TAG: if (id == MLX5_LINEAR_HASH_TAG_INDEX) return REG_C_3; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 024023abb5..9268a07c84 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -2026,7 +2026,8 @@ mlx5_flow_field_id_to_modify_info if (priv->sh->config.dv_flow_en == 2) reg = flow_hw_get_reg_id - (dev, RTE_FLOW_ITEM_TYPE_METER_COLOR, 0); + (dev, + RTE_FLOW_ITEM_TYPE_METER_COLOR, 0); else reg = mlx5_flow_get_reg_id(dev, MLX5_MTR_COLOR, 0, error); @@ -3923,7 +3924,7 @@ flow_dv_validate_item_meter_color(struct rte_eth_dev *dev, }; int ret; - if (priv->sh->registers.mtr_color_reg == REG_NON) + if (priv->sh->registers.aso_reg == REG_NON) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "meter color register" @@ -8375,7 +8376,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return ret; if ((action_flags & MLX5_FLOW_ACTION_SET_TAG) && tag_id == 0 && - priv->sh->registers.mtr_color_reg == REG_NON) + priv->sh->registers.aso_reg == REG_NON) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "sample after tag action causes metadata tag index 0 corruption"); diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 22cf412035..c48c2eec39 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -8469,7 +8469,7 @@ void flow_hw_init_tags_set(struct rte_eth_dev *dev) * The CAPA is global for common device but only used in net. * It is shared per eswitch domain. */ - unset |= 1 << mlx5_regc_index(reg->mtr_color_reg); + unset |= 1 << mlx5_regc_index(reg->aso_reg); unset |= 1 << mlx5_regc_index(REG_C_6); if (sh->config.dv_esw_en) unset |= 1 << mlx5_regc_index(REG_C_0); @@ -8480,7 +8480,6 @@ void flow_hw_init_tags_set(struct rte_eth_dev *dev) if (!!((1 << i) & masks)) reg->hw_avl_tags[j++] = mlx5_regc_value(i); } - reg->mlx5_flow_hw_aso_tag = reg->mtr_color_reg; } static int diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c index eb88dfe39c..7cbf772ea4 100644 --- a/drivers/net/mlx5/mlx5_flow_meter.c +++ b/drivers/net/mlx5/mlx5_flow_meter.c @@ -67,7 +67,7 @@ mlx5_flow_meter_action_create(struct mlx5_priv *priv, val = (ebs_eir >> ASO_DSEG_EBS_MAN_OFFSET) & ASO_DSEG_MAN_MASK; MLX5_SET(flow_meter_parameters, fmp, ebs_mantissa, val); mtr_init.next_table = def_policy->sub_policy.tbl_rsc->obj; - mtr_init.reg_c_index = priv->sh->registers.mtr_color_reg - REG_C_0; + mtr_init.reg_c_index = priv->sh->registers.aso_reg - REG_C_0; mtr_init.flow_meter_parameter = fmp; mtr_init.flow_meter_parameter_sz = MLX5_ST_SZ_BYTES(flow_meter_parameters); @@ -1618,7 +1618,7 @@ mlx5_flow_meter_action_modify(struct mlx5_priv *priv, return ret; } else { /* Fill command parameters. */ - mod_attr.reg_c_index = sh->registers.mtr_color_reg - REG_C_0; + mod_attr.reg_c_index = sh->registers.aso_reg - REG_C_0; mod_attr.flow_meter_parameter = in; mod_attr.flow_meter_parameter_sz = MLX5_ST_SZ_BYTES(flow_meter_parameters); -- 2.39.2