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 B8B7745B5A; Thu, 17 Oct 2024 09:58:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A29240657; Thu, 17 Oct 2024 09:58:24 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2040.outbound.protection.outlook.com [40.107.244.40]) by mails.dpdk.org (Postfix) with ESMTP id C94544064C for ; Thu, 17 Oct 2024 09:58:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=N5T6Nr0boq81g5kFFHarPcM/3GzEjqZCPsx+oBq8hfSUMJTESOvTtXX/UgyLQpqZ1HSy3oCbRo9VpsswDEdX4DpsdImj4eUmIKayi1OdAj97GY7HhRGvUn0Ucv/iHHAfUBahL9ywgKfe9M1QwZ3Rj/fnlenpMCesQfNOXjMHeFEV0sVxdcELsbWfcCWrhqy9hEZ4k9TOlH6mu1X9nbX33gnCXDJ2lJzWqIwLDdfLSFKLI6Wi8wqMdnQaoalAGFhJgnjZuYTV8kDgfWmaIOi2vWQOor18fKcOMktjmYplDwxYnfYSjQJYpI8U0njPhHcKk99x5Oxc74dr5j0bq48TEA== 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=da1byk/jNelBehQfE8I7j7x+3gqJ90IF0qvLsbrSLuw=; b=ISxqePkuNraTTmqEBY3xeP2z3hfXFtW/xci9m2X1BnxwPQ57v1y6ibMwZzaRGz6aWvYr9/kpb7azIjNfISdISTT+PBmM0WFGmU7w2/FFtGW8axibhSV9wsIcae/xoT3VAkwNd0iFsBbJg1AZpmCDDBGJH2t7TjcUPN2eWNJNhRHZg0PNIUjXka4FslRg1qYb8yUxcb555sOBQ/IH8oAThr5lBJG7kJ9YnRL1ZUL9ew8uwHMLeJstkD0JoxBxuQHuX4kzdZVr2J8XB4+3Ulao+1SgvWiJsW3R/DOslHx+yJTn1nEkJdhEMpKMGG3LGk9pYUYS5PFRopKSCjdQTSIPgQ== 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=da1byk/jNelBehQfE8I7j7x+3gqJ90IF0qvLsbrSLuw=; b=JQ5UBgggSMTrrZRU6rozhY23ywOCK6q2JkWa9HY4ZB9EK/lSTitKKtbWhcZDWKSI2+BnukrKqVx51M1aJg9HFx/BToa1AjuqJD1fWkaggzVJarvUhDSBm7yeQg3v39r143bdZ3FGGgHlETvcHuIKAMjZi9W7vmFfDp4DK4ryoLjQMkXBw5mx2oiZ53SLMpdl+vt8UN2ZydmOwpo+KmWa6ydsCYfaKPBHci9M5uKQouC1EefghZri5G5iN+i3+Kflpf9BQGhGL54Op7FxEymaDZlE+sh+w4zrAo57l6QT7LZ4+B0QA+XzBhrfh4zbvg83Bgj1GUkwM7Ob7s9YD+/Yww== Received: from PH7PR13CA0005.namprd13.prod.outlook.com (2603:10b6:510:174::8) by CY8PR12MB7097.namprd12.prod.outlook.com (2603:10b6:930:51::17) 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:18 +0000 Received: from SA2PEPF000015CB.namprd03.prod.outlook.com (2603:10b6:510:174:cafe::10) by PH7PR13CA0005.outlook.office365.com (2603:10b6:510:174::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.7 via Frontend Transport; Thu, 17 Oct 2024 07:58:18 +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 SA2PEPF000015CB.mail.protection.outlook.com (10.167.241.201) 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:18 +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; Thu, 17 Oct 2024 00:58:03 -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:01 -0700 From: Dariusz Sosnowski To: Viacheslav Ovsiienko , Bing Zhao , Ori Kam , Suanming Mou , Matan Azrad CC: Subject: [PATCH 02/10] net/mlx5: add checking if unicast flow rule exists Date: Thu, 17 Oct 2024 09:57:30 +0200 Message-ID: <20241017075738.190064-3-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: SA2PEPF000015CB:EE_|CY8PR12MB7097:EE_ X-MS-Office365-Filtering-Correlation-Id: c706794d-a78c-41ee-7dea-08dcee817636 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?V/V+pYPYGTZ/UPoNL/SwrI9Zs1HOMaJokG9tuEXpw2QwzI5Vxj4SknsKsg5U?= =?us-ascii?Q?zT3WNYbc/0YZN1UHLSXbqd4q4aU552OgrtNfuHG6GxbKLK6ZpDdy6LWwA8pu?= =?us-ascii?Q?Imq2/Rp9DzxObF8bTJ3griG1vYzCz1qckgADM/B+rvOSB0swwZqQF47GXiic?= =?us-ascii?Q?91kXfD+evBDIzc00I6xGKuCMH07z9Onp6iXW6F6XC+02dw+2H80edu3MZiuK?= =?us-ascii?Q?YSaavPSUm/ErDgS2gFOu4F+9E/IuiRGvDr6hwkbeS+qXkpn+1N7J/eStb3F4?= =?us-ascii?Q?92aVZK0SNVt5L0yBKtuaFBetUQrRqxgvsSqc/c0TSle1t74E0D6LHehlxQzg?= =?us-ascii?Q?GaI8xLnkttHUR44CGe+OOOf+J0/tmCVEOwur4VmtTmOYy5pL5OVerVJTl7wD?= =?us-ascii?Q?nSw89SBmkFab6BbnIv3XH/DEyIeS3FOY6aoN34TXvo5wklqubw4RbsBuRNUn?= =?us-ascii?Q?Q8+bozxWrV0dpFoH26xSKacPX8DVGNOfUh5UYAHXtIsy8HredB1lWoawrNJF?= =?us-ascii?Q?2Gykmt2kjA53mcIqrFIH735UT6BuCJmlM3IkcaWoGmUlBDDPHJXwR54kNdRp?= =?us-ascii?Q?zVliFnYmfJ+Y7SyTO4zMeLfz/IIcdijqLfJ7oFKe2sEvSi0sKHgIo7WkUSxu?= =?us-ascii?Q?vW+BmiI2p98z4TksaC5EJ0OereZvumWW0nqitMxGVxgWtC2TpFQauBLdGg9c?= =?us-ascii?Q?MO/pYpAYxZj64WGMHiWOSMcKcJmRyuLbVPl8c3limR64UlPG8Zy/MucVil7u?= =?us-ascii?Q?mP8O3FYk91yybXW47dc4haWD3NWFIWAqvvZufbrTSnajrmcWV2fWeVwBNX1O?= =?us-ascii?Q?Ld4GUNBlfLi+qL3gYN7u8oh8IocKMzMmv07u6oxliiNdM/yF4QG4GBze/0Sn?= =?us-ascii?Q?OyaqMlHyLNMqjdgWAy6mAEkapPCFZRI+rs0f3l4sjIDCYKSyiaOq8wpYsy1i?= =?us-ascii?Q?AanAVSAT4WOfz1MrQWFJiNrhX2SxjRTOK6Oa9wwI2OSrgjR4om5nhQD82lCY?= =?us-ascii?Q?HlBdw3p8PTRGaq4V3vGYpIYOKIts9QJtkw6tlLGG3DPgRB3eMXjY+u1tKWhS?= =?us-ascii?Q?oA71KzKwmDNwNa+JdJJm8kTxxINT07rCA2GUiQApJ5J2vfwau2gtBQODEMSi?= =?us-ascii?Q?RWygPUUsHqUm9PeY/sPuFIfJz6HV6L+OwgkNRu2uVSLVgLdFh6IFBhsFA3Av?= =?us-ascii?Q?6KT5RSojpFLzUcGrcecbpdnFPF3LKkwUQOcdKAxQGIlLIq9NOaoTlwWgGTfS?= =?us-ascii?Q?Pjgguv7andRCAxV80hQF8CKcKEDgB4m454e1ffD3MgwIhBqFGXEVGAu/GQzz?= =?us-ascii?Q?1lGs0ch/5rGnHrURTXIdD8dfHinHTG2uL32ZlGu0tSmEbrHTgkfuBvnqn7JS?= =?us-ascii?Q?wwjzJLkP4vlBNY9zve9oLxjSPxPJFjaXGWkW4SKLv9yWluojHQ=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)(82310400026)(36860700013)(1800799024)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 07:58:18.0148 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c706794d-a78c-41ee-7dea-08dcee817636 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: SA2PEPF000015CB.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7097 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 Add 2 internal functions for checking if: - unicast DMAC control flow rule or - unicast DMAC with VLAN control flow rule, was created. Signed-off-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5.h | 11 +++++++++++ drivers/net/mlx5/mlx5_flow.c | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 80829be5b4..3551b793d6 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1831,6 +1831,17 @@ struct mlx5_hw_ctrl_flow_info { }; }; +/** Returns true if a control flow rule with unicast DMAC match on given address was created. */ +bool mlx5_ctrl_flow_uc_dmac_exists(struct rte_eth_dev *dev, const struct rte_ether_addr *addr); + +/** + * Returns true if a control flow rule with unicast DMAC and VLAN match + * on given values was created. + */ +bool mlx5_ctrl_flow_uc_dmac_vlan_exists(struct rte_eth_dev *dev, + const struct rte_ether_addr *addr, + const uint16_t vid); + /** Entry for tracking control flow rules in HWS. */ struct mlx5_hw_ctrl_flow { LIST_ENTRY(mlx5_hw_ctrl_flow) next; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index effc61cdc9..69f8bd8d97 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -12180,3 +12180,40 @@ rte_pmd_mlx5_destroy_geneve_tlv_parser(void *handle) return -rte_errno; #endif } + +bool +mlx5_ctrl_flow_uc_dmac_exists(struct rte_eth_dev *dev, const struct rte_ether_addr *addr) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_hw_ctrl_flow *entry; + bool exists = false; + + LIST_FOREACH(entry, &priv->hw_ctrl_flows, next) { + if (entry->info.type == MLX5_HW_CTRL_FLOW_TYPE_DEFAULT_RX_RSS_UNICAST_DMAC && + rte_is_same_ether_addr(addr, &entry->info.uc.dmac)) { + exists = true; + break; + } + } + return exists; +} + +bool +mlx5_ctrl_flow_uc_dmac_vlan_exists(struct rte_eth_dev *dev, + const struct rte_ether_addr *addr, + const uint16_t vid) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_hw_ctrl_flow *entry; + bool exists = false; + + LIST_FOREACH(entry, &priv->hw_ctrl_flows, next) { + if (entry->info.type == MLX5_HW_CTRL_FLOW_TYPE_DEFAULT_RX_RSS_UNICAST_DMAC_VLAN && + rte_is_same_ether_addr(addr, &entry->info.uc.dmac) && + vid == entry->info.uc.vlan) { + exists = true; + break; + } + } + return exists; +} -- 2.39.5