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 833EE45BA0; Tue, 22 Oct 2024 14:07:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3FC094066D; Tue, 22 Oct 2024 14:07:16 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2060.outbound.protection.outlook.com [40.107.92.60]) by mails.dpdk.org (Postfix) with ESMTP id 3D67A40649 for ; Tue, 22 Oct 2024 14:07:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IlXhlmtfpF2eZN7Ar22CTGlpUj11PYE7VrXQuzsIA6GLKDYeAJNF9VOVE1zAJNUBIsU0nrnImJmcgWw/IBmP7CLfQQybj850GPY1dPNDhZk8Uxd9JJVm918FQV11ixb4Vm3xWKosHwNF+1cabtwcMxHUX804LM42dIYd062IO2j7kGxB06QDsYGkoQnfxs0nph5CUsHX8ry0WYyuoKT65rXP++t3A+WNZsqXF32gsSCLW/brD0Qkhn460v7bBFHPZUg7HkLew0cSrMK0zqTqGLjJVSjsKOya9L5zIFFPuQWEXV12G2JZLx41/Rzis1nAFPxd5cZniJA5AyRq8d8H/A== 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=SM1ls9T0sWyvZSzpugbqvoRXH7W397Ras9KCPcsZ3yk=; b=KqPjmXi/4oGH9SzFG7vMfZPj/DQJMDfMYLvx1+3NbIO/VkqUiWtZZgubx/7DvRJ+90hCfMHHi8ylF40UTU1nR62g55ARVUtxGzc1tW6NbNLd3256ThFGZA/cNXaK8DoTr5GdGY2VLrXU/OOZjB5WegK4OlXYmVkzXIKmEQS/S21n2CriVtggSsbMPM+qSJ4PRgtyI4Hdd42082nLPscgoFHmp3/XuaKyiOAZKl//QFmompAOt2vPcS5tkDkfITT02nZqaokciMJtw3QCrU+Xjz5Or+typVd/0mt//1skrjOrjG2ZZQm2hgOrrlj11QA0/8r6hr2+5AzB0qT4imDmfQ== 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=SM1ls9T0sWyvZSzpugbqvoRXH7W397Ras9KCPcsZ3yk=; b=miJG8JdbPl8v+a8dJH/kjxXZRZDpU+S6jmQlyK5t11mq1cEMdXS9PoGmiY2J7jEBGU6qgzCaxG0rrdV4lwfUb0OKQqrGFovdVHw25R/KfHy55yV8B4mi5QN/m9Mr+QPNX14XGxFrRCrZzO2Wj75GaS4VEL0xbxvTI8MwtBGPMc0+ftTl5dNEZzqez7MZyDIH+NQ2e8WCQYYnAH91XqJDRiOnBmObcSpacw5rMHrLc+53siZDAcJRDHfO++TCApY496JHxzQNZYXafKdNVzAEPhV4Lt3QQqskW1n/nD1ZULrDw/P3oifiXMzxFFD+Vpgwwv8HiEYjRkNIIoor2jshlQ== Received: from BYAPR08CA0051.namprd08.prod.outlook.com (2603:10b6:a03:117::28) by SA1PR12MB8143.namprd12.prod.outlook.com (2603:10b6:806:333::10) 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:08 +0000 Received: from SJ1PEPF000023D3.namprd21.prod.outlook.com (2603:10b6:a03:117:cafe::9d) by BYAPR08CA0051.outlook.office365.com (2603:10b6:a03:117::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Tue, 22 Oct 2024 12:07:08 +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 SJ1PEPF000023D3.mail.protection.outlook.com (10.167.244.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.2 via Frontend Transport; Tue, 22 Oct 2024 12:07:08 +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; Tue, 22 Oct 2024 05:06:55 -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:06:54 -0700 From: Dariusz Sosnowski To: Viacheslav Ovsiienko , Bing Zhao , Ori Kam , Suanming Mou , Matan Azrad CC: Subject: [PATCH v2 02/10] net/mlx5: add checking if unicast flow rule exists Date: Tue, 22 Oct 2024 14:06:10 +0200 Message-ID: <20241022120618.512091-3-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: SJ1PEPF000023D3:EE_|SA1PR12MB8143:EE_ X-MS-Office365-Filtering-Correlation-Id: 1af6d122-734a-43a9-ada6-08dcf2920d7c 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?upfbQlby4CBGspIVszu8aY5IzbgPF7wKAFROA9HF8PdUUqd1Pq3D88MGWHqH?= =?us-ascii?Q?dvp87sCBekE9gDj1E095Q/yRGGtpBDYNR/9Ao4KgOMn5U6SDZRqbxofjmyjq?= =?us-ascii?Q?a8t13vmS7lSjpwzK75BEoNn6xpvKCqjbLrGa4ND2qIKAv+k2Z+RxulXiylrJ?= =?us-ascii?Q?FpEFoEeMXp5TFaDvhcpmIvMrAV12yxRwJv1rvS1tXf+fhbYvhtE8mqgyW4zN?= =?us-ascii?Q?t5I/y79znmYpQ4N55i/NzbByFL+Jkj9AoZZ5yYp81pamZW0KsBawbZWGM7w4?= =?us-ascii?Q?7ZKZwAKmhDIcDnNJxbhRdA3k0glsrKz+0wCpLs5sfzrq6qTlskhyY51haKcv?= =?us-ascii?Q?zGqma0quD/KA1IHGufDkMXi36N/FSR/K2tE4Vi9zzK2btjUSlDU5r9tNwDLX?= =?us-ascii?Q?qM9KqioD9DAF+NTAYh8X/wDIVUDMz3mNeDQIKEQ2pPcNUy/C4KRfX1T2+nVS?= =?us-ascii?Q?cy3ZQPQfboX7j6QTASH5hc7qZDfwIgCXOJAW6WL6ChHnW57m1YBWcYkyGMWt?= =?us-ascii?Q?Oqx6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3sw=3D=3D?= 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:(13230040)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 12:07:08.3939 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1af6d122-734a-43a9-ada6-08dcf2920d7c 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: SJ1PEPF000023D3.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8143 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 Acked-by: Viacheslav Ovsiienko --- 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 7f8640b488..19c9668bb6 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -12178,3 +12178,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