From patchwork Sun Dec 3 11:25:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 134765 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 779134365F; Sun, 3 Dec 2023 12:28:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4958D40EDF; Sun, 3 Dec 2023 12:26:51 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2081.outbound.protection.outlook.com [40.107.100.81]) by mails.dpdk.org (Postfix) with ESMTP id DE3E740E8A for ; Sun, 3 Dec 2023 12:26:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ixZ8U3mXmxU4jwfiv8/NGseKDylxnpd0f21UozvnZRGvp536AAodkscCnIRA+cf3mAUQGmUPVzvpJ1ctlBkdxqZnqnboQh5FPopRPBp4SMJLtL14c+5Ga3esOmIGy+K8KanUmbHsWUTNBKCIQ6vtHd2DlzWVaijsZLES6Ga7hpa++uMwgpfp9e6SzbdSbCbcZ9Tko+9m/uFSB+KU/hrLWLkjScUIkjcK9Z7xOpkrgQv913bpjwFH7CPfZIbm+WHIlAEWVIy5r1YddI2aQ6QYpAgpRQthH9t5avBneiWYqsOu2mUqFVL//YR5mpLiN/CdO0CfzJ/Th4mRCtIM3t08rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2ZpP9tPwjN0ZtNt1fk/wdglsPcL/PT+GaQx5g/6PkKk=; b=kwULWnaZhArup+lnoR+fJYNPSTd5NG1bGTmEMYqSnSRXW6Fvj2Y54tkTmZhPII1pWf1NZJZTZRIBkK2gthS8Moo/w5mrd2bNUvC60o9tpdbrbGgkjzy6cVb519MKIQNFTnI5yG7C84KdOdjFyfcaiu7RaGz5vYoUM+NS+y1ufzoj/GAjA7hKAZKCDtzGncSk597pfYDLoIdz4KtUrocXcDSsV4u5DWySo15/oKCTHpe3LBXcm+pSTdkPWGbSt6D3qTC6hIyH7MviuSnE8wgtwV86q6IsYYkjBTZjwh15lP60yCiWGJPhRR7wosGXPKQeGbpLaxPDewZlLdXbtzTTlw== 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=2ZpP9tPwjN0ZtNt1fk/wdglsPcL/PT+GaQx5g/6PkKk=; b=akDQAcQEzK+OLrIvdF+K7PIeep4sjbHsv8GkwvVHjzdmORZXGgRZRSZoWFp/92pD1TQKEnSn3spZAYDAhqVGZ9kUtzIlBHJtnURNd3/qN3K3lse3BBHtKew83AqXESaL/rnNZq5eE/59orhm2T7BGBzm26JpWa6FEe6ex1HbnO2xbR1ZUX6dRYv5CKpqqQHgtw6av0qK8DZaOxHIHUSlXxFOZmkPfEQLOURMZbETLsXXEG+GktobCZA9ZutgLiBWpNCQW44z37iU6mQuSU2gLnzUQXV3M8DxlfIO/bDDD+2C4mJT1ihzKSc/L8df3bMqR0X7dDByubHipsyftdoR5g== Received: from DS7PR03CA0018.namprd03.prod.outlook.com (2603:10b6:5:3b8::23) by CH3PR12MB9220.namprd12.prod.outlook.com (2603:10b6:610:198::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.32; Sun, 3 Dec 2023 11:26:45 +0000 Received: from DS1PEPF0001709B.namprd05.prod.outlook.com (2603:10b6:5:3b8:cafe::9c) by DS7PR03CA0018.outlook.office365.com (2603:10b6:5:3b8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31 via Frontend Transport; Sun, 3 Dec 2023 11:26:45 +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 DS1PEPF0001709B.mail.protection.outlook.com (10.167.18.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.20 via Frontend Transport; Sun, 3 Dec 2023 11:26:45 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 3 Dec 2023 03:26:39 -0800 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 3 Dec 2023 03:26:38 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41 via Frontend Transport; Sun, 3 Dec 2023 03:26:37 -0800 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , Ori Kam , Suanming Mou Subject: [PATCH v1 20/23] net/mlx5: add GENEVE option support for profile 0 Date: Sun, 3 Dec 2023 13:25:40 +0200 Message-ID: <20231203112543.844014-21-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231203112543.844014-1-michaelba@nvidia.com> References: <20231203112543.844014-1-michaelba@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0001709B:EE_|CH3PR12MB9220:EE_ X-MS-Office365-Filtering-Correlation-Id: f48325a8-9904-42a6-bcef-08dbf3f2bb64 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wofpGsOj/OKth+rCPxfN0UHk9jqHo2qNGzDvO+t+Vo0wIBKjZDzJplFkmbbojBwQ/CTMQWKmaTULEVBnxePIoHjgr3dG+IWnpuf/ml0+1YfXSGH5oQYbZhEF+ipEwNijFgN2JvDZbGuI0nl/m8CAo+apQM5IcL/2B+Jp84g4cE1m5zsW7/LqO5LVc7LTK48F6uZqSIW9+rGY/zxzO3UDh5QWaEMSlez/+cunPftvUewh6371fzzMIchXTB7Tb7pNTZmW5zn20EOHA9gHblnfBDKosnfY3pQW/wyyArzAg1/MVOxpcSFp6PhDyQ4F/OVEEcW1yM5VNh5hpMLTHLoK4miABASutR7a8oufh+7NhiWJKpeVu82GMNr82148JMUUYd+EvbdW+9ABIkEro7bf1hIQr3QNCSEC2qgCXHrHrlBjyQKaU3gZj45hwZ0C3cmaAXTH1vHyKJW1Kde+FEDAr1zbMT5QX8Dw/9GLCIEt9EAVyXDoTB56TUm6MLgYT7M7BHEwgyNJ/m3gMP16+2IR18EEsfoaE+IA64LkQclMdLc9gpIRn2U/SPmfTL3N9EMl5P2+apHbUHgU6hckd5Hzp7JqMvOZyS2D095Fol0YNltgfHVuGRBy/DXqwR/LSqxkN6hhdsebVLnImfT6/LKkXrGCA7FYC5SghEky4DDqaMJ+iPAvkrXJ6q2dHxAjvaehL5AB7pRUH1Yyaj77uPAP5jMFP3m9wcMY73bUWsNaFVd5lb5i4MMCvcgqkjpxDvEG 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:(13230031)(4636009)(346002)(376002)(39860400002)(396003)(136003)(230922051799003)(82310400011)(1800799012)(64100799003)(186009)(451199024)(46966006)(40470700004)(36840700001)(478600001)(26005)(83380400001)(7636003)(336012)(6286002)(47076005)(6666004)(7696005)(356005)(1076003)(40480700001)(82740400003)(426003)(36756003)(107886003)(2616005)(316002)(6916009)(54906003)(70206006)(70586007)(36860700001)(55016003)(5660300002)(4326008)(86362001)(2906002)(8936002)(8676002)(40460700003)(41300700001)(30864003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2023 11:26:45.3226 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f48325a8-9904-42a6-bcef-08dbf3f2bb64 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: DS1PEPF0001709B.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9220 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 matching and modifying GENEVE option for FLEX_PARSER_PROFILE_ENABLE=0. Before this patch it is supported when FLEX_PARSER_PROFILE_ENABLE=8 in HW steering and when FLEX_PARSER_PROFILE_ENABLE=0 in SW steering. Signed-off-by: Michael Baum --- doc/guides/nics/mlx5.rst | 9 ++- doc/guides/platform/mlx5.rst | 6 +- drivers/net/mlx5/mlx5_flow_geneve.c | 114 +++++++++++++++++++++------- 3 files changed, 95 insertions(+), 34 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 645b566d80..b946ce00c2 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -347,6 +347,7 @@ Limitations - Multiple of same Geneve TLV option isn't supported at the same pattern template. - Supported only when ``FLEX_PARSER_PROFILE_ENABLE`` = 8. + - Supported also when ``FLEX_PARSER_PROFILE_ENABLE`` = 0 for single DW only. - VF: flow rules created on VF devices can only match traffic targeted at the configured MAC addresses (see ``rte_eth_dev_mac_addr_add()``). @@ -2429,8 +2430,14 @@ Limitations ~~~~~~~~~~~ * Supported only in HW steering (``dv_flow_en`` = 2). -* Supported only when ``FLEX_PARSER_PROFILE_ENABLE`` = 8. * Supported for FW version **xx.37.0142** and above. +* Parser creation can be done only for E-Switch manager. +* Supported for multiple DW only when ``FLEX_PARSER_PROFILE_ENABLE`` = 8. +* Supported for single DW also when ``FLEX_PARSER_PROFILE_ENABLE`` = 0 with some limitations: + + - ``sample_len`` must be equal to ``option_len`` and not bigger than 1. + - ``match_on_class_mode`` different than 1 is not supported. + - ``offset`` must be 0. Testpmd driver specific commands diff --git a/doc/guides/platform/mlx5.rst b/doc/guides/platform/mlx5.rst index d16508d0da..a66cf778d1 100644 --- a/doc/guides/platform/mlx5.rst +++ b/doc/guides/platform/mlx5.rst @@ -536,12 +536,10 @@ Below are some firmware configurations listed. or FLEX_PARSER_PROFILE_ENABLE=1 -- enable Geneve TLV option flow matching in SW steering:: +- enable Geneve TLV option flow matching:: FLEX_PARSER_PROFILE_ENABLE=0 - -- enable Geneve TLV option flow matching in HW steering:: - + or FLEX_PARSER_PROFILE_ENABLE=8 - enable GTP flow matching:: diff --git a/drivers/net/mlx5/mlx5_flow_geneve.c b/drivers/net/mlx5/mlx5_flow_geneve.c index 2c8dc39e74..f3ee414d02 100644 --- a/drivers/net/mlx5/mlx5_flow_geneve.c +++ b/drivers/net/mlx5/mlx5_flow_geneve.c @@ -18,6 +18,8 @@ #define MAX_GENEVE_OPTION_TOTAL_DATA_SIZE \ (MAX_GENEVE_OPTION_DATA_SIZE * MAX_GENEVE_OPTIONS_RESOURCES) +#define INVALID_SAMPLE_ID (UINT8_MAX) + /** * Single DW inside GENEVE TLV option. */ @@ -265,6 +267,8 @@ mlx5_geneve_tlv_options_unregister(struct mlx5_priv *priv, * Pointer to header layout structure to update. * @param resource * Pointer to single sample context to fill. + * @param sample_id + * The flex parser id for single DW or UINT8_MAX for multiple DWs. * * @return * 0 on success, a negative errno otherwise and rte_errno is set. @@ -274,7 +278,7 @@ mlx5_geneve_tlv_option_create_sample(void *ctx, struct mlx5_devx_geneve_tlv_option_attr *attr, struct mlx5_devx_match_sample_info_query_attr *query_attr, struct mlx5_hl_data *match_data, - struct mlx5_geneve_tlv_resource *resource) + struct mlx5_geneve_tlv_resource *resource, uint8_t sample_id) { struct mlx5_devx_obj *obj; int ret; @@ -282,7 +286,10 @@ mlx5_geneve_tlv_option_create_sample(void *ctx, obj = mlx5_devx_cmd_create_geneve_tlv_option(ctx, attr); if (obj == NULL) return -rte_errno; - ret = mlx5_devx_cmd_query_geneve_tlv_option(ctx, obj, query_attr); + if (sample_id == INVALID_SAMPLE_ID) + ret = mlx5_devx_cmd_query_geneve_tlv_option(ctx, obj, query_attr); + else + ret = mlx5_devx_cmd_match_sample_info_query(ctx, sample_id, query_attr); if (ret) { claim_zero(mlx5_devx_cmd_destroy(obj)); return ret; @@ -335,20 +342,22 @@ should_configure_sample_for_dw0(const struct rte_pmd_mlx5_geneve_tlv *spec) * Pointer to user configuration. * @param option * Pointer to single GENEVE TLV option to fill. + * @param sample_id + * The flex parser id for single DW or UINT8_MAX for multiple DWs. * * @return * 0 on success, a negative errno otherwise and rte_errno is set. */ static int mlx5_geneve_tlv_option_create(void *ctx, const struct rte_pmd_mlx5_geneve_tlv *spec, - struct mlx5_geneve_tlv_option *option) + struct mlx5_geneve_tlv_option *option, uint8_t sample_id) { struct mlx5_devx_geneve_tlv_option_attr attr = { .option_class = spec->option_class, .option_type = spec->option_type, .option_data_len = spec->option_len, .option_class_ignore = spec->match_on_class_mode == 1 ? 0 : 1, - .offset_valid = 1, + .offset_valid = sample_id == INVALID_SAMPLE_ID ? 1 : 0, }; struct mlx5_devx_match_sample_info_query_attr query_attr = {0}; struct mlx5_geneve_tlv_resource *resource; @@ -356,12 +365,14 @@ mlx5_geneve_tlv_option_create(void *ctx, const struct rte_pmd_mlx5_geneve_tlv *s int ret; if (should_configure_sample_for_dw0(spec)) { + MLX5_ASSERT(sample_id == INVALID_SAMPLE_ID); attr.sample_offset = 0; resource = &option->resources[resource_id]; ret = mlx5_geneve_tlv_option_create_sample(ctx, &attr, &query_attr, &option->match_data[0], - resource); + resource, + INVALID_SAMPLE_ID); if (ret) return ret; resource_id++; @@ -379,7 +390,8 @@ mlx5_geneve_tlv_option_create(void *ctx, const struct rte_pmd_mlx5_geneve_tlv *s ret = mlx5_geneve_tlv_option_create_sample(ctx, &attr, &query_attr, &option->match_data[i], - resource); + resource, + sample_id); if (ret) goto error; resource_id++; @@ -467,6 +479,8 @@ mlx5_geneve_tlv_option_copy(struct rte_pmd_mlx5_geneve_tlv *dst, * A list of GENEVE TLV options to create parser for them. * @param nb_options * The number of options in TLV list. + * @param sample_id + * The flex parser id for single DW or UINT8_MAX for multiple DWs. * * @return * A pointer to GENEVE TLV options parser structure on success, @@ -475,7 +489,7 @@ mlx5_geneve_tlv_option_copy(struct rte_pmd_mlx5_geneve_tlv *dst, static struct mlx5_geneve_tlv_options * mlx5_geneve_tlv_options_create(struct mlx5_dev_ctx_shared *sh, const struct rte_pmd_mlx5_geneve_tlv tlv_list[], - uint8_t nb_options) + uint8_t nb_options, uint8_t sample_id) { struct mlx5_geneve_tlv_options *options; const struct rte_pmd_mlx5_geneve_tlv *spec; @@ -495,7 +509,7 @@ mlx5_geneve_tlv_options_create(struct mlx5_dev_ctx_shared *sh, for (i = 0; i < nb_options; ++i) { spec = &tlv_list[i]; ret = mlx5_geneve_tlv_option_create(sh->cdev->ctx, spec, - &options->options[i]); + &options->options[i], sample_id); if (ret < 0) goto error; /* Copy the user list for comparing future configuration. */ @@ -705,6 +719,12 @@ mlx5_is_same_geneve_tlv_options(const struct mlx5_geneve_tlv_options *options, return true; } +static inline bool +multiple_dws_supported(struct mlx5_hca_attr *attr) +{ + return attr->geneve_tlv_option_offset && attr->geneve_tlv_sample; +} + void * mlx5_geneve_tlv_parser_create(uint16_t port_id, const struct rte_pmd_mlx5_geneve_tlv tlv_list[], @@ -715,8 +735,7 @@ mlx5_geneve_tlv_parser_create(uint16_t port_id, struct rte_eth_dev *dev; struct mlx5_priv *priv; struct mlx5_hca_attr *attr; - uint8_t total_dws = 0; - uint8_t i; + uint8_t sample_id; /* * Validate the input before taking a lock and before any memory @@ -742,34 +761,71 @@ mlx5_geneve_tlv_parser_create(uint16_t port_id, return NULL; } attr = &priv->sh->cdev->config.hca_attr; - MLX5_ASSERT(MAX_GENEVE_OPTIONS_RESOURCES <= - attr->max_geneve_tlv_options); - if (!attr->geneve_tlv_option_offset || !attr->geneve_tlv_sample || - !attr->query_match_sample_info || !attr->geneve_tlv_opt) { - DRV_LOG(ERR, "Not enough capabilities to support GENEVE TLV parser, maybe old FW version"); + if (!attr->query_match_sample_info || !attr->geneve_tlv_opt) { + DRV_LOG(ERR, "Not enough capabilities to support GENEVE TLV parser, is this device eswitch manager?"); rte_errno = ENOTSUP; return NULL; } - if (nb_options > MAX_GENEVE_OPTIONS_RESOURCES) { + DRV_LOG(DEBUG, "Max DWs supported for GENEVE TLV option is %u", + attr->max_geneve_tlv_options); + if (nb_options > attr->max_geneve_tlv_options) { DRV_LOG(ERR, "GENEVE TLV option number (%u) exceeds the limit (%u).", - nb_options, MAX_GENEVE_OPTIONS_RESOURCES); + nb_options, attr->max_geneve_tlv_options); rte_errno = EINVAL; return NULL; } - for (i = 0; i < nb_options; ++i) { - if (mlx5_geneve_tlv_option_validate(attr, &tlv_list[i]) < 0) { - DRV_LOG(ERR, "GENEVE TLV option %u is invalid.", i); + if (multiple_dws_supported(attr)) { + uint8_t total_dws = 0; + uint8_t i; + + MLX5_ASSERT(attr->max_geneve_tlv_options >= MAX_GENEVE_OPTIONS_RESOURCES); + for (i = 0; i < nb_options; ++i) { + if (mlx5_geneve_tlv_option_validate(attr, &tlv_list[i]) < 0) { + DRV_LOG(ERR, "GENEVE TLV option %u is invalid.", i); + return NULL; + } + total_dws += mlx5_geneve_tlv_option_get_nb_dws(&tlv_list[i]); + } + if (total_dws > MAX_GENEVE_OPTIONS_RESOURCES) { + DRV_LOG(ERR, + "Total requested DWs (%u) exceeds the limit (%u).", + total_dws, MAX_GENEVE_OPTIONS_RESOURCES); + rte_errno = EINVAL; return NULL; } - total_dws += mlx5_geneve_tlv_option_get_nb_dws(&tlv_list[i]); - } - if (total_dws > MAX_GENEVE_OPTIONS_RESOURCES) { - DRV_LOG(ERR, - "Total requested DWs (%u) exceeds the limit (%u).", - total_dws, MAX_GENEVE_OPTIONS_RESOURCES); - rte_errno = EINVAL; - return NULL; + /* Multiple DWs is supported, each of the has sample ID given later. */ + sample_id = INVALID_SAMPLE_ID; + DRV_LOG(DEBUG, "GENEVE TLV parser supports multiple DWs, FLEX_PARSER_PROFILE_ENABLE == 8"); + } else { + const struct rte_pmd_mlx5_geneve_tlv *option = &tlv_list[0]; + + if (option->offset != 0) { + DRV_LOG(ERR, + "GENEVE TLV option offset %u is required but not supported.", + option->offset); + rte_errno = ENOTSUP; + return NULL; + } + if (option->sample_len != option->option_len) { + DRV_LOG(ERR, + "GENEVE TLV option length (%u) should be equal to sample length (%u).", + option->option_len, option->sample_len); + rte_errno = ENOTSUP; + return NULL; + } + if (option->match_on_class_mode != 1) { + DRV_LOG(ERR, + "GENEVE TLV option match_on_class_mode %u is invalid for flex parser profile 0.", + option->match_on_class_mode); + rte_errno = EINVAL; + return NULL; + } + if (mlx5_geneve_tlv_option_validate(attr, option) < 0) + return NULL; + /* Single DW is supported, its sample ID is given. */ + sample_id = attr->geneve_tlv_option_sample_id; + DRV_LOG(DEBUG, "GENEVE TLV parser supports only single DW, FLEX_PARSER_PROFILE_ENABLE == 0"); } /* Take lock for this physical device and manage the options. */ phdev = mlx5_get_locked_physical_device(priv); @@ -793,7 +849,7 @@ mlx5_geneve_tlv_parser_create(uint16_t port_id, goto exit; } /* Create GENEVE TLV options for this physical device. */ - options = mlx5_geneve_tlv_options_create(priv->sh, tlv_list, nb_options); + options = mlx5_geneve_tlv_options_create(priv->sh, tlv_list, nb_options, sample_id); if (!options) { mlx5_unlock_physical_device(); return NULL;