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 9248E46468 for ; Mon, 24 Mar 2025 17:20:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8B57940A71; Mon, 24 Mar 2025 17:20:09 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 9D13940A71 for ; Mon, 24 Mar 2025 17:20:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742833208; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PgYOqgbM2Mo2SehTn2fY4GlJGypSLEcnbzbCLSY4pOM=; b=brOB5icjsMF+FaIDxfN1xxWihStZ36mhC5PX2VyL3SZC3p4sS3a6/KHxv1+dsFjawla604 yjXhR2aFTZYUL9Il6b6wqu/a2P1wJmGf+3FscW/4lWD71Pmtvs+a0U53KwgPgqFLTwximN M8jE1kYLCo4TUCyjAqpYcii83FBLuq0= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-453-312li2kgM_SkekC0niVCtQ-1; Mon, 24 Mar 2025 12:18:19 -0400 X-MC-Unique: 312li2kgM_SkekC0niVCtQ-1 X-Mimecast-MFC-AGG-ID: 312li2kgM_SkekC0niVCtQ_1742833099 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E0CD2196D2D0; Mon, 24 Mar 2025 16:18:18 +0000 (UTC) Received: from rh.redhat.com (unknown [10.44.32.16]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 56A8830001A2; Mon, 24 Mar 2025 16:18:17 +0000 (UTC) From: Kevin Traynor To: Maayan Kashani Cc: Bing Zhao , dpdk stable Subject: patch 'net/mlx5: fix flow matching GENEVE options' has been queued to stable release 24.11.2 Date: Mon, 24 Mar 2025 16:16:24 +0000 Message-ID: <20250324161731.63950-17-ktraynor@redhat.com> In-Reply-To: <20250324161731.63950-1-ktraynor@redhat.com> References: <20250324161731.63950-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: v1cexHsLI2Rj9G3sr5m22IViku_sqgTWH1uh3PxhqIM_1742833099 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 24.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/28/25. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/44d0ab5afc575e375f44ab75a0b6b380aba605af Thanks. Kevin --- >From 44d0ab5afc575e375f44ab75a0b6b380aba605af Mon Sep 17 00:00:00 2001 From: Maayan Kashani Date: Tue, 4 Mar 2025 09:56:54 +0200 Subject: [PATCH] net/mlx5: fix flow matching GENEVE options [ upstream commit fdca628a3e22080a27ff5cd166b2e6537f3cf464 ] For non-template API on top of HWS, geneve options were missing a parser and therefore it failed. In template API it geneve options is configured by the user using mlx5 set/apply tlv_options commands. To support hybrid mode, if no parser exists, added inner configuration of geneve parser, else, in debug mode, check if the geneve option needed exist in current parser configured. In release mode, assume the option exist in current configured parser. Updated needed configuration for geneve options in doc. Fixes: e38776c36c8a ("net/mlx5: introduce HWS for non-template flow API") Signed-off-by: Maayan Kashani Acked-by: Bing Zhao --- doc/guides/nics/mlx5.rst | 5 +++ drivers/net/mlx5/mlx5_flow.h | 17 +++++++ drivers/net/mlx5/mlx5_flow_dv.c | 69 ++++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow_geneve.c | 2 +- drivers/net/mlx5/mlx5_flow_hw.c | 6 +-- 5 files changed, 93 insertions(+), 6 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index c9c23eedb2..896f9a0027 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -280,4 +280,9 @@ Limitations d. Only in transfer (switchdev) mode. + - When using synchronous flow API, + the following limitations and considerations apply: + + - Geneve options is supported when ``FLEX_PARSER_PROFILE_ENABLE`` = 0 (default). + - When using Verbs flow engine (``dv_flow_en`` = 0), flow pattern without any specific VLAN will match for VLAN packets as well: diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 9c8892b194..72f6cf6a32 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -2158,4 +2158,21 @@ flow_hw_get_port_id_from_ctx(void *dr_ctx, uint32_t *port_val) } +/** + * Get GENEVE TLV option matching to given type and class. + * + * @param priv + * Pointer to port's private data. + * @param type + * GENEVE option type. + * @param class + * GENEVE option class. + * + * @return + * Pointer to option structure if exist, NULL otherwise and rte_errno is set. + */ +struct mlx5_geneve_tlv_option * +mlx5_geneve_tlv_option_get(const struct mlx5_priv *priv, uint8_t type, + uint16_t class); + /** * Get GENEVE TLV option FW information according type and class. diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 633c41e358..a4a3552386 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -14447,4 +14447,62 @@ flow_dv_translate_items(struct rte_eth_dev *dev, } +static int +flow_dv_translate_items_geneve_opt_nta(struct rte_eth_dev *dev, + const struct rte_flow_item *items, + struct mlx5_flow_attr *attr, + struct rte_flow_error *error) +{ + rte_be32_t geneve_mask = 0xffffffff; + struct rte_pmd_mlx5_geneve_tlv geneve_tlv = { + /* Take from item spec, if changed, destroy and add new parser. */ + .option_class = 0, + /* Take from item spec, if changed, destroy and add new parser. */ + .option_type = 0, + /* 1DW is supported. */ + .option_len = 1, + .match_on_class_mode = 1, + .offset = 0, + .sample_len = 1, + .match_data_mask = &geneve_mask + }; + const struct rte_flow_item_geneve_opt *geneve_opt_v = items->spec; + const struct rte_flow_item_geneve_opt *geneve_opt_m = items->mask; + void *geneve_parser; + struct mlx5_priv *priv = dev->data->dev_private; +#ifdef RTE_LIBRTE_MLX5_DEBUG + struct mlx5_geneve_tlv_option *option; +#endif + + /* option length is not as supported. */ + if ((geneve_opt_v->option_len & geneve_opt_m->option_len) > geneve_tlv.option_len) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ITEM, items, + " GENEVE OPT length is not supported "); + geneve_tlv.option_class = geneve_opt_v->option_class & geneve_opt_m->option_class; + geneve_tlv.option_type = geneve_opt_v->option_type & geneve_opt_m->option_type; + /* if parser doesn't exist */ + if (!priv->tlv_options) { + /* Create a GENEVE option parser. */ + geneve_parser = mlx5_geneve_tlv_parser_create(attr->port_id, + &geneve_tlv, 1); + if (!geneve_parser) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, items, + " GENEVE OPT parser creation failed "); +#ifdef RTE_LIBRTE_MLX5_DEBUG + } else { + /* Check if option exist in current parser. */ + option = mlx5_geneve_tlv_option_get(priv, + geneve_tlv.option_type, + geneve_tlv.option_class); + if (!option) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, items, + " GENEVE OPT configured does not match this rule class/type"); +#endif + } + return 0; +} + /** * Fill the flow matcher with DV spec for items supported in non template mode. @@ -14471,4 +14529,5 @@ flow_dv_translate_items_nta(struct rte_eth_dev *dev, struct mlx5_dv_matcher_workspace *wks, void *key, uint32_t key_type, + struct mlx5_flow_attr *attr, struct rte_flow_error *error) { @@ -14491,4 +14550,10 @@ flow_dv_translate_items_nta(struct rte_eth_dev *dev, wks->last_item = tunnel ? MLX5_FLOW_ITEM_INNER_FLEX : MLX5_FLOW_ITEM_OUTER_FLEX; break; + case RTE_FLOW_ITEM_TYPE_GENEVE_OPT: + ret = flow_dv_translate_items_geneve_opt_nta(dev, items, attr, error); + if (ret) + return ret; + wks->last_item = MLX5_FLOW_LAYER_GENEVE_OPT; + break; default: ret = flow_dv_translate_items(dev, items, wks, key, key_type, error); @@ -14561,10 +14626,10 @@ __flow_dv_translate_items_hws(const struct rte_flow_item *items, if (nt_flow) { ret = flow_dv_translate_items_nta(&rte_eth_devices[attr->port_id], - items, &wks, key, key_type, NULL); + items, &wks, key, key_type, attr, error); if (ret) goto exit; } else { ret = flow_dv_translate_items(&rte_eth_devices[attr->port_id], - items, &wks, key, key_type, NULL); + items, &wks, key, key_type, error); if (ret) goto exit; diff --git a/drivers/net/mlx5/mlx5_flow_geneve.c b/drivers/net/mlx5/mlx5_flow_geneve.c index d8086d333f..6bf53e1270 100644 --- a/drivers/net/mlx5/mlx5_flow_geneve.c +++ b/drivers/net/mlx5/mlx5_flow_geneve.c @@ -98,5 +98,5 @@ option_match_type_and_class(uint8_t type, uint16_t class, * Pointer to option structure if exist, NULL otherwise and rte_errno is set. */ -static struct mlx5_geneve_tlv_option * +struct mlx5_geneve_tlv_option * mlx5_geneve_tlv_option_get(const struct mlx5_priv *priv, uint8_t type, uint16_t class) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 07037d49cb..126f0475d5 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -13792,7 +13792,7 @@ flow_hw_create_flow(struct rte_eth_dev *dev, enum mlx5_flow_type type, (*flow)->nt_rule = true; (*flow)->nt2hws->matcher = &matcher; - ret = flow_dv_translate_items_hws(items, &flow_attr, &matcher.mask.buf, - MLX5_SET_MATCHER_HS_M, NULL, - NULL, error); + ret = __flow_dv_translate_items_hws(items, &flow_attr, &matcher.mask.buf, + MLX5_SET_MATCHER_HS_M, NULL, + NULL, true, error); if (ret) -- 2.48.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-03-24 16:15:15.423845567 +0000 +++ 0017-net-mlx5-fix-flow-matching-GENEVE-options.patch 2025-03-24 16:15:14.804735721 +0000 @@ -1 +1 @@ -From fdca628a3e22080a27ff5cd166b2e6537f3cf464 Mon Sep 17 00:00:00 2001 +From 44d0ab5afc575e375f44ab75a0b6b380aba605af Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit fdca628a3e22080a27ff5cd166b2e6537f3cf464 ] + @@ -20 +21,0 @@ -Cc: stable@dpdk.org @@ -33 +34 @@ -index b45abb6d95..afb19241dc 100644 +index c9c23eedb2..896f9a0027 100644 @@ -36,2 +37,2 @@ -@@ -294,4 +294,9 @@ Limitations - - RTE_FLOW_ITEM_TYPE_MPLS matching is not supported on group 0. +@@ -280,4 +280,9 @@ Limitations + d. Only in transfer (switchdev) mode. @@ -47 +48 @@ -index e5245edd46..a5bde158ca 100644 +index 9c8892b194..72f6cf6a32 100644 @@ -50 +51 @@ -@@ -2159,4 +2159,21 @@ flow_hw_get_port_id_from_ctx(void *dr_ctx, uint32_t *port_val) +@@ -2158,4 +2158,21 @@ flow_hw_get_port_id_from_ctx(void *dr_ctx, uint32_t *port_val) @@ -73 +74 @@ -index 61d3101ce8..c77041317b 100644 +index 633c41e358..a4a3552386 100644 @@ -76 +77 @@ -@@ -14449,4 +14449,62 @@ flow_dv_translate_items(struct rte_eth_dev *dev, +@@ -14447,4 +14447,62 @@ flow_dv_translate_items(struct rte_eth_dev *dev, @@ -139 +140 @@ -@@ -14473,4 +14531,5 @@ flow_dv_translate_items_nta(struct rte_eth_dev *dev, +@@ -14471,4 +14529,5 @@ flow_dv_translate_items_nta(struct rte_eth_dev *dev, @@ -145 +146 @@ -@@ -14493,4 +14552,10 @@ flow_dv_translate_items_nta(struct rte_eth_dev *dev, +@@ -14491,4 +14550,10 @@ flow_dv_translate_items_nta(struct rte_eth_dev *dev, @@ -156 +157 @@ -@@ -14563,10 +14628,10 @@ __flow_dv_translate_items_hws(const struct rte_flow_item *items, +@@ -14561,10 +14626,10 @@ __flow_dv_translate_items_hws(const struct rte_flow_item *items, @@ -181 +182 @@ -index 22778310b0..6254857301 100644 +index 07037d49cb..126f0475d5 100644 @@ -184 +185 @@ -@@ -14036,7 +14036,7 @@ flow_hw_create_flow(struct rte_eth_dev *dev, enum mlx5_flow_type type, +@@ -13792,7 +13792,7 @@ flow_hw_create_flow(struct rte_eth_dev *dev, enum mlx5_flow_type type,