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 CC13045BA0; Tue, 22 Oct 2024 14:08:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C2A240A75; Tue, 22 Oct 2024 14:07:51 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2063.outbound.protection.outlook.com [40.107.236.63]) by mails.dpdk.org (Postfix) with ESMTP id 65543406B8 for ; Tue, 22 Oct 2024 14:07:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mLkQwDO93b84Ngf+6Cbb3WjePT9vLmPHNH2Dwhkf0MT5ndpKALowyKJwhje+mDDbEVV52cG4svhGhMFiD8bmuczXG1pUVu98RBCDtZ4aC0N6JaMqnzzZxSMsWHT5ApnNapPftCxfRLDUTCDMgGPQ9ARtY845cjSlbun04U+smOZZf0jnkxA1YYhalaqE4TNQAEgjpy5XFS+hKGj6CcqbgZk/mm+bncT5lIGLJeQoP1ggKhTTMH/1qjA6TI/KiEhCtMdjJigBkqOCe99TNthghvCW4TruFj7K6Yqet7HPRp61nXc9PkCx6FMXhYt5ODiGZxtHyQs7M6cRMEUThvD69w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=AtGRzjdq8VRFBAhG5qzasaWCDtWrQQl5ZwufSAEP42Q=; b=i5yjPqNhovQSocTlWSTNzTvHkydpc/K+0Yw2zwyRD9EScyWiwTZ/772sYNNvsWmktWH8ImHZTTNCwJV4Qwrc+MEkYTLMttL9BCbHQ9ol00SIOW0KS3TDgOUwwIpQJggrT2TMeqnhQPuYFl8r5fVt+k9BZwSkjDj5pYlD4Q88BgN/13qMHMFFXijqtL4KcwO6mi4QNjrLnjbUX/J5+OcyE3jnqao8lBLpAOtyqEn9iakWYTD5Z2pbuTKvD/xYm12+jfunuP2l4sxRrKkbKRY5SGwpovlziOXXitP2Bxwe/asqRIBeUFsrJo0QTEV3BrdgN+KQ3HWEeE/7e2qIpugyMg== 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=AtGRzjdq8VRFBAhG5qzasaWCDtWrQQl5ZwufSAEP42Q=; b=hND+IR6CzSPAy+6KAV2CAAiTV94f4bIqY2idMFkDPdhuTnc1oLfX09NhtirhT3WM5GGV6+2RvIWvqF6USW3Ad9qgKAQdUtdaIq+Fbaa4R0JTOy3byfii4cXD1aLQutVp8i054QWnxxOTCkPGWSgPDnF6JP7CHfR4D3a0LWajYSrIOtVB7QN/m+Qgg82UAwzruzJDfSnDbCiXLKDvzpH/rEqzwyMy/ZDlQ/FQn1qV0a+4GHkWCvPFOkmJ5WdstN4PMDxLo9PFg0RzNkH9prkngs0nuDgoebUVlXq6XVHgRg8eFmsRUFV0vgXCZpKH7q0RtZugOn6rmkhRMgAyjxhemQ== Received: from MN2PR03CA0002.namprd03.prod.outlook.com (2603:10b6:208:23a::7) by PH7PR12MB5855.namprd12.prod.outlook.com (2603:10b6:510:1d6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 12:07:30 +0000 Received: from BN1PEPF00006000.namprd05.prod.outlook.com (2603:10b6:208:23a:cafe::b7) by MN2PR03CA0002.outlook.office365.com (2603:10b6:208:23a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Tue, 22 Oct 2024 12:07:30 +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 BN1PEPF00006000.mail.protection.outlook.com (10.167.243.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.14 via Frontend Transport; Tue, 22 Oct 2024 12:07:29 +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; Tue, 22 Oct 2024 05:07:07 -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.1544.4; Tue, 22 Oct 2024 05:07:06 -0700 From: Dariusz Sosnowski To: Viacheslav Ovsiienko , Bing Zhao , Ori Kam , Suanming Mou , Matan Azrad CC: Subject: [PATCH v2 08/10] net/mlx5: add legacy unicast flow rule registration Date: Tue, 22 Oct 2024 14:06:16 +0200 Message-ID: <20241022120618.512091-9-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241022120618.512091-1-dsosnowski@nvidia.com> References: <20241017075738.190064-1-dsosnowski@nvidia.com> <20241022120618.512091-1-dsosnowski@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: BN1PEPF00006000:EE_|PH7PR12MB5855:EE_ X-MS-Office365-Filtering-Correlation-Id: 6bbd0faa-5cbf-48bd-936d-08dcf2921a4c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?82w6aGCyFnaDmYLrqfL8k2rOQY81BVj60QywsS7FnsjH3OJgMF/hz6pTSmN4?= =?us-ascii?Q?0e81J6OwvgN9Z7in7w8bjnyRnXWINmSCcpySS8lX7eMpGosvppb4SHGLKaIg?= =?us-ascii?Q?ZBKuCGiXfGSW+dO+X9mHJRrpx1y7EIDf2UpLX0appBE/+xI5uLoFcVD3f0KR?= =?us-ascii?Q?bqKdwr559WKskHjbhPHKV1KKgkwOSgUXJxe2AYq4rv6JTAOQbUTzHfCZHvHo?= =?us-ascii?Q?KKQGkVobYCBx0QsNv0GoBslZLvJBZvk0Un2o+R+4GNTfGwuef0h7Cvh8gDG4?= =?us-ascii?Q?VGRaAbQ6GZDvwFcwkJxSspS6+zAxUgufr3HGwmmM5fqaZda5yj85dYq1C8rb?= =?us-ascii?Q?JpzHzgROpCFOKLisH73Ml4RwYr9v6q0mivLr3uhZkVrTjkMa2mKL99UsCDnT?= =?us-ascii?Q?ETJmGfNb3yqPTizEsrkzpdkXqFlMwyXxBWtVYfWXu+nCaGcW5oNGRA6hz3me?= =?us-ascii?Q?m6s9J+w7Mkp1rtkY/CwxgYzdBvqBUmSx5667+Vgs9AigOmN+HKlw1IIVndpZ?= =?us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OnhvyiAWGgYR++ob9Aaat5sx07cG2zF74TAAA=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:(13230040)(376014)(36860700013)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 12:07:29.8109 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6bbd0faa-5cbf-48bd-936d-08dcf2921a4c 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: BN1PEPF00006000.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5855 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 Whenever a unicast DMAC or unicast DMAC with VLAN ID control flow rule is created when working with Verbs or DV flow engine, add this flow rule to the control flow rule list, with information required for recognizing it. Signed-off-by: Dariusz Sosnowski Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.c | 32 +++++++++++++++++++++++++++++--- drivers/net/mlx5/mlx5_trigger.c | 26 ++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 0d83357eb0..9c43201e05 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -8493,8 +8493,9 @@ mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev, .type = RTE_FLOW_ACTION_TYPE_END, }, }; - uint32_t flow_idx; + uintptr_t flow_idx; struct rte_flow_error error; + struct mlx5_ctrl_flow_entry *entry; unsigned int i; if (!priv->reta_idx_n || !priv->rxqs_n) { @@ -8504,11 +8505,36 @@ mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev, action_rss.types = 0; for (i = 0; i != priv->reta_idx_n; ++i) queue[i] = (*priv->reta_idx)[i]; + + entry = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*entry), alignof(typeof(*entry)), SOCKET_ID_ANY); + if (entry == NULL) { + rte_errno = ENOMEM; + goto err; + } + + entry->owner_dev = dev; + if (vlan_spec == NULL) { + entry->info.type = MLX5_CTRL_FLOW_TYPE_DEFAULT_RX_RSS_UNICAST_DMAC; + } else { + entry->info.type = MLX5_CTRL_FLOW_TYPE_DEFAULT_RX_RSS_UNICAST_DMAC_VLAN; + entry->info.uc.vlan = rte_be_to_cpu_16(vlan_spec->hdr.vlan_tci); + } + entry->info.uc.dmac = eth_spec->hdr.dst_addr; + flow_idx = mlx5_flow_list_create(dev, MLX5_FLOW_TYPE_CTL, &attr, items, actions, false, &error); - if (!flow_idx) - return -rte_errno; + if (!flow_idx) { + mlx5_free(entry); + goto err; + } + + entry->flow = (struct rte_flow *)flow_idx; + LIST_INSERT_HEAD(&priv->hw_ctrl_flows, entry, next); + return 0; + +err: + return -rte_errno; } /** diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index bf836c92fc..4fa9319c4d 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -20,6 +20,8 @@ #include "mlx5_utils.h" #include "rte_pmd_mlx5.h" +static void mlx5_traffic_disable_legacy(struct rte_eth_dev *dev); + /** * Stop traffic on Tx queues. * @@ -1736,11 +1738,31 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) return 0; error: ret = rte_errno; /* Save rte_errno before cleanup. */ - mlx5_flow_list_flush(dev, MLX5_FLOW_TYPE_CTL, false); + mlx5_traffic_disable_legacy(dev); rte_errno = ret; /* Restore rte_errno. */ return -rte_errno; } +static void +mlx5_traffic_disable_legacy(struct rte_eth_dev *dev) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_ctrl_flow_entry *entry; + struct mlx5_ctrl_flow_entry *tmp; + + /* + * Free registered control flow rules first, + * to free the memory allocated for list entries + */ + entry = LIST_FIRST(&priv->hw_ctrl_flows); + while (entry != NULL) { + tmp = LIST_NEXT(entry, next); + mlx5_legacy_ctrl_flow_destroy(dev, entry); + entry = tmp; + } + + mlx5_flow_list_flush(dev, MLX5_FLOW_TYPE_CTL, false); +} /** * Disable traffic flows configured by control plane @@ -1758,7 +1780,7 @@ mlx5_traffic_disable(struct rte_eth_dev *dev) mlx5_flow_hw_flush_ctrl_flows(dev); else #endif - mlx5_flow_list_flush(dev, MLX5_FLOW_TYPE_CTL, false); + mlx5_traffic_disable_legacy(dev); } /** -- 2.39.5