Skip to contentSkip to conversation

net/mlx5: add indirect encap decap support

PATCH Superseded Rongwei Liu 2 participants 7 messages Oct 18, 2023 – Oct 30, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: add indirect encap decap support

Support the raw_encap/decap combinations in the indirect action list, and translates to 4 types of underlayer tunnel operations:
1. Layer 2 encapsulation like VxLAN.
2. Layer 2 decapsulation like VxLAN.
3. Layer 3 encapsulation like GRE.
4. Layer 3 decapsulation like GRE.

Each indirect action list has a unique handle ID and stands for different tunnel operations. The operation is shared globally with fixed patterns. It means there is no configuration associated with each handle ID and conf pointer should be NULL always no matter in the action template or flow rules.

If the handle ID mask in the action template is NULL, each flow rule can take its own indirect handle, otherwise, the ID in action template is used for all rules.
The handle ID used in the flow rules must be the same type as the one in the action template.

Testpmd cli example:

flow indirect_action 0 create action_id 10 transfer list actions raw_decap index 1 / raw_encap index 2 / end

flow pattern_template 0 create transfer pattern_template_id 1 template eth / ipv4 / udp / end

flow actions_template 0 create transfer actions_template_id 1 template indirect_list handle 10 / jump / end mask indirect_list / jump / end

flow template_table 0 create table_id 1 group 1 priority 0 transfer rules_number 64 pattern_template 1 actions_template 1

flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp / end actions indirect_list handle 11 / jump group 10 / end

Depends on the preceding series:
https://inbox.dpdk.org/dev/[email protected]/

---
 drivers/net/mlx5/mlx5_flow.c    |   5 +
 drivers/net/mlx5/mlx5_flow.h    |  15 ++
 drivers/net/mlx5/mlx5_flow_hw.c | 323 ++++++++++++++++++++++++++++++++
 3 files changed, 343 insertions(+)
drivers/net/mlx5/mlx5_flow.c +5 -0
index 16fce9c64e..588ce1b4a3 100644
@@ -66,6 +66,7 @@ void
 mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
+	struct rte_flow_error error;
 
 	while (!LIST_EMPTY(&priv->indirect_list_head)) {
 		struct mlx5_indirect_list *e =
@@ -80,6 +81,10 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)
 		case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY:
 			mlx5_destroy_legacy_indirect(dev, e);
 			break;
+		case MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT:
+			mlx5_reformat_action_destroy(dev,
+				(struct rte_flow_action_list_handle *)e, &error);
+			break;
 #endif
 		default:
 			DRV_LOG(ERR, "invalid indirect list type");
