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 BC7A3A034C for ; Sun, 13 Mar 2022 09:39:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7DFD24068A; Sun, 13 Mar 2022 09:39:32 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2058.outbound.protection.outlook.com [40.107.243.58]) by mails.dpdk.org (Postfix) with ESMTP id C9FA24068A for ; Sun, 13 Mar 2022 09:39:31 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PwVjFVARzmW6RgHQbHapmL+pfO3ixCavcXNfZ7T9IuPQ1jaGUldUW2kARPS4PK5gha9xZd/VpQuba2F3fSOo10xqx4m2R+prLt3gdduGmSOLBP4/mEwFLy2qXppZ2MdCirSMU5kDWpMqcjIdyTmmNjMdPO9cCuYUs6H9BvOssslHwDRZdS9vUsBN0/5f+coLyj1Ypiavq6y0V9uduxVO6RP4dVGJt7Wbx40y6ZJztBxj/oWVXOtbVsYjf5mheE+rA5y78975Pr+oJl9fzqP+4dAaZ/J+M2tO7TOvX+eaQMZxxS+zN9PjbPBvMdtMcQ2jWmTmPiTdl2XgQzkxmO3AuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=rd53MU/H91NqkU6D0UaxCP1E+12yqq0H44ZNfNDuevo=; b=jXesc50re2MPcYnbmjYY/ASz96a1ohRmgsjCb2rpA97UD3GYvgwPSwENjkf3qNbxWdaeOZxQjBcOixfLmGhHhqVGRsyp2VqWfcT16G3m8Gczju7LXC1wLBpjrP83ugk5tX7xWg0jDOz7ZXNXhkAQMcJEKSVW0o5vN6SSiygIRHSFzNaiGKQJ0iZ45lJFJp07SzA772ZHM2qFvjL/QV5cOgrjYEuRhFtg8nVKV1Xc8UuQ9D9nIIy9suiXCPG9n3lQCxJdwU0a0WbnUfW5rx8FGRXYBqojXUOsyqcbt+kHwxLuO7QaZk0aPfJQconjV2yCkIE8UnvhjAcuJr5oMPTFPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) 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 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=rd53MU/H91NqkU6D0UaxCP1E+12yqq0H44ZNfNDuevo=; b=fctTYwVKxQZfU94KMcCSgU2Z69Qpi91c7QuEND9e2su1DHoUK2xYveSTeS1HY0KL4qc+SsBG4w73QgUt8jP5xCQb6VhEgDVdsq8Klw1EL6Bzpd51gss5Y4R4BINE0Eiy6HCDJdOT+0ghjM8d2eb6GxVsNFN4y/qCC+exba6ySPBblV5dW/rO3UJt55/OyM4gRyd0iZtlbNRplsu5fUM36TQmNnGha3jQ7jF7ZkBtD8wxHtTmbML5Tqt0B15BetMHbtYM/HlXIA/v/+N6xatesOIhymgooDQKLNj1W/9ttLsuxHDXTyd+NFGGqzgxQ5fsK1FYg64jqDfMYYIKkgqcfQ== Received: from BN0PR07CA0002.namprd07.prod.outlook.com (2603:10b6:408:141::17) by MN2PR12MB3311.namprd12.prod.outlook.com (2603:10b6:208:100::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Sun, 13 Mar 2022 08:39:29 +0000 Received: from BN8NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:408:141:cafe::c0) by BN0PR07CA0002.outlook.office365.com (2603:10b6:408:141::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.25 via Frontend Transport; Sun, 13 Mar 2022 08:39:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT024.mail.protection.outlook.com (10.13.177.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5061.22 via Frontend Transport; Sun, 13 Mar 2022 08:39:28 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Sun, 13 Mar 2022 08:39:27 +0000 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.986.22; Sun, 13 Mar 2022 00:39:24 -0800 From: Jiawei Wang To: , , , , Matan Azrad , Shahaf Shuler , Ori Kam , Yongseok Koh CC: Subject: [PATCH 19.11] net/mlx5: fix NIC egress flow mismatch in switchdev mode Date: Sun, 13 Mar 2022 10:39:08 +0200 Message-ID: <20220313083908.12990-1-jiaweiw@nvidia.com> X-Mailer: git-send-email 2.18.1 MIME-Version: 1.0 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-Office365-Filtering-Correlation-Id: 84b9c48a-6c31-424d-550b-08da04ccfcd0 X-MS-TrafficTypeDiagnostic: MN2PR12MB3311:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RxorioSEG4FeDVYMbkGhmdzCzDx+jx8ZrMOY6C7QVHd9/lPNTzY08sSDufsGXAuShtYFgmlJkFuGj7rg3j0EMcBz8Ag3s60JhwonhovnahFfjSKF1dn48F4paMb8Ppof9OHgcKHhRIuit53mEPU+wJfetzhcvgryZRagTS4vRQqdFsucXeCnJ20nMHRfkOBPjJTKyJ0B6dusNaLDM2Ew8AF+SE59utx67stjd2GBiAbH468TvxaZx4sdCEhplcnxFekPkwP2fFYPP34SSId+fkVCTyLP2mPHB7bnrMxNMrkzIu4u9JZ33aiwaPGPDObGdt33LZ7SgCAhsQZnV/QibC4941Nnh2kHy5Gq7wpwaceW6aF+8o3DFNPbZIPcykG/eBdJQdtJT2zySy9TLDxo7mSbch/w7ZjKNlhvMZF3mFtr1sRfpeIhKtYhnSzrm4583ccLxDno9cXYjUSd93p6F8hILdCvJI4WL/U3ZanWiys5F61po8OPgLQe0Yby1zZr4cMk0Ie4tXFGX9WOO2j+uXBIVgncSXx6VR8GLYYHUnjImebcFn3IvvItk+lJ4Jl74/F5bPWyZcOheoL2RA+EF+Z7Zip8uHsIREe/VuYDRfPiUSV77V6uXoYev55OpeBDXmqyDtkNJiHiVxnEAzFLIMNlhjORodU/9a6Qy3/ico+E3OuEZDwI5yI3N3RoF0To8pl9teIU6U2clKw7VG1DDQ== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(55016003)(81166007)(356005)(36860700001)(336012)(426003)(83380400001)(316002)(36756003)(47076005)(110136005)(8676002)(70586007)(70206006)(5660300002)(6286002)(7696005)(8936002)(6666004)(2906002)(4326008)(40460700003)(86362001)(186003)(26005)(508600001)(16526019)(82310400004)(1076003)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2022 08:39:28.5822 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84b9c48a-6c31-424d-550b-08da04ccfcd0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3311 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org [ upstream commit 6d4f1066be6cd60a95f21ef07a16a3c3676c5cd9 ] When E-Switch mode was enabled, the NIC egress flows was implicitly appended with source vport to match on. If the metadata register C0 was used to maintain the source vport, it was initialized to zero on packet steering engine entry, the flow could be hit only if source vport was zero, the register C0 of the packet was not correct to match in the TX side, this caused egress flow misses. This patch: - removes the implicit source vport match for NIC egress flow. - rejects the NIC egress flows on the representor ports at validation. - allows the internal NIC egress flows containing the TX_QUEUE items in order to not impact hairpins. Fixes: ce777b147bf8 ("net/mlx5: fix E-Switch flow without port item") Signed-off-by: Jiawei Wang Acked-by: Viacheslav Ovsiienko Acked-by: Ori Kam --- doc/guides/nics/mlx5.rst | 2 ++ drivers/net/mlx5/mlx5_flow_dv.c | 26 +++++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 546f0dd4c2..8f7b285271 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -241,6 +241,8 @@ Limitations from the reference "Clock Queue" completions, the scheduled send timestamps should not be specified with non-zero MSB. +- The NIC egress flow rules on representor port are not supported. + Statistics ---------- diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index dd62bbbbfb..f7e3d92045 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -4833,8 +4833,10 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return ret; last_item = MLX5_FLOW_ITEM_TAG; break; - case MLX5_RTE_FLOW_ITEM_TYPE_TAG: case MLX5_RTE_FLOW_ITEM_TYPE_TX_QUEUE: + last_item = MLX5_FLOW_ITEM_TX_QUEUE; + break; + case MLX5_RTE_FLOW_ITEM_TYPE_TAG: break; default: return rte_flow_error_set(error, ENOTSUP, @@ -5313,6 +5315,18 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, NULL, "too many header modify" " actions to support"); } + /* + * Validation the NIC Egress flow on representor, except implicit + * hairpin default egress flow with TX_QUEUE item, other flows not + * work due to metadata regC0 mismatch. + */ + if ((!attr->transfer && attr->egress) && priv->representor && + !(item_flags & MLX5_FLOW_ITEM_TX_QUEUE)) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + NULL, + "NIC egress rules on representors" + " is not supported"); return 0; } @@ -7891,12 +7905,14 @@ __flow_dv_translate(struct rte_eth_dev *dev, /* * When E-Switch mode is enabled, we have two cases where we need to * set the source port manually. - * The first one, is in case of Nic steering rule, and the second is - * E-Switch rule where no port_id item was found. In both cases - * the source port is set according the current port in use. + * The first one, is in case of NIC ingress steering rule, and the + * second is E-Switch rule where no port_id item was found. + * In both cases the source port is set according the current port + * in use. */ if (!(item_flags & MLX5_FLOW_ITEM_PORT_ID) && - (priv->representor || priv->master)) { + (priv->representor || priv->master) && + !(attr->egress && !attr->transfer)) { if (flow_dv_translate_item_port_id(dev, match_mask, match_value, NULL)) return -rte_errno; -- 2.18.1