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 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 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: 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: =?us-ascii?Q?9xOdZKGbHEz9qGc7eC/L8ZFb64+Xf1fRRAMAMELwBwqSV8Dk1LY11Pv2Ec0x?= =?us-ascii?Q?N+LgYNPvO8sN2oHTCf2z2LSkzh1pzb8taemvoCyrepWu6GqPHA1SKoWrV0Re?= =?us-ascii?Q?HO8K/LNjlzxszDPR/XFcfUQkjF0VB0oIJubjiyh8qmXaDj/LPf3MMMxfjGOX?= =?us-ascii?Q?UZRjctiPsOc1nFUwtzzNu8kZdTtf0P1hBPYJxbO9I8pgouO6gC788Ozwj9Fl?= =?us-ascii?Q?n9viqjjYLroQvnE6NMgn+TK6pyGajhC+rcAqvxX34yYa87Hmy6ieSXc3wKRn?= =?us-ascii?Q?XT/RRDBS2dG9Dsq0Gen3LSvw1z92JIOExWHMnrbLbXfTB3hal9mesRXr3y3R?= =?us-ascii?Q?j7DWbCD7PzGaisrBY7fEzkC3NmbdPExp/goQh7nWxuRElHKP55PY9Pkag+up?= =?us-ascii?Q?OLGtzDD/Imzg2nUmy+fmtJWWloWIn865sB0bdiUUUWsWG3if59ORveWzPJ5E?= =?us-ascii?Q?UT1DG0Ze27/QF3hMvVB9QvGf15IdE3RwbqZ0AmU8/SzWXYB+LX3A2ASIk/qS?= =?us-ascii?Q?wgIeMGHTYv2fn0vnQuORZOms2j7xbR8hckVSE3dwXxRvD7Cv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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 --- 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