Skip to contentSkip to conversation

net/mlx5: reuse reformat and modify header actions in a table

PATCH In review Gregory Etelson 2 participants 2 messages Oct 30, 2023 – Oct 31, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: reuse reformat and modify header actions in a table

If application defined several actions templates with non-shared reformat or modify headers actions AND used these templates to create a table, HWS could share reformat or modify headers resources, instead of creating a resource for each action template.

The patch activates HWS code in a way that provides reformat or modify header resources sharing.

The patch updates modify field and raw encap template actions validations:
- modify field does not allow empty action template masks.
- raw encap added action template mask validation.

---
 drivers/net/mlx5/mlx5_flow.h    |   8 +-
 drivers/net/mlx5/mlx5_flow_dv.c |   3 +-
 drivers/net/mlx5/mlx5_flow_hw.c | 583 ++++++++++++++++++++++++--------
 3 files changed, 451 insertions(+), 143 deletions(-)
drivers/net/mlx5/mlx5_flow.h +6 -2
index 52e92f37de..e27f18eea4 100644
@@ -1376,7 +1376,9 @@ struct mlx5_hw_encap_decap_action {
 	enum mlx5dr_action_type action_type;
 	struct mlx5dr_action *action; /* Action object. */
 	/* Is header_reformat action shared across flows in table. */
-	bool shared;
+	uint32_t shared:1;
+	uint32_t multi_pattern:1;
+	volatile uint32_t *multi_pattern_refcnt;
 	size_t data_size; /* Action metadata size. */
 	uint8_t data[]; /* Action data. */
 };
@@ -1390,7 +1392,9 @@ struct mlx5_hw_modify_header_action {
 	/* Modify header action position in action rule table. */
 	uint16_t pos;
 	/* Is MODIFY_HEADER action shared across flows in table. */
-	bool shared;
+	uint32_t shared:1;
+	uint32_t multi_pattern:1;
+	volatile uint32_t *multi_pattern_refcnt;
 	/* Amount of modification commands stored in the precompiled buffer. */
 	uint32_t mhdr_cmds_num;
 	/* Precompiled modification commands. */
drivers/net/mlx5/mlx5_flow_dv.c +2 -1
index bdc8d0076a..84b94a9815 100644
@@ -4579,7 +4579,8 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf,
 						  (void *)items->type,
 						  "items total size is too big"
 						  " for encap action");
-		rte_memcpy((void *)&buf[temp_size], items->spec, len);
+		if (items->spec)
+			rte_memcpy(&buf[temp_size], items->spec, len);
 		switch (items->type) {
 		case RTE_FLOW_ITEM_TYPE_ETH:
 			eth = (struct rte_ether_hdr *)&buf[temp_size];
drivers/net/mlx5/mlx5_flow_hw.c +443 -140

725 lines not on this page · raw message

Signature · 1 line
2.39.2
#1 lore raw

Hi,

Quoted 19 lines

-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Monday, October 30, 2023 7:43 PM
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Maayan Kashani <[email protected]>; Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Suanming Mou <[email protected]>
Subject: [PATCH] net/mlx5: reuse reformat and modify header actions in a table

If application defined several actions templates with non-shared reformat or modify headers actions AND used these templates to create a table, HWS could share reformat or modify headers resources, instead of creating a resource for each action template.

The patch activates HWS code in a way that provides reformat or modify header resources sharing.

Quoted 7 lines

The patch updates modify field and raw encap template actions validations:
- modify field does not allow empty action template masks.
- raw encap added action template mask validation.

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh