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 2570C41D6F; Sat, 25 Feb 2023 21:19:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B41741153; Sat, 25 Feb 2023 21:19:06 +0100 (CET) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2070.outbound.protection.outlook.com [40.107.102.70]) by mails.dpdk.org (Postfix) with ESMTP id 111C440DDA; Sat, 25 Feb 2023 21:19:03 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BBwsldmujXBplJQ5nb6Kbqs0RaivckshRkfST9Zgb0LUmh4iUXPenj6NVIBTgYDKKpUt/kGotChKs+L/pf24KRuD9nAT2NOxRH//DRdg5CP2NGa7tG0m5/OrN/i/BGHeVbGklmzEptFvc3NCH5d6YqnJZf3Eay3C2Ubp0PYFZIxFtmUW6uKY1Up72b5deY2xMflt+UIGKNeOEBSgaHXx2MNV0XXx7/irD7EkjSBrIhFnq7iJkE6CKbHyIKa3aFI8WnmYdpkfMVxOXx6yhNcsENteZSQKZm2eVG+Qnq7NsFoSYuSVPFqG6UkVZ/mLx86m2yq7nOtsDVZSFQ6eNlz+gA== 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=YFXfRFO8njpWGrJMUwINcpCVl5pxsVnJLSdONuXR1a4=; b=QLEo9PSm2OoB8KEzHzePoFKWIkWVs9Vdq1FcwkBbVNoR41ACdfYN9kjpKjTgR4+kUzy0cWk1PyD5nhYOQWbvXFLYqa5Bg49BJW5zYqkQqMEtbESxt9ixFSHEOWnOi3lSqdGsf48m2KDGAHkHBrh9r59ep9Oo9vzvuejCqzIvMftn0YZ+/lMXSYwnxfpdk0aTmZq2IUOYRwWeDQtm27y28G8Z+gWotpoJrnj+hk98m1R4dFgM5wgic1doAsbI9BvqaWqochnJ65DHw1As77jj0mQ/N1naRRXG8RYww3ECd06X3t5UkYToq8+uS4ILU9BXHb7Q1m2C35P9l/nQIC9Rsg== 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=YFXfRFO8njpWGrJMUwINcpCVl5pxsVnJLSdONuXR1a4=; b=m/w3Cut/hnUd8nrnrgHXPzYZZlzUxR+U5FnL1YBYPaiVMz46yjE7ysqJ+lLfPKOvh8MF7zEZn1rk5gzWHaoJ1nkUF2NoD23+zABkQx742Pf2qg0I0qRMwhfE2jESWISKZHTLmt+IWEO49Q3xc8fNXTfW86V/pcPKftRtVVn1fCNOSQiyIrKu9dkgt65JiEIqoh+tsk/TROos83LQuHFBfxHg1mawnjtoxfCcWV8SUwZUJGhEFLGBanQRT0rlOMJH2ykxfJY9aUo5kRne0y7vgbgj7aF3o9xeCBrogY7yyQo0ouqvdFj3lMu7N+XDiuz0dke2EiY2kKdSDGCY0pOObA== Received: from DM6PR04CA0011.namprd04.prod.outlook.com (2603:10b6:5:334::16) by CH0PR12MB5027.namprd12.prod.outlook.com (2603:10b6:610:e2::19) 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:01 +0000 Received: from DS1PEPF0000E643.namprd02.prod.outlook.com (2603:10b6:5:334:cafe::e5) by DM6PR04CA0011.outlook.office365.com (2603:10b6:5:334::16) 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:01 +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:01 +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:50 -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:48 -0800 From: Dariusz Sosnowski To: Matan Azrad , Viacheslav Ovsiienko CC: , , Ori Kam Subject: [PATCH 1/2] net/mlx5: fix egress group translation in HWS Date: Sat, 25 Feb 2023 20:18:09 +0000 Message-ID: <20230225201810.10838-2-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_|CH0PR12MB5027:EE_ X-MS-Office365-Filtering-Correlation-Id: 840747f6-85cd-4d08-3331-08db176d8891 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ye2MrXpNC24sTTKI70taCY7aICXJecjStd6uNHNYQuXbFu3fdGZIYEN1OO0jBCMVoh4WB/4JJuH8G657neTed+++w1iluuTNks3vjC141K8O7YrYSFXWb8wDVf6EsDJ1e6CC3YRMbPmTj1MAbVazYk+VKAFwKF4q140vdmAGDCEPJMZ3X3DPZjyEMt2sGNYEkf0VbndhZp1S+yZGDUvvLMr2JKIfwkrXNN1zHs8f+VLyFUFurvt0hrH1/KSo6Ua1mTCLIM/f4GxgDzcGhLIYETe7wSP3SQVIcvNcxyeFKBvp6WCTV5HtCV6j1DTjsEW1rwHpQeIPqU/7trMup5VIGS9mVt5fnqCn9YxvgVnZU/oFD2bWTcqmHP3kghtry8RR/6a9/e1T4Dl+ND8iQm/1165ERPFP9icX2Ku3tYdwcyjbOZRb7GQuP0E2vuXxantBGLdr2L07+7XUXn/raEHVkqhfTS3IUGF7HUy8lXQqqtoLwMUriukHqK13rn7UGRycAquy3FQ8RHrB7k8itHjkb6ALgPO2/6dK1epGeFImrK5mWf8DKOJeYpM5rRBeeSFL21PEmWqzpdUnsn6eYtgFVsPc144lOukF+1ZR5IS8yGfa4yb58DnqGp4+kHHbMEM5Ru0pstWuKhN0OJIdoNE+CXPItzY1JKpK98Oc3bbhSj1uB8nzKtsEyFQjd19TsEYcJAP5+kKZ7ClF92dFHPK5Fw== 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)(346002)(376002)(396003)(39860400002)(136003)(451199018)(40470700004)(36840700001)(46966006)(426003)(47076005)(54906003)(110136005)(6636002)(40460700003)(36756003)(356005)(36860700001)(55016003)(26005)(40480700001)(86362001)(7696005)(7636003)(186003)(16526019)(6286002)(82310400005)(83380400001)(2616005)(1076003)(82740400003)(336012)(5660300002)(6666004)(107886003)(478600001)(8676002)(316002)(41300700001)(4326008)(70206006)(8936002)(2906002)(70586007)(450100002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2023 20:19:01.1586 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 840747f6-85cd-4d08-3331-08db176d8891 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: CH0PR12MB5027 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 With HW Steering enabled creating egress template tables and egress flow rules on E-Switch setups is allowed. To enable it, PMD creates a set of default egress flow rules responsible for: - Storing representor ID (vport tag is used) in HW register. This is used for traffic source identification. - Copying software metadata to proper HW register to allow preserving metadata across domains. Structure of these flow rules and whether they are inserted depend on the device configuration. There are the following cases: 1. repr_matching=1 and dv_xmeta_en=4 - An egress flow rule in group 0 is created for each Tx queue; - Flow rule matching SQ number - fills unused REG_C_0 bits with vport tag, copies REG_A to REG_C_1 and jumps to group 1. 2. repr_matching=1 and dv_xmeta_en=0 - An egress flow rule in group 0 is created for each Tx queue; - Flow rule matching SQ number - fills unused REG_C_0 bits with vport tag and jumps to group 1. 3. repr_matching=0 and dv_xmeta_en=4 - A single egress flow rule in group 0 is created; - Flow rule matches all E-Switch manager TX traffic, copies REG_A to REG_C and jumps to group 1. 4. repr_matching=0 and dv_xmeta_en=0 - no default flow rules are added. When default egress flow rules are required, they are inserted in group 0 and this group is reserved for PMD purposes. User created template tables must be created in higher groups. As a result, on template table creation PMD is translating the provided group (incrementing it in that case). Before this patch, a condition used to check if translation of egress flow group is needed was incorrect. It did not allow translation if both representor matching AND extended metadata mode were enabled. This patch fixes this condition - translation is allowed if and only if representor matching OR extended metadata mode is enabled. Fixes: 483181f7b6dd ("net/mlx5: support device control of representor matching") Cc: stable@dpdk.org Signed-off-by: Dariusz Sosnowski Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow_hw.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index a9c7045a3e..d3d86fe24d 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -3260,14 +3260,18 @@ flow_hw_translate_group(struct rte_eth_dev *dev, "group index not supported"); *table_group = group + 1; } else if (config->dv_esw_en && - !(config->repr_matching && config->dv_xmeta_en == MLX5_XMETA_MODE_META32_HWS) && + (config->repr_matching || config->dv_xmeta_en == MLX5_XMETA_MODE_META32_HWS) && cfg->external && flow_attr->egress) { /* - * On E-Switch setups, egress group translation is not done if and only if - * representor matching is disabled and legacy metadata mode is selected. - * In all other cases, egree group 0 is reserved for representor tagging flows - * and metadata copy flows. + * On E-Switch setups, default egress flow rules are inserted to allow + * representor matching and/or preserving metadata across steering domains. + * These flow rules are inserted in group 0 and this group is reserved by PMD + * for these purposes. + * + * As a result, if representor matching or extended metadata mode is enabled, + * group provided by the user must be incremented to avoid inserting flow rules + * in group 0. */ if (group > MLX5_HW_MAX_EGRESS_GROUP) return rte_flow_error_set(error, EINVAL, -- 2.25.1