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 7D2D3A00C2 for ; Sat, 12 Mar 2022 08:58:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 467AA4068A; Sat, 12 Mar 2022 08:58:36 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2070.outbound.protection.outlook.com [40.107.101.70]) by mails.dpdk.org (Postfix) with ESMTP id 90C744068A for ; Sat, 12 Mar 2022 08:58:34 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=loAkrCQkv0vj2GHe/G5qvhJS9DKNhfHr9kAAOZS6eruOARJSDMtejXCrwEvD1ow5lzGENSfqGuJdvv6TzShbELZwfQ9aSDt13bAKAH5wZbH5jrPoNtbd1nTEN6Jd0LroNm+dQ3+v+NDNCg25w5RUmSdaTuB7Me2u0wXRmt2Vfe1ZyVurD3r2jf/9uc4uP11bj9DzlKQqvlBBp/lHE3sxhlazK4u2B5UEcNTd4O9CukipcMLqGrFrFPwAFasf4weAAJ5imhLMFVySldThni2lllVBO60+cgnU8TKtU0l4DErMxy4BLFnP3z5T1PIZ0AyPDKqMzC8ZhD1PEUYm4uumUg== 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=PMDfMTmlf2HrLnXecSxJXHXk8A5cdrxWL1Nf44YCkyY=; b=eaVTk5G3mYenz9JxCKklfc1F0Rj5Q5JOgeba3WOiB3VFPZflNllpctI7uWMVcuC4iLowrTS/r2gUX4hfejfT6H0Nmmmo/cgKnFRyK2ASGz+QU8EM9nrDUt0/fx2XxPCUU0Zd0rXsF2JfQg8yEpJUQHDvohIgnrBj87OVCh3YXUbuP4180nB+Zbafv0UjRvJi29k8+uMfzM7hK25KA6qNDGVlOfIB4rqNSv+hKS04yDjk/P2w0fqmPfhZqezrnCLxqjivzrxT3n0RyoPyftZCg/8nwEaFQAXTxLu1waIcRn/78RMug44iWGZautWDk+KBL3Adhcg6eIQiZtM+B+9F2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) 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=PMDfMTmlf2HrLnXecSxJXHXk8A5cdrxWL1Nf44YCkyY=; b=XwWeXEJtyhIB0bMbIE+WYgvpGA+yFt8HaxQykkXHCm9KDK9aM1imXH4cuaDBcjd0eN1877w8HSEM2TPhRkK0QZl2FOcIYDnHTBYi5y694zJ9AXGdQENktIH+gcMO8mms4k9C94CuNCtBXXAGkYzmD/CEg17Ei/r4CEomkUefuM1SfcNXXAtcwuOhfpS6hXGzGxb3OdGm2/p/0yBK/vLgQWYvGkwfncKT84BbtyPF0f/BAq7yaafh+/fyjL5AU6Yb7iP5Bm8NRaf1UHiOBQZjxTaklJhVYVT4X3LvE1aIP7UeiqWRNalHyZvWhr6jrGrCAVSCk1gSA0g0tByabcQ0qg== Received: from BN1PR12CA0006.namprd12.prod.outlook.com (2603:10b6:408:e1::11) by MN2PR12MB3726.namprd12.prod.outlook.com (2603:10b6:208:168::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.24; Sat, 12 Mar 2022 07:58:30 +0000 Received: from BN8NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e1:cafe::94) by BN1PR12CA0006.outlook.office365.com (2603:10b6:408:e1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22 via Frontend Transport; Sat, 12 Mar 2022 07:58:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) 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.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by BN8NAM11FT018.mail.protection.outlook.com (10.13.176.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5061.22 via Frontend Transport; Sat, 12 Mar 2022 07:58:30 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Sat, 12 Mar 2022 07:58:29 +0000 Received: from nvidia.com (10.126.230.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; Fri, 11 Mar 2022 23:58:26 -0800 From: Jiawei Wang To: , , , , Yongseok Koh , Ori Kam CC: , Subject: [PATCH 21.11] net/mlx5: fix NIC egress flow mismatch in switchdev mode Date: Sat, 12 Mar 2022 09:58:11 +0200 Message-ID: <20220312075812.10804-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.230.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-Office365-Filtering-Correlation-Id: f2ceb5aa-ce9a-4bf0-055f-08da03fe191e X-MS-TrafficTypeDiagnostic: MN2PR12MB3726: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: NHQ/vvy/usMt33ZDNpVJvfNALPO1XvVDWCpsWJpjrJVSav2Av2igJBiix3c1rmKlFn+htePM0zGmMYmN8XOIVsAZRyfwc2FH/qE10bxvMA4lbI86cQTwlSyHhhiBOqhy1QNUvNeSb0kEzRnONYlCDi/lA9nNJ9uFS5c+0JTb/kSeZvzhDfv3GcVebThkpk7dXcVN8LLEVx5G1fpKfgeKTim9b4pPKIWnV8CjLyorerWWLpt+tW2vM6pjjspKdZ8heW3IXjV1Vk7s5kKwmA93QPMdpOIjw0cYdrDbasmNw7939uNBXuejU+fnYDjL6kLdaPK9YMl9Hj5NO21hfLD43HPy0w/LCSdXaWzkyn2qaJd6JQJqIfXsKiPN8k/C54tWvQ8ewQvd8M4Wro9kJWT/VZUddorp6CnIsK+H6dr+P2pm7qZdx7b4O4Lj1h26G6ieTh6yM9X6bk7guI7x7/wguRTcY3Le5BIwcIQyoiqqiZLvBPukgsVl/I3+snuDyCkgp696f31JV+2ZFV7054zRUt/pqfQOC+6DTYVmR/EUK+v/MiNW/w/hI4oeFi4G8pqaGtDYvyclPzwKjiF8qnp5rW2s/rlEVBHP/GAiu1V12PZPbJUXhPlCkmnF0Nb5lAmNma+ZWfv93UD8CHNfgnNI4Mk0a5V+ZesJIHgewMP/FJBjCheK894vkiUJ2wzUNAj6mqXjkjoOUOJO8KNA2oqhyw== X-Forefront-Antispam-Report: CIP:12.22.5.236; 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)(5660300002)(8936002)(70586007)(336012)(426003)(86362001)(8676002)(4326008)(6666004)(40460700003)(1076003)(70206006)(82310400004)(316002)(26005)(6286002)(2906002)(356005)(16526019)(81166007)(107886003)(186003)(36860700001)(508600001)(2616005)(83380400001)(47076005)(7696005)(54906003)(110136005)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2022 07:58:30.2602 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f2ceb5aa-ce9a-4bf0-055f-08da03fe191e 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.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3726 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 e3242a6bd4..8610ffb25a 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -508,6 +508,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 1ed0ebb3d9..28843fe9e6 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -7236,8 +7236,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; case RTE_FLOW_ITEM_TYPE_GTP: ret = flow_dv_validate_item_gtp(dev, items, item_flags, @@ -8071,6 +8073,18 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL, "sample before modify action is not supported"); + /* + * 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; } @@ -13648,12 +13662,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, attr)) return -rte_errno; -- 2.18.1