From patchwork Wed Sep 18 13:46:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 144256 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 029E3459CC; Wed, 18 Sep 2024 15:47:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F0CCA42E6A; Wed, 18 Sep 2024 15:47:02 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2059.outbound.protection.outlook.com [40.107.94.59]) by mails.dpdk.org (Postfix) with ESMTP id A8B484003C for ; Wed, 18 Sep 2024 15:47:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CJjoEOgy3/WLziYjX+O3J9aoAZnEqlk2dj1uAo0d1mIJoGLOdjyZ+dA8VtQfi7dqDjCLe5cyeLvOZlDg5/TI2I7gEfoqQ6h0zIDQcaAgaA1c8h60HcW5mk/RnwPLDq9caq6M4oMx+YMCOoXXr8vAKnkmOo4Y4JadOLZc8mdNJ/SxJ9baWKi8ldTdlYhiN+Haa8lM4zQu87CXFkqWKBpYthMORmjYYeYnG0GPGaL7hmjLoeaY2gTf4Z441UUmgq3zYqZvvj41AvMwae+QPjdsLDRjJpsGtW9X0/FgLZ4kJXgZsurRBfVu97JvDhPkLgBR+0W1iClOhB/+KMaXYtfRhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Oe5tj6B43ohZN1QiavkR2Pr8MNFZHzhxToDEmYbKsjI=; b=AKQqVkRaGOUF4XgeEuPllc5JYe6Sg6RM90MzaGqiMk84auwwp2A8x7lmsomBDcEHSZNhLMEYLiNp31QwnFVpELvRO3s1VZ5xJrpkJDcTavJbYHpDQX3VvI1mPIOI6p3BsDhaAw2UPSCkPbwpuzIdBp7xiepzvXha/GSZIDdXNkISrYoXIIvqCCl4m1hRgfCSeGR2NQSBijsM6CEqBWI8I8OQEFwVAuUFTb2umopxO3G0xdKpJZBN8m6XITx/b/8UiqZTyhiL7pfgahkSvWqwIc/kASohvw5tEs8ycHLcZWc15Ycbkbr1NI88YBxHoKO76NKZ5+lojqd0aU9WJ2c9/w== 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 (0) 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=Oe5tj6B43ohZN1QiavkR2Pr8MNFZHzhxToDEmYbKsjI=; b=q8qBtSZddmRpDujsN/bJ+guLpDOuaVgOqjQaF3/1nRkjYRh1F9Q/ifp8tX4GDIM7KqGXrP66PpN67uivnyVRk0q2N0YAYbF+hmpceG9F7CK5wKCM/ydkgJLPBbs4rajTYyMtGxWNj459VeHAMniLyl82q8KQhjGZxRaHXjnT/x5lPhd0eKQ0EBu/VJipWzOSESoIOMsIEPJrRj7lm4yHW8TDH0Z0j9W1AhUrF0I3QMvMnHW5WgohQMTVVgvV7UjOHBJ8wpdu6X8wlb8HQhtM8JvwNutwY4/4fPbKU/EWeNrgWVS3xul3TnxdNzj5zter5JhgKnO9bxTpzZ8LMwzdXw== Received: from CH0PR08CA0027.namprd08.prod.outlook.com (2603:10b6:610:33::32) by CH3PR12MB8283.namprd12.prod.outlook.com (2603:10b6:610:12a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.17; Wed, 18 Sep 2024 13:46:58 +0000 Received: from DS2PEPF00003447.namprd04.prod.outlook.com (2603:10b6:610:33:cafe::95) by CH0PR08CA0027.outlook.office365.com (2603:10b6:610:33::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.30 via Frontend Transport; Wed, 18 Sep 2024 13:46:58 +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 DS2PEPF00003447.mail.protection.outlook.com (10.167.17.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Wed, 18 Sep 2024 13:46:57 +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.1544.4; Wed, 18 Sep 2024 06:46:46 -0700 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.1544.4; Wed, 18 Sep 2024 06:46:44 -0700 From: Viacheslav Ovsiienko To: CC: , , , Subject: [PATCH v2 1/9] net/mlx5: update flex parser arc types support Date: Wed, 18 Sep 2024 16:46:15 +0300 Message-ID: <20240918134623.8441-2-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240918134623.8441-1-viacheslavo@nvidia.com> References: <20240911160458.524732-1-viacheslavo@nvidia.com> <20240918134623.8441-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] 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: DS2PEPF00003447:EE_|CH3PR12MB8283:EE_ X-MS-Office365-Filtering-Correlation-Id: 4805123b-f51f-4c8a-3bcf-08dcd7e85d62 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: rj4Xoyfs0EY4Obf1+NqRdTlyf8DuvA1IX/mzRmKRHE44WIYM7bweWPXRVYu0YDvdkiesPdLcjX+oVV51bzzWEqj106CxsveVfcCt8U1z6evWhtdv/OBJ3KMwBdBR+X/Wqj7ug9jxJW9OmNXSoFrEEDLGp52FX/PHO+2I89Vjz+lQvA77YHVW/Sb7zW8dOaYlyEsdxaASTPhfUegosJrPEd89MzAr5OhZ23OQGyBDeJ6ffx5XCwJQdduvCulmwlncrVXKZwa3kqPMwG/7fJ32cPO3PQ0fBdy945ldFyhz0kQ2S6PLAV4zU7bcQuJVBLX0hA6hiKwgus6M7YV6VcMkbvKA1PQ+W4YTPpSAepn/bhQT78xBGUJ2+q2uiMFlJ2nwEE5+D7rGwewllyUk5LrYNVFoMinrDREKwwGgur58VMREitKO0a+R4FPIsOrmxYYD/ni5ZMgG6nINhto2IcsSWrPR8kyME3desAgNXphmgD2qbyEKXH+E4Iq6SD+3BvyDpakAaUQ5DfvAou0cpsdi6MYgHBu4dR1tS3v7rHVG6nHj/kkt2XEKHAILqEW8h/p0TDZkkitDA0K15oTnj3uYWWUmVngZSQrJW3Q0ssJggm7lcfY9jIRN5T0K6EIyuyzICCMiIPZddVDouw6yd9dlzd+qRZDrABhawfnqJ6oQVlv5qywfbv7PonZRyoBTE7OUI64DxqsXdOvFlY5EngUJnIyfdEvSct4NAIm3HE3zPsFFKoKUApnOGqkSI5DF+sbxT1i3+oBjU2LNJ5vQklZEzWVuyCu5vDcF7JCyenso09CCyABQpAtrxouN17KKK34Zge12mHxT9z66Gz6udTIwHbRp14IGvOq4o1d25e6aRBE7qZGKcvOQvrfGb3SVPkcIrsQzavSaddJqVooae2fzcV8OlauWfNUG3O7uUC/6im2Im3204hwUTTYlwpo7um8019HSSYCpGnmnMwSzT4bwpH8HjRoWRyChVAd73yOkmkF/X5X+w9+XCckn6AuBh52GOEFUbStvj/YB269+OoUSTKAvUGUBUb4HaMqTSvdLznfLiuVXOkLEt2yphN2X/VqQq8txW7Fe3acM3152HfycN1RYydls6fAWTCoCeofl8uOWBLboc8q0zY2M2mMfqCvBO0yOon8KKkf7MXVktAo8Ns3K6CLjVfRCLXqvc4MQkhHN7yDUhuvsq3bKUjSNwvY7nfjKTeje/RDco579sDb4r8+w/t1N9hnDID+aBrFvoi8+NU7P47TtL+L1gezIgvGtnS2zPDRYTnPtQTPVv+hHRQbHOqtgjJkJS7x1ODqp5DkmxjkRc5gf3SBLD0VUXuvlLRea/kBYUqPQzw23uNkMMniwF0ge4fxKdeyrwnhu+3uFp4KMfFQLsclEv9Kn3Zwh4gdjTgcJdhShOpT9kd9Djc3D0t8YOo7Drxxen+JCEWhqLqk7g+tL2ijTjE8IZ6dA 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:(13230040)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 13:46:57.7465 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4805123b-f51f-4c8a-3bcf-08dcd7e85d62 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: DS2PEPF00003447.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8283 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 Add support for input IPv4 and for ESP output flex parser arcs. Signed-off-by: Viacheslav Ovsiienko Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5_flow_flex.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_flex.c b/drivers/net/mlx5/mlx5_flow_flex.c index 8a02247406..5b104d583c 100644 --- a/drivers/net/mlx5/mlx5_flow_flex.c +++ b/drivers/net/mlx5/mlx5_flow_flex.c @@ -1111,6 +1111,8 @@ mlx5_flex_arc_type(enum rte_flow_item_type type, int in) return MLX5_GRAPH_ARC_NODE_GENEVE; case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: return MLX5_GRAPH_ARC_NODE_VXLAN_GPE; + case RTE_FLOW_ITEM_TYPE_ESP: + return MLX5_GRAPH_ARC_NODE_IPSEC_ESP; default: return -EINVAL; } @@ -1148,6 +1150,22 @@ mlx5_flex_arc_in_udp(const struct rte_flow_item *item, return rte_be_to_cpu_16(spec->hdr.dst_port); } +static int +mlx5_flex_arc_in_ipv4(const struct rte_flow_item *item, + struct rte_flow_error *error) +{ + const struct rte_flow_item_ipv4 *spec = item->spec; + const struct rte_flow_item_ipv4 *mask = item->mask; + struct rte_flow_item_ipv4 ip = { .hdr.next_proto_id = 0xff }; + + if (memcmp(mask, &ip, sizeof(struct rte_flow_item_ipv4))) { + return rte_flow_error_set + (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, + "invalid ipv4 item mask, full mask is desired"); + } + return spec->hdr.next_proto_id; +} + static int mlx5_flex_arc_in_ipv6(const struct rte_flow_item *item, struct rte_flow_error *error) @@ -1210,6 +1228,9 @@ mlx5_flex_translate_arc_in(struct mlx5_hca_flex_attr *attr, case RTE_FLOW_ITEM_TYPE_UDP: ret = mlx5_flex_arc_in_udp(rte_item, error); break; + case RTE_FLOW_ITEM_TYPE_IPV4: + ret = mlx5_flex_arc_in_ipv4(rte_item, error); + break; case RTE_FLOW_ITEM_TYPE_IPV6: ret = mlx5_flex_arc_in_ipv6(rte_item, error); break; From patchwork Wed Sep 18 13:46:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 144257 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0F790459CC; Wed, 18 Sep 2024 15:47:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4D24142E99; Wed, 18 Sep 2024 15:47:09 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2046.outbound.protection.outlook.com [40.107.93.46]) by mails.dpdk.org (Postfix) with ESMTP id A10E84003C for ; Wed, 18 Sep 2024 15:47:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZKZJOYCMW7hUhATnk40gSASmMaAKjXMuDj2PIU3EoNtn5B7qNCEud+rNILBbHIasGPyMv75w7rHspRDWHeQ1UMi8p19wZDcKCNxIZvOPSjymICFGEnIrjHoDSO9APWWR+l1vsEpkwqKnpjArXNeUyOJws3Hk43Q6Vh5DDC456EXUclZYSbgbvo7i1V/SsYMiWJgdaGYej3ak5umnfkgFEWhBZoakXFpZHhuX9sqm1YlzuXRuZkIflr/60QKc9KpVbHPlo6neM2gQFMyTFjomdf3aCBtebrPMEniQhduSpPDqroXvVw98TgLLw0E1EOE0HbPSMu96K8PWnDCrbPgxzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=JUHFXR/iypxVaBnUrJiOXHwjWAFGlhBW+xgNZMcOHlc=; b=mD4gsLGMcj9lfVnoYtFX26DGclMQTi7K4KMjsEXP6ImXiaQMnMm1xn4MwRLA/aYuatOK+txg/2XYXNsUeSkgAGmgm8rEbNeXx/KmtKakZm7QCaSaw5PPQGacbghYOYwp5+fzspzWkvKaEkhuWKEpmahCoZKygDrkLFET8aAE5prHCQ9fZNxGT//vtMBPzI/ebu4q6pE02iEqcRH9D39vXW/0p7JQ00zhDwIxHxRH4oUF1Uj75lOm2Iy0EDPUbr/yBx1PCH5iuUK90vQ6ZUg/muaA6WfPDw2RCZN2+Ua1HS8giX7jkOQ5fKwgwu2vYgibIqEkyS8rqgJVG20coyeJ8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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 (0) 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=JUHFXR/iypxVaBnUrJiOXHwjWAFGlhBW+xgNZMcOHlc=; b=o4PIXQPCf5HOGsW3vfa+xwnURY5ihpvMJ+yxoLHgApWQLidUUhYc9WUViBvYsVxMx9zjFD21KooN+wGrGUIZV8JExVAu8Ymokxe2ndKsqhklTK8T+xTGPyL0gItbeNe2laBLt4fOmBMBExz4dty8q5wqfiqL/JbwWCt0TDnMorO4NTx8HTanJICFKh+C+Bon006o1DGInB5U+XDp7aA4uO/aNCjKRZd3fsC4VUEiN4pfG2tdNGkdhq6oeBCQsoB06QdAVvb14YC3s+Oy8pPQP+s7YIz5x4XqfMRa2WqqX3zice7QvJJbrxeWCHdi7ejROzIXWZNkpTpAeSrO+v4BWw== Received: from MW4PR04CA0384.namprd04.prod.outlook.com (2603:10b6:303:81::29) by SJ2PR12MB8691.namprd12.prod.outlook.com (2603:10b6:a03:541::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.24; Wed, 18 Sep 2024 13:47:02 +0000 Received: from CO1PEPF000044FA.namprd21.prod.outlook.com (2603:10b6:303:81:cafe::2) by MW4PR04CA0384.outlook.office365.com (2603:10b6:303:81::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.30 via Frontend Transport; Wed, 18 Sep 2024 13:47:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000044FA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.1 via Frontend Transport; Wed, 18 Sep 2024 13:47:02 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 18 Sep 2024 06:46:49 -0700 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.1544.4; Wed, 18 Sep 2024 06:46:47 -0700 From: Viacheslav Ovsiienko To: CC: , , , Subject: [PATCH v2 2/9] net/mlx5: add flex item query tunnel mode routine Date: Wed, 18 Sep 2024 16:46:16 +0300 Message-ID: <20240918134623.8441-3-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240918134623.8441-1-viacheslavo@nvidia.com> References: <20240911160458.524732-1-viacheslavo@nvidia.com> <20240918134623.8441-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] 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: CO1PEPF000044FA:EE_|SJ2PR12MB8691:EE_ X-MS-Office365-Filtering-Correlation-Id: 81078821-3cc1-4293-39fd-08dcd7e85fef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: 9xOdZKGbHEz9qGc7eC/L8ZFb64+Xf1fRRAMAMELwBwqSV8Dk1LY11Pv2Ec0xN+LgYNPvO8sN2oHTCf2z2LSkzh1pzb8taemvoCyrepWu6GqPHA1SKoWrV0ReHO8K/LNjlzxszDPR/XFcfUQkjF0VB0oIJubjiyh8qmXaDj/LPf3MMMxfjGOXUZRjctiPsOc1nFUwtzzNu8kZdTtf0P1hBPYJxbO9I8pgouO6gC788Ozwj9Fln9viqjjYLroQvnE6NMgn+TK6pyGajhC+rcAqvxX34yYa87Hmy6ieSXc3wKRnXT/RRDBS2dG9Dsq0Gen3LSvw1z92JIOExWHMnrbLbXfTB3hal9mesRXr3y3Rj7DWbCD7PzGaisrBY7fEzkC3NmbdPExp/goQh7nWxuRElHKP55PY9Pkag+upOLGtzDD/Imzg2nUmy+fmtJWWloWIn865sB0bdiUUUWsWG3if59ORveWzPJ5EUT1DG0Ze27/QF3hMvVB9QvGf15IdE3RwbqZ0AmU8/SzWXYB+LX3A2ASIk/qSwgIeMGHTYv2fn0vnQuORZOms2j7xbR8hckVSE3dwXxRvD7Cvl1df0zpHjwwQq+a+eI4A594oDbwYa4Sa8e/FQ23q/aT92dR2oyTBp8NByKezBc0V97arv3atdhgKhEzGsOSKxMhdhlpLAq4+JhWtMGEQClMcKyMAwH88abU5rCrBuUp3VqNWDnaRVrf+EZ/CiUU5APwiPEzUM/s1XYWW4qp/6sz2CtnxZ9FK554utrbZNVwSUMyzaZBbt9mWh5T3e4Air3NVvYFrjCbgIaYghc2IwLxUmxA0Xo/RXSbL6jfpAuGhgPmNpqFqehCKsnJiz9Q7rUZnTP7XOnki7Ort2je36FnmrrYp+4fFuBbwEXqgLg+xgS1QJLzdD56JRx9qRey2HCsBYSqoNlY0OFA5qOWoYzjnrsuBFQ2NVttUMDIOYErr+WA//RSUfUvDtcOV1puXt9eQLtBZdqm5qX203XsRi7KdtgF9lVECr09FTpx99IaEbGxw7NPiCM9x7ro/Ps9nRQ3bDFGunTBQhthPBs0/zDu9qfheqoM3a85AxyOWKJudmyV5lnxKGT6I0Wl18ngjlgt3uuiPOzT7CyNAgiHG/nvK1WO4FpH0U8ssOiIqdc5aUCX4Rb1QZDt+ozRwRyFhgp3TU+JKJgVv5MOYTn51Yziv57WpN4MaykO5iQtaL5NEhdAQssggRWLJRriJqwRVKlHoXvueDL1QjklGBMzcYxcZ44mTkbnlRDttZNCU46WmrDT/fDg//8/oTYSEDedsLDxN9bSYtBZM5ktdEIGT3+bTKNEUzSZcMGpraKtj4nq9/RUJnbjeR5o6JzgxOw46xHmUiAPlI7ipiJDXP62z2a0vcVy7Rnc2c7x9tc6LmFcg91h6I0z1TV7hqJVcpXtQzUGygxGIg/2ZQ4+/3tZZSmlpZmOp4i5t X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 13:47:02.0728 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81078821-3cc1-4293-39fd-08dcd7e85fef 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044FA.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8691 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 Once parsing the RTE item array the PMD needs to know whether the flex item represents the tunnel header. The appropriate tunnel mode query API is added. Signed-off-by: Viacheslav Ovsiienko Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5.h | 2 ++ drivers/net/mlx5/mlx5_flow_flex.c | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 869aac032b..6d163996e4 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -2605,6 +2605,8 @@ int mlx5_flex_get_sample_id(const struct mlx5_flex_item *tp, int mlx5_flex_get_parser_value_per_byte_off(const struct rte_flow_item_flex *item, void *flex, uint32_t byte_off, bool is_mask, bool tunnel, uint32_t *value); +int mlx5_flex_get_tunnel_mode(const struct rte_flow_item *item, + enum rte_flow_item_flex_tunnel_mode *tunnel_mode); int mlx5_flex_acquire_index(struct rte_eth_dev *dev, struct rte_flow_item_flex_handle *handle, bool acquire); diff --git a/drivers/net/mlx5/mlx5_flow_flex.c b/drivers/net/mlx5/mlx5_flow_flex.c index 5b104d583c..0c41b956b0 100644 --- a/drivers/net/mlx5/mlx5_flow_flex.c +++ b/drivers/net/mlx5/mlx5_flow_flex.c @@ -291,6 +291,33 @@ mlx5_flex_get_parser_value_per_byte_off(const struct rte_flow_item_flex *item, return 0; } +/** + * Get the flex parser tunnel mode. + * + * @param[in] item + * RTE Flex item. + * @param[in, out] tunnel_mode + * Pointer to return tunnel mode. + * + * @return + * 0 on success, otherwise negative error code. + */ +int +mlx5_flex_get_tunnel_mode(const struct rte_flow_item *item, + enum rte_flow_item_flex_tunnel_mode *tunnel_mode) +{ + if (item && item->spec && tunnel_mode) { + const struct rte_flow_item_flex *spec = item->spec; + struct mlx5_flex_item *flex = (struct mlx5_flex_item *)spec->handle; + + if (flex) { + *tunnel_mode = flex->tunnel_mode; + return 0; + } + } + return -EINVAL; +} + /** * Translate item pattern into matcher fields according to translation * array. From patchwork Wed Sep 18 13:46:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 144258 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6C17B459CC; Wed, 18 Sep 2024 15:47:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6918742EAF; Wed, 18 Sep 2024 15:47:10 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2086.outbound.protection.outlook.com [40.107.237.86]) by mails.dpdk.org (Postfix) with ESMTP id 352F04003C; Wed, 18 Sep 2024 15:47:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jpX6jhZbBZFgqpI1AJ7cfGtCEd7Ap36jzNlHKKA8HzZcpru5joK/60pm3K25kaqf6BYO9aheT3x7vOkNb0I0ktTrL+CJCJDqXH9CkvWFrwTViaZq/pOD57VY9M4H3g/4QiC1nmOeDDTRjbxoy4zCLhwzACM5mQoWRlDF4p201IeMwS6jDNkhZGBoPFwws30tQG2r3KqfxJ3Dmwr6urFaqaSJhgoCP42Xemm9IrKkaV/Qp0TKkbelx+qqc6Adr0w3q3fjTbUWCCGrED6+y2A1c+2M7emxsr5+0/z1ycJezyYlEfQu0sK+HAhEmcd8T7Y0Wrfl8AVOxYn7syAU6KEzzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=rdPmsvdslUaM1o5rEOuC5UU41/qiYF9UubL9o3sDPFY=; b=aQBrh4V6YA1KtlFGN6QRM7mJNwJlKvAOw93li73zxqx2Hr1yG7ASxANA2RtOJn38FQmf79qYlgwJ2ow6P69gJ8xLC+vhnHArTaTTXHeOLjDjWifxB5Ibm8hwJysVCPWtClC7at32iCs5sP0M2EB7e3kED1rJ+9h3iKfwoSn0+ZW8vxoDsVS3UL7oOmwyIS0PUdhsNY7uHndoSi/KT4/QOyI/weN37JqQ6rMvg2z6DaeUpkv6pqsVq9NVnyst7J6Ba65gELpgrbDgfVamrb/AKSwff52VN7ipWQkclMpw3M3ADDawIMiHkFimLPlYkqs39RKEpe5UztM9IBwOKagOPw== 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 (0) 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=rdPmsvdslUaM1o5rEOuC5UU41/qiYF9UubL9o3sDPFY=; b=ZGH4lc3NguT7Gwk9ZxYPWJ8+3XukU70728A1FUfqVhKvVAWTi1g0+PPshTOuTPHE+HetJelsKzNL1aW5FQKJcE9IwEPcSc7UMqB88oDo+u21l6uS/2j/eQnvcOQUUBtakIy2WIHNueOSVhlwNGhv3582SSb6nFt0yxSwiXRuHNc9G1gvZOu3bWN7oqn3mEi+J4tjm781arh1MXa0Oj8WNP0S9LXgDnQJsWkTWylzhn7BHZIQc5tl4CvwzLpzmo+0TVpdSjIfmOV3FyN5IVzdlI1P73AtjgCVSw1BVELfkuBjk0h5yb/a6EOqaPT8HCjDU+b4XDEzfoR/U/9//6Ywrg== Received: from CH0PR08CA0012.namprd08.prod.outlook.com (2603:10b6:610:33::17) by LV8PR12MB9408.namprd12.prod.outlook.com (2603:10b6:408:208::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.16; Wed, 18 Sep 2024 13:47:04 +0000 Received: from DS2PEPF00003447.namprd04.prod.outlook.com (2603:10b6:610:33:cafe::51) by CH0PR08CA0012.outlook.office365.com (2603:10b6:610:33::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.30 via Frontend Transport; Wed, 18 Sep 2024 13:47:04 +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 DS2PEPF00003447.mail.protection.outlook.com (10.167.17.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Wed, 18 Sep 2024 13:47:03 +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.1544.4; Wed, 18 Sep 2024 06:46:52 -0700 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.1544.4; Wed, 18 Sep 2024 06:46:50 -0700 From: Viacheslav Ovsiienko To: CC: , , , , Subject: [PATCH v2 3/9] net/mlx5/hws: fix flex item support as tunnel header Date: Wed, 18 Sep 2024 16:46:17 +0300 Message-ID: <20240918134623.8441-4-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240918134623.8441-1-viacheslavo@nvidia.com> References: <20240911160458.524732-1-viacheslavo@nvidia.com> <20240918134623.8441-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] 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: DS2PEPF00003447:EE_|LV8PR12MB9408:EE_ X-MS-Office365-Filtering-Correlation-Id: 8206ca94-6518-4a91-38ab-08dcd7e8610b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: Y0cTwE45WNNuk8ZXrBRqZSOaazphYZ6swVO/21VwYraxYUr/W/YV25FalyRSZqo1yQKs405Jt4fKXCvfYHn6b5MwXz7XVK/VWBQIBYsU60nQFS6LOOItyFAYL8Xa3+GjF+WKUfSwws+QQJY6EKsC9p3ArlyuyD2fWZsyYAj7hzeeVdtf/nzPatGI71EvIk2KBOdBkncax6Vn0z6WriNmDqQtnuNohtOOiCGhX2iq/+ueX1/yqiW895w9GoqatYpjpimdyxJrnClYweBjsCI31sw98HSIZaqV/wdJAgjbh5UKbpdwDrQdaGcezhlTmWxJLSqvmsoiZi+H12Ew2wHe+UXXS89d+FJ1RLLkzKtoqKYZkwMw07mSyApPc3KqOwhUqQvj5dpPdlo2ScwIzClthSEMqU6Pnsmf4eLTSFjyRL1OgMJ+jXWnKO6jJcfY1ne83pAn/RHQd4l8EF5RftxOMLNBNg77OwXrV8cMyzFGHwrjJlAGNREs+NrvAfoD2Do9AGiCMj4pDnGYxJIMQizF9msyQI2rUkaWjT/ONe/ay67cUweYNVqEmE+7f34x8RFxARnN9Cope5E8wTYRoT8kQ99XOTCbBtFPKjpNv/ut476Sb2fljkg2kR6d+kGJgcmwGy0bggTBdigopikhpwikeVGLnvZYr+rpcF78/4iAQMhDJiFscgyr8Z8eJBmXB/ay5Aowf0rlhzhltvC6pQ83rdd8zvbEj7b44yZ+Fgf+rTc0234xb4+IDUYZ0Dd71JjfVUbyDpFOeRU+pyXZvBTVvgf6+9xszUq5hjExgBw73WFbk3GNLnFe8PgkRfRiDoMSwAQQuicy8fXzui5SZKvLepq83TVpTvkPu1QL8iT4B9rYp6N7RMNtOTz8xSZXR1Uvyc18lXqdfTobvfV0AwpDYMLe2LTEuig8aLobuDB/HyTS9U6PnQ1u2gNGXhP0Bps9hy96sUFAUwDAIqNmBeTJm/qAgH/Xq1suoXWsq5CH347MgUGjtmPnp36E8PLBxOEyPBiKCelON91fztr3It2fMKhuzGgIWuHZEE6NCDuZF0jc1dxBe9h9OwBG5H+9xhtOA6d7On6vWXx6ZVwIz/c8FA/K0lbOidJYU+JQnQ0EflfZGL5kKJv5RZXZ+atM3MeYESJXgmMwbm4f3ZF+F/0CHFkZgaBg9//+fuOLz/4fG2A1KavRzTLxP9eeiE1Ov/lbnsiyi6cXoRO0Rb/ixFZ3IMM4PWSIFhSN1p9msIR1o5J1J6Y2pe2nE8ZcqTtpe4WnqsBO3QxQS7grf+qbHsUfaxmDixMcGUmQyPCbBSuJIeu7f++pYOgUbTrCUdBmjj6rXlWppjN9YQTY3tHf+zRTAUo3HWDr6qLmIsrQ/i/S8Oov4K9kS7Pao8s/9CNHBQAEk5PwD7+EAk2FpbJVIKIL34mKmbvh3yAgvKIulPMf2YWjFXQOaM42BeGCglnONSdz 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:(13230040)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 13:47:03.9652 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8206ca94-6518-4a91-38ab-08dcd7e8610b 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: DS2PEPF00003447.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9408 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 The RTE flex item can represent the tunnel header and split the inner and outer layer items. HWS did not support this flex item specifics. Fixes: 8c0ca7527bc8 ("net/mlx5/hws: support flex item matching") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/hws/mlx5dr_definer.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c index 51a3f7be4b..2dfcc5eba6 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.c +++ b/drivers/net/mlx5/hws/mlx5dr_definer.c @@ -3267,8 +3267,17 @@ mlx5dr_definer_conv_items_to_hl(struct mlx5dr_context *ctx, break; case RTE_FLOW_ITEM_TYPE_FLEX: ret = mlx5dr_definer_conv_item_flex_parser(&cd, items, i); - item_flags |= cd.tunnel ? MLX5_FLOW_ITEM_INNER_FLEX : - MLX5_FLOW_ITEM_OUTER_FLEX; + if (ret == 0) { + enum rte_flow_item_flex_tunnel_mode tunnel_mode = + FLEX_TUNNEL_MODE_SINGLE; + + ret = mlx5_flex_get_tunnel_mode(items, &tunnel_mode); + if (tunnel_mode == FLEX_TUNNEL_MODE_TUNNEL) + item_flags |= MLX5_FLOW_ITEM_FLEX_TUNNEL; + else + item_flags |= cd.tunnel ? MLX5_FLOW_ITEM_INNER_FLEX : + MLX5_FLOW_ITEM_OUTER_FLEX; + } break; case RTE_FLOW_ITEM_TYPE_MPLS: ret = mlx5dr_definer_conv_item_mpls(&cd, items, i); From patchwork Wed Sep 18 13:46:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 144259 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 28A5C459CC; Wed, 18 Sep 2024 15:47:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 991CC42F0C; Wed, 18 Sep 2024 15:47:12 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2052.outbound.protection.outlook.com [40.107.236.52]) by mails.dpdk.org (Postfix) with ESMTP id 7A91F42F0C; Wed, 18 Sep 2024 15:47:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HowodyZkmlv9ev2FDOR68J1UM15rWVcD/FrCgjuXE23HGRnio6jkCqkGoZHYMBJ43W9AKpY4ChWuBaV7Na9SCnFNWM0rfrtMW9qWiWu74eihVahBhIuxaWQYfaiXtWWBnLwUL7CzCEmNrg1T1Fh+mNhpahPy4do0C32Nj2pZy9Oyfkj86fMH41uBP2do+DU6xd1YGUcV6jFQY5I/DCiUKsETYjFL0xfgnNGomoEJJcDNmVT2dzwRmm+jXVzIAL+XaJ1aIpSj/hI0e5XqgKHrPthl2AWkbTMx0ymlZJLJCYZ6dHaG1w0hykBzzpMo3k8NdkZ3EpGNm3034/00ffPEqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ekHb84D5H1lBgzjFvABy1weHDcCZWFGuPxka959+A6I=; b=d2+8kUZQ7vtkL4j77PYA7feUz9p83uCKQ6knGZdhQL9rEKouaXBXPtCQqHYR9R/uSnd54MQYxG+RSKoI7/UnNvFFH0/MHBuAMP4+jNP2h0YkoK78NLdl2kaYbaTNXz7CHvK/H2KOfhl6zgW56+ktmYv27KUhYHC9bMIwXIqhl9ynuqQcdWM7fWagwNQEIaQnD7g73fUEDhx/rBYwsdja/yveKvCKNKnB4/tZkbU24+72F/MwEJ4sdHgmoSFdPqQ69eqtEm47w6Fn11dc+zBxq2GucZNOT4lu6fsXVWe6jmxBAVywOXJL7QV658l84x37hJAkOR4COIImE72JEcZntg== 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 (0) 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=ekHb84D5H1lBgzjFvABy1weHDcCZWFGuPxka959+A6I=; b=XD0JKd2z1SwrCVppdayjbdvYK0GBMbJ7S0yljWfUU5gHLwHTVK8KZlgjDJwrGvxjNeFe6ezWdysmBnhb8127hIE4eT4af4akOC72DupfONO/ekIpyXkSqyrgOoR1NuMYco7YVkgfloInUGeN2BK2ULXpFxgt1q3iulHT4WsbJxtZCtiNxJnw4LV3QJqFiq6j8tdkOYvlSKzfQ1ZdbNwHNDanhmMF92cIqdCXobjDfqXow+G3jn9f+6pHw2QMBLAkNpnWaBD4XySAkUhUTTzjmIr3hqMu7piaoRZDrUQOAUqngOpYk+xbrLHwXacf0guAvMRsBqAT/bHQE28IFxGvsQ== Received: from DM6PR08CA0054.namprd08.prod.outlook.com (2603:10b6:5:1e0::28) by BY5PR12MB4306.namprd12.prod.outlook.com (2603:10b6:a03:206::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.17; Wed, 18 Sep 2024 13:47:08 +0000 Received: from DS2PEPF00003443.namprd04.prod.outlook.com (2603:10b6:5:1e0:cafe::db) by DM6PR08CA0054.outlook.office365.com (2603:10b6:5:1e0::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.25 via Frontend Transport; Wed, 18 Sep 2024 13:47:07 +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 DS2PEPF00003443.mail.protection.outlook.com (10.167.17.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Wed, 18 Sep 2024 13:47:07 +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.1544.4; Wed, 18 Sep 2024 06:46:55 -0700 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.1544.4; Wed, 18 Sep 2024 06:46:53 -0700 From: Viacheslav Ovsiienko To: CC: , , , , Subject: [PATCH v2 4/9] net/mlx5: fix flex item tunnel mode handling Date: Wed, 18 Sep 2024 16:46:18 +0300 Message-ID: <20240918134623.8441-5-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240918134623.8441-1-viacheslavo@nvidia.com> References: <20240911160458.524732-1-viacheslavo@nvidia.com> <20240918134623.8441-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] 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: DS2PEPF00003443:EE_|BY5PR12MB4306:EE_ X-MS-Office365-Filtering-Correlation-Id: b18a5041-9da1-47c7-ea6f-08dcd7e86351 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: 7cIIhdUP2bBfxPwo7PJAZjlrNoDN2yfLQJGNry8hepOK06wtKedgrYcFg18xXoq37veQbzSZEiAHg+h152tSmeLsesHXxk33QTWkkh3mMKRYN8bl6E67q94VipDYw8Dwt/o/k8VcCOCt72YZRM8fylClfaqt60cVA4A/UiGhZ8yPIDb94ZYBgdNCzZEvsMoWAzxV+oo3R4GZ3izrV1ul8apTruXnOWgzpVZqGDgem4iFdhVA19okmq3+/9cnty/QNjWhwrAtouGXQ+1PKfUQj0dpPHw64UyK/WDJegrk82Nfi2vS5lu/Ngzy4ChNGJaNPyDwuJLrE5RYhbKnWbTerEEViA1I3Obr2hbBRRG3GlP7Fdu6Wr11HEZ99r7DLvtzcZbNF6K2Qk9ajwPA5/rYPodTOldztgNOFUJiMn9SKhLIksDfrchJ370bRgjRimuU9u/rfGhSQZNUMO4hYSmQgmyqea76jLgnb4A8CrHh0TItWiKZtjfvPGPUXXX0bHqEpFPpJox80LBJkfsOxTci52fa3Z1Q5b9kzre6hM3Ud/xKTit3HsfsxtLaI05xrH5HDpIuRvhzaXwRPwqL7b4f/J7ADk+szIDnbC12Td3wAnBKSjkpqWB0rEpPTM+obiEAZBJgd2IhfXuJqxog0jDEaRMIIDE9TyhZ0VsJpEeJTze1EoP3eIyObzeMefoZb6P3B+gL8n6cqRI/1EUhzvdoSzn2KieSq8URQFr2eBuWQdXcHMkSFaojnk1kGamaRlnDtmdG+Hyvn4khQ3viN5IH4JpZ9IvwVo8j7wu+pBzDgtVwm7EhBfAqU3pe8RwXsPcZEICH/U16ZGe6ySaZDWva8mi7XmgWEi47wzKFlbV8G+eR/I8WpdWwEVaDjWqzMvL+zAShMZGMAi474pHn5V75JT6NRp3afeyTkkN5vZhIjurerZAgu0t2LBmIteDTagGnbUP6UHsqAHyc9Lc8SfEfa/8ZdF3F2hfZ31Tc4ebsuBUiz3XCY8DxEjkb5Q946dNPDrhvVRJX+QL8/5M6FwJOfse53A6RKEyOvmxuAXnvuxf/dqpzr8Eyutxx2hGnI3gTPyc8Z2EG9++WKZnxhkFkU+Hvprb7ZaRQtgMx/90x/nT2UHGb3xgDNYwoRMCJn5ewo2YdEtAp0vk220X8ovyuYLYKq1TWphruRDjir9Ez9sm2rykxG9QscxGifNCX5DemAxky1jl+gS3YS9dOGcxnD48NuxzPy4C96nnawenq3o6t5B1EVIctTrpl2AgC2JUEi6eA/FTQtIaKAndTUhkyv8mrxuy5enCBPP3U7QrEEnDdmGZLEGJmx8uWpFllBqbidPPQWmcIRReRFsyAbWQ9SG2VVQQKBJVfyzynctUfwuSU3YVFW6vu8+IDW/YI/A4zqYFO2jesJIWYMWuLYLeLyUJcSNvIGHFd6U7T9w+agWcSaaiBaX5oQnlnIG2yKf4c 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:(13230040)(1800799024)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 13:47:07.6433 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b18a5041-9da1-47c7-ea6f-08dcd7e86351 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: DS2PEPF00003443.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4306 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 The RTE flex item can represent tunnel header itself, and split inner and outer items, it should be reflected in the item flags while PMD is processing the item array. Fixes: 8c0ca7527bc8 ("net/mlx5/hws: support flex item matching") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5_flow_hw.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 50888944a5..a275154d4b 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -558,6 +558,7 @@ flow_hw_matching_item_flags_get(const struct rte_flow_item items[]) uint64_t last_item = 0; for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) { + enum rte_flow_item_flex_tunnel_mode tunnel_mode = FLEX_TUNNEL_MODE_SINGLE; int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL); int item_type = items->type; @@ -606,6 +607,13 @@ flow_hw_matching_item_flags_get(const struct rte_flow_item items[]) case RTE_FLOW_ITEM_TYPE_COMPARE: last_item = MLX5_FLOW_ITEM_COMPARE; break; + case RTE_FLOW_ITEM_TYPE_FLEX: + mlx5_flex_get_tunnel_mode(items, &tunnel_mode); + last_item = tunnel_mode == FLEX_TUNNEL_MODE_TUNNEL ? + MLX5_FLOW_ITEM_FLEX_TUNNEL : + tunnel ? MLX5_FLOW_ITEM_INNER_FLEX : + MLX5_FLOW_ITEM_OUTER_FLEX; + break; default: break; } From patchwork Wed Sep 18 13:46:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 144260 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D8B8B459CC; Wed, 18 Sep 2024 15:47:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7F0F643248; Wed, 18 Sep 2024 15:47:16 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2088.outbound.protection.outlook.com [40.107.223.88]) by mails.dpdk.org (Postfix) with ESMTP id EC77142FC7; Wed, 18 Sep 2024 15:47:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wq3ih5a6fGrv25JuXn6SV0diUa7SFPq5CTtprXysYQVh7crxtAUu4TAhxS+/iD+HmKpFMw8qbg/ypWlGY53YOjMEOgvcF71CMecoBRanYE41avPeEm2YMM/WSrg6lYTfLThtGVK1h+9K5moFx2BgKMDRz7oGnwsGo0wo06hI/goAq9ppeRuO5ZMA2cC1m5XjwBy2DRX4yQHP0uy1CF4Ac2sjnoUNw2EqXc2cK/7Cr91TMjhfR2kgQ+m7Zbwhs0kZCWttGdqUZKpONA3EUJcKtjQxeRzkUaLoXTcfpAhlbRWLZ+DVvToCmGDAPb8wb/T3/rTaiCxAgeZA9+lijPqNvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=WxHZ/KZ+fOmWRJZ6xpD0Cwp2+Sekc7yA6omiF5+YhTo=; b=xD9pvDA+na4emLKniazjRwM2tFnwhqIV4L0bL4jWSO8ZmPoyg3MhCnrAcnIcnXuUs0ewbOnlZDM9holtdTBHcEJ3/lN1EdTD9GDOW450kReA3eOZraQk0mYMp1IhCRUvVPxT4i5tLUTVZolqbMWIRBuRuJZRfacSQ3Y8wCUeXmD8rcF8FiFi7+itm8mLOBgXJ896dBZAD5aT+IGtnfMNgost3gluQAlVMKyI/Ah2wHMW9MGsvCQdC5k0hYiElT7J0Q1HuO1ICe+Wtx4toqN9moHptEzNM4xxB40XWOHdiUQxp0+8mV0pSDlyWyKdjyB81T7gTkg0qpL5fOu3q8t9lA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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 (0) 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=WxHZ/KZ+fOmWRJZ6xpD0Cwp2+Sekc7yA6omiF5+YhTo=; b=p4VzYmW6xxdptz1DePYbr/aE3qso5FKWmVbqx6ZDh0PQQMaluXXflnVK3Mx/Aufz367nKYMzBdG1O31bXKbwZKax21aJ9gD4D5gZeIFx9f4iRQG/vNNfsnt7w5FKIQFa8KfKMH4nLk8EiAOeZHKzovH9Lh727VC7LuY1fxY+AVsyi0Mq3+syzycQMGcB4pE62u2G0wF/P4yvPEeA1p6D3Mhi06WSRo7KxpS0oT8wdLqv7Wo8k+M/RWAm0MR7jNqTzXpz7V1+2rxw23SNDb/63SSbs7PxAZsvgO6J82mIyz3Wn2DQ1AXvK8lRT1e35Bn0p43SgkqVzCoT73id6MSQgQ== Received: from CH2PR16CA0001.namprd16.prod.outlook.com (2603:10b6:610:50::11) by MN2PR12MB4318.namprd12.prod.outlook.com (2603:10b6:208:1d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.17; Wed, 18 Sep 2024 13:47:10 +0000 Received: from CH3PEPF00000014.namprd21.prod.outlook.com (2603:10b6:610:50:cafe::13) by CH2PR16CA0001.outlook.office365.com (2603:10b6:610:50::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.30 via Frontend Transport; Wed, 18 Sep 2024 13:47:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CH3PEPF00000014.mail.protection.outlook.com (10.167.244.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.1 via Frontend Transport; Wed, 18 Sep 2024 13:47:10 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 18 Sep 2024 06:46:58 -0700 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.1544.4; Wed, 18 Sep 2024 06:46:55 -0700 From: Viacheslav Ovsiienko To: CC: , , , , Subject: [PATCH v2 5/9] net/mlx5: fix number of supported flex parsers Date: Wed, 18 Sep 2024 16:46:19 +0300 Message-ID: <20240918134623.8441-6-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240918134623.8441-1-viacheslavo@nvidia.com> References: <20240911160458.524732-1-viacheslavo@nvidia.com> <20240918134623.8441-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] 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: CH3PEPF00000014:EE_|MN2PR12MB4318:EE_ X-MS-Office365-Filtering-Correlation-Id: e9c4783e-7248-4431-c51a-08dcd7e864d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: cNMaiLFRe2Jg3X3aEByGqUAoCNZrz9sDG6htYUcFrHNUsEI7dGua5mmsTJws5CR1zoslXIJ8wT3Y/i/c7K3VAqb1pDx62ElTwyBsjAUW2irbLv99cPkMD811kerpJtvnYCE112K8g76iPIt2LnXsJ0Y3i2T8fbOxT9BOMsFEljlWSXIS0lYIousYg/dAdwf6IckxeK25ZpJnj9VOpgd6o/6LDaKojEOBaewztPFX6NXp0hm2XB1EGNGhq50ErYemW7tCm8Q1fzF8hufBk5iqpJacTyzJw8CdwCFr+EanC023ik0ifomfM/+DRDy9h0EGpFJJM6in4fq1FKZMI/Kj81XdJVq3ZA0zIJg0njMyW5Ga6arBpAdjsw9deZSwquF1oNFwbYUMMbue7JkrxMSNiq4l4t809P3LVgqTCl/rb351DsoVKqzq74eOySTSNJk6cqsECkCZqXEU5tb0tfPwD9ZQAXYODUTWpBizbsVGQNXZbaNwfl4at2RlLOyUP7sl/tkUNXiu0hl3q7S8k+ScNX4lkAlF3ew2YqbR4O858c/GN2rohkW3f+fr3Kg9yt2dee05LFU40kkZ8a2xvaOr1PNjp7SMX71aj+gT6NXI4zyUJNSdRmM0C+WZZ4YeS6TRwFmwE9gRlcj3a8GKp3bWhZsqsigR8HCSjbysnUwksF9bV9QKyuAsOiVdsWcvo0MixZTMaRuywVvTqRtMc7fpmTMx/dd6vsYqIGo3/BhZQaIE6y3LOToujawwezCvhX9HVas4cUeGuqnE/1lCNVIN1klGNl5GqfCv0yMrwPETUNEgjW2Zt8k9+seRBQW0T3Klhr4ExXq6Mi5p+Nn7aLa7AYdBofMFVojXAoXd2TL1037zQ/QqSFpdsiNz5r62T28NXRffzbAKgd4ZaCFpcsbYijW3yeIOaQ5xls8J/3BCVwUQoX8lI1A/nVCiukJCqJ9Kkm5tMUIwMZmm6DnA+dsVBdZdEZZq+6PIlfuFzNbmW3NkXh8u+EkBoaNraHrrxmBikMNiqCcsJ/dk+wtkS6AVM0urUZo2N8oYCM7sKeFVHpYQmanZl0FM8IpLGRULPkpHLqnpIB3tqIfnQb6Itb3ndp7U8Cso7gZoQSvz0qy6FBJ/vXHMEeElfVPDlE0jUCauhf3nTyelhlXshZyK3v3zAW37bCM97iRCbDrgMPKEa9+dSOtzug7NW1mOW8zhffRuVvyKzCvBWnbvS6HgsdcGcEjIxrV8Ri/o8rBXttIPBD+Phn1OXYU/lIB2bvgoc1JqRumwUcnwG85mLrfIr8XV/zg2KUAPp87U4SVPbJ3/uaGCv7nZo94QsMywiay6PIyksINZnLDKRLZtHldSQfOTTNex1h2KG0/2PrBesHIyBfonG9j+NvZOgqEL1C/AhBN0T308ImOtKEN2iRabwfmUAB0rCkiziX+hG0yt02uCRJLTH0ajK92aKC/mU4ksWH2A X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 13:47:10.2033 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9c4783e-7248-4431-c51a-08dcd7e864d3 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF00000014.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4318 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 The hardware supports up to 8 flex parser configurations. Some of them can be utilized internally by firmware, depending on the configured profile ("FLEX_PARSER_PROFILE_ENABLE" in NV-setting). The firmware does not report in capabilities how many flex parser configuration is remaining available (this is device-wide resource and can be allocated runtime by other agents - kernel, DPDK applications, etc.), and once there is no more available parsers on the parse object creation moment firmware just returns an error. Fixes: db25cadc0887 ("net/mlx5: add flex item operations") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 6d163996e4..b1423b6868 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -69,7 +69,7 @@ #define MLX5_ROOT_TBL_MODIFY_NUM 16 /* Maximal number of flex items created on the port.*/ -#define MLX5_PORT_FLEX_ITEM_NUM 4 +#define MLX5_PORT_FLEX_ITEM_NUM 8 /* Maximal number of field/field parts to map into sample registers .*/ #define MLX5_FLEX_ITEM_MAPPING_NUM 32 From patchwork Wed Sep 18 13:46:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 144261 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DAC4D459CC; Wed, 18 Sep 2024 15:48:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9E76C42F71; Wed, 18 Sep 2024 15:47:17 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2064.outbound.protection.outlook.com [40.107.93.64]) by mails.dpdk.org (Postfix) with ESMTP id A056642EC3 for ; Wed, 18 Sep 2024 15:47:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rIkG4p/PcRL7EUVXD33M2hibIOjIOVYwRcWgnUIH0bnAdvCbSFmAHhLOIx5uUaqhm/M1fNDumFaDF/9xnMBeFg/jPajbcnK0BJ+qS8coAkevdGgDtrawZydqRIZYlCdo6WBykOmnMlEmnx9MnThNmLRTHecG4d/dXjTUdWLWpj56ow/QGdzc8awHRVCD4TlfIunhQ6dVFybZJG/XFoenv9R0GvIq4ln2Lk3kLF6mIJNgsFJHjLpXJTkE62TfdOeuwVfZn0MG9V2deX4PH/L/6fDwQ27swNss7sLKl4TPN37n7pa3Hwmu+ThualxpIriCDUkNL0uKzamnI+LuMbaXPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=bvc7cIm8990IriIZVSMNW1jJaQZPWV6wRx68vCQJzD8=; b=HHBeMhyQqFo3c7xfGCagMr6pt2+wncGwbl0ykwHemQEJSvXFo8t0dLaDFjQowx0Q0KLn+T0jzuVfwLqjnFCrmiMQWzR9PZFc7WyaVDnkBdAwOxWgqwrJlTErNtRvPyJveeTvuyUPnIaCUzJQIRCTVB3hsAet1JYThNw3NNSwdROPq/Z69HvQiZhnMNt91dGcTAkS+KQS8dYazUhOwMD75dGPpmSma0wWzYy+jH4+CrNsYInnUQKeCwLJ+pmLvhfaXG9tsLLbN8VInG21U/iENXcVIxP3x4S5L9GCXdGldCr7vfrdYzqDyZkQV6nOicV/fOZpJuCKaItbRUiLkjxHoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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 (0) 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=bvc7cIm8990IriIZVSMNW1jJaQZPWV6wRx68vCQJzD8=; b=ClWhuNbpMfTha42iRav4PPVx+qxKhszWYddh4F/845H0GrWr7RnpCo80eVWH67WK/brfGFoxkKX6AGau14Ws1c0lVQYRMcz/2oFbLbSr+K9DSV/dXi0ciOipD3agSux5gG3C5OSW7Jx0/owyA8SVeLWi0W7yrNNGXq7JQBIAbR/x6hR5zfsDKb/947P7F3do5qS4o9D0xUhtbXmrreZbbn/4KDiJDoux+2cX46ZhbalqE1Vp7JP6YKROIuruXEcOWeCDYb7fRy0VwfUOzWawcs3T0u+O5JdGpEWWQeaTi7FAzYvkUSGj9U60ozvfcROELf9sdwW1A85HI77Q4Y9qnw== Received: from DS7P222CA0019.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::12) by MW6PR12MB9020.namprd12.prod.outlook.com (2603:10b6:303:240::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.24; Wed, 18 Sep 2024 13:47:12 +0000 Received: from CH3PEPF00000015.namprd21.prod.outlook.com (2603:10b6:8:2e:cafe::24) by DS7P222CA0019.outlook.office365.com (2603:10b6:8:2e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.30 via Frontend Transport; Wed, 18 Sep 2024 13:47:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CH3PEPF00000015.mail.protection.outlook.com (10.167.244.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.1 via Frontend Transport; Wed, 18 Sep 2024 13:47:12 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 18 Sep 2024 06:47:00 -0700 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.1544.4; Wed, 18 Sep 2024 06:46:58 -0700 From: Viacheslav Ovsiienko To: CC: , , , Subject: [PATCH v2 6/9] app/testpmd: remove flex item init command leftover Date: Wed, 18 Sep 2024 16:46:20 +0300 Message-ID: <20240918134623.8441-7-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240918134623.8441-1-viacheslavo@nvidia.com> References: <20240911160458.524732-1-viacheslavo@nvidia.com> <20240918134623.8441-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] 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: CH3PEPF00000015:EE_|MW6PR12MB9020:EE_ X-MS-Office365-Filtering-Correlation-Id: c15ed95a-f33a-4545-a799-08dcd7e865ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: E3iWpQH7xmIe57cbnM9piDqd2Wchfrg+biXb7JSe9T9P7eZQR7iF4AHIdLE1W47dFgC3rISwtqGZoYgnkyPx/dA3utflzW+hjfLKCozZoMgK5G6fG9Pw9PfIJXwrRWOQke0Ib5/ADyccHRll7AVIwS43LPtS65x1DstxzpFypFyZlHnqs6El99LSPiKQvUZ2b1VKABd0ToqqOkai4rFtzMT1a5qkO1vEyMpoVt9eH9AjopwIzsuKlJ0yX15We7Q/2zTvzv4X29IZ41oQ9//2qrFAZkUftaqAxBs74mYB758Sn+y81wrqua+0g1a3C888CBlaAz7ldm8eRLsJFqD8obq/F6J+vjtfplzfJuy6xFMP++dVeuf4yICfHjkisu3xXOto0HXiRhMVK01CuzozsEk4SVHaev+axh6J352pWEMpcugrmGWhhz5+J+xkDyVgKakRjzpzm2zbF25zRsLPAAK1SsnwS1Lt3pU0Idu7dGbW25TyrehL1FMZnikXoHE6fx6My6IRERXWj1yavNqPWzvH2eFCPQzvxg1LmhnW2Z9Zb9LIdhX3GdfwKvDCwmBrucIsXvgmSMKK/HmL70zCheso7iblua3Kyly1hXPtH2pS2of337hHz2fNhwcwfwS4PeJ6/0yktc2d11GJiYnhOsLNKraSrve3iwAgRjOg7mNlVEzq5dd0X2lrk3Q7WYI7SkaXIpO2zHILkirgUwYlJQHsWgChCPXb2vg5gGSTwub1PLDO2IflQ4E4l8FF3vzsaDWC2RTu4LoKMkLYU+dZ+C4suK7AA0fVmZlK9O2rhUetaOP1wIFfXEnJItOlIRhzOjFDl/LyEUtrjdFWdWs3sD3Knc39CnBwC6M+5o6eHtKTBboctMjQt8OMd49cWhfcC6O0mP7yHpS6iWu70ggZB41WrOqdJuipPimorQF1iCRpRARcEi386DgW7MfiYXNFXiqunn9XLeDARHAflbygOX89BhxCY70J43BbgK3sol76lAMY4Dsj2nXoOwO7GXbgjXTajAJ1cFAPfxpBDuumBw42TPgy9eQW7T1O47EnL2Gd0Nc3TQCtmMt12GOX9Oj4UruCgWkZ/0+W8hJVRTVDBHwmP/h9uZ5IC9ArSHbXd7OqndmZJVG4zVKKVCn/1UXYwiz0YhyHq5oFhAeuLZR3WDdQ4hdY0oUEnvtt2Tf3nnjYHr88+3Xo97sPni4rdM84w39FK6klOc6lZi48W6Rp6HhYsiOMtxwO5Rjs2cMC4rpzgCiKbxl5/V4QY2ebLHzOwDShEveBJFFodqE6cw6JOeFrFiE/QUxSyK7dtzWZvS8385wkBMG5XrwFalbRwhaJGi7VxzDqrwvG1xACIILhfKX4UgCk0BZfExHXHDmbA1B8Fu2Ww7QEGk+q3Q8KJoWHXNoQ4zWrzD/PVw2+/BPGsxUdFKIU6EK6XCR6ZGGI8ArzRnVmVw2jDCGbsKWc/Otw X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(1800799024)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 13:47:12.0441 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c15ed95a-f33a-4545-a799-08dcd7e865ec 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF00000015.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB9020 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 There was a leftover of "flow flex init" command used for debug purposes and had no useful functionality in the production code. Signed-off-by: Viacheslav Ovsiienko Acked-by: Dariusz Sosnowski --- app/test-pmd/cmdline_flow.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index d04280eb3e..858f4077bd 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -106,7 +106,6 @@ enum index { HASH, /* Flex arguments */ - FLEX_ITEM_INIT, FLEX_ITEM_CREATE, FLEX_ITEM_DESTROY, @@ -1317,7 +1316,6 @@ struct parse_action_priv { }) static const enum index next_flex_item[] = { - FLEX_ITEM_INIT, FLEX_ITEM_CREATE, FLEX_ITEM_DESTROY, ZERO, @@ -4171,15 +4169,6 @@ static const struct token token_list[] = { .next = NEXT(next_flex_item), .call = parse_flex, }, - [FLEX_ITEM_INIT] = { - .name = "init", - .help = "flex item init", - .args = ARGS(ARGS_ENTRY(struct buffer, args.flex.token), - ARGS_ENTRY(struct buffer, port)), - .next = NEXT(NEXT_ENTRY(COMMON_FLEX_TOKEN), - NEXT_ENTRY(COMMON_PORT_ID)), - .call = parse_flex - }, [FLEX_ITEM_CREATE] = { .name = "create", .help = "flex item create", @@ -11431,7 +11420,6 @@ parse_flex(struct context *ctx, const struct token *token, switch (ctx->curr) { default: break; - case FLEX_ITEM_INIT: case FLEX_ITEM_CREATE: case FLEX_ITEM_DESTROY: out->command = ctx->curr; From patchwork Wed Sep 18 13:46:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 144262 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1320D459CC; Wed, 18 Sep 2024 15:48:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E46634325C; Wed, 18 Sep 2024 15:47:19 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2048.outbound.protection.outlook.com [40.107.236.48]) by mails.dpdk.org (Postfix) with ESMTP id 7B1E94324F; Wed, 18 Sep 2024 15:47:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JflxooOZfF11TbNuwKkLzG/jMQGnWsCcVWHijTTjTFrM8m3UW1vN+BDuzrINTOI6lmFLuye/sCP724RPLM4xEjlV6roaB0bUWb/l1DXTolC8Ob7rA35QlCMr7Fjva1y7MoJcPrDhAoEthh1dUgF2Q++m9DDNZn+gFw/BCRHtZ/SWPdO4glakmkBhPrUBuKAOFvoPY/oaJqDDTVX3Pb9gBlr01g29Ce7e+K5eXDBhf6nAK/tfDPE9znH4+4VACoudam0nldFdQu4YePDyf0UPm4Ah8N4yPuCyakBdMa4uXC5q1/N3m5RNnU1FqejDe6P2FDkehtHTL6U3ZVn/2tYCSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=dSsNBnKYkKCoBROO028dZkQvwzmgQl3UZhzatTPRrn4=; b=RuV7ba3v7xUaoNgj7tCSy2AVEDJwSwd74HX/D6o7rs9gtTjX7gMp9PHiG9PyCmAPsjeqQ0ftlgYhO30PCkqQzxcBnit9S+4v76edYKji9RRdMT9AE6KiraM5E6CmO10hRHziRkTzXnvPbGnoB0t7kXjfZ4xK0HrTswPKbPPs8oORyM6oQy33psdjCm2nmcnUt8ZM4xfTC0dUnfeeEkqah87nirT2jAPKN130/JeHRFtBu3Oh4yRuEzgdHHyk4xt0kx4Hu2O/6lrzg6arDKND3zZePNfGfwuIggMiwYZg8wS8EkcLWlEmJ4TeQUrv/Z9cOpwTsQ70VUITpZY2Jd2x1g== 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 (0) 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=dSsNBnKYkKCoBROO028dZkQvwzmgQl3UZhzatTPRrn4=; b=igNPd6UY30vvXZTkCmIYpR8BtMoHxqBx85tx8QkWmDCZEIuAbG3jcTEI9ojWj8uVzFID5qV56p+QDeTsXUhAx1XqzP19VptobGoQKmKBahHXRWfZVYd2BUaVC3RMzApBtOxJHD+HP9J+uKLEvmtCuJqi/fCD2LafzDqmFcxvPd+pu3BJbBv9ENwkxprsReNoYtoE5qu59d5mF/2hzuvQp3A8VZZXdzqwQiCTSOJDKtXc+2N6fbOiiR5c7jwEK4P5GARnZPv/1dM6doebIbiCPTt7BmdidYrTpxXweEz7+Vtqmqzp03FN4OT1usgRhD51NaGnU3fPEJR1KP86/qfATA== Received: from CH0PR03CA0345.namprd03.prod.outlook.com (2603:10b6:610:11a::29) by CY8PR12MB9033.namprd12.prod.outlook.com (2603:10b6:930:71::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.24; Wed, 18 Sep 2024 13:47:15 +0000 Received: from DS2PEPF00003441.namprd04.prod.outlook.com (2603:10b6:610:11a:cafe::c1) by CH0PR03CA0345.outlook.office365.com (2603:10b6:610:11a::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.25 via Frontend Transport; Wed, 18 Sep 2024 13:47:15 +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 DS2PEPF00003441.mail.protection.outlook.com (10.167.17.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Wed, 18 Sep 2024 13:47:15 +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.1544.4; Wed, 18 Sep 2024 06:47:03 -0700 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.1544.4; Wed, 18 Sep 2024 06:47:01 -0700 From: Viacheslav Ovsiienko To: CC: , , , , Subject: [PATCH v2 7/9] net/mlx5: fix next protocol validation after flex item Date: Wed, 18 Sep 2024 16:46:21 +0300 Message-ID: <20240918134623.8441-8-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240918134623.8441-1-viacheslavo@nvidia.com> References: <20240911160458.524732-1-viacheslavo@nvidia.com> <20240918134623.8441-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] 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: DS2PEPF00003441:EE_|CY8PR12MB9033:EE_ X-MS-Office365-Filtering-Correlation-Id: afad83be-e4ba-4520-551e-08dcd7e867f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: jq8MP8a/07GWNe+VGubIezUzGL4j7X8iXjYgqnZ/GSVQIx2+LHpwCgjzgqRh6n8X5ORlnObj1tWDwhjymk2VZrb5fEsullA2Q+fMFSDryFtNImZZLgBUMVlWT/5OQyVol/ITv7YEdw+/atF0J/XEsE02K75jYpC38nYmw1ngiAB6pUkduQqmThd83z75pot8pGA9sHZN06xgraJecNull9+KoBdm3mljoTcnX0sqStVjZgtCKSjjaHQWnT1pUWfOhZWPrRdvacsljZy9DNfDsBo1DAHmbRuKLEcVS/dyT0hlIRSLnsAJwixng9G9+6ouVT9Nc7edhHGKrwx06C4rlaDzNX7zSGjpM1DVy87xyXw7p/xJ8mveX3kdTfDe/MjrzUvhMHWbKh0nJ8FDe8FMplcjRs0iSWw9I6xw1ZgXo/Pzvhat6hJ3QA16tlqnLQZXpJ6tKH2nWuk4qo414NoYxsTusfMcGgLjfMZw2NfUVLauQNTlApIfIO9Hsf6AYJSvWlCxhcH4Zmzs/kDuSztCFtknwOgQvMJTV4+F3mUlErqBzo2GazSE+rU3cjXioPMjqTEuuV4zu7WZZYUBHynSHiiJAODCi9DL5iRS2hQBXa/I4dILzr5r3As36Z9TXrhIxUXAVC1Y9DJJLEPur/zazZ7tPqEIwOrDCGSYpN9/HDWj+eiyExwB95HtAqs3MT7qF1bHECaeJaDd/Qwurhw3mKgtutcjzcTZVNcxGYjLOS0wEv51pxYC/0++6OAn5m0SjvJmdakxcnF5GaSNMxXDqNyBRZVnVfIg3XRRI7fdOaQ1hLQJBl9J0biFbkgTexEJARFsoDmFd0N5woG72KLolYvGLRxoYVxdRm6uWI334rS7crWGN2y4XcrJlBd11B8Ub2Figs8ZzztUc3z9nA/bT2Oud59MOxVM+3CGc39eWKWhdwDci8wRVgwBqmbBftkRoQFdCLtkWWz/dzKcyZ4UwFgpSIkUEL6huCucmBi0SXfUtbeUjx4PacQ3qlBZPfJgIwtaJuK6VcJF1umrKFiAoXwlrrH2Vre9Pc6gAdrx3+XV8/kUlD/ZdHn6mBIrE+PchWUAdC0yQHuEdjijmbNH8z643+CoKyJ2FTvBXdC/Fz1D/ByB2V065GoT5wFQMARdbt8PvFCQ+rnf6+9+IpkWWUgc1yPhvM+VhNh0HB7yx7Ls3qoNp7vEalODOoVgVihxc+e3hGfwINGq/RxByoW2seJl108JCjk52VIwhR7RoYwI+SCj9EVVZTQlziIVXnjoKrYvfZjcYnoCxJgR/G+HPQIlctXwTmtgPdfI2kvhSdXRtJhC9UyjUg4F/MUq+QF0mlfUZqjW9izA+FriYRL803X6ePVtkgi1gFDzizjfCUeF0VCpr3n9952xwmDLmVKnR5VokZ5aB9pu8L4R99MMmiQP07/4SJGM39d9CeFDRRIi2HUXwmPA7qxahTYUpObW 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:(13230040)(36860700013)(1800799024)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 13:47:15.4786 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: afad83be-e4ba-4520-551e-08dcd7e867f6 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: DS2PEPF00003441.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB9033 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 On the flow validation some items may check the preceding protocols. In case of flex item the next protocol is opaque (or can be multiple ones) we should set neutral value and allow successful validation, for example, for the combination of flex and following ESP items. Fixes: a23e9b6e3ee9 ("net/mlx5: handle flex item in flows") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5_flow_dv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index a51d4dd1a4..b18bb430d7 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -8196,6 +8196,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, tunnel != 0, error); if (ret < 0) return ret; + /* Reset for next proto, it is unknown. */ + next_protocol = 0xff; break; case RTE_FLOW_ITEM_TYPE_METER_COLOR: ret = flow_dv_validate_item_meter_color(dev, items, From patchwork Wed Sep 18 13:46:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 144263 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3DF86459CC; Wed, 18 Sep 2024 15:48:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D51243246; Wed, 18 Sep 2024 15:47:26 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2042.outbound.protection.outlook.com [40.107.244.42]) by mails.dpdk.org (Postfix) with ESMTP id 34BE343269; Wed, 18 Sep 2024 15:47:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=i7i1/wlvGBGT1uCUUMG8orSPrps10NZ43o6y3q8wzS6lzEF7bYY3rayIKK2B91cig98ICo/jkpB45vUGKXtVyTBuoF9cjg3iL4SNMsbx7qNAwkUqAsX5WcnfRNxvp7OVhqJ/Hi+Ygn5/tb6JMXoVQXy73+lDg2n2oIBHk2Hh//+YWawUbxjXtF+l9nFA+ljibK7FBrkjFiR3Li1szYLFUyuuMu5hF2ZcJi5SXhigJjI2jTv4ug81ol6KhREH+KWCaJgtUg72p+bY5+Q6BHN9pbPJpuDF282txYyVkLbkcU6/CIeOFv3n59eq5Vb66oYfnC32GUTTDfzehgFS97t41w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=rMKra3jpOKfiR4FQURpKrHQTg19TUBAdhm4wg8dG+PA=; b=wIvBAeERYJa82/NskgGdifokBu9QKqa4xfd2+4bhqsCZlmJXYkql0sp5R2d267uF1dvk8Y90eIWSOjS6kPhkumQYsYO9wmFwjLtJcdyQ2r5yqNRDFbU6j2BlVWe7YSdJ2dvf1F+CBjbYE8V3nu/SStStUFkzQ9biCYr4R6o3s1VL5zRIBNNzGIFlIlPmZD1SjQj+Di9wnWljv2txc+LOJKFEccNWMgTiUMwURyzYx7DKEDixFT2a+OJohn4qkW5c3Xiw5mOYoftwFbLMt49JxcifJQ2zui05Db1HpD+A39VWzX8+EOpG0zaybwcih04VFo8mKdwwKn8o8LDY+/nAWg== 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 (0) 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=rMKra3jpOKfiR4FQURpKrHQTg19TUBAdhm4wg8dG+PA=; b=DOmOK0TwIP3RN60m3+wl1YhphpoIRNTb6pXx2pJmllwwc/ta+GWSneCltwb8ywidWK2MIOJnjUGdPwvAUqJLvMJ4j5FwrvyCYcitpcg0hO4ShAd8ACsFsOAWEWSWYW/yMVC58ZKNHi5sFK66e11VrIFvlquGR0LSrc9iI0iWhxRU5TxhWU3VetiVs9PRvdoi9Pk4trNKm2SpSvdP5jfoKwr/TCBGMZaNBHKlL9aw7e2C0sAXYWldiu6FDjjm1XkVuxErp8WS7AOc0YkfPo7HLPNIvizen0X2levOq9lfsGZF8AUCtN8x3oRhSHkhqjUWFzwddHKamjU6nRg0xMzSUA== Received: from CH0PR03CA0347.namprd03.prod.outlook.com (2603:10b6:610:11a::26) by SA1PR12MB7126.namprd12.prod.outlook.com (2603:10b6:806:2b0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.16; Wed, 18 Sep 2024 13:47:20 +0000 Received: from DS2PEPF00003441.namprd04.prod.outlook.com (2603:10b6:610:11a:cafe::5f) by CH0PR03CA0347.outlook.office365.com (2603:10b6:610:11a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.30 via Frontend Transport; Wed, 18 Sep 2024 13:47:19 +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 DS2PEPF00003441.mail.protection.outlook.com (10.167.17.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Wed, 18 Sep 2024 13:47:19 +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.1544.4; Wed, 18 Sep 2024 06:47:06 -0700 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.1544.4; Wed, 18 Sep 2024 06:47:03 -0700 From: Viacheslav Ovsiienko To: CC: , , , , Subject: [PATCH v2 8/9] net/mlx5: fix non full word sample fields in flex item Date: Wed, 18 Sep 2024 16:46:22 +0300 Message-ID: <20240918134623.8441-9-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240918134623.8441-1-viacheslavo@nvidia.com> References: <20240911160458.524732-1-viacheslavo@nvidia.com> <20240918134623.8441-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] 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: DS2PEPF00003441:EE_|SA1PR12MB7126:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a36c100-ef00-4e0a-8497-08dcd7e86a8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: rrwNpTaNSVhkure30rJj0atzAR6NypQokj5K3vRf2EdSgVnUbOjJwrDukD1w1M/VFDIk3MEUiNlry+erKsoTPYuv6+lX2FPNWe624tsSJYcclTEqcP9pYQpBI3+3ptFLH54dFscgzT++b1DpDksw4t9sAUoMwGPrKZShDxeaTyVAb5VGnCbnOU7X1nU4MWvICA0cywnrJmQEGgHjcFVfh0j9tfPs32t1y9itVpyfWMRNPIgI0RgSvqJtHmrF+fGmge3CHfukcgss9EFl3vOiJEOy3VUfI0dJGkjOhgsco+yBEXhP1Sp7E9P8V5ijumJO9nYnMwHUJjvQDgyGYv9O88YvRLuWp5EDDpUS9Wu3N+wAehgst15IUA842qXKPJkaw9DplIhZtKCUTJ1qG8+GtUhGUxFUXj8Jt7+JnEEfOObCzkVw71rTDLsKJHDkCYHE7fVvwlMMIn+M7lXJtcwoz0VFlDk/iK93Bwgcsw1lmE/8wHRsrYi8SCRjKKDSRUM9wSPGKAXRi/65CPsFowmHQA7GfBC0D63tDPpjdMEiErf/Jz/sOARv0oUGuJHurFMTOwfC9fS0WcUazjfcozz4b7g0lV6Q+uAv5W173o15Z8IXP3OtIsc0n0/5JQgCUxDTgx4zFPHlniYOgQZ5jNe8iU6CEUUkDo2Bv+VeHzG7KKZh5XnrsUtyW8xWQgsvEdGNBps/krzcQ3lYzoGTeNv3Ko5gei36aONOq+mvG7GkQXucXagmEQwHznsXC2UlzcIbTX87pEZNzY1pOConjCJn0Xgxlfo+LSQ9QKWtrCV5KACsui9COM3YMCbI9Tq2avqsLnn6O10EGihvDmosbl2xbsrp2aqAtxa2A8CS0Olib6CaL0AqxXscDtJavgSmEH/B8O4ovXnyuX1Xo0VHdzJeqQNlTePzFJC+UYElI2KHtECWOVs55sf/ixnWUfgxyUJGIRq1cVB4ej8gS9k3uXNi4laueBFnpYpMYjaJGPkuVDpg9guMGZzSAeRTqNkg+oSXGuC5bTU5kz9+SWanL1eIjpfzqqRLb1w/O/Eap7KLHTC+2rn+GPypWW8RHi7eIyRezR90+I+vpCPFNsiGCK8lHBLEOLkfBUJasmSATwhW0NIgr/L7QqSQzOYvXwAmcmS3CxoGNZlmG9r/CSp0bW8Mh2LAghxgy78DAN6Fb1nkNevkus1vG97BnUkvtqDYHRSOitQiCRahVUiYmA1QCntY6Lgzy0WdX7riXc0A3/Jwi4hcXrg2I5dUambiaZrAG8EyoZtdIZEenz+WwC3Aov5yRH1Kr9XkmzGwy1wU9xbhlwDGOs/jyZQIN6SEvbLPIG5sszLIESf4nMBvKvm3SmoHxWZWaxgk2uaaUhKGkhTEJTj70dCBKfhM/UuBLwPj3LVX1EXSGvPhuCLttpQkAp3m/Wz4h8m38b0+GGR2VX5JnJgNwVoTViHCXggrMNE00hin 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:(13230040)(1800799024)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 13:47:19.8380 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a36c100-ef00-4e0a-8497-08dcd7e86a8f 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: DS2PEPF00003441.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7126 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 If the sample field in flex item did not cover the entire 32-bit word (width was not verified 32 bits) or was not aligned on the byte boundary the match on this sample in flows happened to be ignored or wrongly missed. The field mask "def" was build in wrong endianness, and non-byte aligned shifts were wrongly performed for the pattern masks and values. Fixes: 6dac7d7ff2bf ("net/mlx5: translate flex item pattern into matcher") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/hws/mlx5dr_definer.c | 4 +-- drivers/net/mlx5/mlx5.h | 5 ++- drivers/net/mlx5/mlx5_flow_dv.c | 5 ++- drivers/net/mlx5/mlx5_flow_flex.c | 47 +++++++++++++-------------- 4 files changed, 29 insertions(+), 32 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c index 2dfcc5eba6..10b986d66b 100644 --- a/drivers/net/mlx5/hws/mlx5dr_definer.c +++ b/drivers/net/mlx5/hws/mlx5dr_definer.c @@ -574,7 +574,7 @@ mlx5dr_definer_flex_parser_set(struct mlx5dr_definer_fc *fc, idx = fc->fname - MLX5DR_DEFINER_FNAME_FLEX_PARSER_0; byte_off -= idx * sizeof(uint32_t); ret = mlx5_flex_get_parser_value_per_byte_off(flex, flex->handle, byte_off, - false, is_inner, &val); + is_inner, &val); if (ret == -1 || !val) return; @@ -2825,7 +2825,7 @@ mlx5dr_definer_conv_item_flex_parser(struct mlx5dr_definer_conv_data *cd, for (i = 0; i < MLX5_GRAPH_NODE_SAMPLE_NUM; i++) { byte_off = base_off - i * sizeof(uint32_t); ret = mlx5_flex_get_parser_value_per_byte_off(m, v->handle, byte_off, - true, is_inner, &mask); + is_inner, &mask); if (ret == -1) { rte_errno = EINVAL; return rte_errno; diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index b1423b6868..0fb18f7fb1 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -2600,11 +2600,10 @@ void mlx5_flex_flow_translate_item(struct rte_eth_dev *dev, void *matcher, void *key, const struct rte_flow_item *item, bool is_inner); int mlx5_flex_get_sample_id(const struct mlx5_flex_item *tp, - uint32_t idx, uint32_t *pos, - bool is_inner, uint32_t *def); + uint32_t idx, uint32_t *pos, bool is_inner); int mlx5_flex_get_parser_value_per_byte_off(const struct rte_flow_item_flex *item, void *flex, uint32_t byte_off, - bool is_mask, bool tunnel, uint32_t *value); + bool tunnel, uint32_t *value); int mlx5_flex_get_tunnel_mode(const struct rte_flow_item *item, enum rte_flow_item_flex_tunnel_mode *tunnel_mode); int mlx5_flex_acquire_index(struct rte_eth_dev *dev, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index b18bb430d7..d2a3f829d5 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1526,7 +1526,6 @@ mlx5_modify_flex_item(const struct rte_eth_dev *dev, const struct mlx5_flex_pattern_field *map; uint32_t offset = data->offset; uint32_t width_left = width; - uint32_t def; uint32_t cur_width = 0; uint32_t tmp_ofs; uint32_t idx = 0; @@ -1551,7 +1550,7 @@ mlx5_modify_flex_item(const struct rte_eth_dev *dev, tmp_ofs = pos < data->offset ? data->offset - pos : 0; for (j = i; i < flex->mapnum && width_left > 0; ) { map = flex->map + i; - id = mlx5_flex_get_sample_id(flex, i, &pos, false, &def); + id = mlx5_flex_get_sample_id(flex, i, &pos, false); if (id == -1) { i++; /* All left length is dummy */ @@ -1570,7 +1569,7 @@ mlx5_modify_flex_item(const struct rte_eth_dev *dev, * 2. Width has been covered. */ for (j = i + 1; j < flex->mapnum; j++) { - tmp_id = mlx5_flex_get_sample_id(flex, j, &pos, false, &def); + tmp_id = mlx5_flex_get_sample_id(flex, j, &pos, false); if (tmp_id == -1) { i = j; pos -= flex->map[j].width; diff --git a/drivers/net/mlx5/mlx5_flow_flex.c b/drivers/net/mlx5/mlx5_flow_flex.c index 0c41b956b0..bf38643a23 100644 --- a/drivers/net/mlx5/mlx5_flow_flex.c +++ b/drivers/net/mlx5/mlx5_flow_flex.c @@ -118,28 +118,32 @@ mlx5_flex_get_bitfield(const struct rte_flow_item_flex *item, uint32_t pos, uint32_t width, uint32_t shift) { const uint8_t *ptr = item->pattern + pos / CHAR_BIT; - uint32_t val, vbits; + uint32_t val, vbits, skip = pos % CHAR_BIT; /* Proceed the bitfield start byte. */ MLX5_ASSERT(width <= sizeof(uint32_t) * CHAR_BIT && width); MLX5_ASSERT(width + shift <= sizeof(uint32_t) * CHAR_BIT); if (item->length <= pos / CHAR_BIT) return 0; - val = *ptr++ >> (pos % CHAR_BIT); + /* Bits are enumerated in byte in network order: 01234567 */ + val = *ptr++; vbits = CHAR_BIT - pos % CHAR_BIT; - pos = (pos + vbits) / CHAR_BIT; + pos = RTE_ALIGN_CEIL(pos, CHAR_BIT) / CHAR_BIT; vbits = RTE_MIN(vbits, width); - val &= RTE_BIT32(vbits) - 1; + /* Load bytes to cover the field width, checking pattern boundary */ while (vbits < width && pos < item->length) { uint32_t part = RTE_MIN(width - vbits, (uint32_t)CHAR_BIT); uint32_t tmp = *ptr++; - pos++; - tmp &= RTE_BIT32(part) - 1; - val |= tmp << vbits; + val |= tmp << RTE_ALIGN_CEIL(vbits, CHAR_BIT); vbits += part; + pos++; } - return rte_bswap32(val <<= shift); + val = rte_cpu_to_be_32(val); + val <<= skip; + val >>= shift; + val &= (RTE_BIT64(width) - 1) << (sizeof(uint32_t) * CHAR_BIT - shift - width); + return val; } #define SET_FP_MATCH_SAMPLE_ID(x, def, msk, val, sid) \ @@ -211,21 +215,17 @@ mlx5_flex_set_match_sample(void *misc4_m, void *misc4_v, * Where to search the value and mask. * @param[in] is_inner * For inner matching or not. - * @param[in, def] def - * Mask generated by mapping shift and width. * * @return * 0 on success, -1 to ignore. */ int mlx5_flex_get_sample_id(const struct mlx5_flex_item *tp, - uint32_t idx, uint32_t *pos, - bool is_inner, uint32_t *def) + uint32_t idx, uint32_t *pos, bool is_inner) { const struct mlx5_flex_pattern_field *map = tp->map + idx; uint32_t id = map->reg_id; - *def = (RTE_BIT64(map->width) - 1) << map->shift; /* Skip placeholders for DUMMY fields. */ if (id == MLX5_INVALID_SAMPLE_REG_ID) { *pos += map->width; @@ -252,8 +252,6 @@ mlx5_flex_get_sample_id(const struct mlx5_flex_item *tp, * Mlx5 flex item sample mapping handle. * @param[in] byte_off * Mlx5 flex item format_select_dw. - * @param[in] is_mask - * Spec or mask. * @param[in] tunnel * Tunnel mode or not. * @param[in, def] value @@ -265,25 +263,23 @@ mlx5_flex_get_sample_id(const struct mlx5_flex_item *tp, int mlx5_flex_get_parser_value_per_byte_off(const struct rte_flow_item_flex *item, void *flex, uint32_t byte_off, - bool is_mask, bool tunnel, uint32_t *value) + bool tunnel, uint32_t *value) { struct mlx5_flex_pattern_field *map; struct mlx5_flex_item *tp = flex; - uint32_t def, i, pos, val; + uint32_t i, pos, val; int id; *value = 0; for (i = 0, pos = 0; i < tp->mapnum && pos < item->length * CHAR_BIT; i++) { map = tp->map + i; - id = mlx5_flex_get_sample_id(tp, i, &pos, tunnel, &def); + id = mlx5_flex_get_sample_id(tp, i, &pos, tunnel); if (id == -1) continue; if (id >= (int)tp->devx_fp->num_samples || id >= MLX5_GRAPH_NODE_SAMPLE_NUM) return -1; if (byte_off == tp->devx_fp->sample_info[id].sample_dw_data * sizeof(uint32_t)) { val = mlx5_flex_get_bitfield(item, pos, map->width, map->shift); - if (is_mask) - val &= RTE_BE32(def); *value |= val; } pos += map->width; @@ -355,10 +351,10 @@ mlx5_flex_flow_translate_item(struct rte_eth_dev *dev, spec = item->spec; mask = item->mask; tp = (struct mlx5_flex_item *)spec->handle; - for (i = 0; i < tp->mapnum; i++) { + for (i = 0; i < tp->mapnum && pos < (spec->length * CHAR_BIT); i++) { struct mlx5_flex_pattern_field *map = tp->map + i; uint32_t val, msk, def; - int id = mlx5_flex_get_sample_id(tp, i, &pos, is_inner, &def); + int id = mlx5_flex_get_sample_id(tp, i, &pos, is_inner); if (id == -1) continue; @@ -366,11 +362,14 @@ mlx5_flex_flow_translate_item(struct rte_eth_dev *dev, if (id >= (int)tp->devx_fp->num_samples || id >= MLX5_GRAPH_NODE_SAMPLE_NUM) return; + def = (uint32_t)(RTE_BIT64(map->width) - 1); + def <<= (sizeof(uint32_t) * CHAR_BIT - map->shift - map->width); val = mlx5_flex_get_bitfield(spec, pos, map->width, map->shift); - msk = mlx5_flex_get_bitfield(mask, pos, map->width, map->shift); + msk = pos < (mask->length * CHAR_BIT) ? + mlx5_flex_get_bitfield(mask, pos, map->width, map->shift) : def; sample_id = tp->devx_fp->sample_ids[id]; mlx5_flex_set_match_sample(misc4_m, misc4_v, - def, msk & def, val & msk & def, + def, msk, val & msk, sample_id, id); pos += map->width; } From patchwork Wed Sep 18 13:46:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 144264 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7B634459CC; Wed, 18 Sep 2024 15:48:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB5D1432B0; Wed, 18 Sep 2024 15:47:31 +0200 (CEST) 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 18D90432B0; Wed, 18 Sep 2024 15:47:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EQ8jrPOFMfMVfVa/UWyf4+Dg8Q75dWWCcAnzFFb1hBDFcNQW5x+uZy7krZ1yGVWXhWjUD9gGTLL3vNSpxS8wgo8HD7U8ZpmHHbz525JJQpfjtpOHTenOJzOfbOEHO/morvAEKgJwRZV51TdO6XmsGvG4/1tFbmaPKEGl0bqd3Nr8LATaZzXBE/uJyI8G5koWV59rUhAcdgk0MFReY9aoe1DnuoGAwYF5chvsavp3ab1S9geVPyFjCrcZYxWUBMx1hkCoNm+qmgJrfi7YxFhKj2MNUoP6yB/sWonlISH49zPYmeRs0eFqrRmXzvp1I4CdqGDkTHg3OBWKxhobktC/Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Om94qSh5KjPCvYJlVWdyGfmtYpnq+GxiH4HKerrp1qE=; b=h2GhGbd9i7JqZ1J9tYTP02VF4RRpjzg6rdcnNLT945Ry2Frzn1P3rRyi9e11FSfl1imLlhVWcZnnhGlbQlo1DoDOZe2MkEpNaSHkyQkEAgxP0MwONhUba8jtTeJVvMO9l3/iNmrQK/26VhKOhfpzixnqxZH+1/V77S7JOhpkaW3GXxMwLJcu/tGROh/1tVXFVP+i7jT8V2zB3yCmvSr4oBBzO242gmnhVaz9J7TPvhSVtWiaLCBVEB+/U03Ev0x69nX+nHyMcvi2QBfMpE1Dnn0ZqjBJxRn3HkLMhDTA3Zu6G92wBdk9pMaXTI/9koUvriM4jKs1CvbhPFFOvEc2mw== 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 (0) 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=Om94qSh5KjPCvYJlVWdyGfmtYpnq+GxiH4HKerrp1qE=; b=Hw5NHDo5SpZ61Z4HB5o+uwt+sLUZwkP4YEIr9f6lZPfim7jUOHFdVGjPDtWraySUa+j3QZYRzhkt4yjqpPNhtC35bctFrb1E0zryL7kZ8oiOzK/w6PCMg9Y3322kFxvmlvZ3nmMkwGJQdSrG7InTgsMuaP5fv/oW8eIXOaF18cKsrA2twSML8voE04dndQOimyt6btChdj0NP8s7xUI2XMkPzaAXxa/VcBVG0rPOnK53WOELQp/UIHoq98QXk0mux6M9DEp4Hm6DvX6JuXZiVVWMfsfrV5IXMGlhSJFLw8kPnuNs3bQ44e2uubISx0C7WFDNT5fUDexQdWSDFshsWg== Received: from CH0PR08CA0021.namprd08.prod.outlook.com (2603:10b6:610:33::26) by CH3PR12MB9430.namprd12.prod.outlook.com (2603:10b6:610:1cd::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.26; Wed, 18 Sep 2024 13:47:24 +0000 Received: from DS2PEPF00003447.namprd04.prod.outlook.com (2603:10b6:610:33:cafe::bd) by CH0PR08CA0021.outlook.office365.com (2603:10b6:610:33::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.30 via Frontend Transport; Wed, 18 Sep 2024 13:47:24 +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 DS2PEPF00003447.mail.protection.outlook.com (10.167.17.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Wed, 18 Sep 2024 13:47:24 +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.1544.4; Wed, 18 Sep 2024 06:47:09 -0700 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.1544.4; Wed, 18 Sep 2024 06:47:07 -0700 From: Viacheslav Ovsiienko To: CC: , , , , Subject: [PATCH v2 9/9] net/mlx5: fix flex item header length field translation Date: Wed, 18 Sep 2024 16:46:23 +0300 Message-ID: <20240918134623.8441-10-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240918134623.8441-1-viacheslavo@nvidia.com> References: <20240911160458.524732-1-viacheslavo@nvidia.com> <20240918134623.8441-1-viacheslavo@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] 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: DS2PEPF00003447:EE_|CH3PR12MB9430:EE_ X-MS-Office365-Filtering-Correlation-Id: fd453bb9-134b-4aa5-d147-08dcd7e86d4c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: GYFWh+p7RAxH3fD71j85+j7wSYISWa8MLBa6NDRFyXxmGcgsdsArTN4v1ZTtPBGk9utweaiMW2tKozY69hu2aHD4h9j6FpCozpAYiSUqLO9xKCVctOySMMIpIyUPqIaQQdQdYoQyowJue6NT8YcSI6nzYmxdtlEHyuHdvJ55L/dqCAIXQmSpim1EPZLAa04E2xv1sZw5dn3vPVX753D2P1rc4BgIR+PIgofLfN7SjwPMjAcHAB+aSp6SPSBCxaSyKGfLOnqLE1iLB5q3xK2dq09jWqjGEE33r3BpRg3EAqfsyU6tCPf8BRMAang+l8wBzoKR3ot1NREWzk29fDW2fsm8jdRT0uGXxI8T+dkYCt9ORS5C4rJPNXY+SuoLAIGlUqwBqKpKGrryGcyVVd9T2Ft3eCoH+3rNqjdtQVPC84+3zB6UNh/ER7YilT2fFpt4XJpRbG7J0sfB6hdQicwztC1BfnkVk2eBPjAlaGVMoWzSvLqzrjDFbf4NkpMxfSMwtDVjqOZB5fciZCtZOaFikQPqJ59HMRjm1ns3/aUORg+wdB2E5izcwaCOQLKI68FMTq/c1W27e56//NHJbhWsg00cYVRQXV5kbPh0napbECQNbUMLtqBgXmWn65UbhgcckrcCqUQxvCwr+MIJttBR8WgVlNWWVPDCJluiaKs26OsTTBAs8wR4K1V6wzmePQ5CLT8eHjxlHhGiGanJi8anLitxY97yVqnnVAmpy7+3tpkZNRJqfVWuYdOQqmxkGQK4JGQJgSk8Gn/rMcSqYQEnaRMyBj93GGeIcYrY/tQnyeXdkDSC43njVoMJurVXW5+8A9iYePv/9Nvi7y2b1hhq0BcQdGHDBs2o7KcdCmV3AVONQoHPXwRZRTP4V+hRpmtIP7/YZUeyauRQtsdkVJnVpvbttwjU/NrVefQ4DW3A+STqJk7RkHiZxbDJaK+A/UpZpObv37+MmR1amm8+w49avAuKvdEZvapO8TCsh4APG7p9e/rc6NecJp1tnq0Y+bbpkWyoDNcZPpQ92jx5+DsjTF2hIrBzgg+aMZIBpMvZ9Jl5l02rfWcXQBDCuSZrO6DHsxa2NdfKbuzr7+eatHTOubE7kED9DfqKNXtJz9GKwxXwexqvzd/OKwhQ5pByMt+tOVjzz561B/m1zJ3GHfn06/0vbRfu0pRmuEFJkMn9EFWyFXbNn3QGppsUpHBr8hvIRsmeomXG/UVR6Ys79q3pN4wx/68E/vrX/3LC22X+HxskRHHDnFbxLefQ70VHbFV+QA+LBj6unqrHDWrvkqFJuiCS7YXXHajbh6fOdbVS18A2br/aDS0ogJyOrkcXK1Xdijx1Z6hXA9FnKRucWJyNQsUihDyElNUcl6DOQy9R0y8Y35yTUk0zfjffXN8BlhHe 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:(13230040)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 13:47:24.4496 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd453bb9-134b-4aa5-d147-08dcd7e86d4c 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: DS2PEPF00003447.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9430 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 There are hardware imposed limitations on the header length field description for the mask and shift combinations in the FIELD_MODE_OFFSET mode. The patch updates: - parameter check for FIELD_MODE_OFFSET for the header length field - check whether length field crosses dword boundaries in header - correct mask extension to the hardware required width 6-bits - correct adjusting the mask left margin offset, preventing dword offset Fixes: b293e8e49d78 ("net/mlx5: translate flex item configuration") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko Acked-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5_flow_flex.c | 120 ++++++++++++++++-------------- 1 file changed, 66 insertions(+), 54 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_flex.c b/drivers/net/mlx5/mlx5_flow_flex.c index bf38643a23..afed16985a 100644 --- a/drivers/net/mlx5/mlx5_flow_flex.c +++ b/drivers/net/mlx5/mlx5_flow_flex.c @@ -449,12 +449,14 @@ mlx5_flex_release_index(struct rte_eth_dev *dev, * * shift mask * ------- --------------- - * 0 b111100 0x3C - * 1 b111110 0x3E - * 2 b111111 0x3F - * 3 b011111 0x1F - * 4 b001111 0x0F - * 5 b000111 0x07 + * 0 b11111100 0x3C + * 1 b01111110 0x3E + * 2 b00111111 0x3F + * 3 b00011111 0x1F + * 4 b00001111 0x0F + * 5 b00000111 0x07 + * 6 b00000011 0x03 + * 7 b00000001 0x01 */ static uint8_t mlx5_flex_hdr_len_mask(uint8_t shift, @@ -464,8 +466,7 @@ mlx5_flex_hdr_len_mask(uint8_t shift, int diff = shift - MLX5_PARSE_GRAPH_NODE_HDR_LEN_SHIFT_DWORD; base_mask = mlx5_hca_parse_graph_node_base_hdr_len_mask(attr); - return diff == 0 ? base_mask : - diff < 0 ? (base_mask << -diff) & base_mask : base_mask >> diff; + return diff < 0 ? base_mask << -diff : base_mask >> diff; } static int @@ -476,7 +477,6 @@ mlx5_flex_translate_length(struct mlx5_hca_flex_attr *attr, { const struct rte_flow_item_flex_field *field = &conf->next_header; struct mlx5_devx_graph_node_attr *node = &devx->devx_conf; - uint32_t len_width, mask; if (field->field_base % CHAR_BIT) return rte_flow_error_set @@ -504,7 +504,14 @@ mlx5_flex_translate_length(struct mlx5_hca_flex_attr *attr, "negative header length field base (FIXED)"); node->header_length_mode = MLX5_GRAPH_NODE_LEN_FIXED; break; - case FIELD_MODE_OFFSET: + case FIELD_MODE_OFFSET: { + uint32_t msb, lsb; + int32_t shift = field->offset_shift; + uint32_t offset = field->offset_base; + uint32_t mask = field->offset_mask; + uint32_t wmax = attr->header_length_mask_width + + MLX5_PARSE_GRAPH_NODE_HDR_LEN_SHIFT_DWORD; + if (!(attr->header_length_mode & RTE_BIT32(MLX5_GRAPH_NODE_LEN_FIELD))) return rte_flow_error_set @@ -514,47 +521,73 @@ mlx5_flex_translate_length(struct mlx5_hca_flex_attr *attr, return rte_flow_error_set (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, "field size is a must for offset mode"); - if (field->field_size + field->offset_base < attr->header_length_mask_width) + if ((offset ^ (field->field_size + offset)) >> 5) return rte_flow_error_set (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, - "field size plus offset_base is too small"); - node->header_length_mode = MLX5_GRAPH_NODE_LEN_FIELD; - if (field->offset_mask == 0 || - !rte_is_power_of_2(field->offset_mask + 1)) + "field crosses the 32-bit word boundary"); + /* Hardware counts in dwords, all shifts done by offset within mask */ + if (shift < 0 || (uint32_t)shift >= wmax) + return rte_flow_error_set + (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, + "header length field shift exceeds limits (OFFSET)"); + if (!mask) + return rte_flow_error_set + (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, + "zero length field offset mask (OFFSET)"); + msb = rte_fls_u32(mask) - 1; + lsb = rte_bsf32(mask); + if (!rte_is_power_of_2((mask >> lsb) + 1)) return rte_flow_error_set (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, - "invalid length field offset mask (OFFSET)"); - len_width = rte_fls_u32(field->offset_mask); - if (len_width > attr->header_length_mask_width) + "length field offset mask not contiguous (OFFSET)"); + if (msb >= field->field_size) return rte_flow_error_set (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, - "length field offset mask too wide (OFFSET)"); - mask = mlx5_flex_hdr_len_mask(field->offset_shift, attr); - if (mask < field->offset_mask) + "length field offset mask exceeds field size (OFFSET)"); + if (msb >= wmax) return rte_flow_error_set (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, - "length field shift too big (OFFSET)"); - node->header_length_field_mask = RTE_MIN(mask, - field->offset_mask); + "length field offset mask exceeds supported width (OFFSET)"); + if (mask & ~mlx5_flex_hdr_len_mask(shift, attr)) + return rte_flow_error_set + (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, + "mask and shift combination not supported (OFFSET)"); + msb++; + offset += field->field_size - msb; + if (msb < attr->header_length_mask_width) { + if (attr->header_length_mask_width - msb > offset) + return rte_flow_error_set + (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, + "field size plus offset_base is too small"); + offset += msb; + /* + * Here we can move to preceding dword. Hardware does + * cyclic left shift so we should avoid this and stay + * at current dword offset. + */ + offset = (offset & ~0x1Fu) | + ((offset - attr->header_length_mask_width) & 0x1F); + } + node->header_length_mode = MLX5_GRAPH_NODE_LEN_FIELD; + node->header_length_field_mask = mask; + node->header_length_field_shift = shift; + node->header_length_field_offset = offset; break; + } case FIELD_MODE_BITMASK: if (!(attr->header_length_mode & RTE_BIT32(MLX5_GRAPH_NODE_LEN_BITMASK))) return rte_flow_error_set (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, "unsupported header length field mode (BITMASK)"); - if (attr->header_length_mask_width < field->field_size) + if (field->offset_shift > 15 || field->offset_shift < 0) return rte_flow_error_set (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, - "header length field width exceeds limit"); + "header length field shift exceeds limit (BITMASK)"); node->header_length_mode = MLX5_GRAPH_NODE_LEN_BITMASK; - mask = mlx5_flex_hdr_len_mask(field->offset_shift, attr); - if (mask < field->offset_mask) - return rte_flow_error_set - (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, - "length field shift too big (BITMASK)"); - node->header_length_field_mask = RTE_MIN(mask, - field->offset_mask); + node->header_length_field_mask = field->offset_mask; + node->header_length_field_shift = field->offset_shift; + node->header_length_field_offset = field->offset_base; break; default: return rte_flow_error_set @@ -567,27 +600,6 @@ mlx5_flex_translate_length(struct mlx5_hca_flex_attr *attr, (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, "header length field base exceeds limit"); node->header_length_base_value = field->field_base / CHAR_BIT; - if (field->field_mode == FIELD_MODE_OFFSET || - field->field_mode == FIELD_MODE_BITMASK) { - if (field->offset_shift > 15 || field->offset_shift < 0) - return rte_flow_error_set - (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, - "header length field shift exceeds limit"); - node->header_length_field_shift = field->offset_shift; - node->header_length_field_offset = field->offset_base; - } - if (field->field_mode == FIELD_MODE_OFFSET) { - if (field->field_size > attr->header_length_mask_width) { - node->header_length_field_offset += - field->field_size - attr->header_length_mask_width; - } else if (field->field_size < attr->header_length_mask_width) { - node->header_length_field_offset -= - attr->header_length_mask_width - field->field_size; - node->header_length_field_mask = - RTE_MIN(node->header_length_field_mask, - (1u << field->field_size) - 1); - } - } return 0; }