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 AD67145B5A; Thu, 17 Oct 2024 09:59:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2B3840A71; Thu, 17 Oct 2024 09:58:44 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2075.outbound.protection.outlook.com [40.107.95.75]) by mails.dpdk.org (Postfix) with ESMTP id D924E40697 for ; Thu, 17 Oct 2024 09:58:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qugFT3C8/gkc27lQoDs0tUY3g426E1Ad2ER4tSfiNXTwVTtOZ1yTYm/8g0XaexJNqidtPKHuNh6sp49o+pbH2nZm66XnK0jgx7H9FIskY905OVc25ca0UBLEFYKuPzkWXACxdb7mokZmM3/ujXXK/EV1TebMvzUTO1sa9pGMatGobWzykJyFSRZYU4VoY6mrtLU/EsbI16iR22K+vFvvLJLpvK0UIu53dCX+1wOAkWE2gBIUS1mUutcR+pBB5EP1z1oDEM2XYIZrZmjLTBh6ff7n3NmCHZ788aQ0Zu+XOBsgu2PvVzX6guro4G7XpH7Di+oczyFzp68wjKrbVKxMwA== 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=DPvB6dvSCa2gCax3xBGcT1isFR4CkqYDrn4ULwYrsoE=; b=LiH+fmCmTQuPIB2JxcPTqOi4xBO6h+zNi5Pw4N8BeyCS59jao5KaE3YW8qZL3MKWy14FOMn3E3o8pB6zXLOZoAGCFtIGHpARJWlRG2KkCxc/98iR+qsd9I6xdkdO54GCuhRYwvZBUUJB0DWaMtzlzGkRBPe1fKtQiuHhBET3BSPrwOccTbwe4gbGSFi4WZvyKbGMf02RUYe4zIac51xZbLQfLy7NQ8gbD7b3OFBh5XVBEDKPrkK68RGg7Tt+ziRTtvoEm3JZyCGaUy76/s1mCOTNmuEvvVahLl+9ZWRQVlnXR4XWC6obO2xx5lFYAGmsAFNOGjIpxxbLkDTdSYH/YQ== 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=DPvB6dvSCa2gCax3xBGcT1isFR4CkqYDrn4ULwYrsoE=; b=mTo3dNRNNPe8ngChvnd8MyF37p36eV/KRUdQq4t1E0b1Aft5tAg8Qo6zSalgt1c7OKwxBAd29RBC+gPTSOHl62/y1zNAB+5oTdqj/kZM7upMoS11VntmwIORcOCMNj+XzzUwFDQ8VgUbzqN6nJsK6MAIYinSbcsGz+8MYIeG1M5o+grZmQ8++0JHmhRs9viUsEXob21u1msWaUHmzL3taMDu5YXpaLfB0vcppp4WNqlmxGnO5fzaZtE+CxZZL0Ymj875PJFA8pFHguP8MPnw4mcsY83hGio6Ew+AvJa4WNyvtpfAUmhLrumVQTMql8Mq4z7vdZxTErT5T+pXbjLvUw== Received: from BL0PR02CA0007.namprd02.prod.outlook.com (2603:10b6:207:3c::20) by CH0PR12MB8506.namprd12.prod.outlook.com (2603:10b6:610:18a::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 17 Oct 2024 07:58:35 +0000 Received: from MN1PEPF0000F0DE.namprd04.prod.outlook.com (2603:10b6:207:3c:cafe::f1) by BL0PR02CA0007.outlook.office365.com (2603:10b6:207:3c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18 via Frontend Transport; Thu, 17 Oct 2024 07:58:35 +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 MN1PEPF0000F0DE.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Thu, 17 Oct 2024 07:58:34 +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.1544.4; Thu, 17 Oct 2024 00:58:17 -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; Thu, 17 Oct 2024 00:58:15 -0700 From: Dariusz Sosnowski To: Viacheslav Ovsiienko , Bing Zhao , Ori Kam , Suanming Mou , Matan Azrad CC: Subject: [PATCH 08/10] net/mlx5: add legacy unicast flow rule registration Date: Thu, 17 Oct 2024 09:57:36 +0200 Message-ID: <20241017075738.190064-9-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241017075738.190064-1-dsosnowski@nvidia.com> References: <20241017075738.190064-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: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0DE:EE_|CH0PR12MB8506:EE_ X-MS-Office365-Filtering-Correlation-Id: f9c72d02-c2f8-42dd-d7f0-08dcee81805e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?jxVNYO1EXWVZPC3Deu3SS6LzrKZ2U+MwSg9Nu4MXowpGvO9aaUuN9xOBCGcM?= =?us-ascii?Q?JGONUu7qLjDW6Ur+mveRjquaK4GUD1lneLU1kVxn3zl9gAR/lQv6j/Whnf0n?= =?us-ascii?Q?KymbLkkR+RDtRib/AbzMR/G5TrTX4ltqTiJsur/ainXi5oKRG/z8dW5eOVmF?= =?us-ascii?Q?am51wwQCJ8fRGYG7Fd+MHKhdYqHssxrNF6qz2HFgsZRyotos6JgmhSD85dT4?= =?us-ascii?Q?143Z7cBIdyoRIgxgDhdn8pYxBSFu2D6Vn6kpqCEEmnWNmizo72KkPY8gBdiU?= =?us-ascii?Q?aeNv7DfPBIRUcmC7JZhNaTsQ9bCEtO8coCk/VqnNOmdAxGSBGSa7RzXC9OE+?= =?us-ascii?Q?IlQZgSd3Wcugri81AdnpklGKRDKDHVLGwPqyOmnGMwMXpqse2Ex9oNcZI9PY?= =?us-ascii?Q?yee7YvSheT/a9tVt4tsR4ITZwpIENht4bmJtZmqvf/ZMOjLuFTLLJvKGP769?= =?us-ascii?Q?c+PUSl8vXj+uHPoWmykVCrGBc3hHwAzcRCzrWtIUMbHwLldvuFEOfTtNhicC?= =?us-ascii?Q?cIU60TekpLEjpRf+bpoJUEe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efront-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:(13230040)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 07:58:34.9784 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9c72d02-c2f8-42dd-d7f0-08dcee81805e 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: MN1PEPF0000F0DE.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB8506 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 --- 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 463edae70e..2038f78481 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -8495,8 +8495,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) { @@ -8506,11 +8507,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