Skip to contentSkip to conversation

net/mlx5: fix flow create failure with GENEVE options match

PATCH New Maayan Kashani 1 participant 1 message Mar 4, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net/mlx5: fix flow create failure with GENEVE options match

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")
---
 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(-)
doc/guides/nics/mlx5.rst +5 -0
index 190c58b54d6..1e34eab8d8e 100644
@@ -288,6 +288,11 @@ Limitations
     - RTE_FLOW_ITEM_TYPE_MPLS matching is not supported on group 0.
     - mpls_encap and mpls_decap actions support only one level of MPLS.
 
+  - When using synchrounous rte_flow APIs,
+    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:
 
drivers/net/mlx5/mlx5_flow.h +17 -0
index e5245edd463..a5bde158caa 100644
@@ -2158,6 +2158,23 @@ flow_hw_get_port_id_from_ctx(void *dr_ctx, uint32_t *port_val)
 	return -EINVAL;
 }
 
+/**
+ * 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.
  *
drivers/net/mlx5/mlx5_flow_dv.c +67 -2

97 lines not on this page · raw message

drivers/net/mlx5/mlx5_flow_geneve.c +1 -1
index d8086d333ff..6bf53e12708 100644
@@ -97,7 +97,7 @@ option_match_type_and_class(uint8_t type, uint16_t class,
  * @return
  *   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)
 {
drivers/net/mlx5/mlx5_flow_hw.c +3 -3
index 03cbf53f492..7099b59319a 100644
@@ -14096,9 +14096,9 @@ flow_hw_create_flow(struct rte_eth_dev *dev, enum mlx5_flow_type type,
 	/* TODO TBD flow_hw_handle_tunnel_offload(). */
 	(*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)
 		goto error;
Signature · 1 line
2.21.0