Skip to contentSkip to conversation

net/mlx5: support copy from inner fields

PATCH Superseded Michael Baum 3 participants 26 messages Feb 6, 2024 – Feb 27, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

cover net/mlx5: support copy from inner fields

This patch-set adds support of encapsulation level for HWS modify field in MLX5 PMD.
Outermost is represented by 0,1 and inner is represented by 2. In addition, modify inner/outer us added for both IPv6 flow label and IPv6 traffic class.

Depends-on: series-31008 ("ethdev: add modify IPv4 next protocol field")
Depends-on: series-31010 ("ethdev: add IPv6 field identifiers")

Michael Baum (7):
common/mlx5: remove enum value duplication common/mlx5: reorder modification field PRM list common/mlx5: add inner PRM fields common/mlx5: add IPv6 flow label PRM field net/mlx5: add support for modify inner fields net/mlx5: support modify IPv6 traffic class field net/mlx5: support modify IPv6 flow label field

 doc/guides/nics/mlx5.rst               |  28 ++++-
 doc/guides/rel_notes/release_24_03.rst |   2 +
 drivers/common/mlx5/mlx5_prm.h         |  49 +++++----
 drivers/net/mlx5/hws/mlx5dr_action.c   |   4 +-
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c  |   2 +-
 drivers/net/mlx5/mlx5_flow.c           |  12 ++-
 drivers/net/mlx5/mlx5_flow_dv.c        | 136 +++++++++++++++----------
 drivers/net/mlx5/mlx5_flow_hw.c        | 134 +++++++++++++++++++++++-
 8 files changed, 282 insertions(+), 85 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/7 common/mlx5: remove enum value duplication

The "mlx5_modification_field" enumeration has 2 different fields representing the same value 0x4A.
1. "MLX5_MODI_OUT_IPV6_NEXT_HDR" - specific for IPv6.
2. "MLX5_MODI_OUT_IP_PROTOCOL" - for both IPv4 and IPv6.

This patch removes "MLX5_MODI_OUT_IPV6_NEXT_HDR" and replaces all its usages with "MLX5_MODI_OUT_IP_PROTOCOL".

---
 drivers/common/mlx5/mlx5_prm.h        | 1 -
 drivers/net/mlx5/hws/mlx5dr_action.c  | 4 ++--
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
drivers/common/mlx5/mlx5_prm.h +0 -1
index 3150412580..1f04a35683 100644
@@ -840,7 +840,6 @@ enum mlx5_modification_field {
 	MLX5_MODI_IN_MPLS_LABEL_3,
 	MLX5_MODI_IN_MPLS_LABEL_4,
 	MLX5_MODI_OUT_IP_PROTOCOL = 0x4A,
-	MLX5_MODI_OUT_IPV6_NEXT_HDR = 0x4A,
 	MLX5_MODI_META_REG_C_8 = 0x8F,
 	MLX5_MODI_META_REG_C_9 = 0x90,
 	MLX5_MODI_META_REG_C_10 = 0x91,
drivers/net/mlx5/hws/mlx5dr_action.c +2 -2
index 862ee3e332..2828a82d5b 100644
@@ -2287,7 +2287,7 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr3(struct mlx5dr_action *action)
 	MLX5_SET(copy_action_in, cmd, length, 8);
 	MLX5_SET(copy_action_in, cmd, src_offset, 24);
 	MLX5_SET(copy_action_in, cmd, src_field, mod_id);
-	MLX5_SET(copy_action_in, cmd, dst_field, MLX5_MODI_OUT_IPV6_NEXT_HDR);
+	MLX5_SET(copy_action_in, cmd, dst_field, MLX5_MODI_OUT_IP_PROTOCOL);
 
 	pattern.data = (__be64 *)cmd;
 	pattern.sz = sizeof(cmd);
@@ -2348,7 +2348,7 @@ mlx5dr_action_create_push_ipv6_route_ext_mhdr1(struct mlx5dr_action *action)
 	/* Set ipv6.protocol to IPPROTO_ROUTING */
 	MLX5_SET(set_action_in, cmd, action_type, MLX5_MODIFICATION_TYPE_SET);
 	MLX5_SET(set_action_in, cmd, length, 8);
-	MLX5_SET(set_action_in, cmd, field, MLX5_MODI_OUT_IPV6_NEXT_HDR);
+	MLX5_SET(set_action_in, cmd, field, MLX5_MODI_OUT_IP_PROTOCOL);
 	MLX5_SET(set_action_in, cmd, data, IPPROTO_ROUTING);
 
 	pattern.data = (__be64 *)cmd;
drivers/net/mlx5/hws/mlx5dr_pat_arg.c +1 -1
index a949844d24..513549ff3c 100644
@@ -67,7 +67,7 @@ bool mlx5dr_pat_require_reparse(__be64 *actions, uint16_t num_of_actions)
 
 		/* Below fields can change packet structure require a reparse */
 		if (field == MLX5_MODI_OUT_ETHERTYPE ||
-		    field == MLX5_MODI_OUT_IPV6_NEXT_HDR)
+		    field == MLX5_MODI_OUT_IP_PROTOCOL)
 			return true;
 	}
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/7 common/mlx5: reorder modification field PRM list

In reply to Michael Baum

Reorder modification field PRM list according to values from lowest to highest.
This patch also removes value specification from all fields which their value is one more than previous one.

---
 drivers/common/mlx5/mlx5_prm.h | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/common/mlx5/mlx5_prm.h +16 -16
