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 6051545BA0; Tue, 22 Oct 2024 14:07:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B7D74064C; Tue, 22 Oct 2024 14:07:15 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2050.outbound.protection.outlook.com [40.107.244.50]) by mails.dpdk.org (Postfix) with ESMTP id 4135A40611 for ; Tue, 22 Oct 2024 14:07:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ufNFUV+sMN3MvzdyQxT1turUPvnW1ICnChXiEuZh8mCjjHk20NqNoLvGRNGlJj02OBrezwW+sVnRzvjI1XRxvcVGcfx/rINLjwkoBNQ1aXpfuxU/1pZMMZRfFZTe+pEpJllGGQDis8Ufl+Jwl4tvGv/RSK2QkrWZqxt3RNLIeu9ti5+o6pfNTGoPPBCzQF+BHLSEXLMdqJ8rROFb2ExETcMJX79LDFwTSBQCrgxD6aQ7oGnYoVWMN/pVAuOX5uGYueqvx1sP52luhK6enLIkBSPurQJQ8SA8KCfH9bAS8GJCUxinG62x/dhW381RINTIVtnzFu6jeblJ2bX+YO5f3g== 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=0GmhmF4MVL0Eu9XhmyTtrEWkJ3KuQs9LBjAET+uP8Dk=; b=VaLedbcCBcQsaAfclRqrlNcO71Dj9Nm4FgzXPlTvAyjrCGjZ93a04qv+6bOaaOPFqkC5OJPEaoq8h9Xvc4NiPIOF2NM1wvr7AlzPaL1Up8pV5c4c6cL5SXsuyU1ZQSJKlYWmtnfKz71nDE9T9av1MaoklSXsuYpcyn9t0Tb8soD4WuhnHeLLz76g5kCmGLcZR4SCTFvyuYbvSfnp7HF/Ud6R+VzLc0mqe4XVobuBlQF3p9lFIQrJRbyu0RcL1D1uRdiMdCGWxW75cROZK4VrUnGIA7o1EDXexGKAqjTuBxW7AnSoL/bbDqtAFEg2GkE7qocP/5SGYvazAF4UzNsNng== 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=0GmhmF4MVL0Eu9XhmyTtrEWkJ3KuQs9LBjAET+uP8Dk=; b=ntMcYkslLbq027dDrc1tG1mJXe2YimUs/0vgADS2r62xVnfNFsCDwlkW3L9ODwkc9qYQVwIf3C+bDwOYmUhJrJwHU0W3IR8z/h70U0GDA9VjW9IYnb0QngZYRTM4o0liKq4+rRi+ggUCGV8HDyQpFzc6H1y7jGjArZ/nqL/Re1QjYoZj9gIF18c+v0PaOv/ZuIrXFNbcCS4iSU4DBr476xvSGnD4NhU/uI5PncWSlO+CCcX86B+T8KZL0SCeTPi1ALXobpEadKodcujPC3lEB+YgzviQzYf+YfV/ef4XW0MRgrpQxKs+Kd84J7Pu2EuHuNe8Rm5AGFGmVKty9qmrcg== Received: from BY5PR16CA0002.namprd16.prod.outlook.com (2603:10b6:a03:1a0::15) by DS0PR12MB8504.namprd12.prod.outlook.com (2603:10b6:8:155::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.26; Tue, 22 Oct 2024 12:07:07 +0000 Received: from SJ1PEPF000023DA.namprd21.prod.outlook.com (2603:10b6:a03:1a0:cafe::97) by BY5PR16CA0002.outlook.office365.com (2603:10b6:a03:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.26 via Frontend Transport; Tue, 22 Oct 2024 12:07:07 +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 SJ1PEPF000023DA.mail.protection.outlook.com (10.167.244.75) 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:07 +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:53 -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:52 -0700 From: Dariusz Sosnowski To: Viacheslav Ovsiienko , Bing Zhao , Ori Kam , Suanming Mou , Matan Azrad CC: Subject: [PATCH v2 01/10] net/mlx5: track unicast DMAC control flow rules Date: Tue, 22 Oct 2024 14:06:09 +0200 Message-ID: <20241022120618.512091-2-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: SJ1PEPF000023DA:EE_|DS0PR12MB8504:EE_ X-MS-Office365-Filtering-Correlation-Id: 09bd4595-fc83-4b6d-3184-08dcf2920cce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?XTIsrDQ2ynMifbpYwNddhPUVQU8kkLJtR668gOzwX1NzjiSLfId9+BDhL4J/?= =?us-ascii?Q?lQaG4nGJoCsyhid3zdFYK3fSE+fZ2id9aLU6d7A6yX92C6AGezXCV0uiltoE?= =?us-ascii?Q?oWMsU09sRS0dx8DzddTBevb7bRhb+AgCV9Zy0wXfH/d3ZY8oFyNF4kwuUs52?= =?us-ascii?Q?COMjmdUxNgWwimDh8fRBlM1gl8Z4cWUckIjez+tZKrszEf2tQUFwOy9V2r/C?= =?us-ascii?Q?CaQR7ItWaw58OZvVQ2A8TTn2NunFBECnVSPTxZ/2Izj6evnXA0HD3oNFqlWU?= =?us-ascii?Q?1oT4s+zRzHz0RrFKJdkGs1pNcT8OZzhccgEOeS1L5QIDBXXSOefA5b2gtT2C?= =?us-ascii?Q?cBd62b07KGakoUneHDTHtG4CxVkPv+hrmc96EGjugW+s9l7pM0Oyfq+1fFnT?= =?us-ascii?Q?+QwQz7RqYqQvamxT663xC11iL4Y0k5Du1jEyYD//zFeflF9Xt9Vn3Ux++pJe?= =?us-ascii?Q?JAmgUXf6nH8kJuTSpchE+VRfV2zc2dnb5BlI4yRHLOkAX86zLY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ZbT7MB2Sx8cDMMlREwNDXczaaN4g=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)(1800799024)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 12:07:07.2504 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09bd4595-fc83-4b6d-3184-08dcf2920cce 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: SJ1PEPF000023DA.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8504 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 All control flow rules in NIC Rx domain, created by HWS flow engine, were assigned MLX5_HW_CTRL_FLOW_TYPE_DEFAULT_RX_RSS type. To allow checking if a flow rule with given DMAC or VLAN were created, the list of associated types is extended with: - type for unicast DMAC flow rules, - type for unicast DMAC with VLAN flow rules. These will be used in the follow up commit, which adds functions for checking if a given control flow rule exists. Signed-off-by: Dariusz Sosnowski Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.h | 15 +++++++++++++++ drivers/net/mlx5/mlx5_flow_hw.c | 11 +++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 18b4c15a26..80829be5b4 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1796,6 +1796,8 @@ enum mlx5_hw_ctrl_flow_type { MLX5_HW_CTRL_FLOW_TYPE_TX_REPR_MATCH, MLX5_HW_CTRL_FLOW_TYPE_LACP_RX, MLX5_HW_CTRL_FLOW_TYPE_DEFAULT_RX_RSS, + MLX5_HW_CTRL_FLOW_TYPE_DEFAULT_RX_RSS_UNICAST_DMAC, + MLX5_HW_CTRL_FLOW_TYPE_DEFAULT_RX_RSS_UNICAST_DMAC_VLAN, }; /** Additional info about control flow rule. */ @@ -1813,6 +1815,19 @@ struct mlx5_hw_ctrl_flow_info { * then fields contains matching SQ number. */ uint32_t tx_repr_sq; + /** Contains data relevant for unicast control flow rules. */ + struct { + /** + * If control flow is a unicast DMAC (or with VLAN) flow rule, + * then this field contains DMAC. + */ + struct rte_ether_addr dmac; + /** + * If control flow is a unicast DMAC with VLAN flow rule, + * then this field contains VLAN ID. + */ + uint16_t vlan; + } uc; }; }; diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 0084f81980..fbc56497ae 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -15906,7 +15906,7 @@ __flow_hw_ctrl_flows_unicast(struct rte_eth_dev *dev, { .type = RTE_FLOW_ACTION_TYPE_END }, }; struct mlx5_hw_ctrl_flow_info flow_info = { - .type = MLX5_HW_CTRL_FLOW_TYPE_DEFAULT_RX_RSS, + .type = MLX5_HW_CTRL_FLOW_TYPE_DEFAULT_RX_RSS_UNICAST_DMAC, }; const struct rte_ether_addr cmp = { .addr_bytes = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, @@ -15930,7 +15930,8 @@ __flow_hw_ctrl_flows_unicast(struct rte_eth_dev *dev, if (!memcmp(mac, &cmp, sizeof(*mac))) continue; - memcpy(ð_spec.hdr.dst_addr.addr_bytes, mac->addr_bytes, RTE_ETHER_ADDR_LEN); + eth_spec.hdr.dst_addr = *mac; + flow_info.uc.dmac = *mac; if (flow_hw_create_ctrl_flow(dev, dev, tbl, items, 0, actions, 0, &flow_info, false)) return -rte_errno; @@ -15952,7 +15953,7 @@ __flow_hw_ctrl_flows_unicast_vlan(struct rte_eth_dev *dev, { .type = RTE_FLOW_ACTION_TYPE_END }, }; struct mlx5_hw_ctrl_flow_info flow_info = { - .type = MLX5_HW_CTRL_FLOW_TYPE_DEFAULT_RX_RSS, + .type = MLX5_HW_CTRL_FLOW_TYPE_DEFAULT_RX_RSS_UNICAST_DMAC_VLAN, }; const struct rte_ether_addr cmp = { .addr_bytes = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, @@ -15977,13 +15978,15 @@ __flow_hw_ctrl_flows_unicast_vlan(struct rte_eth_dev *dev, if (!memcmp(mac, &cmp, sizeof(*mac))) continue; - memcpy(ð_spec.hdr.dst_addr.addr_bytes, mac->addr_bytes, RTE_ETHER_ADDR_LEN); + eth_spec.hdr.dst_addr = *mac; + flow_info.uc.dmac = *mac; for (j = 0; j < priv->vlan_filter_n; ++j) { uint16_t vlan = priv->vlan_filter[j]; struct rte_flow_item_vlan vlan_spec = { .hdr.vlan_tci = rte_cpu_to_be_16(vlan), }; + flow_info.uc.vlan = vlan; items[1].spec = &vlan_spec; if (flow_hw_create_ctrl_flow(dev, dev, tbl, items, 0, actions, 0, &flow_info, false)) -- 2.39.5