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 23AE0A04A5 for ; Wed, 2 Mar 2022 16:31:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 133074273C; Wed, 2 Mar 2022 16:31:31 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2040.outbound.protection.outlook.com [40.107.93.40]) by mails.dpdk.org (Postfix) with ESMTP id 0804C40141; Wed, 2 Mar 2022 16:31:28 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UFMO6XJz5P1sOge2DVHYJvN1tnEZNnJqj9SeI/xCbBrKG7nl/mg99rxdXldk43aWnkOqJXcIqvIrMzak+K8jwnPq/94vsch78PCiw/M+riiIqHn4SFeeAn63+ho0sUai0CzTAtsHmSOKJRvXrCJH6O/lTF9eGV8MgLyY5zek9SjOsSpe2uho0gglmgV2dzLF1xT6GegQGiu3qgpzgqqj/rPpapUq3/lUnP4iUA8tECAHr2DY1UjDvWDyBkMchuD/OzXDmGERkcb7PRHjF8rmy/i+ngLhdjsPvW9ybTG+dgcM6mFSLHdDD13UIQtDwxZRhnpXIxnGfIXdFOJ0LO4nxw== 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=76BKivRi0bUkcJPSOGAg83OODG46jJtcYBuTbc5fyJ8=; b=ABDoDpHZuGey2dKkOWTKHQZNyH693EQw/ldW8SFe/aZWMWTBARMDF0QchzGvGnnihQsdvp3WXjtJlqSrOG6l0R1BhbLd408Qdw4E2e7ApXsemERk5wsOGxTQAt9HM8WkaomglCUeSZT12A0/i0xJI4pX9Yz2p9oaWCqFrkeuBhs1tkXwPjrGN6rcPDzN2cnf95SbpmQhEFlI3xDFXcLrDsC0heY9q5wGpIL5Tx9k1BLgfoW7dbSSBu+eSF69jeo/dRsc8cX7MnBlR2pn+PTZdxieDaov5sN8zwWQB9UfojuttHq4McXN9SIjYKpYw3CITDd+CeO8Ga3DVBSDYHFaEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) 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=76BKivRi0bUkcJPSOGAg83OODG46jJtcYBuTbc5fyJ8=; b=M36NntfgifdPt6YpJRWzmE5wsod3gZLTdDPJb1aPmE36/+3MJz652ZprDL25Clr2YD7ZOuYyt1r4ZxbtrMMuAnXUNHojGaK7OQlAl8uF1Ww3UkIUfE5c8GB4tVUUv9ResJ7tNE03x3jSmf/c6QUeszqPqCQ1vATnqlS9OgUNEzSQDH0B9ccJdOnfiNOh4zuIDwO83gfZ7DjTolHTAPzt0qZF0oJRjA7QKqxSGRHjYhCOwbPNDJw5tLYKCvRKdM4j1vQ7WQ+/MyMoTWkOFxSIUr6NK7iDZvDisTNVOG8ZQDpT42+GeH/METylDa1j031w3/lrX53Lv9C93d2GhITsNQ== Received: from BN6PR2001CA0020.namprd20.prod.outlook.com (2603:10b6:404:b4::30) by PH7PR12MB5926.namprd12.prod.outlook.com (2603:10b6:510:1d9::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Wed, 2 Mar 2022 15:31:26 +0000 Received: from BN8NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:404:b4:cafe::f2) by BN6PR2001CA0020.outlook.office365.com (2603:10b6:404:b4::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14 via Frontend Transport; Wed, 2 Mar 2022 15:31:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) 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.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT057.mail.protection.outlook.com (10.13.177.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5038.14 via Frontend Transport; Wed, 2 Mar 2022 15:31:25 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 2 Mar 2022 15:31:14 +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.9; Wed, 2 Mar 2022 07:31:11 -0800 From: Jiawei Wang To: , , , "Yongseok Koh" , Ori Kam CC: , , Subject: [PATCH v4] net/mlx5: fix the NIC egress flow mismatch in switchdev mode Date: Wed, 2 Mar 2022 17:30:51 +0200 Message-ID: <20220302153051.45530-1-jiaweiw@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20211105084051.20159-1-jiaweiw@nvidia.com> References: <20211105084051.20159-1-jiaweiw@nvidia.com> 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: ed65682b-f5bd-4dc9-744b-08d9fc61b6a3 X-MS-TrafficTypeDiagnostic: PH7PR12MB5926: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: 277Xx6fCkaK3xIoNbzGXjKQSB3ih8Uki3u6tztIKN+O+f4YbRBUYIZBrHEZ62B2Qlyj9RUEJF0SeKpsbKVq30zsTTBPjQGSVNqAC4l0xBH+98c3z/OrCm9Ve76pjO+EylggEwmxAL2NcuTgaLvq/3xF0/lqkk6KUCnL8cTjrxRu3azz21bgwsxUFhRVjqKK323w+OJtDN4vX0di7S0BCts2jTKa/odFJeqPx1knEoEWEhkYcBMHddcpDYJ4vIFz+NxUpHxMIlRrhPHM0E24SD9iJMUNNByC0hUd1QJ7WajvgjfIlvngcQaD4RdCR0/ONccxffqnOmrBQZ8H64N6KBO3gpZi/NRzm1J1E4p7LVBqyFvezgS4fBu7Ah5FKd1FoiFWaGektLlOqTby+EH2LPa5D0MUaSj63l4PLeu2QpiVYdrb2ZyTJEo9rkuUsS5T2xOjKsXjsNoEyzj5dzk7YIbxWLT50H41YhSlfzOJkFsbHZ/y3lKN+C0p/fzO4Dl2yrxKPj2xd3z7M8p8yYuKgLr2XHNYTy33tXmhJlFcxkN/vZRDxd/uvnIcj0Ul5n1N8z9Ze/a8LCjwcj0+G56nZ8BcagVRZuss+oNLZzHwCcTBZl2rLDUmfYpvdsk8+lZGhFKnfC8eJ/rbzCUL+t2YgjqYHrhQqx1ha5hIm3tLTFa2eGBU6DjKzcDgAaM0JvmydRWZMFPYEZuCwwx9frxcauA== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(316002)(40460700003)(2906002)(6666004)(54906003)(7696005)(110136005)(508600001)(86362001)(5660300002)(82310400004)(8936002)(55016003)(47076005)(4326008)(426003)(2616005)(83380400001)(336012)(70206006)(450100002)(36756003)(70586007)(356005)(36860700001)(81166007)(186003)(6286002)(26005)(8676002)(1076003)(16526019)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2022 15:31:25.4109 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed65682b-f5bd-4dc9-744b-08d9fc61b6a3 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.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT057.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5926 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 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") Cc: stable@dpdk.org Signed-off-by: Jiawei Wang Acked-by: Viacheslav Ovsiienko Acked-by: Ori Kam --- v4: rebase v3: update the tx_item checking v2: fix one typo --- doc/guides/nics/mlx5.rst | 1 + drivers/net/mlx5/mlx5_flow_dv.c | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index c31a154181..acf37bd862 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -504,6 +504,7 @@ Limitations Matching on checksum and sequence needs OFED 5.6+. +- The NIC Egress flow on representor port is not supported. Statistics ---------- diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index ae88a1cc29..b596144159 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -7212,8 +7212,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, @@ -8047,6 +8049,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; } @@ -13732,11 +13746,13 @@ 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->sh->esw_mode) { + if (!(item_flags & MLX5_FLOW_ITEM_PORT_ID) && priv->sh->esw_mode && + !(attr->egress && !attr->transfer)) { if (flow_dv_translate_item_port_id(dev, match_mask, match_value, NULL, attr)) return -rte_errno; -- 2.18.1