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 0B34741D6F; Sat, 25 Feb 2023 21:19:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2808941140; Sat, 25 Feb 2023 21:19:07 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2078.outbound.protection.outlook.com [40.107.93.78]) by mails.dpdk.org (Postfix) with ESMTP id 3F60B40DDC; Sat, 25 Feb 2023 21:19:04 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cO8ad0y0kY4WDrKGrL3lB0SJogV87QB8N+KlfDfzVQrBYuTdICs00Xu4JAHdyWnBqJqF4iCJKPFFk4xDw0eHcsgpkPn3ncXzTHr3huHqGa7UxqwFVVvzw1ppxCEOR1gBjEQQoVOHMhzfxzn2Q/pMqA64o9JCj9sZAhx2A4OqSruMdkThmRLqX6n7f10vdbcynW67t4xwwqKW5wuDRBioME00Tl2U7sqODSUpOnzL+KUkpO8tOrEoXEsUonryTHw5CDZgr8q3+duXCAz42KCS6pYBCveIqaHyHdIZ2mV75toTnmKoFWTGw/lDqqfnPC9qGPSQDxDW0TMB7Q6HqD20jQ== 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=ELopWrRJSht5Fin+6x0tLdbHBKbzexewSAthFmoaXwU=; b=iwwNzRIBG7PvFRZmx/G+HMzZu/DnfdPwsoRRsEDTWz2VYNpg7Op8K4TA2uIBGDhi53PuBkhOJk3OlDTiBCdf25Z5rFYrk9gMHomSzLFzojHd5/R6CMAPYsDt/s8+CY/VZGUX1wNWF+AMORR0e0WgEHYp8OrcExDNvRfHg2cqx2T1iLOz1B1y/BDpVPXHYbL8gh85zDIZ4KTt7xIgXoIY8fGVw6hq8P7IypFcutgFFYjSNX+ALs83dPzvxfLPXDHGfx0EJVa2Q2NM7Xwfk1QmU3kX6xvHznrzS1yNp7GpUOxahnsRLa98uVPn4iXGJBeQJwdEPBuEbyPpOCTZjnbShA== 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 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=ELopWrRJSht5Fin+6x0tLdbHBKbzexewSAthFmoaXwU=; b=g8PJWKCoc2fTFIUb25MefDMThIrVmmb0qPkha4fRYJxhvMTf3pExPtfPwmTyiWRiRxeJUAOidRO83GcoeUO7EQVyFoXuXlLc77HgxlKUXl66ZCorKIjpzYNyREQNIwhIq/ecRiRyOX0prq4oee69lnxxTOwVwOk1udlg2ML91boWX2+urvyZG6nhsneAtQOF3P796nMmBeQ2mQWqJjPV2dG6PDqG4rwlD3DqycCHhJT0VVqF9ORtsZbeSIRWvwkC0DbN5BEM1FesDrZfKK6cXDleZUIErSrqSl/6peC6SCvgPbHuiUVvHCM8fiTzIFar50S08vxsO7Nr/0laTHOc7g== Received: from DM6PR04CA0015.namprd04.prod.outlook.com (2603:10b6:5:334::20) by CY5PR12MB6429.namprd12.prod.outlook.com (2603:10b6:930:3b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.25; Sat, 25 Feb 2023 20:19:02 +0000 Received: from DS1PEPF0000E643.namprd02.prod.outlook.com (2603:10b6:5:334:cafe::76) by DM6PR04CA0015.outlook.office365.com (2603:10b6:5:334::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.25 via Frontend Transport; Sat, 25 Feb 2023 20:19:02 +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 DS1PEPF0000E643.mail.protection.outlook.com (10.167.17.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.12 via Frontend Transport; Sat, 25 Feb 2023 20:19:02 +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.986.36; Sat, 25 Feb 2023 12:18:54 -0800 Received: from nvidia.com (10.126.230.37) 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.36; Sat, 25 Feb 2023 12:18:53 -0800 From: Dariusz Sosnowski To: Matan Azrad , Viacheslav Ovsiienko CC: , , Ori Kam Subject: [PATCH 2/2] net/mlx5: fix isolated mode when repr matching is disabled Date: Sat, 25 Feb 2023 20:18:10 +0000 Message-ID: <20230225201810.10838-3-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230225201810.10838-1-dsosnowski@nvidia.com> References: <20230225201810.10838-1-dsosnowski@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E643:EE_|CY5PR12MB6429:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f3b39de-6213-443d-8bbf-08db176d896c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Og5s7QWyCBp2CQKNCUaX5C6qVIa08f5LZqfMRxW3f1B/Yke/Tm0bXODgoLhnHIGMBeObFiMOiuCqcsZbCVijk9cHrE9OEbC5cGlqbU2CLVUB35HxAaSlOUQZBd6bzobCmEYV/zI60b2EDxczZ9wi21CULlO+uXOe6ztvT1z+XSZQfz0n8Pv13ft/VCtCvcFJYa+x7L0Yc+oH7qb30VlqO/OIe4TYGQq4cuXCSz+chKwjfmM9SjoCUtlV5BDW0DwA1gdHBGNzYdWLFUrdX0kTbm/EDQ2nvHBZAyM+WyN5ouPkgv92EaQXbNA/RHZqHMvJ//s7Sxio72EcxF4QULQ/jBZ4ptYkTNDe0ai1pMMKTuBOsnDieMx4i+OQIi8ajV8pgPis/B9fcfMOqtzZExwfj+7fCHfJ6ZyGe+P0A/o53ph/tUF+oYGus3NWlkT0we80Ut2JSce/v2fldYuL/hVl74jOUhY7xNvI1Ea/1k7ox5v3TWPhLul5REYv+IqU9VQO9zRU0KY1fv4qRmWEmTlCHERn65iQOIhMJGkyohTfnZb+d55diJLYdH4i3AROjrG9wzFgBwjQuC6SDYi2YN2mgymd2wtpX8Lpc3KRSwt1nERBGELtCt80u0g11ba7y/nDeF5sIKfTWwDWFfv8DIJcJII1MQTnS10ZfhWcHKiaQOY/ar7BV5/VSp0znXEd7BAe3PCLUdN2WjCz6lKVslRC9x+YEvCiU19DaFma8L8Hs+w= 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:(13230025)(4636009)(136003)(376002)(396003)(39850400004)(346002)(451199018)(40470700004)(36840700001)(46966006)(47076005)(40480700001)(186003)(26005)(6286002)(316002)(16526019)(40460700003)(41300700001)(450100002)(4326008)(70206006)(7696005)(82310400005)(70586007)(426003)(54906003)(55016003)(8676002)(110136005)(1076003)(6636002)(478600001)(6666004)(107886003)(36756003)(2906002)(83380400001)(86362001)(356005)(8936002)(2616005)(336012)(5660300002)(82740400003)(7636003)(36860700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2023 20:19:02.6117 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f3b39de-6213-443d-8bbf-08db176d896c 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: DS1PEPF0000E643.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6429 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 In HW steering mode, when running on an E-Switch setup, mlx5 PMD provides an ability to enable or disable representor matching (through `repr_matching_en` device argument). If representor matching is enabled, any ingress or egress flow rule, created on any port representor will match traffic related to that specific port. If it is disabled, flow rule created on one of the ports, will match traffic related to all ports. As a result, when representor matching is disabled, PMD cannot correctly create control flow rules for receiving default traffic according to port configuration. Since each port representor in the same switch domain, can have different port configuration and flow rules do not differentiate between ports, these flow rules cannot be correctly applied. In that case, each port works in de facto isolated mode. This patch makes sure that if representor matching is disabled, port is forced into isolated mode. Disabling flow isolated is forbidden. Fixes: 483181f7b6dd ("net/mlx5: support device control of representor matching") Cc: stable@dpdk.org Signed-off-by: Dariusz Sosnowski Acked-by: Ori Kam --- doc/guides/nics/mlx5.rst | 3 +++ drivers/net/mlx5/linux/mlx5_os.c | 16 ++++++++++++++++ drivers/net/mlx5/mlx5_flow.c | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 6510e74fb9..350fb0287e 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -1137,6 +1137,9 @@ for an additional list of options shared with other mlx5 drivers. - 0. If representor matching is disabled, then there will be no implicit item added. As a result, ingress flow rules will match traffic coming to any port, not only the port on which flow rule is created. + Because of that, default flow rules for ingress traffic cannot be created + and port starts in isolated mode by default. Port cannot be switched back + to non-isolated mode. - 1. If representor matching is enabled (default setting), then each ingress pattern template has an implicit REPRESENTED_PORT diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index a71474c90a..2cce0a7f0f 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1613,6 +1613,22 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, err = EINVAL; goto error; } + /* + * If representor matching is disabled, PMD cannot create default flow rules + * to receive traffic for all ports, since implicit source port match is not added. + * Isolated mode is forced. + */ + if (priv->sh->config.dv_esw_en && !priv->sh->config.repr_matching) { + err = mlx5_flow_isolate(eth_dev, 1, NULL); + if (err < 0) { + err = -err; + goto error; + } + DRV_LOG(WARNING, "port %u ingress traffic is restricted to defined " + "flow rules (isolated mode) since representor " + "matching is disabled", + eth_dev->data->port_id); + } return eth_dev; #else DRV_LOG(ERR, "DV support is missing for HWS."); diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index a6a426caf7..7ee30bdd1f 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -8077,6 +8077,10 @@ mlx5_flow_isolate(struct rte_eth_dev *dev, "port must be stopped first"); return -rte_errno; } + if (!enable && !priv->sh->config.repr_matching) + return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, + "isolated mode cannot be disabled when " + "representor matching is disabled"); priv->isolated = !!enable; if (enable) dev->dev_ops = &mlx5_dev_ops_isolate; -- 2.25.1