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 7534FA034F for ; Fri, 12 Nov 2021 13:43:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F8DC40692; Fri, 12 Nov 2021 13:43:02 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2084.outbound.protection.outlook.com [40.107.94.84]) by mails.dpdk.org (Postfix) with ESMTP id 5FBE140692; Fri, 12 Nov 2021 13:43:00 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g74V3UECsH8ftHNMvWTfKUj+Kn0sxVYWGmt+Pjros2m5Hp2zJWogg6iRH9CC5JTpQRxafAomsMFssQ3soiVtHAtoIS6xcjVRSyvKCrSCTCvJlY1WbztJaetSd0oXwXpF22xet6qj/Xix0XX9bGZo/uIy0kDwS/264zHAF8xIJ43nPXDQ0iwDIA+KgErC3GxvJNaICPRgiHS9rS1HDZSnm6CWQJfYJnLZXBR3BtyiambmUWT5WTlnupF+BU6deXUMIxFUJR23Qd6O5eq0K4rSGgBCHhuvIN4UvnQgJhHUjYDz2oYW6VvRGfClzYKZeT8z5hHCZP2h3Uz3nrJq96X5Kg== 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=0oyN0qM/GYvenu6kG/mGfptZifUEJ5wELdOvKz5T7mY=; b=jyaQJV6l0icfE21YdN084NtAY0dSJvfJGcoQazlNW8vQvtbxDf2CNIBYsYrxdDIpDZ40PkgPQI3pXEE0NJLFCakD9cLpU5n6VMC3cizIV9nAhKM/GV1CJg5/aAU+T0b++T56g8VS73aiiRZH2Y0i9o1Bm4mXFMhzFr9OA7KoMyvSkNXYmZa25zjsIhat9ztD5jrvox5YKST9JqmI+G22yXTnxFQzeCkcBQjigN/mojmQ581Qc1FcQHFgFcbu8amw9CrCMYshzhkP7SNS4mocjUz8tXau2HpfnGnfp93vz8Ybpp21jA27noVaqSpLK5VJJSSx1QxhUT5xZKdycbpxQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=0oyN0qM/GYvenu6kG/mGfptZifUEJ5wELdOvKz5T7mY=; b=seQlQmapmDJ4ZJ+sQ5Nl3qYpDgkjo5rRB3EwJ8vb55o0SKVmxkmaxHWcAZpWRTpCWehfreAwEiVw3i3KMAMV5vhAi45rICf6klwhLxF4NE+AhpPn4GDXAamH9ifk3S0liNoHdytAc+xtYxk4SvL4YU5tUEiiJjU6zPmuJ2JRDjiTqhiiEh+tlXg3TP4QUjXQbn0PJGagPPaQN20v0j1bKt8KrFSezbFEqZZpeAS0qwZg6jLXMY6q5ckxE+eWrWOxcxI8Z/jgj1jTyQZdve1YvYWxhLZNCJQ26gipmY6vsS/MKJQlMM27jy52Elt8VjJ4WQV/H3sXAkMZzI41rkSxqw== Received: from MW4P223CA0020.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::25) by CH0PR12MB5235.namprd12.prod.outlook.com (2603:10b6:610:d2::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16; Fri, 12 Nov 2021 12:42:58 +0000 Received: from CO1NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::ff) by MW4P223CA0020.outlook.office365.com (2603:10b6:303:80::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.16 via Frontend Transport; Fri, 12 Nov 2021 12:42:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT015.mail.protection.outlook.com (10.13.175.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Fri, 12 Nov 2021 12:42:57 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 12 Nov 2021 12:42:54 +0000 From: Jiawei Wang To: , , , "Yongseok Koh" , Ori Kam CC: , , Subject: [PATCH v3] net/mlx5: fix the NIC egress flow mismatch in switchdev mode Date: Fri, 12 Nov 2021 14:42:35 +0200 Message-ID: <20211112124235.9191-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: [172.20.187.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf703750-1f89-4c5d-89ef-08d9a5d9f412 X-MS-TrafficTypeDiagnostic: CH0PR12MB5235: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v4JaJo6E027AUU/BYmHfYMq7BdvYnR9T3+ADq8SBXAsNaJf0Y2T470Bme9Lsy4IzssRyddEXcyG47X7e/Jw/SHHBxlhJUlIm0IHFr5YDE3kxzupwC4fDxMs646VKEOS10FVTLVgRLybuQ1rX0A52bT9iOzfalSWN9cTPMGargVBL14obuqQiAAFREBpJERIXUE6qPhZzXIlxIY96n5G/+4boZFZ3MFHpwvPDTWFJDrQpYA8bT3PRCv/IG10MRCxeKlkwW+dk/Qq6z0sJbaXWEB1S1hervJQV7fMsCQTZs0oWPDOrSoUokUNFsjsP0sH5qYH2qf+S30cByxCCF5+Q3cTs4Rly7MARZpZ2kRmPaO++CP+lhhieSqQUGiHiX2kVD3aKbBFbGywFD3POwu0uQfaMNd4vH6xgINHIN8k4b3cflitzn78BgEP+iBA9+cfkIJciFJiHuLVvz1JFqaNZ9luYJd0K1RTKd/7z9ozGUQKYnbODUmK07exDaaZHeJdoxb7cWPctCaGRhLbsfljUBS1dc1B943yKZ10/nxSKMzwlJkLtLK0dgDKNMWJKblmkrj8PPf34hmYCnVyLiWmCfvPOWAaba0pSCMdsIV3kYlx/3bz42VrvT7pzX7zLBVDwVmX7XH1Vht8d0kZjqY9M3qzYLfUapsRuIoUcq7JiH5Ng5xP5v1iCF72YPjmJxamMGg9F5OCxw6bFMPW2DatVYA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(1076003)(82310400003)(6286002)(70586007)(2616005)(26005)(70206006)(316002)(508600001)(83380400001)(8676002)(336012)(186003)(16526019)(86362001)(426003)(55016002)(7696005)(4326008)(6666004)(450100002)(36860700001)(2906002)(5660300002)(36756003)(7636003)(8936002)(54906003)(47076005)(110136005)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2021 12:42:57.0348 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf703750-1f89-4c5d-89ef-08d9a5d9f412 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5235 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 --- v3: update the tx_item checking v2: fix one typo --- doc/guides/nics/mlx5.rst | 2 ++ drivers/net/mlx5/mlx5_flow_dv.c | 24 ++++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 043d006a2b..267d25ebb8 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -493,6 +493,8 @@ Limitations completions, the scheduled send timestamps should not be specified with non-zero msb +- 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 28911d6f0f..201f04ca84 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -7164,8 +7164,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, @@ -7999,6 +8001,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; } @@ -13563,11 +13577,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) && + !(attr->egress && !attr->transfer) && (priv->representor || priv->master)) { if (flow_dv_translate_item_port_id(dev, match_mask, match_value, NULL, attr)) -- 2.18.1