index 1f04a35683..a13b5790b0 100644
@@ -816,6 +816,7 @@ enum mlx5_modification_field {
 	MLX5_MODI_OUT_IPV6_HOPLIMIT,
 	MLX5_MODI_IN_IPV6_HOPLIMIT,
 	MLX5_MODI_META_DATA_REG_A,
+	MLX5_MODI_OUT_IP_PROTOCOL,
 	MLX5_MODI_META_DATA_REG_B = 0x50,
 	MLX5_MODI_META_REG_C_0,
 	MLX5_MODI_META_REG_C_1,
@@ -829,32 +830,31 @@ enum mlx5_modification_field {
 	MLX5_MODI_IN_TCP_SEQ_NUM,
 	MLX5_MODI_OUT_TCP_ACK_NUM,
 	MLX5_MODI_IN_TCP_ACK_NUM = 0x5C,
+	MLX5_MODI_OUT_ESP_SPI = 0x5E,
 	MLX5_MODI_GTP_TEID = 0x6E,
 	MLX5_MODI_OUT_IP_ECN = 0x73,
 	MLX5_MODI_TUNNEL_HDR_DW_1 = 0x75,
-	MLX5_MODI_GTPU_FIRST_EXT_DW_0 = 0x76,
+	MLX5_MODI_GTPU_FIRST_EXT_DW_0,
 	MLX5_MODI_HASH_RESULT = 0x81,
+	MLX5_MODI_OUT_ESP_SEQ_NUM,
 	MLX5_MODI_IN_MPLS_LABEL_0 = 0x8a,
 	MLX5_MODI_IN_MPLS_LABEL_1,
 	MLX5_MODI_IN_MPLS_LABEL_2,
 	MLX5_MODI_IN_MPLS_LABEL_3,
 	MLX5_MODI_IN_MPLS_LABEL_4,
-	MLX5_MODI_OUT_IP_PROTOCOL = 0x4A,
-	MLX5_MODI_META_REG_C_8 = 0x8F,
-	MLX5_MODI_META_REG_C_9 = 0x90,
-	MLX5_MODI_META_REG_C_10 = 0x91,
-	MLX5_MODI_META_REG_C_11 = 0x92,
-	MLX5_MODI_META_REG_C_12 = 0x93,
-	MLX5_MODI_META_REG_C_13 = 0x94,
-	MLX5_MODI_META_REG_C_14 = 0x95,
-	MLX5_MODI_META_REG_C_15 = 0x96,
+	MLX5_MODI_META_REG_C_8,
+	MLX5_MODI_META_REG_C_9,
+	MLX5_MODI_META_REG_C_10,
+	MLX5_MODI_META_REG_C_11,
+	MLX5_MODI_META_REG_C_12,
+	MLX5_MODI_META_REG_C_13,
+	MLX5_MODI_META_REG_C_14,
+	MLX5_MODI_META_REG_C_15,
 	MLX5_MODI_OUT_IPV6_TRAFFIC_CLASS = 0x11C,
-	MLX5_MODI_OUT_IPV4_TOTAL_LEN = 0x11D,
-	MLX5_MODI_OUT_IPV6_PAYLOAD_LEN = 0x11E,
-	MLX5_MODI_OUT_IPV4_IHL = 0x11F,
-	MLX5_MODI_OUT_TCP_DATA_OFFSET = 0x120,
-	MLX5_MODI_OUT_ESP_SPI = 0x5E,
-	MLX5_MODI_OUT_ESP_SEQ_NUM = 0x82,
+	MLX5_MODI_OUT_IPV4_TOTAL_LEN,
+	MLX5_MODI_OUT_IPV6_PAYLOAD_LEN,
+	MLX5_MODI_OUT_IPV4_IHL,
+	MLX5_MODI_OUT_TCP_DATA_OFFSET,
 	MLX5_MODI_OUT_IPSEC_NEXT_HDR = 0x126,
 	MLX5_MODI_INVALID = INT_MAX,
 };
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/7 common/mlx5: add inner PRM fields

In reply to Michael Baum

This patch adds inner values into PRM modify field list for each existing outer field.

---
 drivers/common/mlx5/mlx5_prm.h | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/common/mlx5/mlx5_prm.h +11 -3
index a13b5790b0..7ac43f42b8 100644
@@ -829,14 +829,17 @@ enum mlx5_modification_field {
 	MLX5_MODI_OUT_TCP_SEQ_NUM,
 	MLX5_MODI_IN_TCP_SEQ_NUM,
 	MLX5_MODI_OUT_TCP_ACK_NUM,
-	MLX5_MODI_IN_TCP_ACK_NUM = 0x5C,
+	MLX5_MODI_IN_TCP_ACK_NUM,
 	MLX5_MODI_OUT_ESP_SPI = 0x5E,
+	MLX5_MODI_IN_ESP_SPI,
 	MLX5_MODI_GTP_TEID = 0x6E,
 	MLX5_MODI_OUT_IP_ECN = 0x73,
-	MLX5_MODI_TUNNEL_HDR_DW_1 = 0x75,
+	MLX5_MODI_IN_IP_ECN,
+	MLX5_MODI_TUNNEL_HDR_DW_1,
 	MLX5_MODI_GTPU_FIRST_EXT_DW_0,
 	MLX5_MODI_HASH_RESULT = 0x81,
 	MLX5_MODI_OUT_ESP_SEQ_NUM,
+	MLX5_MODI_IN_ESP_SEQ_NUM,
 	MLX5_MODI_IN_MPLS_LABEL_0 = 0x8a,
 	MLX5_MODI_IN_MPLS_LABEL_1,
 	MLX5_MODI_IN_MPLS_LABEL_2,
@@ -855,7 +858,12 @@ enum mlx5_modification_field {
 	MLX5_MODI_OUT_IPV6_PAYLOAD_LEN,
 	MLX5_MODI_OUT_IPV4_IHL,
 	MLX5_MODI_OUT_TCP_DATA_OFFSET,
-	MLX5_MODI_OUT_IPSEC_NEXT_HDR = 0x126,
+	MLX5_MODI_IN_IPV6_TRAFFIC_CLASS,
+	MLX5_MODI_IN_IPV4_TOTAL_LEN,
+	MLX5_MODI_IN_IPV6_PAYLOAD_LEN,
+	MLX5_MODI_IN_IPV4_IHL,
+	MLX5_MODI_IN_TCP_DATA_OFFSET,
+	MLX5_MODI_OUT_IPSEC_NEXT_HDR,
 	MLX5_MODI_INVALID = INT_MAX,
 };
 
Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/7 common/mlx5: add IPv6 flow label PRM field

In reply to Michael Baum

Add IPv6 flow label field into PRM modify field list. The new values are "MLX5_MODI_OUT_IPV6_FLOW_LABEL" and "MLX5_MODI_IN_IPV6_FLOW_LABEL".

---
 drivers/common/mlx5/mlx5_prm.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/common/mlx5/mlx5_prm.h +2 -0
index 7ac43f42b8..afd0001e8f 100644
@@ -864,6 +864,8 @@ enum mlx5_modification_field {
 	MLX5_MODI_IN_IPV4_IHL,
 	MLX5_MODI_IN_TCP_DATA_OFFSET,
 	MLX5_MODI_OUT_IPSEC_NEXT_HDR,
+	MLX5_MODI_OUT_IPV6_FLOW_LABEL,
+	MLX5_MODI_IN_IPV6_FLOW_LABEL,
 	MLX5_MODI_INVALID = INT_MAX,
 };
 
Signature · 1 line
2.25.1
#5 lore raw

PATCH 5/7 net/mlx5: add support for modify inner fields

In reply to Michael Baum

This patch adds support for copying from inner fields using "level" 2.

---
 doc/guides/nics/mlx5.rst        |  28 ++++++-
 drivers/net/mlx5/mlx5_flow.c    |  12 ++-
 drivers/net/mlx5/mlx5_flow_dv.c | 113 ++++++++++++++-------------
 drivers/net/mlx5/mlx5_flow_hw.c | 130 +++++++++++++++++++++++++++++++-
 4 files changed, 222 insertions(+), 61 deletions(-)
doc/guides/nics/mlx5.rst +27 -1
index 6e1e2df79a..030bbe664f 100644
@@ -595,7 +595,6 @@ Limitations
     Only DWs configured in :ref:`parser creation <geneve_parser_api>` can be modified,
     'type' and 'class' fields can be modified when ``match_on_class_mode=2``.
   - Modification of GENEVE TLV option data supports one DW per action.
-  - Encapsulation levels are not supported, can modify outermost header fields only.
   - Offsets cannot skip past the boundary of a field.
   - If the field type is ``RTE_FLOW_FIELD_MAC_TYPE``
     and packet contains one or more VLAN headers,
@@ -609,6 +608,33 @@ Limitations
   - For flow metadata fields (e.g. META or TAG)
     offset specifies the number of bits to skip from field's start,
     starting from LSB in the least significant byte, in the host order.
+  - Modification of the MPLS header is supported with some limitations:
+
+    - Only in HW steering.
+    - Only in ``src`` field.
+    - Only for outermost tunnel header (``level=2``).
+      For ``RTE_FLOW_FIELD_MPLS``,
+      the default encapsulation level ``0`` describes the outermost tunnel header.
+
+      .. note::
+
+         the default encapsulation level ``0`` describes the "outermost that match is supported",
+         currently it is first tunnel, but it can be changed to outer when it is supported.
+
+  - Default encapsulation level ``0`` describes outermost.
+  - Encapsulation level ``1`` is supported.
+  - Encapsulation level ``2`` is supported with some limitations:
+
+    - Only in HW steering.
+    - Only in ``src`` field.
+    - ``RTE_FLOW_FIELD_VLAN_ID`` is not supported.
+    - ``RTE_FLOW_FIELD_IPV4_PROTO`` is not supported.
+    - ``RTE_FLOW_FIELD_IPV6_PROTO/DSCP/ECN`` are not supported.
+    - ``RTE_FLOW_FIELD_ESP_PROTO/SPI/SEQ_NUM`` are not supported.
+    - ``RTE_FLOW_FIELD_TCP_SEQ/ACK_NUM`` are not supported.
+    - Second tunnel fields are not supported.
+
+  - Encapsulation levels greater than ``2`` are not supported.
 
 - Age action:
 
drivers/net/mlx5/mlx5_flow.c +8 -4
index 5159e8e773..fa85089364 100644
@@ -2507,10 +2507,14 @@ flow_validate_modify_field_level(const struct rte_flow_action_modify_data *data,
 	if (data->level == 0)
 		return 0;
 	if (data->field != RTE_FLOW_FIELD_TAG &&
-	    data->field != (enum rte_flow_field_id)MLX5_RTE_FLOW_FIELD_META_REG)
-		return rte_flow_error_set(error, ENOTSUP,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "inner header fields modification is not supported");
+	    data->field != (enum rte_flow_field_id)MLX5_RTE_FLOW_FIELD_META_REG) {
+		if (data->level > 1)
+			return rte_flow_error_set(error, ENOTSUP,
+						  RTE_FLOW_ERROR_TYPE_ACTION,
+						  NULL,
+						  "inner header fields modification is not supported");
+		return 0;
+	}
 	if (data->tag_index != 0)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
drivers/net/mlx5/mlx5_flow_dv.c +59 -54

275 lines not on this page · raw message

drivers/net/mlx5/mlx5_flow_hw.c +128 -2

154 lines not on this page · raw message

Signature · 1 line
2.25.1
#6 lore raw

PATCH 6/7 net/mlx5: support modify IPv6 traffic class field

In reply to Michael Baum

Add HW steering support for IPv6 traffic class field modification. Copy from inner IPv6 traffic class field is also supported using "level=2".

---
 doc/guides/rel_notes/release_24_03.rst |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c        | 11 +++++++++++
 drivers/net/mlx5/mlx5_flow_hw.c        |  3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_24_03.rst +1 -0
index 10268b7879..272bc9d056 100644
@@ -100,6 +100,7 @@ New Features
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SPI`` flow action.
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SEQ_NUM`` flow action.
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_PROTO`` flow action.
+  * Added HW steering support for modify field ``RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS`` flow action.
 
 
 Removed Items
drivers/net/mlx5/mlx5_flow_dv.c +11 -0
index 8454d00d4f..90ef21d75b 100644
@@ -1394,6 +1394,7 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,
 		return 32;
 	case RTE_FLOW_FIELD_IPV6_DSCP:
 		return 6;
+	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_PROTO:
 		return 8;
@@ -1795,6 +1796,16 @@ mlx5_flow_field_id_to_modify_info
 		else
 			info[idx].offset = off_be;
 		break;
+	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
+		MLX5_ASSERT(data->offset + width <= 8);
+		off_be = 8 - (data->offset + width);
+		modi_id = CALC_MODI_ID(IPV6_TRAFFIC_CLASS, data->level);
+		info[idx] = (struct field_modify_info){1, 0, modi_id};
+		if (mask)
+			mask[idx] = flow_modify_info_mask_8(width, off_be);
+		else
+			info[idx].offset = off_be;
+		break;
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 		MLX5_ASSERT(data->offset + width <= 16);
 		off_be = 16 - (data->offset + width);
drivers/net/mlx5/mlx5_flow_hw.c +2 -1
index fc0f9dabb3..90e3cf2555 100644
@@ -2871,7 +2871,7 @@ flow_hw_modify_field_construct(struct mlx5_hw_q_job *job,
 		 * bits left. Shift the data left for IPV6 DSCP
 		 */
 		if (field->id == MLX5_MODI_OUT_IPV6_TRAFFIC_CLASS &&
-		    !(mask & MLX5_IPV6_HDR_ECN_MASK))
+		    mhdr_action->dst.field == RTE_FLOW_FIELD_IPV6_DSCP)
 			data <<= MLX5_IPV6_HDR_DSCP_SHIFT;
 		data = (data & mask) >> off_b;
 		job->mhdr_cmd[i++].data1 = rte_cpu_to_be_32(data);
@@ -5058,6 +5058,7 @@ flow_hw_validate_modify_field_level(const struct rte_flow_action_modify_data *da
 	case RTE_FLOW_FIELD_IPV4_TTL:
 	case RTE_FLOW_FIELD_IPV4_SRC:
 	case RTE_FLOW_FIELD_IPV4_DST:
+	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_SRC:
Signature · 1 line
2.25.1
#7 lore raw

PATCH 7/7 net/mlx5: support modify IPv6 flow label field

In reply to Michael Baum

Add HW steering support for IPv6 flow label field modification. Copy from inner IPv6 flow label field is also supported using "level=2".

---
 doc/guides/rel_notes/release_24_03.rst |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c        | 12 ++++++++++++
 drivers/net/mlx5/mlx5_flow_hw.c        |  1 +
 3 files changed, 14 insertions(+)
doc/guides/rel_notes/release_24_03.rst +1 -0
index 272bc9d056..4cb45ba439 100644
@@ -101,6 +101,7 @@ New Features
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SEQ_NUM`` flow action.
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_PROTO`` flow action.
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS`` flow action.
+  * Added HW steering support for modify field ``RTE_FLOW_FIELD_IPV6_FLOW_LABEL`` flow action.
 
 
 Removed Items
drivers/net/mlx5/mlx5_flow_dv.c +12 -0
index 90ef21d75b..418e0c0998 100644
@@ -1394,6 +1394,8 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,
 		return 32;
 	case RTE_FLOW_FIELD_IPV6_DSCP:
 		return 6;
+	case RTE_FLOW_FIELD_IPV6_FLOW_LABEL:
+		return 20;
 	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_PROTO:
@@ -1806,6 +1808,16 @@ mlx5_flow_field_id_to_modify_info
 		else
 			info[idx].offset = off_be;
 		break;
+	case RTE_FLOW_FIELD_IPV6_FLOW_LABEL:
+		MLX5_ASSERT(data->offset + width <= 20);
+		off_be = 20 - (data->offset + width);
+		modi_id = CALC_MODI_ID(IPV6_FLOW_LABEL, data->level);
+		info[idx] = (struct field_modify_info){4, 0, modi_id};
+		if (mask)
+			mask[idx] = flow_modify_info_mask_32(width, off_be);
+		else
+			info[idx].offset = off_be;
+		break;
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 		MLX5_ASSERT(data->offset + width <= 16);
 		off_be = 16 - (data->offset + width);
drivers/net/mlx5/mlx5_flow_hw.c +1 -0
index 90e3cf2555..90a06e7b44 100644
@@ -5059,6 +5059,7 @@ flow_hw_validate_modify_field_level(const struct rte_flow_action_modify_data *da
 	case RTE_FLOW_FIELD_IPV4_SRC:
 	case RTE_FLOW_FIELD_IPV4_DST:
 	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
+	case RTE_FLOW_FIELD_IPV6_FLOW_LABEL:
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_SRC:
Signature · 1 line
2.25.1
#8 lore raw

v2 cover net/mlx5: support copy from inner fields

In reply to Michael Baum

This patch-set adds support of encapsulation level for HWS modify field in MLX5 PMD.
Outermost is represented by 0,1 and inner is represented by 2. In addition, modify inner/outer us added for both IPv6 flow label and IPv6 traffic class.

Depends-on: series-31008 ("ethdev: add modify IPv4 next protocol field")
Depends-on: series-31010 ("ethdev: add IPv6 field identifiers")

v2:
- Rebase.
- Add "copy from inner" to release notes.

Michael Baum (7):
common/mlx5: remove enum value duplication common/mlx5: reorder modification field PRM list common/mlx5: add inner PRM fields common/mlx5: add IPv6 flow label PRM field net/mlx5: add support for modify inner fields net/mlx5: support modify IPv6 traffic class field net/mlx5: support modify IPv6 flow label field

 doc/guides/nics/mlx5.rst               |  28 ++++-
 doc/guides/rel_notes/release_24_03.rst |   4 +
 drivers/common/mlx5/mlx5_prm.h         |  49 +++++----
 drivers/net/mlx5/hws/mlx5dr_action.c   |   4 +-
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c  |   2 +-
 drivers/net/mlx5/mlx5_flow.c           |  12 ++-
 drivers/net/mlx5/mlx5_flow_dv.c        | 136 +++++++++++++++----------
 drivers/net/mlx5/mlx5_flow_hw.c        | 134 +++++++++++++++++++++++-
 8 files changed, 284 insertions(+), 85 deletions(-)
Signature · 1 line
2.25.1
#9 lore raw

PATCH v2 1/7 common/mlx5: remove enum value duplication

The "mlx5_modification_field" enumeration has 2 different fields representing the same value 0x4A.
1. "MLX5_MODI_OUT_IPV6_NEXT_HDR" - specific for IPv6.
2. "MLX5_MODI_OUT_IP_PROTOCOL" - for both IPv4 and IPv6.

This patch removes "MLX5_MODI_OUT_IPV6_NEXT_HDR" and replaces all its usages with "MLX5_MODI_OUT_IP_PROTOCOL".

---
 drivers/common/mlx5/mlx5_prm.h        | 1 -
 drivers/net/mlx5/hws/mlx5dr_action.c  | 4 ++--
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
drivers/common/mlx5/mlx5_prm.h +0 -1
index 0035a1e616..af16bf4cf6 100644
@@ -840,7 +840,6 @@ enum mlx5_modification_field {
 	MLX5_MODI_IN_MPLS_LABEL_3,
 	MLX5_MODI_IN_MPLS_LABEL_4,
 	MLX5_MODI_OUT_IP_PROTOCOL = 0x4A,
-	MLX5_MODI_OUT_IPV6_NEXT_HDR = 0x4A,
 	MLX5_MODI_META_REG_C_8 = 0x8F,
 	MLX5_MODI_META_REG_C_9 = 0x90,
 	MLX5_MODI_META_REG_C_10 = 0x91,
drivers/net/mlx5/hws/mlx5dr_action.c +2 -2
index 862ee3e332..2828a82d5b 100644
@@ -2287,7 +2287,7 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr3(struct mlx5dr_action *action)
 	MLX5_SET(copy_action_in, cmd, length, 8);
 	MLX5_SET(copy_action_in, cmd, src_offset, 24);
 	MLX5_SET(copy_action_in, cmd, src_field, mod_id);
-	MLX5_SET(copy_action_in, cmd, dst_field, MLX5_MODI_OUT_IPV6_NEXT_HDR);
+	MLX5_SET(copy_action_in, cmd, dst_field, MLX5_MODI_OUT_IP_PROTOCOL);
 
 	pattern.data = (__be64 *)cmd;
 	pattern.sz = sizeof(cmd);
@@ -2348,7 +2348,7 @@ mlx5dr_action_create_push_ipv6_route_ext_mhdr1(struct mlx5dr_action *action)
 	/* Set ipv6.protocol to IPPROTO_ROUTING */
 	MLX5_SET(set_action_in, cmd, action_type, MLX5_MODIFICATION_TYPE_SET);
 	MLX5_SET(set_action_in, cmd, length, 8);
-	MLX5_SET(set_action_in, cmd, field, MLX5_MODI_OUT_IPV6_NEXT_HDR);
+	MLX5_SET(set_action_in, cmd, field, MLX5_MODI_OUT_IP_PROTOCOL);
 	MLX5_SET(set_action_in, cmd, data, IPPROTO_ROUTING);
 
 	pattern.data = (__be64 *)cmd;
drivers/net/mlx5/hws/mlx5dr_pat_arg.c +1 -1
index a949844d24..513549ff3c 100644
@@ -67,7 +67,7 @@ bool mlx5dr_pat_require_reparse(__be64 *actions, uint16_t num_of_actions)
 
 		/* Below fields can change packet structure require a reparse */
 		if (field == MLX5_MODI_OUT_ETHERTYPE ||
-		    field == MLX5_MODI_OUT_IPV6_NEXT_HDR)
+		    field == MLX5_MODI_OUT_IP_PROTOCOL)
 			return true;
 	}
 
Signature · 1 line
2.25.1
#10 lore raw

PATCH v2 2/7 common/mlx5: reorder modification field PRM list

In reply to Michael Baum

Reorder modification field PRM list according to values from lowest to highest.
This patch also removes value specification from all fields which their value is one more than previous one.

---
 drivers/common/mlx5/mlx5_prm.h | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/common/mlx5/mlx5_prm.h +16 -16
index af16bf4cf6..b758557ef9 100644
@@ -816,6 +816,7 @@ enum mlx5_modification_field {
 	MLX5_MODI_OUT_IPV6_HOPLIMIT,
 	MLX5_MODI_IN_IPV6_HOPLIMIT,
 	MLX5_MODI_META_DATA_REG_A,
+	MLX5_MODI_OUT_IP_PROTOCOL,
 	MLX5_MODI_META_DATA_REG_B = 0x50,
 	MLX5_MODI_META_REG_C_0,
 	MLX5_MODI_META_REG_C_1,
@@ -829,32 +830,31 @@ enum mlx5_modification_field {
 	MLX5_MODI_IN_TCP_SEQ_NUM,
 	MLX5_MODI_OUT_TCP_ACK_NUM,
 	MLX5_MODI_IN_TCP_ACK_NUM = 0x5C,
+	MLX5_MODI_OUT_ESP_SPI = 0x5E,
 	MLX5_MODI_GTP_TEID = 0x6E,
 	MLX5_MODI_OUT_IP_ECN = 0x73,
 	MLX5_MODI_TUNNEL_HDR_DW_1 = 0x75,
-	MLX5_MODI_GTPU_FIRST_EXT_DW_0 = 0x76,
+	MLX5_MODI_GTPU_FIRST_EXT_DW_0,
 	MLX5_MODI_HASH_RESULT = 0x81,
+	MLX5_MODI_OUT_ESP_SEQ_NUM,
 	MLX5_MODI_IN_MPLS_LABEL_0 = 0x8a,
 	MLX5_MODI_IN_MPLS_LABEL_1,
 	MLX5_MODI_IN_MPLS_LABEL_2,
 	MLX5_MODI_IN_MPLS_LABEL_3,
 	MLX5_MODI_IN_MPLS_LABEL_4,
-	MLX5_MODI_OUT_IP_PROTOCOL = 0x4A,
-	MLX5_MODI_META_REG_C_8 = 0x8F,
-	MLX5_MODI_META_REG_C_9 = 0x90,
-	MLX5_MODI_META_REG_C_10 = 0x91,
-	MLX5_MODI_META_REG_C_11 = 0x92,
-	MLX5_MODI_META_REG_C_12 = 0x93,
-	MLX5_MODI_META_REG_C_13 = 0x94,
-	MLX5_MODI_META_REG_C_14 = 0x95,
-	MLX5_MODI_META_REG_C_15 = 0x96,
+	MLX5_MODI_META_REG_C_8,
+	MLX5_MODI_META_REG_C_9,
+	MLX5_MODI_META_REG_C_10,
+	MLX5_MODI_META_REG_C_11,
+	MLX5_MODI_META_REG_C_12,
+	MLX5_MODI_META_REG_C_13,
+	MLX5_MODI_META_REG_C_14,
+	MLX5_MODI_META_REG_C_15,
 	MLX5_MODI_OUT_IPV6_TRAFFIC_CLASS = 0x11C,
-	MLX5_MODI_OUT_IPV4_TOTAL_LEN = 0x11D,
-	MLX5_MODI_OUT_IPV6_PAYLOAD_LEN = 0x11E,
-	MLX5_MODI_OUT_IPV4_IHL = 0x11F,
-	MLX5_MODI_OUT_TCP_DATA_OFFSET = 0x120,
-	MLX5_MODI_OUT_ESP_SPI = 0x5E,
-	MLX5_MODI_OUT_ESP_SEQ_NUM = 0x82,
+	MLX5_MODI_OUT_IPV4_TOTAL_LEN,
+	MLX5_MODI_OUT_IPV6_PAYLOAD_LEN,
+	MLX5_MODI_OUT_IPV4_IHL,
+	MLX5_MODI_OUT_TCP_DATA_OFFSET,
 	MLX5_MODI_OUT_IPSEC_NEXT_HDR = 0x126,
 	MLX5_MODI_INVALID = INT_MAX,
 };
Signature · 1 line
2.25.1
#11 lore raw

PATCH v2 3/7 common/mlx5: add inner PRM fields

In reply to Michael Baum

This patch adds inner values into PRM modify field list for each existing outer field.

---
 drivers/common/mlx5/mlx5_prm.h | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/common/mlx5/mlx5_prm.h +11 -3
index b758557ef9..c6d409833a 100644
@@ -829,14 +829,17 @@ enum mlx5_modification_field {
 	MLX5_MODI_OUT_TCP_SEQ_NUM,
 	MLX5_MODI_IN_TCP_SEQ_NUM,
 	MLX5_MODI_OUT_TCP_ACK_NUM,
-	MLX5_MODI_IN_TCP_ACK_NUM = 0x5C,
+	MLX5_MODI_IN_TCP_ACK_NUM,
 	MLX5_MODI_OUT_ESP_SPI = 0x5E,
+	MLX5_MODI_IN_ESP_SPI,
 	MLX5_MODI_GTP_TEID = 0x6E,
 	MLX5_MODI_OUT_IP_ECN = 0x73,
-	MLX5_MODI_TUNNEL_HDR_DW_1 = 0x75,
+	MLX5_MODI_IN_IP_ECN,
+	MLX5_MODI_TUNNEL_HDR_DW_1,
 	MLX5_MODI_GTPU_FIRST_EXT_DW_0,
 	MLX5_MODI_HASH_RESULT = 0x81,
 	MLX5_MODI_OUT_ESP_SEQ_NUM,
+	MLX5_MODI_IN_ESP_SEQ_NUM,
 	MLX5_MODI_IN_MPLS_LABEL_0 = 0x8a,
 	MLX5_MODI_IN_MPLS_LABEL_1,
 	MLX5_MODI_IN_MPLS_LABEL_2,
@@ -855,7 +858,12 @@ enum mlx5_modification_field {
 	MLX5_MODI_OUT_IPV6_PAYLOAD_LEN,
 	MLX5_MODI_OUT_IPV4_IHL,
 	MLX5_MODI_OUT_TCP_DATA_OFFSET,
-	MLX5_MODI_OUT_IPSEC_NEXT_HDR = 0x126,
+	MLX5_MODI_IN_IPV6_TRAFFIC_CLASS,
+	MLX5_MODI_IN_IPV4_TOTAL_LEN,
+	MLX5_MODI_IN_IPV6_PAYLOAD_LEN,
+	MLX5_MODI_IN_IPV4_IHL,
+	MLX5_MODI_IN_TCP_DATA_OFFSET,
+	MLX5_MODI_OUT_IPSEC_NEXT_HDR,
 	MLX5_MODI_INVALID = INT_MAX,
 };
 
Signature · 1 line
2.25.1
#12 lore raw

PATCH v2 4/7 common/mlx5: add IPv6 flow label PRM field

In reply to Michael Baum

Add IPv6 flow label field into PRM modify field list. The new values are "MLX5_MODI_OUT_IPV6_FLOW_LABEL" and "MLX5_MODI_IN_IPV6_FLOW_LABEL".

---
 drivers/common/mlx5/mlx5_prm.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/common/mlx5/mlx5_prm.h +2 -0
index c6d409833a..59d885e43b 100644
@@ -864,6 +864,8 @@ enum mlx5_modification_field {
 	MLX5_MODI_IN_IPV4_IHL,
 	MLX5_MODI_IN_TCP_DATA_OFFSET,
 	MLX5_MODI_OUT_IPSEC_NEXT_HDR,
+	MLX5_MODI_OUT_IPV6_FLOW_LABEL,
+	MLX5_MODI_IN_IPV6_FLOW_LABEL,
 	MLX5_MODI_INVALID = INT_MAX,
 };
 
Signature · 1 line
2.25.1
#13 lore raw

PATCH v2 5/7 net/mlx5: add support for modify inner fields

In reply to Michael Baum

This patch adds support for copying from inner fields using "level" 2.

---
 doc/guides/nics/mlx5.rst               |  28 +++++-
 doc/guides/rel_notes/release_24_03.rst |   2 +
 drivers/net/mlx5/mlx5_flow.c           |  12 ++-
 drivers/net/mlx5/mlx5_flow_dv.c        | 113 +++++++++++----------
 drivers/net/mlx5/mlx5_flow_hw.c        | 130 ++++++++++++++++++++++++-
 5 files changed, 224 insertions(+), 61 deletions(-)
doc/guides/nics/mlx5.rst +27 -1
index fa013b03bb..5439e8fd7d 100644
@@ -595,7 +595,6 @@ Limitations
     Only DWs configured in :ref:`parser creation <geneve_parser_api>` can be modified,
     'type' and 'class' fields can be modified when ``match_on_class_mode=2``.
   - Modification of GENEVE TLV option data supports one DW per action.
-  - Encapsulation levels are not supported, can modify outermost header fields only.
   - Offsets cannot skip past the boundary of a field.
   - If the field type is ``RTE_FLOW_FIELD_MAC_TYPE``
     and packet contains one or more VLAN headers,
@@ -609,6 +608,33 @@ Limitations
   - For flow metadata fields (e.g. META or TAG)
     offset specifies the number of bits to skip from field's start,
     starting from LSB in the least significant byte, in the host order.
+  - Modification of the MPLS header is supported with some limitations:
+
+    - Only in HW steering.
+    - Only in ``src`` field.
+    - Only for outermost tunnel header (``level=2``).
+      For ``RTE_FLOW_FIELD_MPLS``,
+      the default encapsulation level ``0`` describes the outermost tunnel header.
+
+      .. note::
+
+         the default encapsulation level ``0`` describes the "outermost that match is supported",
+         currently it is first tunnel, but it can be changed to outer when it is supported.
+
+  - Default encapsulation level ``0`` describes outermost.
+  - Encapsulation level ``1`` is supported.
+  - Encapsulation level ``2`` is supported with some limitations:
+
+    - Only in HW steering.
+    - Only in ``src`` field.
+    - ``RTE_FLOW_FIELD_VLAN_ID`` is not supported.
+    - ``RTE_FLOW_FIELD_IPV4_PROTO`` is not supported.
+    - ``RTE_FLOW_FIELD_IPV6_PROTO/DSCP/ECN`` are not supported.
+    - ``RTE_FLOW_FIELD_ESP_PROTO/SPI/SEQ_NUM`` are not supported.
+    - ``RTE_FLOW_FIELD_TCP_SEQ/ACK_NUM`` are not supported.
+    - Second tunnel fields are not supported.
+
+  - Encapsulation levels greater than ``2`` are not supported.
 
 - Age action:
 
doc/guides/rel_notes/release_24_03.rst +2 -0
index f548eacc5e..a504aebe15 100644
@@ -92,6 +92,8 @@ New Features
 
   * Added support for accumulating from src field to dst field.
 
+  * Added support for copy inner fields in HW Steering flow engine.
+
   * Added support for VXLAN-GPE flags/rsvd0/rsvd fields matching in DV flow
     engine (``dv_flow_en`` = 1).
 
drivers/net/mlx5/mlx5_flow.c +8 -4
index 40376c99ba..b8cb385564 100644
@@ -2507,10 +2507,14 @@ flow_validate_modify_field_level(const struct rte_flow_field_data *data,
 	if (data->level == 0)
 		return 0;
 	if (data->field != RTE_FLOW_FIELD_TAG &&
-	    data->field != (enum rte_flow_field_id)MLX5_RTE_FLOW_FIELD_META_REG)
-		return rte_flow_error_set(error, ENOTSUP,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "inner header fields modification is not supported");
+	    data->field != (enum rte_flow_field_id)MLX5_RTE_FLOW_FIELD_META_REG) {
+		if (data->level > 1)
+			return rte_flow_error_set(error, ENOTSUP,
+						  RTE_FLOW_ERROR_TYPE_ACTION,
+						  NULL,
+						  "inner header fields modification is not supported");
+		return 0;
+	}
 	if (data->tag_index != 0)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
drivers/net/mlx5/mlx5_flow_dv.c +59 -54

275 lines not on this page · raw message

drivers/net/mlx5/mlx5_flow_hw.c +128 -2

154 lines not on this page · raw message

Signature · 1 line
2.25.1
#14 lore raw

PATCH v2 6/7 net/mlx5: support modify IPv6 traffic class field

In reply to Michael Baum

Add HW steering support for IPv6 traffic class field modification. Copy from inner IPv6 traffic class field is also supported using "level=2".

---
 doc/guides/rel_notes/release_24_03.rst |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c        | 11 +++++++++++
 drivers/net/mlx5/mlx5_flow_hw.c        |  3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_24_03.rst +1 -0
index a504aebe15..50ba66daac 100644
@@ -113,6 +113,7 @@ New Features
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SPI`` flow action.
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SEQ_NUM`` flow action.
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_PROTO`` flow action.
+  * Added HW steering support for modify field ``RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS`` flow action.
 
 
 Removed Items
drivers/net/mlx5/mlx5_flow_dv.c +11 -0
index 46f9f59e67..7d92c1cc24 100644
@@ -1394,6 +1394,7 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,
 		return 32;
 	case RTE_FLOW_FIELD_IPV6_DSCP:
 		return 6;
+	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_PROTO:
 		return 8;
@@ -1795,6 +1796,16 @@ mlx5_flow_field_id_to_modify_info
 		else
 			info[idx].offset = off_be;
 		break;
+	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
+		MLX5_ASSERT(data->offset + width <= 8);
+		off_be = 8 - (data->offset + width);
+		modi_id = CALC_MODI_ID(IPV6_TRAFFIC_CLASS, data->level);
+		info[idx] = (struct field_modify_info){1, 0, modi_id};
+		if (mask)
+			mask[idx] = flow_modify_info_mask_8(width, off_be);
+		else
+			info[idx].offset = off_be;
+		break;
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 		MLX5_ASSERT(data->offset + width <= 16);
 		off_be = 16 - (data->offset + width);
drivers/net/mlx5/mlx5_flow_hw.c +2 -1
index 7a1821f457..a41b46e18f 100644
@@ -2874,7 +2874,7 @@ flow_hw_modify_field_construct(struct mlx5_hw_q_job *job,
 		 * bits left. Shift the data left for IPV6 DSCP
 		 */
 		if (field->id == MLX5_MODI_OUT_IPV6_TRAFFIC_CLASS &&
-		    !(mask & MLX5_IPV6_HDR_ECN_MASK))
+		    mhdr_action->dst.field == RTE_FLOW_FIELD_IPV6_DSCP)
 			data <<= MLX5_IPV6_HDR_DSCP_SHIFT;
 		data = (data & mask) >> off_b;
 		job->mhdr_cmd[i++].data1 = rte_cpu_to_be_32(data);
@@ -5063,6 +5063,7 @@ flow_hw_validate_modify_field_level(const struct rte_flow_field_data *data,
 	case RTE_FLOW_FIELD_IPV4_TTL:
 	case RTE_FLOW_FIELD_IPV4_SRC:
 	case RTE_FLOW_FIELD_IPV4_DST:
+	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_SRC:
Signature · 1 line
2.25.1
#15 lore raw

PATCH v2 7/7 net/mlx5: support modify IPv6 flow label field

In reply to Michael Baum

Add HW steering support for IPv6 flow label field modification. Copy from inner IPv6 flow label field is also supported using "level=2".

---
 doc/guides/rel_notes/release_24_03.rst |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c        | 12 ++++++++++++
 drivers/net/mlx5/mlx5_flow_hw.c        |  1 +
 3 files changed, 14 insertions(+)
doc/guides/rel_notes/release_24_03.rst +1 -0
index 50ba66daac..267851f920 100644
@@ -114,6 +114,7 @@ New Features
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_SEQ_NUM`` flow action.
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_ESP_PROTO`` flow action.
   * Added HW steering support for modify field ``RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS`` flow action.
+  * Added HW steering support for modify field ``RTE_FLOW_FIELD_IPV6_FLOW_LABEL`` flow action.
 
 
 Removed Items
drivers/net/mlx5/mlx5_flow_dv.c +12 -0
index 7d92c1cc24..bf5cd37f2f 100644
@@ -1394,6 +1394,8 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,
 		return 32;
 	case RTE_FLOW_FIELD_IPV6_DSCP:
 		return 6;
+	case RTE_FLOW_FIELD_IPV6_FLOW_LABEL:
+		return 20;
 	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_PROTO:
@@ -1806,6 +1808,16 @@ mlx5_flow_field_id_to_modify_info
 		else
 			info[idx].offset = off_be;
 		break;
+	case RTE_FLOW_FIELD_IPV6_FLOW_LABEL:
+		MLX5_ASSERT(data->offset + width <= 20);
+		off_be = 20 - (data->offset + width);
+		modi_id = CALC_MODI_ID(IPV6_FLOW_LABEL, data->level);
+		info[idx] = (struct field_modify_info){4, 0, modi_id};
+		if (mask)
+			mask[idx] = flow_modify_info_mask_32(width, off_be);
+		else
+			info[idx].offset = off_be;
+		break;
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 		MLX5_ASSERT(data->offset + width <= 16);
 		off_be = 16 - (data->offset + width);
drivers/net/mlx5/mlx5_flow_hw.c +1 -0
index a41b46e18f..1d003c9389 100644
@@ -5064,6 +5064,7 @@ flow_hw_validate_modify_field_level(const struct rte_flow_field_data *data,
 	case RTE_FLOW_FIELD_IPV4_SRC:
 	case RTE_FLOW_FIELD_IPV4_DST:
 	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
+	case RTE_FLOW_FIELD_IPV6_FLOW_LABEL:
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_SRC:
Signature · 1 line
2.25.1
#16 lore raw
In reply to Michael Baum
Quoted 42 lines

-----Original Message-----
From: Michael Baum <[email protected]>
Sent: Wednesday, February 7, 2024 16:55
To: [email protected]
Cc: Matan Azrad <[email protected]>; Dariusz Sosnowski <[email protected]>; Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>
Subject: [PATCH v2 0/7] net/mlx5: support copy from inner fields

This patch-set adds support of encapsulation level for HWS modify field in MLX5 PMD.
Outermost is represented by 0,1 and inner is represented by 2.
In addition, modify inner/outer us added for both IPv6 flow label and IPv6 traffic class.

Depends-on: series-31008 ("ethdev: add modify IPv4 next protocol field")
Depends-on: series-31010 ("ethdev: add IPv6 field identifiers")

v2:
- Rebase.
- Add "copy from inner" to release notes.

Michael Baum (7):
common/mlx5: remove enum value duplication common/mlx5: reorder modification field PRM list common/mlx5: add inner PRM fields common/mlx5: add IPv6 flow label PRM field net/mlx5: add support for modify inner fields net/mlx5: support modify IPv6 traffic class field net/mlx5: support modify IPv6 flow label field

 doc/guides/nics/mlx5.rst               |  28 ++++-
 doc/guides/rel_notes/release_24_03.rst |   4 +
 drivers/common/mlx5/mlx5_prm.h         |  49 +++++----
 drivers/net/mlx5/hws/mlx5dr_action.c   |   4 +-
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c  |   2 +-
 drivers/net/mlx5/mlx5_flow.c           |  12 ++-
 drivers/net/mlx5/mlx5_flow_dv.c        | 136 +++++++++++++++----------
 drivers/net/mlx5/mlx5_flow_hw.c        | 134 +++++++++++++++++++++++-
 8 files changed, 284 insertions(+), 85 deletions(-)
Quoted 2 lines

--
2.25.1

Best regards,
Dariusz Sosnowski

#17 lore raw

v3 cover net/mlx5: support copy from inner fields

In reply to Michael Baum

This patch-set adds support of encapsulation level for HWS modify field in MLX5 PMD.
Outermost is represented by 0,1 and inner is represented by 2. In addition, modify inner/outer us added for both IPv6 flow label and IPv6 traffic class.

v2:
- Rebase.
- Add "copy from inner" to release notes.

v3:
- Rebase.
- Add "Acked-by" from v2.
- Remove the "Depends-on" labels.

Michael Baum (7):
common/mlx5: remove enum value duplication common/mlx5: reorder modification field PRM list common/mlx5: add inner PRM fields common/mlx5: add IPv6 flow label PRM field net/mlx5: add support for modify inner fields net/mlx5: support modify IPv6 traffic class field net/mlx5: support modify IPv6 flow label field

 doc/guides/nics/mlx5.rst               |  28 ++++-
 doc/guides/rel_notes/release_24_03.rst |   3 +
 drivers/common/mlx5/mlx5_prm.h         |  49 +++++----
 drivers/net/mlx5/hws/mlx5dr_action.c   |   4 +-
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c  |   2 +-
 drivers/net/mlx5/mlx5_flow.c           |  12 ++-
 drivers/net/mlx5/mlx5_flow_dv.c        | 136 +++++++++++++++----------
 drivers/net/mlx5/mlx5_flow_hw.c        | 134 +++++++++++++++++++++++-
 8 files changed, 283 insertions(+), 85 deletions(-)
Signature · 1 line
2.25.1
#18 lore raw

PATCH v3 1/7 common/mlx5: remove enum value duplication

The "mlx5_modification_field" enumeration has 2 different fields representing the same value 0x4A.
1. "MLX5_MODI_OUT_IPV6_NEXT_HDR" - specific for IPv6.
2. "MLX5_MODI_OUT_IP_PROTOCOL" - for both IPv4 and IPv6.

This patch removes "MLX5_MODI_OUT_IPV6_NEXT_HDR" and replaces all its usages with "MLX5_MODI_OUT_IP_PROTOCOL".

---
 drivers/common/mlx5/mlx5_prm.h        | 1 -
 drivers/net/mlx5/hws/mlx5dr_action.c  | 4 ++--
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
drivers/common/mlx5/mlx5_prm.h +0 -1
index 282e59e52c..6a8cb7a8aa 100644
@@ -840,7 +840,6 @@ enum mlx5_modification_field {
 	MLX5_MODI_IN_MPLS_LABEL_3,
 	MLX5_MODI_IN_MPLS_LABEL_4,
 	MLX5_MODI_OUT_IP_PROTOCOL = 0x4A,
-	MLX5_MODI_OUT_IPV6_NEXT_HDR = 0x4A,
 	MLX5_MODI_META_REG_C_8 = 0x8F,
 	MLX5_MODI_META_REG_C_9 = 0x90,
 	MLX5_MODI_META_REG_C_10 = 0x91,
drivers/net/mlx5/hws/mlx5dr_action.c +2 -2
index f55069c675..631763dee0 100644
@@ -2291,7 +2291,7 @@ mlx5dr_action_create_pop_ipv6_route_ext_mhdr3(struct mlx5dr_action *action)
 	MLX5_SET(copy_action_in, cmd, length, 8);
 	MLX5_SET(copy_action_in, cmd, src_offset, 24);
 	MLX5_SET(copy_action_in, cmd, src_field, mod_id);
-	MLX5_SET(copy_action_in, cmd, dst_field, MLX5_MODI_OUT_IPV6_NEXT_HDR);
+	MLX5_SET(copy_action_in, cmd, dst_field, MLX5_MODI_OUT_IP_PROTOCOL);
 
 	pattern.data = (__be64 *)cmd;
 	pattern.sz = sizeof(cmd);
@@ -2352,7 +2352,7 @@ mlx5dr_action_create_push_ipv6_route_ext_mhdr1(struct mlx5dr_action *action)
 	/* Set ipv6.protocol to IPPROTO_ROUTING */
 	MLX5_SET(set_action_in, cmd, action_type, MLX5_MODIFICATION_TYPE_SET);
 	MLX5_SET(set_action_in, cmd, length, 8);
-	MLX5_SET(set_action_in, cmd, field, MLX5_MODI_OUT_IPV6_NEXT_HDR);
+	MLX5_SET(set_action_in, cmd, field, MLX5_MODI_OUT_IP_PROTOCOL);
 	MLX5_SET(set_action_in, cmd, data, IPPROTO_ROUTING);
 
 	pattern.data = (__be64 *)cmd;
drivers/net/mlx5/hws/mlx5dr_pat_arg.c +1 -1
index a949844d24..513549ff3c 100644
@@ -67,7 +67,7 @@ bool mlx5dr_pat_require_reparse(__be64 *actions, uint16_t num_of_actions)
 
 		/* Below fields can change packet structure require a reparse */
 		if (field == MLX5_MODI_OUT_ETHERTYPE ||
-		    field == MLX5_MODI_OUT_IPV6_NEXT_HDR)
+		    field == MLX5_MODI_OUT_IP_PROTOCOL)
 			return true;
 	}
 
Signature · 1 line
2.25.1
#19 lore raw

PATCH v3 2/7 common/mlx5: reorder modification field PRM list

In reply to Michael Baum

Reorder modification field PRM list according to values from lowest to highest.
This patch also removes value specification from all fields which their value is one more than previous one.

---
 drivers/common/mlx5/mlx5_prm.h | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/common/mlx5/mlx5_prm.h +16 -16
index 6a8cb7a8aa..6967acbdc3 100644
@@ -816,6 +816,7 @@ enum mlx5_modification_field {
 	MLX5_MODI_OUT_IPV6_HOPLIMIT,
 	MLX5_MODI_IN_IPV6_HOPLIMIT,
 	MLX5_MODI_META_DATA_REG_A,
+	MLX5_MODI_OUT_IP_PROTOCOL,
 	MLX5_MODI_META_DATA_REG_B = 0x50,
 	MLX5_MODI_META_REG_C_0,
 	MLX5_MODI_META_REG_C_1,
@@ -829,32 +830,31 @@ enum mlx5_modification_field {
 	MLX5_MODI_IN_TCP_SEQ_NUM,
 	MLX5_MODI_OUT_TCP_ACK_NUM,
 	MLX5_MODI_IN_TCP_ACK_NUM = 0x5C,
+	MLX5_MODI_OUT_ESP_SPI = 0x5E,
 	MLX5_MODI_GTP_TEID = 0x6E,
 	MLX5_MODI_OUT_IP_ECN = 0x73,
 	MLX5_MODI_TUNNEL_HDR_DW_1 = 0x75,
-	MLX5_MODI_GTPU_FIRST_EXT_DW_0 = 0x76,
+	MLX5_MODI_GTPU_FIRST_EXT_DW_0,
 	MLX5_MODI_HASH_RESULT = 0x81,
+	MLX5_MODI_OUT_ESP_SEQ_NUM,
 	MLX5_MODI_IN_MPLS_LABEL_0 = 0x8a,
 	MLX5_MODI_IN_MPLS_LABEL_1,
 	MLX5_MODI_IN_MPLS_LABEL_2,
 	MLX5_MODI_IN_MPLS_LABEL_3,
 	MLX5_MODI_IN_MPLS_LABEL_4,
-	MLX5_MODI_OUT_IP_PROTOCOL = 0x4A,
-	MLX5_MODI_META_REG_C_8 = 0x8F,
-	MLX5_MODI_META_REG_C_9 = 0x90,
-	MLX5_MODI_META_REG_C_10 = 0x91,
-	MLX5_MODI_META_REG_C_11 = 0x92,
-	MLX5_MODI_META_REG_C_12 = 0x93,
-	MLX5_MODI_META_REG_C_13 = 0x94,
-	MLX5_MODI_META_REG_C_14 = 0x95,
-	MLX5_MODI_META_REG_C_15 = 0x96,
+	MLX5_MODI_META_REG_C_8,
+	MLX5_MODI_META_REG_C_9,
+	MLX5_MODI_META_REG_C_10,
+	MLX5_MODI_META_REG_C_11,
+	MLX5_MODI_META_REG_C_12,
+	MLX5_MODI_META_REG_C_13,
+	MLX5_MODI_META_REG_C_14,
+	MLX5_MODI_META_REG_C_15,
 	MLX5_MODI_OUT_IPV6_TRAFFIC_CLASS = 0x11C,
-	MLX5_MODI_OUT_IPV4_TOTAL_LEN = 0x11D,
-	MLX5_MODI_OUT_IPV6_PAYLOAD_LEN = 0x11E,
-	MLX5_MODI_OUT_IPV4_IHL = 0x11F,
-	MLX5_MODI_OUT_TCP_DATA_OFFSET = 0x120,
-	MLX5_MODI_OUT_ESP_SPI = 0x5E,
-	MLX5_MODI_OUT_ESP_SEQ_NUM = 0x82,
+	MLX5_MODI_OUT_IPV4_TOTAL_LEN,
+	MLX5_MODI_OUT_IPV6_PAYLOAD_LEN,
+	MLX5_MODI_OUT_IPV4_IHL,
+	MLX5_MODI_OUT_TCP_DATA_OFFSET,
 	MLX5_MODI_OUT_IPSEC_NEXT_HDR = 0x126,
 	MLX5_MODI_INVALID = INT_MAX,
 };
Signature · 1 line
2.25.1
#20 lore raw

PATCH v3 3/7 common/mlx5: add inner PRM fields

In reply to Michael Baum

This patch adds inner values into PRM modify field list for each existing outer field.

---
 drivers/common/mlx5/mlx5_prm.h | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/common/mlx5/mlx5_prm.h +11 -3
index 6967acbdc3..6124af1857 100644
@@ -829,14 +829,17 @@ enum mlx5_modification_field {
 	MLX5_MODI_OUT_TCP_SEQ_NUM,
 	MLX5_MODI_IN_TCP_SEQ_NUM,
 	MLX5_MODI_OUT_TCP_ACK_NUM,
-	MLX5_MODI_IN_TCP_ACK_NUM = 0x5C,
+	MLX5_MODI_IN_TCP_ACK_NUM,
 	MLX5_MODI_OUT_ESP_SPI = 0x5E,
+	MLX5_MODI_IN_ESP_SPI,
 	MLX5_MODI_GTP_TEID = 0x6E,
 	MLX5_MODI_OUT_IP_ECN = 0x73,
-	MLX5_MODI_TUNNEL_HDR_DW_1 = 0x75,
+	MLX5_MODI_IN_IP_ECN,
+	MLX5_MODI_TUNNEL_HDR_DW_1,
 	MLX5_MODI_GTPU_FIRST_EXT_DW_0,
 	MLX5_MODI_HASH_RESULT = 0x81,
 	MLX5_MODI_OUT_ESP_SEQ_NUM,
+	MLX5_MODI_IN_ESP_SEQ_NUM,
 	MLX5_MODI_IN_MPLS_LABEL_0 = 0x8a,
 	MLX5_MODI_IN_MPLS_LABEL_1,
 	MLX5_MODI_IN_MPLS_LABEL_2,
@@ -855,7 +858,12 @@ enum mlx5_modification_field {
 	MLX5_MODI_OUT_IPV6_PAYLOAD_LEN,
 	MLX5_MODI_OUT_IPV4_IHL,
 	MLX5_MODI_OUT_TCP_DATA_OFFSET,
-	MLX5_MODI_OUT_IPSEC_NEXT_HDR = 0x126,
+	MLX5_MODI_IN_IPV6_TRAFFIC_CLASS,
+	MLX5_MODI_IN_IPV4_TOTAL_LEN,
+	MLX5_MODI_IN_IPV6_PAYLOAD_LEN,
+	MLX5_MODI_IN_IPV4_IHL,
+	MLX5_MODI_IN_TCP_DATA_OFFSET,
+	MLX5_MODI_OUT_IPSEC_NEXT_HDR,
 	MLX5_MODI_INVALID = INT_MAX,
 };
 
Signature · 1 line
2.25.1
#21 lore raw

PATCH v3 4/7 common/mlx5: add IPv6 flow label PRM field

In reply to Michael Baum

Add IPv6 flow label field into PRM modify field list. The new values are "MLX5_MODI_OUT_IPV6_FLOW_LABEL" and "MLX5_MODI_IN_IPV6_FLOW_LABEL".

---
 drivers/common/mlx5/mlx5_prm.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/common/mlx5/mlx5_prm.h +2 -0
index 6124af1857..92309d453b 100644
@@ -864,6 +864,8 @@ enum mlx5_modification_field {
 	MLX5_MODI_IN_IPV4_IHL,
 	MLX5_MODI_IN_TCP_DATA_OFFSET,
 	MLX5_MODI_OUT_IPSEC_NEXT_HDR,
+	MLX5_MODI_OUT_IPV6_FLOW_LABEL,
+	MLX5_MODI_IN_IPV6_FLOW_LABEL,
 	MLX5_MODI_INVALID = INT_MAX,
 };
 
Signature · 1 line
2.25.1
#22 lore raw

PATCH v3 5/7 net/mlx5: add support for modify inner fields

In reply to Michael Baum

This patch adds support for copying from inner fields using "level" 2.

---
 doc/guides/nics/mlx5.rst               |  28 +++++-
 doc/guides/rel_notes/release_24_03.rst |   1 +
 drivers/net/mlx5/mlx5_flow.c           |  12 ++-
 drivers/net/mlx5/mlx5_flow_dv.c        | 113 +++++++++++----------
 drivers/net/mlx5/mlx5_flow_hw.c        | 130 ++++++++++++++++++++++++-
 5 files changed, 223 insertions(+), 61 deletions(-)
doc/guides/nics/mlx5.rst +27 -1
index 0d2213497a..dcf58c0a34 100644
@@ -639,7 +639,6 @@ Limitations
     Only DWs configured in :ref:`parser creation <geneve_parser_api>` can be modified,
     'type' and 'class' fields can be modified when ``match_on_class_mode=2``.
   - Modification of GENEVE TLV option data supports one DW per action.
-  - Encapsulation levels are not supported, can modify outermost header fields only.
   - Offsets cannot skip past the boundary of a field.
   - If the field type is ``RTE_FLOW_FIELD_MAC_TYPE``
     and packet contains one or more VLAN headers,
@@ -653,6 +652,33 @@ Limitations
   - For flow metadata fields (e.g. META or TAG)
     offset specifies the number of bits to skip from field's start,
     starting from LSB in the least significant byte, in the host order.
+  - Modification of the MPLS header is supported with some limitations:
+
+    - Only in HW steering.
+    - Only in ``src`` field.
+    - Only for outermost tunnel header (``level=2``).
+      For ``RTE_FLOW_FIELD_MPLS``,
+      the default encapsulation level ``0`` describes the outermost tunnel header.
+
+      .. note::
+
+         the default encapsulation level ``0`` describes the "outermost that match is supported",
+         currently it is first tunnel, but it can be changed to outer when it is supported.
+
+  - Default encapsulation level ``0`` describes outermost.
+  - Encapsulation level ``1`` is supported.
+  - Encapsulation level ``2`` is supported with some limitations:
+
+    - Only in HW steering.
+    - Only in ``src`` field.
+    - ``RTE_FLOW_FIELD_VLAN_ID`` is not supported.
+    - ``RTE_FLOW_FIELD_IPV4_PROTO`` is not supported.
+    - ``RTE_FLOW_FIELD_IPV6_PROTO/DSCP/ECN`` are not supported.
+    - ``RTE_FLOW_FIELD_ESP_PROTO/SPI/SEQ_NUM`` are not supported.
+    - ``RTE_FLOW_FIELD_TCP_SEQ/ACK_NUM`` are not supported.
+    - Second tunnel fields are not supported.
+
+  - Encapsulation levels greater than ``2`` are not supported.
 
 - Age action:
 
doc/guides/rel_notes/release_24_03.rst +1 -0
index 879bb4944c..0473858e19 100644
@@ -130,6 +130,7 @@ New Features
   * Added support for matching a random value.
   * Added support for comparing result between packet fields or value.
   * Added support for accumulating value of field into another one.
+  * Added support for copy inner fields in HWS flow engine.
 
 * **Updated Marvell cnxk crypto driver.**
 
drivers/net/mlx5/mlx5_flow.c +8 -4
index 2b2ae62618..3e179110a0 100644
@@ -2387,10 +2387,14 @@ flow_validate_modify_field_level(const struct rte_flow_field_data *data,
 	if (data->level == 0)
 		return 0;
 	if (data->field != RTE_FLOW_FIELD_TAG &&
-	    data->field != (enum rte_flow_field_id)MLX5_RTE_FLOW_FIELD_META_REG)
-		return rte_flow_error_set(error, ENOTSUP,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "inner header fields modification is not supported");
+	    data->field != (enum rte_flow_field_id)MLX5_RTE_FLOW_FIELD_META_REG) {
+		if (data->level > 1)
+			return rte_flow_error_set(error, ENOTSUP,
+						  RTE_FLOW_ERROR_TYPE_ACTION,
+						  NULL,
+						  "inner header fields modification is not supported");
+		return 0;
+	}
 	if (data->tag_index != 0)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
drivers/net/mlx5/mlx5_flow_dv.c +59 -54

275 lines not on this page · raw message

drivers/net/mlx5/mlx5_flow_hw.c +128 -2

154 lines not on this page · raw message

Signature · 1 line
2.25.1
#23 lore raw

PATCH v3 6/7 net/mlx5: support modify IPv6 traffic class field

In reply to Michael Baum

Add HW steering support for IPv6 traffic class field modification. Copy from inner IPv6 traffic class field is also supported using "level=2".

---
 doc/guides/rel_notes/release_24_03.rst |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c        | 11 +++++++++++
 drivers/net/mlx5/mlx5_flow_hw.c        |  3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_24_03.rst +1 -0
index 0473858e19..c2fc22ed66 100644
@@ -127,6 +127,7 @@ New Features
   * Added support for GENEVE matching and modifying in HWS flow engine.
   * Added support for modifying IPv4 proto field in HWS flow engine.
   * Added support for modifying IPsec ESP fields in HWS flow engine.
+  * Added support for modifying IPv6 traffic class field in HWS flow engine.
   * Added support for matching a random value.
   * Added support for comparing result between packet fields or value.
   * Added support for accumulating value of field into another one.
drivers/net/mlx5/mlx5_flow_dv.c +11 -0
index feda003c07..2c0c8e37f7 100644
@@ -1394,6 +1394,7 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,
 		return 32;
 	case RTE_FLOW_FIELD_IPV6_DSCP:
 		return 6;
+	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_PROTO:
 		return 8;
@@ -1795,6 +1796,16 @@ mlx5_flow_field_id_to_modify_info
 		else
 			info[idx].offset = off_be;
 		break;
+	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
+		MLX5_ASSERT(data->offset + width <= 8);
+		off_be = 8 - (data->offset + width);
+		modi_id = CALC_MODI_ID(IPV6_TRAFFIC_CLASS, data->level);
+		info[idx] = (struct field_modify_info){1, 0, modi_id};
+		if (mask)
+			mask[idx] = flow_modify_info_mask_8(width, off_be);
+		else
+			info[idx].offset = off_be;
+		break;
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 		MLX5_ASSERT(data->offset + width <= 16);
 		off_be = 16 - (data->offset + width);
drivers/net/mlx5/mlx5_flow_hw.c +2 -1
index fc1bcdd84e..9d4fdb06c1 100644
@@ -2878,7 +2878,7 @@ flow_hw_modify_field_construct(struct mlx5_hw_q_job *job,
 		 * bits left. Shift the data left for IPv6 DSCP
 		 */
 		if (field->id == MLX5_MODI_OUT_IPV6_TRAFFIC_CLASS &&
-		    !(mask & MLX5_IPV6_HDR_ECN_MASK))
+		    mhdr_action->dst.field == RTE_FLOW_FIELD_IPV6_DSCP)
 			data <<= MLX5_IPV6_HDR_DSCP_SHIFT;
 		data = (data & mask) >> off_b;
 		job->mhdr_cmd[i++].data1 = rte_cpu_to_be_32(data);
@@ -5067,6 +5067,7 @@ flow_hw_validate_modify_field_level(const struct rte_flow_field_data *data,
 	case RTE_FLOW_FIELD_IPV4_TTL:
 	case RTE_FLOW_FIELD_IPV4_SRC:
 	case RTE_FLOW_FIELD_IPV4_DST:
+	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_SRC:
Signature · 1 line
2.25.1
#24 lore raw

PATCH v3 7/7 net/mlx5: support modify IPv6 flow label field

In reply to Michael Baum

Add HW steering support for IPv6 flow label field modification. Copy from inner IPv6 flow label field is also supported using "level=2".

---
 doc/guides/rel_notes/release_24_03.rst |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c        | 12 ++++++++++++
 drivers/net/mlx5/mlx5_flow_hw.c        |  1 +
 3 files changed, 14 insertions(+)
doc/guides/rel_notes/release_24_03.rst +1 -0
index c2fc22ed66..ff9c6552e4 100644
@@ -128,6 +128,7 @@ New Features
   * Added support for modifying IPv4 proto field in HWS flow engine.
   * Added support for modifying IPsec ESP fields in HWS flow engine.
   * Added support for modifying IPv6 traffic class field in HWS flow engine.
+  * Added support for modifying IPv6 flow label field in HWS flow engine.
   * Added support for matching a random value.
   * Added support for comparing result between packet fields or value.
   * Added support for accumulating value of field into another one.
drivers/net/mlx5/mlx5_flow_dv.c +12 -0
index 2c0c8e37f7..75a8a223ab 100644
@@ -1394,6 +1394,8 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,
 		return 32;
 	case RTE_FLOW_FIELD_IPV6_DSCP:
 		return 6;
+	case RTE_FLOW_FIELD_IPV6_FLOW_LABEL:
+		return 20;
 	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_PROTO:
@@ -1806,6 +1808,16 @@ mlx5_flow_field_id_to_modify_info
 		else
 			info[idx].offset = off_be;
 		break;
+	case RTE_FLOW_FIELD_IPV6_FLOW_LABEL:
+		MLX5_ASSERT(data->offset + width <= 20);
+		off_be = 20 - (data->offset + width);
+		modi_id = CALC_MODI_ID(IPV6_FLOW_LABEL, data->level);
+		info[idx] = (struct field_modify_info){4, 0, modi_id};
+		if (mask)
+			mask[idx] = flow_modify_info_mask_32(width, off_be);
+		else
+			info[idx].offset = off_be;
+		break;
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 		MLX5_ASSERT(data->offset + width <= 16);
 		off_be = 16 - (data->offset + width);
drivers/net/mlx5/mlx5_flow_hw.c +1 -0
index 9d4fdb06c1..254273e0fb 100644
@@ -5068,6 +5068,7 @@ flow_hw_validate_modify_field_level(const struct rte_flow_field_data *data,
 	case RTE_FLOW_FIELD_IPV4_SRC:
 	case RTE_FLOW_FIELD_IPV4_DST:
 	case RTE_FLOW_FIELD_IPV6_TRAFFIC_CLASS:
+	case RTE_FLOW_FIELD_IPV6_FLOW_LABEL:
 	case RTE_FLOW_FIELD_IPV6_PAYLOAD_LEN:
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 	case RTE_FLOW_FIELD_IPV6_SRC:
Signature · 1 line
2.25.1
#25 lore raw
In reply to Michael Baum

Hi,

Quoted 44 lines

-----Original Message-----
From: Michael Baum <[email protected]>
Sent: Monday, February 26, 2024 3:46 PM
To: [email protected]
Cc: Matan Azrad <[email protected]>; Dariusz Sosnowski <[email protected]>; Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>
Subject: [PATCH v3 0/7] net/mlx5: support copy from inner fields

This patch-set adds support of encapsulation level for HWS modify field in MLX5 PMD.
Outermost is represented by 0,1 and inner is represented by 2. In addition, modify inner/outer us added for both IPv6 flow label and IPv6 traffic class.

v2:
- Rebase.
- Add "copy from inner" to release notes.

v3:
- Rebase.
- Add "Acked-by" from v2.
- Remove the "Depends-on" labels.

Michael Baum (7):
common/mlx5: remove enum value duplication common/mlx5: reorder modification field PRM list common/mlx5: add inner PRM fields common/mlx5: add IPv6 flow label PRM field net/mlx5: add support for modify inner fields net/mlx5: support modify IPv6 traffic class field net/mlx5: support modify IPv6 flow label field

 doc/guides/nics/mlx5.rst               |  28 ++++-
 doc/guides/rel_notes/release_24_03.rst |   3 +
 drivers/common/mlx5/mlx5_prm.h         |  49 +++++----
 drivers/net/mlx5/hws/mlx5dr_action.c   |   4 +-
 drivers/net/mlx5/hws/mlx5dr_pat_arg.c  |   2 +-
 drivers/net/mlx5/mlx5_flow.c           |  12 ++-
 drivers/net/mlx5/mlx5_flow_dv.c        | 136 +++++++++++++++----------
 drivers/net/mlx5/mlx5_flow_hw.c        | 134 +++++++++++++++++++++++-
 8 files changed, 283 insertions(+), 85 deletions(-)
Quoted 2 lines

--
2.25.1

Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh