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 5F80243238; Sun, 29 Oct 2023 17:32:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C5B8640A80; Sun, 29 Oct 2023 17:32:50 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2074.outbound.protection.outlook.com [40.107.94.74]) by mails.dpdk.org (Postfix) with ESMTP id 9819240A73 for ; Sun, 29 Oct 2023 17:32:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IufMKlL7gx2gYB/nHhFy5GK0iDczA8BzhXJLZcs8r+lYD9PTATpSJCJVkveJEbYmyCjUCqSfM379zch7TOG3slvY/GBJkpJNyzKsuCndLBtLwySp5gng5XV84GSoqWfqqxIsxXFGOwPT8JQrZ9ryzX9/amCNIDJTm72IhK5XCctPRQpykhpO6bQJNgGsOdRWJe0eFxIOvfr/OLogRsi8L/SZJXq+DRCxY/XPH2QEyywKGQr71Fp7jRxG5K+IkjgigZm/Rw+efe1ishb/CWDzL5Bp9q1tEootN1ksDbVsj6sEhBL8uPfE7G1r+I1uNYIb3S85HdnIwSc4Dw6iRlI8GA== 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=dhZh1UyF86FmkzHWtO5nldC3uVLeJbYN3U2T2xBiMZc=; b=I86Ue89DxECZXDr92aJiUA5SIDhcagrx3wOmsPqc4piTC+bOyBmHOZEnTOnvHBw+aM+N36pu70jMVcj6nxFXpz65vwUP8WFSKslD5rtAs2+BxrYB2iBpVK7QYMl+dPxiP5WGfIpE1NmQ1j2ve50GjsT8P1C0DRdXNWx6jjY66i4ItngChO8sqFdKAF8xqYmlQFiUC5xhFEl1r5Xfbl30S3k/J9ppcKezzKnvct52VpZ6yzEquQ5IWQiqeHphOwaJZb7gH0udF/izJmuu7Kul5Eqd+LA6/Osuu4tiT38S3HlqW4cvbN5G1cP6EK2lemEbwoHCq76mByqo/67njc+oig== 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=dhZh1UyF86FmkzHWtO5nldC3uVLeJbYN3U2T2xBiMZc=; b=QZLouGM1aq1SM8DIcIT2NmV6R92CHFrwNmU1z+StT721emGANSj1Qbq/RwH01L+lHKUukfRcBpwfn5vO2WJU4OGW7RAVQtenQGggpeuhd+aX/YIz+stU2lG6PDLibp+0CSXPDUQT7ZLQbfQuJoWFwPDYC/nfVX5EK2jXs+OM2ODmuc5XVeGpLFGTbWuu1J57pdDJNSOMWLaXE1pJ7U4IIOvgVg8iLLwGiXo4FEHEcw9Yp/FERGPJjCMvPw7XP4QxaBne5vY/QrG2UK8i7iM0e8CqKi/9J0xgIqR4wMNyxrepjYAjG/aUWb4rpVmYCLX/QavhfPYLP+g5HhZBCpTEPw== Received: from MN2PR16CA0019.namprd16.prod.outlook.com (2603:10b6:208:134::32) by DS0PR12MB9276.namprd12.prod.outlook.com (2603:10b6:8:1a0::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.26; Sun, 29 Oct 2023 16:32:45 +0000 Received: from BL02EPF0001A0FC.namprd03.prod.outlook.com (2603:10b6:208:134:cafe::39) by MN2PR16CA0019.outlook.office365.com (2603:10b6:208:134::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.34 via Frontend Transport; Sun, 29 Oct 2023 16:32:45 +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 BL02EPF0001A0FC.mail.protection.outlook.com (10.167.242.103) 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:45 +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:29 -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:26 -0700 From: Gregory Etelson To: CC: , , , "Ori Kam" , Matan Azrad , Viacheslav Ovsiienko , Suanming Mou Subject: [PATCH 04/30] net/mlx5: add rte_device parameter to locate HWS registers Date: Sun, 29 Oct 2023 18:31:36 +0200 Message-ID: <20231029163202.216450-4-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: BL02EPF0001A0FC:EE_|DS0PR12MB9276:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b058bda-8e6e-4fd0-e201-08dbd89cae8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w/t3140q4E//Dn9zK2a3cQxxq2vimUehZ/HcFIGhZUGWP6U9C2XGZsGulwVUpCqQKTFimBP9PtC/jX/fzMTobBZFCFbSqIVrEA6UjsN7rffkgZHvIU6Sj1W8eZOX2Z/Y1n2k0MpkcU+XTcq3PyYDzDs6+B6dcr+xby4ceShnwfnBAXEzh1+MhJAF/qv7XReMOySlleQU0mlkX/NASD2p8plLGwuHNgaTVrXEluVdfEkG+QCsoWY6gcIXZgHZa3NTvnfIRS0pZLfwr7GbpEwgz6NIOM1XCkaP7GZEMPQ4fACzJKF3577F3MlG4hhhiuxY2vMH1Z+YYeAAwz5dJwlS9H7JuEbomDqdGhLU1M8UPHQ4+uXrb+s7gubLkh5wW+R5YZbtQFgtTcWPb0gIraYpq2OkIUskr5UmULCTBfS6YU8Hw/AyCGCAxJqfoi1m4soZ2q1/Ztmubzqk5QcBHiga7WDMuywbYauwKIG017ds1VE7pyXJtRk9V9IgytrNopjGAr1JG7MOLlFHMkcMJOADj7wTV7ySnZH7YGX3nnRQT6GZsHKrUzn95U5ovfMz9w/hlZAgQEwMF4K7/++oZLWxf8HvBf48Qpl5fV5kbgkwIPzT/mxZRAdQfdSnNc7mErlGFw8V7Mrg9gtEmW9Z7Yi223Myz7z2ebxPEfiQo7LMwOPRRy6ToMS8MkcPlACzd/irWrijUgz4U+OJDTfhBC/l/tdYzS9rnNH0Yp9lc3ezAzaiRGOfntk4mr6dJq7CXhwA 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)(136003)(396003)(39860400002)(376002)(346002)(230922051799003)(451199024)(186009)(64100799003)(82310400011)(1800799009)(36840700001)(46966006)(40470700004)(40480700001)(40460700003)(55016003)(478600001)(70586007)(70206006)(7696005)(6666004)(83380400001)(36860700001)(36756003)(47076005)(7636003)(82740400003)(356005)(1076003)(107886003)(2616005)(2906002)(41300700001)(26005)(426003)(16526019)(6286002)(336012)(86362001)(4326008)(8936002)(8676002)(316002)(6916009)(54906003)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2023 16:32:45.6345 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b058bda-8e6e-4fd0-e201-08dbd89cae8f 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: BL02EPF0001A0FC.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB9276 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 1. Add rte_eth_dev parameter to the `flow_hw_get_reg_id()` 2. Add mlx5_flow_hw_get_reg_id() Signed-off-by: Gregory Etelson Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow.c | 2 +- drivers/net/mlx5/mlx5_flow.h | 13 +++++++++++-- drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++------ drivers/net/mlx5/mlx5_flow_hw.c | 7 +++---- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index a500afd4f7..45a67607ed 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1718,7 +1718,7 @@ flow_drv_rxq_flags_set(struct rte_eth_dev *dev, } } -static void +void flow_rxq_mark_flag_set(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 92dfd9a3a4..9344b5178a 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1678,8 +1678,10 @@ void flow_hw_clear_flow_metadata_config(void); * TODO: Per port / device, FDB or NIC for Meta matching. */ static __rte_always_inline int -flow_hw_get_reg_id(enum rte_flow_item_type type, uint32_t id) +flow_hw_get_reg_id(struct rte_eth_dev *dev, + enum rte_flow_item_type type, uint32_t id) { + RTE_SET_USED(dev); switch (type) { case RTE_FLOW_ITEM_TYPE_META: #ifdef HAVE_MLX5_HWS_SUPPORT @@ -1723,7 +1725,8 @@ flow_hw_get_reg_id_from_ctx(void *dr_ctx, priv = rte_eth_devices[port].data->dev_private; if (priv->dr_ctx == dr_ctx) - return flow_hw_get_reg_id(type, id); + return flow_hw_get_reg_id(&rte_eth_devices[port], + type, id); } #else RTE_SET_USED(dr_ctx); @@ -2874,6 +2877,12 @@ flow_hw_get_srh_flex_parser_byte_off_from_ctx(void *dr_ctx __rte_unused) } void mlx5_indirect_list_handles_release(struct rte_eth_dev *dev); +void +flow_rxq_mark_flag_set(struct rte_eth_dev *dev); +int +mlx5_flow_hw_get_reg_id(struct mlx5dr_context *ctx, + enum rte_flow_item_type type, uint32_t id); + #ifdef HAVE_MLX5_HWS_SUPPORT struct mlx5_mirror; void diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 3dc2fe5c71..05a374493d 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1919,8 +1919,8 @@ mlx5_flow_field_id_to_modify_info off_be = (tag_index == MLX5_LINEAR_HASH_TAG_INDEX) ? 16 - (data->offset + width) + 16 : data->offset; if (priv->sh->config.dv_flow_en == 2) - reg = flow_hw_get_reg_id(RTE_FLOW_ITEM_TYPE_TAG, - tag_index); + reg = flow_hw_get_reg_id(dev, RTE_FLOW_ITEM_TYPE_TAG, + data->level); else reg = mlx5_flow_get_reg_id(dev, MLX5_APP_TAG, tag_index, error); @@ -2025,7 +2025,7 @@ mlx5_flow_field_id_to_modify_info if (priv->sh->config.dv_flow_en == 2) reg = flow_hw_get_reg_id - (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); @@ -10256,7 +10256,7 @@ flow_dv_translate_item_meta(struct rte_eth_dev *dev, if (!!(key_type & MLX5_SET_MATCHER_SW)) reg = flow_dv_get_metadata_reg(dev, attr, NULL); else - reg = flow_hw_get_reg_id(RTE_FLOW_ITEM_TYPE_META, 0); + reg = flow_hw_get_reg_id(dev, RTE_FLOW_ITEM_TYPE_META, 0); if (reg < 0) return; MLX5_ASSERT(reg != REG_NON); @@ -10359,7 +10359,7 @@ flow_dv_translate_item_tag(struct rte_eth_dev *dev, void *key, if (!!(key_type & MLX5_SET_MATCHER_SW)) reg = mlx5_flow_get_reg_id(dev, MLX5_APP_TAG, index, NULL); else - reg = flow_hw_get_reg_id(RTE_FLOW_ITEM_TYPE_TAG, index); + reg = flow_hw_get_reg_id(dev, RTE_FLOW_ITEM_TYPE_TAG, index); MLX5_ASSERT(reg > 0); flow_dv_match_meta_reg(key, (enum modify_reg)reg, tag_v->data, tag_m->data); } @@ -11057,7 +11057,7 @@ flow_dv_translate_item_meter_color(struct rte_eth_dev *dev, void *key, if (!!(key_type & MLX5_SET_MATCHER_SW)) reg = mlx5_flow_get_reg_id(dev, MLX5_MTR_COLOR, 0, NULL); else - reg = flow_hw_get_reg_id(RTE_FLOW_ITEM_TYPE_METER_COLOR, 0); + reg = flow_hw_get_reg_id(dev, RTE_FLOW_ITEM_TYPE_METER_COLOR, 0); if (reg == REG_NON) return; flow_dv_match_meta_reg(key, (enum modify_reg)reg, value, mask); diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 88fe8d9a68..d3f065e9c1 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -5595,9 +5595,8 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev, if (tag == NULL) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, - NULL, - "Tag spec is NULL"); - tag_idx = flow_hw_get_reg_id(RTE_FLOW_ITEM_TYPE_TAG, tag->index); + NULL, "Tag spec is NULL"); + tag_idx = flow_hw_get_reg_id(dev, RTE_FLOW_ITEM_TYPE_TAG, tag->index); if (tag_idx == REG_NON) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, @@ -5655,7 +5654,7 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev, break; case RTE_FLOW_ITEM_TYPE_METER_COLOR: { - int reg = flow_hw_get_reg_id(RTE_FLOW_ITEM_TYPE_METER_COLOR, 0); + int reg = flow_hw_get_reg_id(dev, RTE_FLOW_ITEM_TYPE_METER_COLOR, 0); if (reg == REG_NON) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, -- 2.39.2