From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 48D9945962; Wed, 11 Sep 2024 18:06:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B926243248; Wed, 11 Sep 2024 18:06:00 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2044.outbound.protection.outlook.com [40.107.243.44]) by mails.dpdk.org (Postfix) with ESMTP id 1A7DD42F6B for ; Wed, 11 Sep 2024 18:05:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iSxNqThXCu8Bp3Po+N/ZvHmnXRpeEHpmLVPZWrL6PmL23O4Nfa//07Xz+8PyxikR3xXwdjczMrPEvhU+y/7MZ5gxe6sgjHmD2IV+tdWJ7Le/5Wlm9JQHi3aj1+VCTvGxZYGsvtp1DF38B1ymQY3/6lCb5ZC0xcrmbaBy/hpuukKB7SmpGms/EwoarbXrnEcq+lYVunLBqGGyp/RK5MERIVg9vdDbrcRXmfNnt3NA9QEsITZYbUNTJ/68/5hzet/HZMUdx8xI1CszXJ7uIig40Y+cEMUofxBlHmUN0rHojHIuxbunmNG9b4Glqpdxoah42i3PkVEU8M3W7viCgd5QKQ== 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=XJxQ2cKFAeMJB8yKnRJEsr81vnVer4LsecnvO1BylQ3bTKm/FrvNoKiic/1ThAEBGkAelMOI7yCC9Wdi6zbO/h1oaHdhFqSsJEzNXw+dLWhW7fTLBEFEPa8y49puziEvOSwT3m6Uj8v1+kdvmpVAoCgu4Nfuo+diyPWBMrZJrw/Kcf6x2JyO83GWRhBQ1fvWg2QPfkLP7EQi3yWj7yyDr9c32VntLa67O50uZC4Fjw5d/N3uhU/ivuwedjyciTMoIQc2tINdHpDiPEY81lmYFXD+mV+RD8RqHKSqawfLa3biPagHitcsh1+NOA+CofSiRMyj90HO0La8JTIJlnHdWg== 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=tr9alUtrOW8YqkVenLESLM7hU4rCkYoseF5+Jn4r3OsOx/9UtBwny4/cGDuNwrASbfGhuZSi6JUHT0E8D2i3G3w2pKWyPOV/0rC6yTLJdTfYmTjUIECze9zGBXmC5AGZ0NOl6ACDB98KCLWdqMyfcmrxhDpC2WXCvpf0kro2DbMPPBWDV3EmUGh9t+0DzES8EWnRPG7Qv8wo0dlcBQ0snaUuMY4FaURpEc1xmwGfbC/CUPzlcNZnM6YhpUHYRP+b6MM2wS6+j39SU0twliEo+yu9ezUAVqDfHfII7wGjGZC3xN9BGjqq5MK4xnc67TD5NacO+gKeT+O1zogUsNxpaQ== Received: from CH0P220CA0006.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::27) by DS0PR12MB9040.namprd12.prod.outlook.com (2603:10b6:8:f5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.17; Wed, 11 Sep 2024 16:05:47 +0000 Received: from CH2PEPF00000147.namprd02.prod.outlook.com (2603:10b6:610:ef:cafe::f0) by CH0P220CA0006.outlook.office365.com (2603:10b6:610:ef::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.23 via Frontend Transport; Wed, 11 Sep 2024 16:05:47 +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 CH2PEPF00000147.mail.protection.outlook.com (10.167.244.104) 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, 11 Sep 2024 16:05:46 +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, 11 Sep 2024 09:05:27 -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, 11 Sep 2024 09:05:25 -0700 From: Viacheslav Ovsiienko To: CC: , , , Subject: [PATCH 2/9] net/mlx5: add flex item query tunnel mode routine Date: Wed, 11 Sep 2024 19:04:51 +0300 Message-ID: <20240911160458.524732-2-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240911160458.524732-1-viacheslavo@nvidia.com> References: <20240911160458.524732-1-viacheslavo@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: CH2PEPF00000147:EE_|DS0PR12MB9040:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f01c9e3-2a4f-49c2-a760-08dcd27b9907 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: =?us-ascii?Q?9AyYNomnWDAwEEmuAJ0u/GOR7jcSUFmg1oQnEoFu03lmmBncDHZ1c7j1ojoC?= =?us-ascii?Q?eoWcCG7OIfS0eK5/6MVTjC9zE7PvZ5g3frJkiH44pw0zsaVjJs69JG8VmiAW?= =?us-ascii?Q?p60g51v+DkiksL7/DElgaC446Hpz6cakH1xu16NS28TvV9gSdlupBwmHfhCK?= =?us-ascii?Q?b7zfE46sjZZCpPAJcaXVoZFQNYJLTSrIcLPHxfhcznYGa9rDKMjspXoQRFIi?= =?us-ascii?Q?Di8IMvDFidoxkcXkiA5yQ+qr/FrUDDqQbHKyIu2jPDe7otlj8HZPyBDMWCgI?= =?us-ascii?Q?Ww3gAlbx3qLN7pC0CMU7t6VZO+OaE8G0xEOniZun7/wHXZA3G+OA82OqqnCJ?= =?us-ascii?Q?AYMV8uF8bi1Am+Vt4InOx4bURz9tIqcgsmhHx17odCytrra9HsuoSIp7i18i?= =?us-ascii?Q?Dr8HuZWx5jA6X84mc1F9B+2igEAUCl2zotAXXBnnmvhcCxQWYv9z7JE19Q8+?= =?us-ascii?Q?s7aaOcTwTqi+5yAk+xRLi8G6NSXbOQDwBRke4DBf8TD7kgSh9GzKU9rDGSZG?= =?us-ascii?Q?w1fCDwIIKaHIkbWF5E4tuM4C2ffMI5s0Kl7GAXmOjSKmPbUTibQg4e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= 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)(36860700013)(1800799024)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 16:05:46.8431 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f01c9e3-2a4f-49c2-a760-08dcd27b9907 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: CH2PEPF00000147.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB9040 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 --- 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. -- 2.34.1