drivers/net/mlx5/mlx5_flow.h +15 -0
index 53c11651c8..593eadeafc 100644
@@ -101,6 +101,7 @@ enum mlx5_indirect_list_type {
 	MLX5_INDIRECT_ACTION_LIST_TYPE_ERR = 0,
 	MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY = 1,
 	MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR = 2,
+	MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT = 3,
 };
 
 /**
@@ -1367,6 +1368,8 @@ struct mlx5_hw_jump_action {
 
 /* Encap decap action struct. */
 struct mlx5_hw_encap_decap_action {
+	struct mlx5_indirect_list indirect;
+	enum mlx5dr_action_type action_type;
 	struct mlx5dr_action *action; /* Action object. */
 	/* Is header_reformat action shared across flows in table. */
 	bool shared;
@@ -2427,6 +2430,15 @@ const struct rte_flow_action *mlx5_flow_find_action
 int mlx5_validate_action_rss(struct rte_eth_dev *dev,
 			     const struct rte_flow_action *action,
 			     struct rte_flow_error *error);
+struct mlx5_hw_encap_decap_action*
+mlx5_reformat_action_create(struct rte_eth_dev *dev,
+			    const struct rte_flow_indir_action_conf *conf,
+			    const struct rte_flow_action *encap_action,
+			    const struct rte_flow_action *decap_action,
+			    struct rte_flow_error *error);
+int mlx5_reformat_action_destroy(struct rte_eth_dev *dev,
+				 struct rte_flow_action_list_handle *handle,
+				 struct rte_flow_error *error);
 int mlx5_flow_validate_action_count(struct rte_eth_dev *dev,
 				    const struct rte_flow_attr *attr,
 				    struct rte_flow_error *error);
@@ -2860,5 +2872,8 @@ mlx5_hw_mirror_destroy(struct rte_eth_dev *dev, struct mlx5_mirror *mirror);
 void
 mlx5_destroy_legacy_indirect(struct rte_eth_dev *dev,
 			     struct mlx5_indirect_list *ptr);
+void
+mlx5_hw_decap_encap_destroy(struct rte_eth_dev *dev,
+			    struct mlx5_indirect_list *reformat);
 #endif
 #endif /* RTE_PMD_MLX5_FLOW_H_ */
drivers/net/mlx5/mlx5_flow_hw.c +323 -0

375 lines not on this page · raw message

Signature · 1 line
2.27.0
#1 lore raw

PATCH v2 1/1 net/mlx5: add indirect encap decap support

Support the raw_encap/decap combinations in the indirect action list, and translates to 4 types of underlayer tunnel operations:
1. Layer 2 encapsulation like VxLAN.
2. Layer 2 decapsulation like VxLAN.
3. Layer 3 encapsulation like GRE.
4. Layer 3 decapsulation like GRE.

Each indirect action list has a unique handle ID and stands for different tunnel operations. The operation is shared globally with fixed patterns. It means there is no configuration associated with each handle ID and conf pointer should be NULL always no matter in the action template or flow rules.

If the handle ID mask in the action template is NULL, each flow rule can take its own indirect handle, otherwise, the ID in action template is used for all rules.
The handle ID used in the flow rules must be the same type as the one in the action template.

Testpmd cli example:

flow indirect_action 0 create action_id 10 transfer list actions raw_decap index 1 / raw_encap index 2 / end

flow pattern_template 0 create transfer pattern_template_id 1 template eth / ipv4 / udp / end

flow actions_template 0 create transfer actions_template_id 1 template indirect_list handle 10 / jump / end mask indirect_list / jump / end

flow template_table 0 create table_id 1 group 1 priority 0 transfer rules_number 64 pattern_template 1 actions_template 1

flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp / end actions indirect_list handle 11 / jump group 10 / end

v2: Code rebase

---
 drivers/net/mlx5/mlx5_flow.c    |   5 +
 drivers/net/mlx5/mlx5_flow.h    |  16 ++
 drivers/net/mlx5/mlx5_flow_hw.c | 323 ++++++++++++++++++++++++++++++++
 3 files changed, 344 insertions(+)
drivers/net/mlx5/mlx5_flow.c +5 -0
index a500afd4f7..4a28d13422 100644
@@ -66,6 +66,7 @@ void
 mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
+	struct rte_flow_error error;
 
 	while (!LIST_EMPTY(&priv->indirect_list_head)) {
 		struct mlx5_indirect_list *e =
@@ -80,6 +81,10 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)
 		case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY:
 			mlx5_destroy_legacy_indirect(dev, e);
 			break;
+		case MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT:
+			mlx5_reformat_action_destroy(dev,
+				(struct rte_flow_action_list_handle *)e, &error);
+			break;
 #endif
 		default:
 			DRV_LOG(ERR, "invalid indirect list type");
drivers/net/mlx5/mlx5_flow.h +16 -0
index 3ea2548d2b..2b94a4355c 100644
@@ -101,6 +101,7 @@ enum mlx5_indirect_list_type {
 	MLX5_INDIRECT_ACTION_LIST_TYPE_ERR = 0,
 	MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY = 1,
 	MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR = 2,
+	MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT = 3,
 };
 
 /**
@@ -1366,6 +1367,8 @@ struct mlx5_hw_jump_action {
 
 /* Encap decap action struct. */
 struct mlx5_hw_encap_decap_action {
+	struct mlx5_indirect_list indirect;
+	enum mlx5dr_action_type action_type;
 	struct mlx5dr_action *action; /* Action object. */
 	/* Is header_reformat action shared across flows in table. */
 	bool shared;
@@ -2426,6 +2429,16 @@ const struct rte_flow_action *mlx5_flow_find_action
 int mlx5_validate_action_rss(struct rte_eth_dev *dev,
 			     const struct rte_flow_action *action,
 			     struct rte_flow_error *error);
+
+struct mlx5_hw_encap_decap_action*
+mlx5_reformat_action_create(struct rte_eth_dev *dev,
+			    const struct rte_flow_indir_action_conf *conf,
+			    const struct rte_flow_action *encap_action,
+			    const struct rte_flow_action *decap_action,
+			    struct rte_flow_error *error);
+int mlx5_reformat_action_destroy(struct rte_eth_dev *dev,
+				 struct rte_flow_action_list_handle *handle,
+				 struct rte_flow_error *error);
 int mlx5_flow_validate_action_count(struct rte_eth_dev *dev,
 				    const struct rte_flow_attr *attr,
 				    struct rte_flow_error *error);
@@ -2859,5 +2872,8 @@ mlx5_hw_mirror_destroy(struct rte_eth_dev *dev, struct mlx5_mirror *mirror);
 void
 mlx5_destroy_legacy_indirect(struct rte_eth_dev *dev,
 			     struct mlx5_indirect_list *ptr);
+void
+mlx5_hw_decap_encap_destroy(struct rte_eth_dev *dev,
+			    struct mlx5_indirect_list *reformat);
 #endif
 #endif /* RTE_PMD_MLX5_FLOW_H_ */
drivers/net/mlx5/mlx5_flow_hw.c +323 -0

375 lines not on this page · raw message

Signature · 1 line
2.27.0
#2 lore raw

PATCH v3 1/1 net/mlx5: add indirect encap decap support

Support the raw_encap/decap combinations in the indirect action list, and translates to 4 types of underlayer tunnel operations:
1. Layer 2 encapsulation like VxLAN.
2. Layer 2 decapsulation like VxLAN.
3. Layer 3 encapsulation like GRE.
4. Layer 3 decapsulation like GRE.

Each indirect action list has a unique handle ID and stands for different tunnel operations. The operation is shared globally with fixed patterns. It means there is no configuration associated with each handle ID and conf pointer should be NULL always no matter in the action template or flow rules.

If the handle ID mask in the action template is NULL, each flow rule can take its own indirect handle, otherwise, the ID in action template is used for all rules.
The handle ID used in the flow rules must be the same type as the one in the action template.

Testpmd cli example:

flow indirect_action 0 create action_id 10 transfer list actions raw_decap index 1 / raw_encap index 2 / end

flow pattern_template 0 create transfer pattern_template_id 1 template eth / ipv4 / udp / end

flow actions_template 0 create transfer actions_template_id 1 template indirect_list handle 10 / jump / end mask indirect_list / jump / end

flow template_table 0 create table_id 1 group 1 priority 0 transfer rules_number 64 pattern_template 1 actions_template 1

flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp / end actions indirect_list handle 11 / jump group 10 / end

v3: Protect with macro to fix warning.
v2: Code rebase

---
 drivers/net/mlx5/mlx5_flow.c    |   5 +
 drivers/net/mlx5/mlx5_flow.h    |  16 ++
 drivers/net/mlx5/mlx5_flow_hw.c | 323 ++++++++++++++++++++++++++++++++
 3 files changed, 344 insertions(+)
drivers/net/mlx5/mlx5_flow.c +5 -0
index a500afd4f7..4a28d13422 100644
@@ -66,6 +66,7 @@ void
 mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
+	struct rte_flow_error error;
 
 	while (!LIST_EMPTY(&priv->indirect_list_head)) {
 		struct mlx5_indirect_list *e =
@@ -80,6 +81,10 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)
 		case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY:
 			mlx5_destroy_legacy_indirect(dev, e);
 			break;
+		case MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT:
+			mlx5_reformat_action_destroy(dev,
+				(struct rte_flow_action_list_handle *)e, &error);
+			break;
 #endif
 		default:
 			DRV_LOG(ERR, "invalid indirect list type");
drivers/net/mlx5/mlx5_flow.h +16 -0
index 3ea2548d2b..2b94a4355c 100644
@@ -101,6 +101,7 @@ enum mlx5_indirect_list_type {
 	MLX5_INDIRECT_ACTION_LIST_TYPE_ERR = 0,
 	MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY = 1,
 	MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR = 2,
+	MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT = 3,
 };
 
 /**
@@ -1366,6 +1367,8 @@ struct mlx5_hw_jump_action {
 
 /* Encap decap action struct. */
 struct mlx5_hw_encap_decap_action {
+	struct mlx5_indirect_list indirect;
+	enum mlx5dr_action_type action_type;
 	struct mlx5dr_action *action; /* Action object. */
 	/* Is header_reformat action shared across flows in table. */
 	bool shared;
@@ -2426,6 +2429,16 @@ const struct rte_flow_action *mlx5_flow_find_action
 int mlx5_validate_action_rss(struct rte_eth_dev *dev,
 			     const struct rte_flow_action *action,
 			     struct rte_flow_error *error);
+
+struct mlx5_hw_encap_decap_action*
+mlx5_reformat_action_create(struct rte_eth_dev *dev,
+			    const struct rte_flow_indir_action_conf *conf,
+			    const struct rte_flow_action *encap_action,
+			    const struct rte_flow_action *decap_action,
+			    struct rte_flow_error *error);
+int mlx5_reformat_action_destroy(struct rte_eth_dev *dev,
+				 struct rte_flow_action_list_handle *handle,
+				 struct rte_flow_error *error);
 int mlx5_flow_validate_action_count(struct rte_eth_dev *dev,
 				    const struct rte_flow_attr *attr,
 				    struct rte_flow_error *error);
@@ -2859,5 +2872,8 @@ mlx5_hw_mirror_destroy(struct rte_eth_dev *dev, struct mlx5_mirror *mirror);
 void
 mlx5_destroy_legacy_indirect(struct rte_eth_dev *dev,
 			     struct mlx5_indirect_list *ptr);
+void
+mlx5_hw_decap_encap_destroy(struct rte_eth_dev *dev,
+			    struct mlx5_indirect_list *reformat);
 #endif
 #endif /* RTE_PMD_MLX5_FLOW_H_ */
drivers/net/mlx5/mlx5_flow_hw.c +323 -0

375 lines not on this page · raw message

Signature · 1 line
2.27.0
#3 lore raw

Hi,

Quoted 44 lines

-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Sunday, October 29, 2023 2:54 PM
To: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>
Subject: [PATCH v3] net/mlx5: add indirect encap decap support

Support the raw_encap/decap combinations in the indirect action list, and translates to 4 types of underlayer tunnel operations:
1. Layer 2 encapsulation like VxLAN.
2. Layer 2 decapsulation like VxLAN.
3. Layer 3 encapsulation like GRE.
4. Layer 3 decapsulation like GRE.

Each indirect action list has a unique handle ID and stands for different tunnel operations. The operation is shared globally with fixed patterns. It means there is no configuration associated with each handle ID and conf pointer should be NULL always no matter in the action template or flow rules.

If the handle ID mask in the action template is NULL, each flow rule can take its own indirect handle, otherwise, the ID in action template is used for all rules. The handle ID used in the flow rules must be the same type as the one in the action template.

Testpmd cli example:

flow indirect_action 0 create action_id 10 transfer list actions raw_decap index 1 / raw_encap index 2 / end

flow pattern_template 0 create transfer pattern_template_id 1 template eth / ipv4 / udp / end

flow actions_template 0 create transfer actions_template_id 1 template indirect_list handle 10 / jump / end mask indirect_list / jump / end

flow template_table 0 create table_id 1 group 1 priority 0 transfer rules_number 64 pattern_template 1 actions_template 1

flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp / end actions indirect_list handle 11 / jump group 10 / end

Quoted 6 lines

v3: Protect with macro to fix warning.
v2: Code rebase

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

#4 lore raw

It has a compilation issue,
@Rongwei Liu please lets fix it I missed it before integration

Quoted 71 lines

-----Original Message-----
From: Raslan Darawsheh
Sent: Sunday, October 29, 2023 4:33 PM
To: Rongwei Liu <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; NBU- Contact-Thomas Monjalon (EXTERNAL) <[email protected]>
Subject: RE: [PATCH v3] net/mlx5: add indirect encap decap support

Hi,

Quoted 16 lines

-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Sunday, October 29, 2023 2:54 PM
To: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>
Subject: [PATCH v3] net/mlx5: add indirect encap decap support

Support the raw_encap/decap combinations in the indirect action list, and translates to 4 types of underlayer tunnel operations:
1. Layer 2 encapsulation like VxLAN.
2. Layer 2 decapsulation like VxLAN.
3. Layer 3 encapsulation like GRE.
4. Layer 3 decapsulation like GRE.

Quoted 4 lines

Each indirect action list has a unique handle ID and stands for different tunnel operations. The operation is shared globally with fixed patterns. It means there is no configuration associated with each handle ID and conf pointer should be NULL always no matter in the

action template or flow rules.

Quoted 3 lines

If the handle ID mask in the action template is NULL, each flow rule can take its own indirect handle, otherwise, the ID in action template is used

for all rules.

Quoted 24 lines

The handle ID used in the flow rules must be the same type as the one in the action template.

Testpmd cli example:

flow indirect_action 0 create action_id 10 transfer list actions raw_decap index
1 / raw_encap index 2 / end

flow pattern_template 0 create transfer pattern_template_id 1 template eth /
ipv4 / udp / end

flow actions_template 0 create transfer actions_template_id 1 template indirect_list handle 10 / jump / end mask indirect_list / jump / end

flow template_table 0 create table_id 1 group 1 priority 0 transfer rules_number 64 pattern_template 1 actions_template 1

flow queue 0 create 0 template_table 1 pattern_template 0 actions_template
0 postpone no pattern eth / ipv4 / udp / end actions indirect_list handle 11 / jump group 10 / end

Quoted 6 lines

v3: Protect with macro to fix warning.
v2: Code rebase

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

#5 lore raw

PATCH v4 1/1 net/mlx5: add indirect encap decap support

In reply to Rongwei Liu

Support the raw_encap/decap combinations in the indirect action list, and translates to 4 types of underlayer tunnel operations:
1. Layer 2 encapsulation like VxLAN.
2. Layer 2 decapsulation like VxLAN.
3. Layer 3 encapsulation like GRE.
4. Layer 3 decapsulation like GRE.

Each indirect action list has a unique handle ID and stands for different tunnel operations. The operation is shared globally with fixed patterns. It means there is no configuration associated with each handle ID and conf pointer should be NULL always no matter in the action template or flow rules.

If the handle ID mask in the action template is NULL, each flow rule can take its own indirect handle, otherwise, the ID in action template is used for all rules.
The handle ID used in the flow rules must be the same type as the one in the action template.

Testpmd cli example:

flow indirect_action 0 create action_id 10 transfer list actions raw_decap index 1 / raw_encap index 2 / end

flow pattern_template 0 create transfer pattern_template_id 1 template eth / ipv4 / udp / end

flow actions_template 0 create transfer actions_template_id 1 template indirect_list handle 10 / jump / end mask indirect_list / jump / end

flow template_table 0 create table_id 1 group 1 priority 0 transfer rules_number 64 pattern_template 1 actions_template 1

flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp / end actions indirect_list handle 11 / jump group 10 / end

v4, v3: add macro to fix build failure
v2: rebase

---
 drivers/net/mlx5/mlx5_flow.c    |   7 +
 drivers/net/mlx5/mlx5_flow.h    |  16 ++
 drivers/net/mlx5/mlx5_flow_hw.c | 323 ++++++++++++++++++++++++++++++++
 3 files changed, 346 insertions(+)
drivers/net/mlx5/mlx5_flow.c +7 -0
index a500afd4f7..12efc75e6d 100644
@@ -66,6 +66,9 @@ void
 mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
+#ifdef HAVE_MLX5_HWS_SUPPORT
+	struct rte_flow_error error;
+#endif
 
 	while (!LIST_EMPTY(&priv->indirect_list_head)) {
 		struct mlx5_indirect_list *e =
@@ -80,6 +83,10 @@ mlx5_indirect_list_handles_release(struct rte_eth_dev *dev)
 		case MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY:
 			mlx5_destroy_legacy_indirect(dev, e);
 			break;
+		case MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT:
+			mlx5_reformat_action_destroy(dev,
+				(struct rte_flow_action_list_handle *)e, &error);
+			break;
 #endif
 		default:
 			DRV_LOG(ERR, "invalid indirect list type");
drivers/net/mlx5/mlx5_flow.h +16 -0
index 3ea2548d2b..2b94a4355c 100644
@@ -101,6 +101,7 @@ enum mlx5_indirect_list_type {
 	MLX5_INDIRECT_ACTION_LIST_TYPE_ERR = 0,
 	MLX5_INDIRECT_ACTION_LIST_TYPE_LEGACY = 1,
 	MLX5_INDIRECT_ACTION_LIST_TYPE_MIRROR = 2,
+	MLX5_INDIRECT_ACTION_LIST_TYPE_REFORMAT = 3,
 };
 
 /**
@@ -1366,6 +1367,8 @@ struct mlx5_hw_jump_action {
 
 /* Encap decap action struct. */
 struct mlx5_hw_encap_decap_action {
+	struct mlx5_indirect_list indirect;
+	enum mlx5dr_action_type action_type;
 	struct mlx5dr_action *action; /* Action object. */
 	/* Is header_reformat action shared across flows in table. */
 	bool shared;
@@ -2426,6 +2429,16 @@ const struct rte_flow_action *mlx5_flow_find_action
 int mlx5_validate_action_rss(struct rte_eth_dev *dev,
 			     const struct rte_flow_action *action,
 			     struct rte_flow_error *error);
+
+struct mlx5_hw_encap_decap_action*
+mlx5_reformat_action_create(struct rte_eth_dev *dev,
+			    const struct rte_flow_indir_action_conf *conf,
+			    const struct rte_flow_action *encap_action,
+			    const struct rte_flow_action *decap_action,
+			    struct rte_flow_error *error);
+int mlx5_reformat_action_destroy(struct rte_eth_dev *dev,
+				 struct rte_flow_action_list_handle *handle,
+				 struct rte_flow_error *error);
 int mlx5_flow_validate_action_count(struct rte_eth_dev *dev,
 				    const struct rte_flow_attr *attr,
 				    struct rte_flow_error *error);
@@ -2859,5 +2872,8 @@ mlx5_hw_mirror_destroy(struct rte_eth_dev *dev, struct mlx5_mirror *mirror);
 void
 mlx5_destroy_legacy_indirect(struct rte_eth_dev *dev,
 			     struct mlx5_indirect_list *ptr);
+void
+mlx5_hw_decap_encap_destroy(struct rte_eth_dev *dev,
+			    struct mlx5_indirect_list *reformat);
 #endif
 #endif /* RTE_PMD_MLX5_FLOW_H_ */
drivers/net/mlx5/mlx5_flow_hw.c +323 -0

375 lines not on this page · raw message

Signature · 1 line
2.27.0
#6 lore raw

Hi,

Quoted 44 lines

-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Sunday, October 29, 2023 5:30 PM
To: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>
Subject: [PATCH v4] net/mlx5: add indirect encap decap support

Support the raw_encap/decap combinations in the indirect action list, and translates to 4 types of underlayer tunnel operations:
1. Layer 2 encapsulation like VxLAN.
2. Layer 2 decapsulation like VxLAN.
3. Layer 3 encapsulation like GRE.
4. Layer 3 decapsulation like GRE.

Each indirect action list has a unique handle ID and stands for different tunnel operations. The operation is shared globally with fixed patterns. It means there is no configuration associated with each handle ID and conf pointer should be NULL always no matter in the action template or flow rules.

If the handle ID mask in the action template is NULL, each flow rule can take its own indirect handle, otherwise, the ID in action template is used for all rules. The handle ID used in the flow rules must be the same type as the one in the action template.

Testpmd cli example:

flow indirect_action 0 create action_id 10 transfer list actions raw_decap index 1 / raw_encap index 2 / end

flow pattern_template 0 create transfer pattern_template_id 1 template eth / ipv4 / udp / end

flow actions_template 0 create transfer actions_template_id 1 template indirect_list handle 10 / jump / end mask indirect_list / jump / end

flow template_table 0 create table_id 1 group 1 priority 0 transfer rules_number 64 pattern_template 1 actions_template 1

flow queue 0 create 0 template_table 1 pattern_template 0 actions_template 0 postpone no pattern eth / ipv4 / udp / end actions indirect_list handle 11 / jump group 10 / end

Quoted 6 lines

v4, v3: add macro to fix build failure
v2: rebase

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh