Skip to contentSkip to conversation

jump to table index support in mlx5

PATCH Superseded Alexander Kozyrev 3 participants 18 messages Oct 24, 2024 – Oct 30, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

v3 cover jump to table index support in mlx5

Support the new Flow API JUMP_TO_TABLE_INDEX action in mlx5.

Alexander Kozyrev (3):
net/mlx5: create array ste matcher
net/mlx5: add flow rule insertion by index with pattern net/mlx5: implement jump to table index action

Hamdan Igbaria (2):
net/mlx5/hws: introduce new matcher type
net/mlx5/hws: introduce jump to matcher action

 doc/guides/nics/features/mlx5.ini             |   1 +
 doc/guides/prog_guide/ethdev/flow_offload.rst |  24 +
 doc/guides/rel_notes/release_24_11.rst        |   3 +
 drivers/net/mlx5/hws/mlx5dr.h                 |  42 +-
 drivers/net/mlx5/hws/mlx5dr_action.c          |  87 +++-
 drivers/net/mlx5/hws/mlx5dr_action.h          |   3 +
 drivers/net/mlx5/hws/mlx5dr_debug.c           |  13 +-
 drivers/net/mlx5/hws/mlx5dr_matcher.c         |  58 ++-
 drivers/net/mlx5/hws/mlx5dr_matcher.h         |   6 +
 drivers/net/mlx5/hws/mlx5dr_rule.c            |   2 +-
 drivers/net/mlx5/hws/mlx5dr_table.c           |  61 ++-
 drivers/net/mlx5/hws/mlx5dr_table.h           |   8 +-
 drivers/net/mlx5/mlx5_flow.h                  |   8 +-
 drivers/net/mlx5/mlx5_flow_hw.c               | 435 ++++++++++--------
 14 files changed, 519 insertions(+), 232 deletions(-)
Signature · 1 line
2.43.5
#1 lore raw

PATCH v3 1/5 net/mlx5/hws: introduce new matcher type

From: Hamdan Igbaria <[email protected]>

introduce STE array matcher, where this matcher can only be isolated under a parent table and not chained to the table matchers chain.

---
 drivers/net/mlx5/hws/mlx5dr.h         | 13 +++++-
 drivers/net/mlx5/hws/mlx5dr_debug.c   | 12 +++++-
 drivers/net/mlx5/hws/mlx5dr_matcher.c | 58 +++++++++++++++++++++++--
 drivers/net/mlx5/hws/mlx5dr_matcher.h |  6 +++
 drivers/net/mlx5/hws/mlx5dr_rule.c    |  2 +-
 drivers/net/mlx5/hws/mlx5dr_table.c   | 61 +++++++++++++++++++--------
 drivers/net/mlx5/hws/mlx5dr_table.h   |  8 +++-
 drivers/net/mlx5/mlx5_flow_hw.c       |  2 +
 8 files changed, 135 insertions(+), 27 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +12 -1
index 0fe39e9c76..8a1a389a3f 100644
@@ -130,6 +130,14 @@ enum mlx5dr_matcher_distribute_mode {
 	MLX5DR_MATCHER_DISTRIBUTE_BY_LINEAR = 0x1,
 };
 
+/* Match mode describes the behavior of the matcher STE's when a packet arrives */
+enum mlx5dr_matcher_match_mode {
+	/* Packet arriving at this matcher STE's will match according it's tag and match definer */
+	MLX5DR_MATCHER_MATCH_MODE_DEFAULT = 0x0,
+	/* Packet arriving at this matcher STE's will always hit and perform the actions */
+	MLX5DR_MATCHER_MATCH_MODE_ALWAYS_HIT = 0x1,
+};
+
 enum mlx5dr_rule_hash_calc_mode {
 	MLX5DR_RULE_HASH_CALC_MODE_RAW,
 	MLX5DR_RULE_HASH_CALC_MODE_IDX,
@@ -144,11 +152,14 @@ struct mlx5dr_matcher_attr {
 	enum mlx5dr_matcher_resource_mode mode;
 	/* Optimize insertion in case packet origin is the same for all rules */
 	enum mlx5dr_matcher_flow_src optimize_flow_src;
-	/* Define the insertion and distribution modes for this matcher */
+	/* Define the insertion, distribution and match modes for this matcher */
 	enum mlx5dr_matcher_insert_mode insert_mode;
 	enum mlx5dr_matcher_distribute_mode distribute_mode;
+	enum mlx5dr_matcher_match_mode match_mode;
 	/* Define whether the created matcher supports resizing into a bigger matcher */
 	bool resizable;
+	/* This will imply that this matcher is not part of the matchers chain of parent table */
+	bool isolated;
 	union {
 		struct {
 			uint8_t sz_row_log;
drivers/net/mlx5/hws/mlx5dr_debug.c +10 -2
index 741a725842..f15ad96598 100644
@@ -182,7 +182,7 @@ mlx5dr_debug_dump_matcher_attr(FILE *f, struct mlx5dr_matcher *matcher)
 	struct mlx5dr_matcher_attr *attr = &matcher->attr;
 	int ret;
 
-	ret = fprintf(f, "%d,0x%" PRIx64 ",%d,%d,%d,%d,%d,%d,%d,%d\n",
+	ret = fprintf(f, "%d,0x%" PRIx64 ",%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
 		      MLX5DR_DEBUG_RES_TYPE_MATCHER_ATTR,
 		      (uint64_t)(uintptr_t)matcher,
 		      attr->priority,
@@ -192,7 +192,9 @@ mlx5dr_debug_dump_matcher_attr(FILE *f, struct mlx5dr_matcher *matcher)
 		      attr->optimize_using_rule_idx,
 		      attr->optimize_flow_src,
 		      attr->insert_mode,
-		      attr->distribute_mode);
+		      attr->distribute_mode,
+		      attr->match_mode,
+		      attr->isolated);
 	if (ret < 0) {
 		rte_errno = EINVAL;
 		return rte_errno;
@@ -377,6 +379,12 @@ static int mlx5dr_debug_dump_table(FILE *f, struct mlx5dr_table *tbl)
 			return ret;
 	}
 
+	LIST_FOREACH(matcher, &tbl->isolated_matchers, next) {
+		ret = mlx5dr_debug_dump_matcher(f, matcher);
+		if (ret)
+			return ret;
+	}
+
 	return 0;
 
 out_err:
drivers/net/mlx5/hws/mlx5dr_matcher.c +54 -4

122 lines not on this page · raw message

drivers/net/mlx5/hws/mlx5dr_matcher.h +6 -0
index ca6a5298d9..ef42b7de6b 100644
@@ -28,6 +28,7 @@ enum mlx5dr_matcher_flags {
 	MLX5DR_MATCHER_FLAGS_COLLISION		= 1 << 2,
 	MLX5DR_MATCHER_FLAGS_RESIZABLE		= 1 << 3,
 	MLX5DR_MATCHER_FLAGS_COMPARE		= 1 << 4,
+	MLX5DR_MATCHER_FLAGS_STE_ARRAY		= 1 << 5,
 };
 
 struct mlx5dr_match_template {
@@ -146,6 +147,11 @@ static inline bool mlx5dr_matcher_is_insert_by_idx(struct mlx5dr_matcher *matche
 	return matcher->attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX;
 }
 
+static inline bool mlx5dr_matcher_is_always_hit(struct mlx5dr_matcher *matcher)
+{
+	return matcher->attr.match_mode == MLX5DR_MATCHER_MATCH_MODE_ALWAYS_HIT;
+}
+
 int mlx5dr_matcher_free_rtc_pointing(struct mlx5dr_context *ctx,
 				     uint32_t fw_ft_type,
 				     enum mlx5dr_table_type type,
drivers/net/mlx5/hws/mlx5dr_rule.c +1 -1
index 5d66d81ea5..519328ccf3 100644
@@ -539,7 +539,7 @@ static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule,
 			 * will always match and perform the specified actions, which
 			 * makes the tag irrelevant.
 			 */
-			if (likely(!mlx5dr_matcher_is_insert_by_idx(matcher) && !is_update))
+			if (likely(!mlx5dr_matcher_is_always_hit(matcher) && !is_update))
 				mlx5dr_definer_create_tag(items, mt->fc, mt->fc_sz,
 							  (uint8_t *)dep_wqe->wqe_data.action);
 			else if (unlikely(is_update))
drivers/net/mlx5/hws/mlx5dr_table.c +43 -18

122 lines not on this page · raw message

drivers/net/mlx5/hws/mlx5dr_table.h +7 -1
index b2fbb47416..32f2574a97 100644
@@ -23,6 +23,7 @@ struct mlx5dr_table {
 	uint32_t fw_ft_type;
 	uint32_t level;
 	LIST_HEAD(matcher_head, mlx5dr_matcher) head;
+	LIST_HEAD(isolated_matchers_head, mlx5dr_matcher) isolated_matchers;
 	LIST_ENTRY(mlx5dr_table) next;
 	struct mlx5dr_default_miss default_miss;
 };
@@ -54,7 +55,8 @@ void mlx5dr_table_destroy_default_ft(struct mlx5dr_table *tbl,
 				     struct mlx5dr_devx_obj *ft_obj);
 
 int mlx5dr_table_connect_to_miss_table(struct mlx5dr_table *src_tbl,
-				       struct mlx5dr_table *dst_tbl);
+				       struct mlx5dr_table *dst_tbl,
+				       bool only_update_last_ft);
 
 int mlx5dr_table_update_connected_miss_tables(struct mlx5dr_table *dst_tbl);
 
@@ -66,4 +68,8 @@ int mlx5dr_table_ft_set_next_rtc(struct mlx5dr_devx_obj *ft,
 				 struct mlx5dr_devx_obj *rtc_0,
 				 struct mlx5dr_devx_obj *rtc_1);
 
+int mlx5dr_table_connect_src_ft_to_miss_table(struct mlx5dr_table *src_tbl,
+					      struct mlx5dr_devx_obj *ft,
+					      struct mlx5dr_table *dst_tbl);
+
 #endif /* MLX5DR_TABLE_H_ */
drivers/net/mlx5/mlx5_flow_hw.c +2 -0
index 5b34154bf1..c21eb1eaed 100644
@@ -5157,6 +5157,8 @@ flow_hw_table_create(struct rte_eth_dev *dev,
 	matcher_attr.optimize_using_rule_idx = true;
 	matcher_attr.mode = MLX5DR_MATCHER_RESOURCE_MODE_RULE;
 	matcher_attr.insert_mode = flow_hw_matcher_insert_mode_get(attr->insertion_type);
+	if (matcher_attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX)
+		matcher_attr.match_mode = MLX5DR_MATCHER_MATCH_MODE_ALWAYS_HIT;
 	if (attr->hash_func == RTE_FLOW_TABLE_HASH_FUNC_CRC16) {
 		DRV_LOG(ERR, "16-bit checksum hash type is not supported");
 		rte_errno = ENOTSUP;
Signature · 1 line
2.43.5
#2 lore raw

PATCH v3 2/5 net/mlx5/hws: introduce jump to matcher action

In reply to Alexander Kozyrev

From: Hamdan Igbaria <[email protected]>

Introduce jump to matcher action, this action will allow jumping to another matcher.
For now this jump restricted to STE array matchers and matchers of size 1.

---
 drivers/net/mlx5/hws/mlx5dr.h        | 29 ++++++++++
 drivers/net/mlx5/hws/mlx5dr_action.c | 87 +++++++++++++++++++++++++++-
 drivers/net/mlx5/hws/mlx5dr_action.h |  3 +
 drivers/net/mlx5/hws/mlx5dr_debug.c  |  1 +
 4 files changed, 117 insertions(+), 3 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +29 -0
index 8a1a389a3f..1b58eeb2c7 100644
@@ -52,6 +52,7 @@ enum mlx5dr_action_type {
 	MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT,
 	MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT,
 	MLX5DR_ACTION_TYP_NAT64,
+	MLX5DR_ACTION_TYP_JUMP_TO_MATCHER,
 	MLX5DR_ACTION_TYP_MAX,
 };
 
@@ -287,6 +288,10 @@ struct mlx5dr_rule_action {
 			uint32_t offset;
 			enum mlx5dr_action_aso_ct_flags direction;
 		} aso_ct;
+
+		struct {
+			uint32_t offset;
+		} jump_to_matcher;
 	};
 };
 
@@ -304,6 +309,15 @@ struct mlx5dr_action_dest_attr {
 	} reformat;
 };
 
+enum mlx5dr_action_jump_to_matcher_type {
+	MLX5DR_ACTION_JUMP_TO_MATCHER_BY_INDEX,
+};
+
+struct mlx5dr_action_jump_to_matcher_attr {
+	enum mlx5dr_action_jump_to_matcher_type type;
+	struct mlx5dr_matcher *matcher;
+};
+
 union mlx5dr_crc_encap_entropy_hash_ip_field {
 	uint8_t  ipv6_addr[16];
 	struct {
@@ -938,6 +952,21 @@ mlx5dr_action_create_nat64(struct mlx5dr_context *ctx,
 			   struct mlx5dr_action_nat64_attr *attr,
 			   uint32_t flags);
 
+/* Create direct rule jump to matcher action.
+ *
+ * @param[in] ctx
+ *	The context in which the new action will be created.
+ * @param[in] attr
+ *	The relevant attribute of the action.
+ * @param[in] flags
+ *	Action creation flags. (enum mlx5dr_action_flags)
+ * @return pointer to mlx5dr_action on success NULL otherwise.
+ */
+struct mlx5dr_action *
+mlx5dr_action_create_jump_to_matcher(struct mlx5dr_context *ctx,
+				     struct mlx5dr_action_jump_to_matcher_attr *attr,
+				     uint32_t flags);
+
 /* Destroy direct rule action.
  *
  * @param[in] action
drivers/net/mlx5/hws/mlx5dr_action.c +84 -3

135 lines not on this page · raw message

drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
index ba4ce55228..8ce4ecd5ba 100644
@@ -223,6 +223,9 @@ struct mlx5dr_action {
 				struct {
 					struct mlx5dr_action *stages[MLX5DR_ACTION_NAT64_STAGES];
 				} nat64;
+				struct {
+					struct mlx5dr_matcher *matcher;
+				} jump_to_matcher;
 			};
 		};
 
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -0
index f15ad96598..8684a8197a 100644
@@ -29,6 +29,7 @@ const char *mlx5dr_debug_action_type_str[] = {
 	[MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT] = "POP_IPV6_ROUTE_EXT",
 	[MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT] = "PUSH_IPV6_ROUTE_EXT",
 	[MLX5DR_ACTION_TYP_NAT64] = "NAT64",
+	[MLX5DR_ACTION_TYP_JUMP_TO_MATCHER] = "JUMP_TO_MATCHER",
 };
 
 static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
Signature · 1 line
2.43.5
#3 lore raw

PATCH v3 3/5 net/mlx5: create array ste matcher

In reply to Alexander Kozyrev

Create an array STE matcher for a template table in case of insertion by index with pattern is selected. Packets will be matched on a pattern at the index. This table is isolated from any other tables in a group. That means packets missed the rule won't go to a lower priority tables, but proceed with the default miss instead.

---
 drivers/net/mlx5/mlx5_flow_hw.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +9 -2
index c21eb1eaed..c236831e21 100644
@@ -5157,8 +5157,15 @@ flow_hw_table_create(struct rte_eth_dev *dev,
 	matcher_attr.optimize_using_rule_idx = true;
 	matcher_attr.mode = MLX5DR_MATCHER_RESOURCE_MODE_RULE;
 	matcher_attr.insert_mode = flow_hw_matcher_insert_mode_get(attr->insertion_type);
-	if (matcher_attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX)
-		matcher_attr.match_mode = MLX5DR_MATCHER_MATCH_MODE_ALWAYS_HIT;
+	if (matcher_attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX) {
+		if (attr->insertion_type == RTE_FLOW_TABLE_INSERTION_TYPE_INDEX_WITH_PATTERN) {
+			matcher_attr.isolated = true;
+			matcher_attr.match_mode = MLX5DR_MATCHER_MATCH_MODE_DEFAULT;
+		} else {
+			matcher_attr.isolated = false;
+			matcher_attr.match_mode = MLX5DR_MATCHER_MATCH_MODE_ALWAYS_HIT;
+		}
+	}
 	if (attr->hash_func == RTE_FLOW_TABLE_HASH_FUNC_CRC16) {
 		DRV_LOG(ERR, "16-bit checksum hash type is not supported");
 		rte_errno = ENOTSUP;
Signature · 1 line
2.43.5
#4 lore raw

PATCH v3 4/5 net/mlx5: add flow rule insertion by index with pattern

In reply to Alexander Kozyrev

Implement rte_flow_async_create_by_index_with_pattern() function. Rework the driver implementation to reduce code duplication by providing a single flow insertion routine, that can be called with different parameters depending on the insertion type.

---
 doc/guides/rel_notes/release_24_11.rst |   2 +
 drivers/net/mlx5/mlx5_flow_hw.c        | 281 +++++++------------------
 2 files changed, 83 insertions(+), 200 deletions(-)
doc/guides/rel_notes/release_24_11.rst +2 -0
index fa4822d928..07a8435b19 100644
@@ -247,6 +247,8 @@ New Features
   Added ability for node to advertise and update multiple xstat counters,
   that can be retrieved using ``rte_graph_cluster_stats_get``.
 
+* **Updated NVIDIA MLX5 net driver.**
+  * Added rte_flow_async_create_by_index_with_pattern() support.
 
 Removed Items
 -------------
drivers/net/mlx5/mlx5_flow_hw.c +81 -200

363 lines not on this page · raw message

Signature · 1 line
2.43.5
#5 lore raw

PATCH v3 5/5 net/mlx5: implement jump to table index action

In reply to Alexander Kozyrev

Implement RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE_INDEX action. Create the hardware steering jump to matcher action, associated with the template matcher. Use this action and provide the rule index as an offset in the matcher. Note that it is only supported by the isolated matcher, i.e. the table insertion type is by index with pattern.

---
 doc/guides/nics/features/mlx5.ini             |   1 +
 doc/guides/prog_guide/ethdev/flow_offload.rst |  24 +++
 doc/guides/rel_notes/release_24_11.rst        |   1 +
 drivers/net/mlx5/mlx5_flow.h                  |   8 +-
 drivers/net/mlx5/mlx5_flow_hw.c               | 145 ++++++++++++++++++
 5 files changed, 177 insertions(+), 2 deletions(-)
doc/guides/nics/features/mlx5.ini +1 -0
index 056e04275b..55bc52c666 100644
@@ -150,3 +150,4 @@ set_tp_src           = Y
 set_ttl              = Y
 vxlan_decap          = Y
 vxlan_encap          = Y
+jump_to_table_index  = Y
doc/guides/prog_guide/ethdev/flow_offload.rst +24 -0
index 2d6187ed11..bff0b5a794 100644
@@ -3535,6 +3535,30 @@ Send packets to the kernel, without going to userspace at all.
 The packets will be received by the kernel driver sharing the same device
 as the DPDK port on which this action is configured.
 
+Action: ``JUMP_TO_TABLE_INDEX``
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Redirects packets to a particular index in a flow table.
+
+Bypassing a hierarchy of groups, this action redirects the matched flow to
+the specified index in the particular template table on the device.
+
+If a matched flow is redirected to a non-existing template table or
+the table which doesn't contain a rule at the specified index,
+then the behavior is undefined and the resulting behavior is up to driver.
+
+.. _table_rte_flow_action_jump_to_table_index:
+
+.. table:: JUMP_TO_TABLE_INDEX
+
+   +-----------+-------------------------------------------+
+   | Field     | Value                                     |
+   +===========+===========================================+
+   | ``table`` | Template table to redirect packets to     |
+   +-----------+-------------------------------------------+
+   | ``index`` | Index in the table to redirect packets to |
+   +-----------+-------------------------------------------+
+
 Negative types
 ~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_24_11.rst +1 -0
index 07a8435b19..dbef29706c 100644
@@ -249,6 +249,7 @@ New Features
 
 * **Updated NVIDIA MLX5 net driver.**
   * Added rte_flow_async_create_by_index_with_pattern() support.
+  * Added RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE_INDEX support.
 
 Removed Items
 -------------
drivers/net/mlx5/mlx5_flow.h +6 -2
index db56ae051d..90ad23c94a 100644
@@ -398,6 +398,7 @@ enum mlx5_feature_name {
 #define MLX5_FLOW_ACTION_IPV6_ROUTING_REMOVE (1ull << 48)
 #define MLX5_FLOW_ACTION_IPV6_ROUTING_PUSH (1ull << 49)
 #define MLX5_FLOW_ACTION_NAT64 (1ull << 50)
+#define MLX5_FLOW_ACTION_JUMP_TO_TABLE_INDEX (1ull << 51)
 
 #define MLX5_FLOW_DROP_INCLUSIVE_ACTIONS \
 	(MLX5_FLOW_ACTION_COUNT | MLX5_FLOW_ACTION_SAMPLE | MLX5_FLOW_ACTION_AGE)
@@ -408,12 +409,14 @@ enum mlx5_feature_name {
 	 MLX5_FLOW_ACTION_DEFAULT_MISS | \
 	 MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY | \
 	 MLX5_FLOW_ACTION_SEND_TO_KERNEL | \
-	 MLX5_FLOW_ACTION_PORT_REPRESENTOR)
+	 MLX5_FLOW_ACTION_PORT_REPRESENTOR | \
+	 MLX5_FLOW_ACTION_JUMP_TO_TABLE_INDEX)
 
 #define MLX5_FLOW_FATE_ESWITCH_ACTIONS \
 	(MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID | \
 	 MLX5_FLOW_ACTION_SEND_TO_KERNEL | \
-	 MLX5_FLOW_ACTION_JUMP | MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY)
+	 MLX5_FLOW_ACTION_JUMP | MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY | \
+	 MLX5_FLOW_ACTION_JUMP_TO_TABLE_INDEX)
 
 #define MLX5_FLOW_MODIFY_HDR_ACTIONS (MLX5_FLOW_ACTION_SET_IPV4_SRC | \
 				      MLX5_FLOW_ACTION_SET_IPV4_DST | \
@@ -1704,6 +1707,7 @@ struct mlx5_flow_template_table_cfg {
 
 struct mlx5_matcher_info {
 	struct mlx5dr_matcher *matcher; /* Template matcher. */
+	struct mlx5dr_action *jump; /* Jump to matcher action. */
 	RTE_ATOMIC(uint32_t) refcnt;
 };
 
drivers/net/mlx5/mlx5_flow_hw.c +145 -0

275 lines not on this page · raw message

Signature · 1 line
2.43.5
#6 lore raw

v4 cover jump to table index support in mlx5

In reply to Alexander Kozyrev

Support the new Flow API JUMP_TO_TABLE_INDEX action in mlx5.

Alexander Kozyrev (3):
net/mlx5: create array ste matcher
net/mlx5: add flow rule insertion by index with pattern net/mlx5: implement jump to table index action

Hamdan Igbaria (2):
net/mlx5/hws: introduce new matcher type
net/mlx5/hws: introduce jump to matcher action

 doc/guides/nics/features/default.ini          |   1 +
 doc/guides/nics/features/mlx5.ini             |   1 +
 doc/guides/prog_guide/ethdev/flow_offload.rst |  24 +
 doc/guides/rel_notes/release_24_11.rst        |   3 +
 drivers/net/mlx5/hws/mlx5dr.h                 |  42 +-
 drivers/net/mlx5/hws/mlx5dr_action.c          |  87 +++-
 drivers/net/mlx5/hws/mlx5dr_action.h          |   3 +
 drivers/net/mlx5/hws/mlx5dr_debug.c           |  13 +-
 drivers/net/mlx5/hws/mlx5dr_matcher.c         |  58 ++-
 drivers/net/mlx5/hws/mlx5dr_matcher.h         |   6 +
 drivers/net/mlx5/hws/mlx5dr_rule.c            |   2 +-
 drivers/net/mlx5/hws/mlx5dr_table.c           |  61 ++-
 drivers/net/mlx5/hws/mlx5dr_table.h           |   8 +-
 drivers/net/mlx5/mlx5_flow.h                  |   8 +-
 drivers/net/mlx5/mlx5_flow_hw.c               | 435 ++++++++++--------
 15 files changed, 520 insertions(+), 232 deletions(-)
Signature · 1 line
2.43.5
#7 lore raw

PATCH v4 1/5 net/mlx5/hws: introduce new matcher type

From: Hamdan Igbaria <[email protected]>

introduce STE array matcher, where this matcher can only be isolated under a parent table and not chained to the table matchers chain.

---
 drivers/net/mlx5/hws/mlx5dr.h         | 13 +++++-
 drivers/net/mlx5/hws/mlx5dr_debug.c   | 12 +++++-
 drivers/net/mlx5/hws/mlx5dr_matcher.c | 58 +++++++++++++++++++++++--
 drivers/net/mlx5/hws/mlx5dr_matcher.h |  6 +++
 drivers/net/mlx5/hws/mlx5dr_rule.c    |  2 +-
 drivers/net/mlx5/hws/mlx5dr_table.c   | 61 +++++++++++++++++++--------
 drivers/net/mlx5/hws/mlx5dr_table.h   |  8 +++-
 drivers/net/mlx5/mlx5_flow_hw.c       |  2 +
 8 files changed, 135 insertions(+), 27 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +12 -1
index 0fe39e9c76..8a1a389a3f 100644
@@ -130,6 +130,14 @@ enum mlx5dr_matcher_distribute_mode {
 	MLX5DR_MATCHER_DISTRIBUTE_BY_LINEAR = 0x1,
 };
 
+/* Match mode describes the behavior of the matcher STE's when a packet arrives */
+enum mlx5dr_matcher_match_mode {
+	/* Packet arriving at this matcher STE's will match according it's tag and match definer */
+	MLX5DR_MATCHER_MATCH_MODE_DEFAULT = 0x0,
+	/* Packet arriving at this matcher STE's will always hit and perform the actions */
+	MLX5DR_MATCHER_MATCH_MODE_ALWAYS_HIT = 0x1,
+};
+
 enum mlx5dr_rule_hash_calc_mode {
 	MLX5DR_RULE_HASH_CALC_MODE_RAW,
 	MLX5DR_RULE_HASH_CALC_MODE_IDX,
@@ -144,11 +152,14 @@ struct mlx5dr_matcher_attr {
 	enum mlx5dr_matcher_resource_mode mode;
 	/* Optimize insertion in case packet origin is the same for all rules */
 	enum mlx5dr_matcher_flow_src optimize_flow_src;
-	/* Define the insertion and distribution modes for this matcher */
+	/* Define the insertion, distribution and match modes for this matcher */
 	enum mlx5dr_matcher_insert_mode insert_mode;
 	enum mlx5dr_matcher_distribute_mode distribute_mode;
+	enum mlx5dr_matcher_match_mode match_mode;
 	/* Define whether the created matcher supports resizing into a bigger matcher */
 	bool resizable;
+	/* This will imply that this matcher is not part of the matchers chain of parent table */
+	bool isolated;
 	union {
 		struct {
 			uint8_t sz_row_log;
drivers/net/mlx5/hws/mlx5dr_debug.c +10 -2
index 741a725842..f15ad96598 100644
@@ -182,7 +182,7 @@ mlx5dr_debug_dump_matcher_attr(FILE *f, struct mlx5dr_matcher *matcher)
 	struct mlx5dr_matcher_attr *attr = &matcher->attr;
 	int ret;
 
-	ret = fprintf(f, "%d,0x%" PRIx64 ",%d,%d,%d,%d,%d,%d,%d,%d\n",
+	ret = fprintf(f, "%d,0x%" PRIx64 ",%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
 		      MLX5DR_DEBUG_RES_TYPE_MATCHER_ATTR,
 		      (uint64_t)(uintptr_t)matcher,
 		      attr->priority,
@@ -192,7 +192,9 @@ mlx5dr_debug_dump_matcher_attr(FILE *f, struct mlx5dr_matcher *matcher)
 		      attr->optimize_using_rule_idx,
 		      attr->optimize_flow_src,
 		      attr->insert_mode,
-		      attr->distribute_mode);
+		      attr->distribute_mode,
+		      attr->match_mode,
+		      attr->isolated);
 	if (ret < 0) {
 		rte_errno = EINVAL;
 		return rte_errno;
@@ -377,6 +379,12 @@ static int mlx5dr_debug_dump_table(FILE *f, struct mlx5dr_table *tbl)
 			return ret;
 	}
 
+	LIST_FOREACH(matcher, &tbl->isolated_matchers, next) {
+		ret = mlx5dr_debug_dump_matcher(f, matcher);
+		if (ret)
+			return ret;
+	}
+
 	return 0;
 
 out_err:
drivers/net/mlx5/hws/mlx5dr_matcher.c +54 -4

122 lines not on this page · raw message

drivers/net/mlx5/hws/mlx5dr_matcher.h +6 -0
index ca6a5298d9..ef42b7de6b 100644
@@ -28,6 +28,7 @@ enum mlx5dr_matcher_flags {
 	MLX5DR_MATCHER_FLAGS_COLLISION		= 1 << 2,
 	MLX5DR_MATCHER_FLAGS_RESIZABLE		= 1 << 3,
 	MLX5DR_MATCHER_FLAGS_COMPARE		= 1 << 4,
+	MLX5DR_MATCHER_FLAGS_STE_ARRAY		= 1 << 5,
 };
 
 struct mlx5dr_match_template {
@@ -146,6 +147,11 @@ static inline bool mlx5dr_matcher_is_insert_by_idx(struct mlx5dr_matcher *matche
 	return matcher->attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX;
 }
 
+static inline bool mlx5dr_matcher_is_always_hit(struct mlx5dr_matcher *matcher)
+{
+	return matcher->attr.match_mode == MLX5DR_MATCHER_MATCH_MODE_ALWAYS_HIT;
+}
+
 int mlx5dr_matcher_free_rtc_pointing(struct mlx5dr_context *ctx,
 				     uint32_t fw_ft_type,
 				     enum mlx5dr_table_type type,
drivers/net/mlx5/hws/mlx5dr_rule.c +1 -1
index 5d66d81ea5..519328ccf3 100644
@@ -539,7 +539,7 @@ static int mlx5dr_rule_create_hws(struct mlx5dr_rule *rule,
 			 * will always match and perform the specified actions, which
 			 * makes the tag irrelevant.
 			 */
-			if (likely(!mlx5dr_matcher_is_insert_by_idx(matcher) && !is_update))
+			if (likely(!mlx5dr_matcher_is_always_hit(matcher) && !is_update))
 				mlx5dr_definer_create_tag(items, mt->fc, mt->fc_sz,
 							  (uint8_t *)dep_wqe->wqe_data.action);
 			else if (unlikely(is_update))
drivers/net/mlx5/hws/mlx5dr_table.c +43 -18

122 lines not on this page · raw message

drivers/net/mlx5/hws/mlx5dr_table.h +7 -1
index b2fbb47416..32f2574a97 100644
@@ -23,6 +23,7 @@ struct mlx5dr_table {
 	uint32_t fw_ft_type;
 	uint32_t level;
 	LIST_HEAD(matcher_head, mlx5dr_matcher) head;
+	LIST_HEAD(isolated_matchers_head, mlx5dr_matcher) isolated_matchers;
 	LIST_ENTRY(mlx5dr_table) next;
 	struct mlx5dr_default_miss default_miss;
 };
@@ -54,7 +55,8 @@ void mlx5dr_table_destroy_default_ft(struct mlx5dr_table *tbl,
 				     struct mlx5dr_devx_obj *ft_obj);
 
 int mlx5dr_table_connect_to_miss_table(struct mlx5dr_table *src_tbl,
-				       struct mlx5dr_table *dst_tbl);
+				       struct mlx5dr_table *dst_tbl,
+				       bool only_update_last_ft);
 
 int mlx5dr_table_update_connected_miss_tables(struct mlx5dr_table *dst_tbl);
 
@@ -66,4 +68,8 @@ int mlx5dr_table_ft_set_next_rtc(struct mlx5dr_devx_obj *ft,
 				 struct mlx5dr_devx_obj *rtc_0,
 				 struct mlx5dr_devx_obj *rtc_1);
 
+int mlx5dr_table_connect_src_ft_to_miss_table(struct mlx5dr_table *src_tbl,
+					      struct mlx5dr_devx_obj *ft,
+					      struct mlx5dr_table *dst_tbl);
+
 #endif /* MLX5DR_TABLE_H_ */
drivers/net/mlx5/mlx5_flow_hw.c +2 -0
index 5b34154bf1..c21eb1eaed 100644
@@ -5157,6 +5157,8 @@ flow_hw_table_create(struct rte_eth_dev *dev,
 	matcher_attr.optimize_using_rule_idx = true;
 	matcher_attr.mode = MLX5DR_MATCHER_RESOURCE_MODE_RULE;
 	matcher_attr.insert_mode = flow_hw_matcher_insert_mode_get(attr->insertion_type);
+	if (matcher_attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX)
+		matcher_attr.match_mode = MLX5DR_MATCHER_MATCH_MODE_ALWAYS_HIT;
 	if (attr->hash_func == RTE_FLOW_TABLE_HASH_FUNC_CRC16) {
 		DRV_LOG(ERR, "16-bit checksum hash type is not supported");
 		rte_errno = ENOTSUP;
Signature · 1 line
2.43.5
Acked-by on v4 1/5
#8 lore raw

RE: [PATCH v4 1/5] net/mlx5/hws: introduce new matcher type

Quoted 13 lines

-----Original Message-----
From: Alexander Kozyrev <[email protected]>
Sent: Thursday, October 24, 2024 19:50
To: [email protected]
Cc: Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Hamdan Agbariya <[email protected]>; Alex Vesker <[email protected]>; Dariusz Sosnowski <[email protected]>; Ori Kam <[email protected]>; Bing Zhao <[email protected]>; Suanming Mou <[email protected]>
Subject: [PATCH v4 1/5] net/mlx5/hws: introduce new matcher type

Quoted 6 lines

From: Hamdan Igbaria <[email protected]>

introduce STE array matcher, where this matcher can only be isolated under a parent table and not chained to the table matchers chain.

Best regards,
Dariusz Sosnowski

#9 lore raw

PATCH v4 2/5 net/mlx5/hws: introduce jump to matcher action

In reply to Alexander Kozyrev

From: Hamdan Igbaria <[email protected]>

Introduce jump to matcher action, this action will allow jumping to another matcher.
For now this jump restricted to STE array matchers and matchers of size 1.

---
 drivers/net/mlx5/hws/mlx5dr.h        | 29 ++++++++++
 drivers/net/mlx5/hws/mlx5dr_action.c | 87 +++++++++++++++++++++++++++-
 drivers/net/mlx5/hws/mlx5dr_action.h |  3 +
 drivers/net/mlx5/hws/mlx5dr_debug.c  |  1 +
 4 files changed, 117 insertions(+), 3 deletions(-)
drivers/net/mlx5/hws/mlx5dr.h +29 -0
index 8a1a389a3f..1b58eeb2c7 100644
@@ -52,6 +52,7 @@ enum mlx5dr_action_type {
 	MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT,
 	MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT,
 	MLX5DR_ACTION_TYP_NAT64,
+	MLX5DR_ACTION_TYP_JUMP_TO_MATCHER,
 	MLX5DR_ACTION_TYP_MAX,
 };
 
@@ -287,6 +288,10 @@ struct mlx5dr_rule_action {
 			uint32_t offset;
 			enum mlx5dr_action_aso_ct_flags direction;
 		} aso_ct;
+
+		struct {
+			uint32_t offset;
+		} jump_to_matcher;
 	};
 };
 
@@ -304,6 +309,15 @@ struct mlx5dr_action_dest_attr {
 	} reformat;
 };
 
+enum mlx5dr_action_jump_to_matcher_type {
+	MLX5DR_ACTION_JUMP_TO_MATCHER_BY_INDEX,
+};
+
+struct mlx5dr_action_jump_to_matcher_attr {
+	enum mlx5dr_action_jump_to_matcher_type type;
+	struct mlx5dr_matcher *matcher;
+};
+
 union mlx5dr_crc_encap_entropy_hash_ip_field {
 	uint8_t  ipv6_addr[16];
 	struct {
@@ -938,6 +952,21 @@ mlx5dr_action_create_nat64(struct mlx5dr_context *ctx,
 			   struct mlx5dr_action_nat64_attr *attr,
 			   uint32_t flags);
 
+/* Create direct rule jump to matcher action.
+ *
+ * @param[in] ctx
+ *	The context in which the new action will be created.
+ * @param[in] attr
+ *	The relevant attribute of the action.
+ * @param[in] flags
+ *	Action creation flags. (enum mlx5dr_action_flags)
+ * @return pointer to mlx5dr_action on success NULL otherwise.
+ */
+struct mlx5dr_action *
+mlx5dr_action_create_jump_to_matcher(struct mlx5dr_context *ctx,
+				     struct mlx5dr_action_jump_to_matcher_attr *attr,
+				     uint32_t flags);
+
 /* Destroy direct rule action.
  *
  * @param[in] action
drivers/net/mlx5/hws/mlx5dr_action.c +84 -3

135 lines not on this page · raw message

drivers/net/mlx5/hws/mlx5dr_action.h +3 -0
index ba4ce55228..8ce4ecd5ba 100644
@@ -223,6 +223,9 @@ struct mlx5dr_action {
 				struct {
 					struct mlx5dr_action *stages[MLX5DR_ACTION_NAT64_STAGES];
 				} nat64;
+				struct {
+					struct mlx5dr_matcher *matcher;
+				} jump_to_matcher;
 			};
 		};
 
drivers/net/mlx5/hws/mlx5dr_debug.c +1 -0
index f15ad96598..8684a8197a 100644
@@ -29,6 +29,7 @@ const char *mlx5dr_debug_action_type_str[] = {
 	[MLX5DR_ACTION_TYP_POP_IPV6_ROUTE_EXT] = "POP_IPV6_ROUTE_EXT",
 	[MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT] = "PUSH_IPV6_ROUTE_EXT",
 	[MLX5DR_ACTION_TYP_NAT64] = "NAT64",
+	[MLX5DR_ACTION_TYP_JUMP_TO_MATCHER] = "JUMP_TO_MATCHER",
 };
 
 static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
Signature · 1 line
2.43.5
Acked-by on v4 2/5
#10 lore raw

RE: [PATCH v4 2/5] net/mlx5/hws: introduce jump to matcher action

Quoted 13 lines

-----Original Message-----
From: Alexander Kozyrev <[email protected]>
Sent: Thursday, October 24, 2024 19:50
To: [email protected]
Cc: Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Hamdan Agbariya <[email protected]>; Alex Vesker <[email protected]>; Dariusz Sosnowski <[email protected]>; Ori Kam <[email protected]>; Bing Zhao <[email protected]>; Suanming Mou <[email protected]>
Subject: [PATCH v4 2/5] net/mlx5/hws: introduce jump to matcher action

Quoted 7 lines

From: Hamdan Igbaria <[email protected]>

Introduce jump to matcher action, this action will allow jumping to another matcher.
For now this jump restricted to STE array matchers and matchers of size 1.

Best regards,
Dariusz Sosnowski

#11 lore raw

PATCH v4 3/5 net/mlx5: create array ste matcher

In reply to Alexander Kozyrev

Create an array STE matcher for a template table in case of insertion by index with pattern is selected. Packets will be matched on a pattern at the index. This table is isolated from any other tables in a group. That means packets missed the rule won't go to a lower priority tables, but proceed with the default miss instead.

---
 drivers/net/mlx5/mlx5_flow_hw.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow_hw.c +9 -2
index c21eb1eaed..c236831e21 100644
@@ -5157,8 +5157,15 @@ flow_hw_table_create(struct rte_eth_dev *dev,
 	matcher_attr.optimize_using_rule_idx = true;
 	matcher_attr.mode = MLX5DR_MATCHER_RESOURCE_MODE_RULE;
 	matcher_attr.insert_mode = flow_hw_matcher_insert_mode_get(attr->insertion_type);
-	if (matcher_attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX)
-		matcher_attr.match_mode = MLX5DR_MATCHER_MATCH_MODE_ALWAYS_HIT;
+	if (matcher_attr.insert_mode == MLX5DR_MATCHER_INSERT_BY_INDEX) {
+		if (attr->insertion_type == RTE_FLOW_TABLE_INSERTION_TYPE_INDEX_WITH_PATTERN) {
+			matcher_attr.isolated = true;
+			matcher_attr.match_mode = MLX5DR_MATCHER_MATCH_MODE_DEFAULT;
+		} else {
+			matcher_attr.isolated = false;
+			matcher_attr.match_mode = MLX5DR_MATCHER_MATCH_MODE_ALWAYS_HIT;
+		}
+	}
 	if (attr->hash_func == RTE_FLOW_TABLE_HASH_FUNC_CRC16) {
 		DRV_LOG(ERR, "16-bit checksum hash type is not supported");
 		rte_errno = ENOTSUP;
Signature · 1 line
2.43.5
Acked-by on v4 3/5
#12 lore raw

RE: [PATCH v4 3/5] net/mlx5: create array ste matcher

Quoted 13 lines

-----Original Message-----
From: Alexander Kozyrev <[email protected]>
Sent: Thursday, October 24, 2024 19:50
To: [email protected]
Cc: Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Hamdan Agbariya <[email protected]>; Alex Vesker <[email protected]>; Dariusz Sosnowski <[email protected]>; Ori Kam <[email protected]>; Bing Zhao <[email protected]>; Suanming Mou <[email protected]>
Subject: [PATCH v4 3/5] net/mlx5: create array ste matcher

Quoted 8 lines

Create an array STE matcher for a template table in case of insertion by index with pattern is selected.
Packets will be matched on a pattern at the index.
This table is isolated from any other tables in a group.
That means packets missed the rule won't go to a lower priority tables, but proceed with the default miss instead.

Best regards,
Dariusz Sosnowski

#13 lore raw

PATCH v4 4/5 net/mlx5: add flow rule insertion by index with pattern

In reply to Alexander Kozyrev

Implement rte_flow_async_create_by_index_with_pattern() function. Rework the driver implementation to reduce code duplication by providing a single flow insertion routine, that can be called with different parameters depending on the insertion type.

---
 doc/guides/rel_notes/release_24_11.rst |   2 +
 drivers/net/mlx5/mlx5_flow_hw.c        | 281 +++++++------------------
 2 files changed, 83 insertions(+), 200 deletions(-)
doc/guides/rel_notes/release_24_11.rst +2 -0
index fa4822d928..07a8435b19 100644
@@ -247,6 +247,8 @@ New Features
   Added ability for node to advertise and update multiple xstat counters,
   that can be retrieved using ``rte_graph_cluster_stats_get``.
 
+* **Updated NVIDIA MLX5 net driver.**
+  * Added rte_flow_async_create_by_index_with_pattern() support.
 
 Removed Items
 -------------
drivers/net/mlx5/mlx5_flow_hw.c +81 -200

363 lines not on this page · raw message

Signature · 1 line
2.43.5
Acked-by on v4 4/5
#14 lore raw

RE: [PATCH v4 4/5] net/mlx5: add flow rule insertion by index with pattern

Quoted 13 lines

-----Original Message-----
From: Alexander Kozyrev <[email protected]>
Sent: Thursday, October 24, 2024 19:50
To: [email protected]
Cc: Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Hamdan Agbariya <[email protected]>; Alex Vesker <[email protected]>; Dariusz Sosnowski <[email protected]>; Ori Kam <[email protected]>; Bing Zhao <[email protected]>; Suanming Mou <[email protected]>
Subject: [PATCH v4 4/5] net/mlx5: add flow rule insertion by index with pattern

Quoted 6 lines

Implement rte_flow_async_create_by_index_with_pattern() function. Rework the driver implementation to reduce code duplication by providing a single flow insertion routine, that can be called with different parameters depending on the insertion type.

Best regards,
Dariusz Sosnowski

#15 lore raw

PATCH v4 5/5 net/mlx5: implement jump to table index action

In reply to Alexander Kozyrev

Implement RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE_INDEX action. Create the hardware steering jump to matcher action, associated with the template matcher. Use this action and provide the rule index as an offset in the matcher. Note that it is only supported by the isolated matcher, i.e. the table insertion type is by index with pattern.

---
 doc/guides/nics/features/default.ini          |   1 +
 doc/guides/nics/features/mlx5.ini             |   1 +
 doc/guides/prog_guide/ethdev/flow_offload.rst |  24 +++
 doc/guides/rel_notes/release_24_11.rst        |   1 +
 drivers/net/mlx5/mlx5_flow.h                  |   8 +-
 drivers/net/mlx5/mlx5_flow_hw.c               | 145 ++++++++++++++++++
 6 files changed, 178 insertions(+), 2 deletions(-)
doc/guides/nics/features/default.ini +1 -0
index 1e9a156a2a..a730365a16 100644
@@ -221,3 +221,4 @@ skip_cman            =
 vf                   =
 vxlan_decap          =
 vxlan_encap          =
+jump_to_table_index  =
doc/guides/nics/features/mlx5.ini +1 -0
index 056e04275b..55bc52c666 100644
@@ -150,3 +150,4 @@ set_tp_src           = Y
 set_ttl              = Y
 vxlan_decap          = Y
 vxlan_encap          = Y
+jump_to_table_index  = Y
doc/guides/prog_guide/ethdev/flow_offload.rst +24 -0
index 2d6187ed11..bff0b5a794 100644
@@ -3535,6 +3535,30 @@ Send packets to the kernel, without going to userspace at all.
 The packets will be received by the kernel driver sharing the same device
 as the DPDK port on which this action is configured.
 
+Action: ``JUMP_TO_TABLE_INDEX``
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Redirects packets to a particular index in a flow table.
+
+Bypassing a hierarchy of groups, this action redirects the matched flow to
+the specified index in the particular template table on the device.
+
+If a matched flow is redirected to a non-existing template table or
+the table which doesn't contain a rule at the specified index,
+then the behavior is undefined and the resulting behavior is up to driver.
+
+.. _table_rte_flow_action_jump_to_table_index:
+
+.. table:: JUMP_TO_TABLE_INDEX
+
+   +-----------+-------------------------------------------+
+   | Field     | Value                                     |
+   +===========+===========================================+
+   | ``table`` | Template table to redirect packets to     |
+   +-----------+-------------------------------------------+
+   | ``index`` | Index in the table to redirect packets to |
+   +-----------+-------------------------------------------+
+
 Negative types
 ~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_24_11.rst +1 -0
index 07a8435b19..dbef29706c 100644
@@ -249,6 +249,7 @@ New Features
 
 * **Updated NVIDIA MLX5 net driver.**
   * Added rte_flow_async_create_by_index_with_pattern() support.
+  * Added RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE_INDEX support.
 
 Removed Items
 -------------
drivers/net/mlx5/mlx5_flow.h +6 -2
index db56ae051d..90ad23c94a 100644
@@ -398,6 +398,7 @@ enum mlx5_feature_name {
 #define MLX5_FLOW_ACTION_IPV6_ROUTING_REMOVE (1ull << 48)
 #define MLX5_FLOW_ACTION_IPV6_ROUTING_PUSH (1ull << 49)
 #define MLX5_FLOW_ACTION_NAT64 (1ull << 50)
+#define MLX5_FLOW_ACTION_JUMP_TO_TABLE_INDEX (1ull << 51)
 
 #define MLX5_FLOW_DROP_INCLUSIVE_ACTIONS \
 	(MLX5_FLOW_ACTION_COUNT | MLX5_FLOW_ACTION_SAMPLE | MLX5_FLOW_ACTION_AGE)
@@ -408,12 +409,14 @@ enum mlx5_feature_name {
 	 MLX5_FLOW_ACTION_DEFAULT_MISS | \
 	 MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY | \
 	 MLX5_FLOW_ACTION_SEND_TO_KERNEL | \
-	 MLX5_FLOW_ACTION_PORT_REPRESENTOR)
+	 MLX5_FLOW_ACTION_PORT_REPRESENTOR | \
+	 MLX5_FLOW_ACTION_JUMP_TO_TABLE_INDEX)
 
 #define MLX5_FLOW_FATE_ESWITCH_ACTIONS \
 	(MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID | \
 	 MLX5_FLOW_ACTION_SEND_TO_KERNEL | \
-	 MLX5_FLOW_ACTION_JUMP | MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY)
+	 MLX5_FLOW_ACTION_JUMP | MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY | \
+	 MLX5_FLOW_ACTION_JUMP_TO_TABLE_INDEX)
 
 #define MLX5_FLOW_MODIFY_HDR_ACTIONS (MLX5_FLOW_ACTION_SET_IPV4_SRC | \
 				      MLX5_FLOW_ACTION_SET_IPV4_DST | \
@@ -1704,6 +1707,7 @@ struct mlx5_flow_template_table_cfg {
 
 struct mlx5_matcher_info {
 	struct mlx5dr_matcher *matcher; /* Template matcher. */
+	struct mlx5dr_action *jump; /* Jump to matcher action. */
 	RTE_ATOMIC(uint32_t) refcnt;
 };
 
drivers/net/mlx5/mlx5_flow_hw.c +145 -0

275 lines not on this page · raw message

Signature · 1 line
2.43.5
Acked-by on v4 5/5
#16 lore raw

RE: [PATCH v4 5/5] net/mlx5: implement jump to table index action

Quoted 13 lines

-----Original Message-----
From: Alexander Kozyrev <[email protected]>
Sent: Thursday, October 24, 2024 19:50
To: [email protected]
Cc: Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Hamdan Agbariya <[email protected]>; Alex Vesker <[email protected]>; Dariusz Sosnowski <[email protected]>; Ori Kam <[email protected]>; Bing Zhao <[email protected]>; Suanming Mou <[email protected]>
Subject: [PATCH v4 5/5] net/mlx5: implement jump to table index action

Quoted 8 lines

Implement RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE_INDEX action.
Create the hardware steering jump to matcher action, associated with the template matcher. Use this action and provide the rule index as an offset in the matcher.
Note that it is only supported by the isolated matcher, i.e. the table insertion type is by index with pattern.

Best regards,
Dariusz Sosnowski

#17 lore raw
In reply to Alexander Kozyrev

Hi,

From: Alexander Kozyrev <[email protected]>
Sent: Thursday, October 24, 2024 8:50 PM
To: [email protected]
Cc: Raslan Darawsheh; Slava Ovsiienko; Matan Azrad; Hamdan Agbariya; Alex Vesker; Dariusz Sosnowski; Ori Kam; Bing Zhao; Suanming Mou
Subject: [PATCH v4 0/5] jump to table index support in mlx5

Support the new Flow API JUMP_TO_TABLE_INDEX action in mlx5.

Alexander Kozyrev (3):
net/mlx5: create array ste matcher
net/mlx5: add flow rule insertion by index with pattern net/mlx5: implement jump to table index action

Hamdan Igbaria (2):
net/mlx5/hws: introduce new matcher type
net/mlx5/hws: introduce jump to matcher action

 doc/guides/nics/features/default.ini          |   1 +
 doc/guides/nics/features/mlx5.ini             |   1 +
 doc/guides/prog_guide/ethdev/flow_offload.rst |  24 +
 doc/guides/rel_notes/release_24_11.rst        |   3 +
 drivers/net/mlx5/hws/mlx5dr.h                 |  42 +-
 drivers/net/mlx5/hws/mlx5dr_action.c          |  87 +++-
 drivers/net/mlx5/hws/mlx5dr_action.h          |   3 +
 drivers/net/mlx5/hws/mlx5dr_debug.c           |  13 +-
 drivers/net/mlx5/hws/mlx5dr_matcher.c         |  58 ++-
 drivers/net/mlx5/hws/mlx5dr_matcher.h         |   6 +
 drivers/net/mlx5/hws/mlx5dr_rule.c            |   2 +-
 drivers/net/mlx5/hws/mlx5dr_table.c           |  61 ++-
 drivers/net/mlx5/hws/mlx5dr_table.h           |   8 +-
 drivers/net/mlx5/mlx5_flow.h                  |   8 +-
 drivers/net/mlx5/mlx5_flow_hw.c               | 435 ++++++++++--------
 15 files changed, 520 insertions(+), 232 deletions(-)

--
2.43.5

series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh