DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/6] modify field action enhancements
@ 2021-03-24 15:04 Alexander Kozyrev
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 1/6] net/mlx5: check for a field size in modify field action Alexander Kozyrev
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Alexander Kozyrev @ 2021-03-24 15:04 UTC (permalink / raw)
  To: dev; +Cc: rasland, viacheslavo, matan, orika

Various fixes/improvements for RTE MODIFY_FIELD Flow Action.

v2: added the patch with rejection of VXLAN IDs modification

Alexander Kozyrev (6):
  net/mlx5: check for a field size in modify field action
  net/mlx5: adjust modify field action endianess
  net/mlx5: check extended metadata for mark modififcation
  net/mlx5: allow group 0 modify field action
  doc: add list of supported Field IDs to modify
  net/mlx5: reject VXLAN ID's modifications

 doc/guides/nics/mlx5.rst           |   1 +
 doc/guides/prog_guide/rte_flow.rst |  45 +++-
 drivers/net/mlx5/mlx5_flow_dv.c    | 325 +++++++++++++++--------------
 3 files changed, 212 insertions(+), 159 deletions(-)

-- 
2.24.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v2 1/6] net/mlx5: check for a field size in modify field action
  2021-03-24 15:04 [dpdk-dev] [PATCH v2 0/6] modify field action enhancements Alexander Kozyrev
@ 2021-03-24 15:04 ` Alexander Kozyrev
  2021-03-30  7:09   ` Slava Ovsiienko
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 2/6] net/mlx5: adjust modify field action endianess Alexander Kozyrev
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Alexander Kozyrev @ 2021-03-24 15:04 UTC (permalink / raw)
  To: dev; +Cc: rasland, viacheslavo, matan, orika, stable

Add a validation check to make sure that the specified width
for MODIFY_FIELD RTE action is not bigger than a field size.

Fixes: 641dbe4fb0 ("net/mlx5: support modify field flow action")
Cc: stable@dpdk.org

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 23e5849783..84e1bb6892 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -4608,9 +4608,22 @@ flow_dv_validate_action_modify_field(const uint64_t action_flags,
 	if (ret)
 		return ret;
 
+	if (action_modify_field->width == 0)
+		return rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ACTION,
+					NULL,
+					"no bits are requested to be modified");
+	else if (action_modify_field->width > dst_width ||
+		 action_modify_field->width > src_width)
+		return rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ACTION,
+					NULL,
+					"cannot modify more bits than"
+					" the width of a field");
 	if (action_modify_field->dst.field != RTE_FLOW_FIELD_VALUE &&
 	    action_modify_field->dst.field != RTE_FLOW_FIELD_POINTER) {
-		if (action_modify_field->dst.offset >= dst_width ||
+		if ((action_modify_field->dst.offset +
+		     action_modify_field->width > dst_width) ||
 		    (action_modify_field->dst.offset % 32))
 			return rte_flow_error_set(error, EINVAL,
 						RTE_FLOW_ERROR_TYPE_ACTION,
@@ -4626,7 +4639,8 @@ flow_dv_validate_action_modify_field(const uint64_t action_flags,
 	}
 	if (action_modify_field->src.field != RTE_FLOW_FIELD_VALUE &&
 	    action_modify_field->src.field != RTE_FLOW_FIELD_POINTER) {
-		if (action_modify_field->src.offset >= src_width ||
+		if ((action_modify_field->src.offset +
+		     action_modify_field->width > src_width) ||
 		    (action_modify_field->src.offset % 32))
 			return rte_flow_error_set(error, EINVAL,
 						RTE_FLOW_ERROR_TYPE_ACTION,
@@ -4640,11 +4654,6 @@ flow_dv_validate_action_modify_field(const uint64_t action_flags,
 						NULL,
 						"cannot copy from inner headers");
 	}
-	if (action_modify_field->width == 0)
-		return rte_flow_error_set(error, EINVAL,
-						RTE_FLOW_ERROR_TYPE_ACTION,
-						NULL,
-						"width is required for modify action");
 	if (action_modify_field->dst.field ==
 	    action_modify_field->src.field)
 		return rte_flow_error_set(error, EINVAL,
-- 
2.24.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v2 2/6] net/mlx5: adjust modify field action endianess
  2021-03-24 15:04 [dpdk-dev] [PATCH v2 0/6] modify field action enhancements Alexander Kozyrev
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 1/6] net/mlx5: check for a field size in modify field action Alexander Kozyrev
@ 2021-03-24 15:04 ` Alexander Kozyrev
  2021-03-30  7:09   ` Slava Ovsiienko
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 3/6] net/mlx5: check extended metadata for mark modififcation Alexander Kozyrev
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Alexander Kozyrev @ 2021-03-24 15:04 UTC (permalink / raw)
  To: dev; +Cc: rasland, viacheslavo, matan, orika, stable

Masks that used to modify a packet field must be in a big
endian format. Convert then to BE to ensure proper modification.

Fixes: 641dbe4fb0 ("net/mlx5: support modify field flow action")
Cc: stable@dpdk.org

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 241 ++++++++++++++------------------
 1 file changed, 103 insertions(+), 138 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 84e1bb6892..a1e4e2e5df 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1345,11 +1345,13 @@ mlx5_flow_field_id_to_modify_info
 			if (data->offset < 32) {
 				info[idx] = (struct field_modify_info){4, 0,
 						MLX5_MODI_OUT_DMAC_47_16};
-				mask[idx] = 0xffffffff;
 				if (width < 32) {
-					mask[idx] = mask[idx] << (32 - width);
+					mask[idx] =
+						rte_cpu_to_be_32(0xffffffff >>
+								 (32 - width));
 					width = 0;
 				} else {
+					mask[idx] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1358,10 +1360,8 @@ mlx5_flow_field_id_to_modify_info
 			}
 			info[idx] = (struct field_modify_info){2, 4 * idx,
 						MLX5_MODI_OUT_DMAC_15_0};
-			mask[idx] = (width) ? 0x0000ffff : 0x0;
-			if (width < 16)
-				mask[idx] = (mask[idx] << (16 - width)) &
-						0x0000ffff;
+			mask[idx] = rte_cpu_to_be_32(0x0000ffff >>
+						     (16 - width));
 		} else {
 			if (data->offset < 32)
 				info[idx++] = (struct field_modify_info){4, 0,
@@ -1375,11 +1375,13 @@ mlx5_flow_field_id_to_modify_info
 			if (data->offset < 32) {
 				info[idx] = (struct field_modify_info){4, 0,
 						MLX5_MODI_OUT_SMAC_47_16};
-				mask[idx] = 0xffffffff;
 				if (width < 32) {
-					mask[idx] = mask[idx] << (32 - width);
+					mask[idx] =
+						rte_cpu_to_be_32(0xffffffff >>
+								(32 - width));
 					width = 0;
 				} else {
+					mask[idx] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1388,10 +1390,8 @@ mlx5_flow_field_id_to_modify_info
 			}
 			info[idx] = (struct field_modify_info){2, 4 * idx,
 						MLX5_MODI_OUT_SMAC_15_0};
-			mask[idx] = (width) ? 0x0000ffff : 0x0;
-			if (width < 16)
-				mask[idx] = (mask[idx] << (16 - width)) &
-						0x0000ffff;
+			mask[idx] = rte_cpu_to_be_32(0x0000ffff >>
+						     (16 - width));
 		} else {
 			if (data->offset < 32)
 				info[idx++] = (struct field_modify_info){4, 0,
@@ -1406,91 +1406,71 @@ mlx5_flow_field_id_to_modify_info
 	case RTE_FLOW_FIELD_VLAN_ID:
 		info[idx] = (struct field_modify_info){2, 0,
 					MLX5_MODI_OUT_FIRST_VID};
-		if (mask) {
-			mask[idx] = 0x00000fff;
-			if (width < 12)
-				mask[idx] = (mask[idx] << (12 - width)) &
-						0x00000fff;
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0x00000fff >>
+						     (12 - width));
 		break;
 	case RTE_FLOW_FIELD_MAC_TYPE:
 		info[idx] = (struct field_modify_info){2, 0,
 					MLX5_MODI_OUT_ETHERTYPE};
-		if (mask) {
-			mask[idx] = 0x0000ffff;
-			if (width < 16)
-				mask[idx] = (mask[idx] << (16 - width)) &
-						0x0000ffff;
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0x0000ffff >>
+						     (16 - width));
 		break;
 	case RTE_FLOW_FIELD_IPV4_DSCP:
 		info[idx] = (struct field_modify_info){1, 0,
 					MLX5_MODI_OUT_IP_DSCP};
-		if (mask) {
-			mask[idx] = 0x0000003f;
-			if (width < 6)
-				mask[idx] = (mask[idx] << (6 - width)) &
-						0x0000003f;
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0x0000003f >>
+						     (6 - width));
 		break;
 	case RTE_FLOW_FIELD_IPV4_TTL:
 		info[idx] = (struct field_modify_info){1, 0,
 					MLX5_MODI_OUT_IPV4_TTL};
-		if (mask) {
-			mask[idx] = 0x000000ff;
-			if (width < 8)
-				mask[idx] = (mask[idx] << (8 - width)) &
-						0x000000ff;
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0x000000ff >>
+						     (8 - width));
 		break;
 	case RTE_FLOW_FIELD_IPV4_SRC:
 		info[idx] = (struct field_modify_info){4, 0,
 					MLX5_MODI_OUT_SIPV4};
-		if (mask) {
-			mask[idx] = 0xffffffff;
-			if (width < 32)
-				mask[idx] = mask[idx] << (32 - width);
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0xffffffff >>
+						     (32 - width));
 		break;
 	case RTE_FLOW_FIELD_IPV4_DST:
 		info[idx] = (struct field_modify_info){4, 0,
 					MLX5_MODI_OUT_DIPV4};
-		if (mask) {
-			mask[idx] = 0xffffffff;
-			if (width < 32)
-				mask[idx] = mask[idx] << (32 - width);
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0xffffffff >>
+						     (32 - width));
 		break;
 	case RTE_FLOW_FIELD_IPV6_DSCP:
 		info[idx] = (struct field_modify_info){1, 0,
 					MLX5_MODI_OUT_IP_DSCP};
-		if (mask) {
-			mask[idx] = 0x0000003f;
-			if (width < 6)
-				mask[idx] = (mask[idx] << (6 - width)) &
-						0x0000003f;
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0x0000003f >>
+						     (6 - width));
 		break;
 	case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
 		info[idx] = (struct field_modify_info){1, 0,
 					MLX5_MODI_OUT_IPV6_HOPLIMIT};
-		if (mask) {
-			mask[idx] = 0x000000ff;
-			if (width < 8)
-				mask[idx] = (mask[idx] << (8 - width)) &
-						0x000000ff;
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0x000000ff >>
+						     (8 - width));
 		break;
 	case RTE_FLOW_FIELD_IPV6_SRC:
 		if (mask) {
 			if (data->offset < 32) {
 				info[idx] = (struct field_modify_info){4, 0,
 						MLX5_MODI_OUT_SIPV6_127_96};
-				mask[idx] = 0xffffffff;
 				if (width < 32) {
-					mask[idx] = mask[idx] << (32 - width);
+					mask[idx] =
+						rte_cpu_to_be_32(0xffffffff >>
+								 (32 - width));
 					width = 0;
 				} else {
+					mask[idx] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1501,11 +1481,13 @@ mlx5_flow_field_id_to_modify_info
 				info[idx] = (struct field_modify_info){4,
 						4 * idx,
 						MLX5_MODI_OUT_SIPV6_95_64};
-				mask[idx] = 0xffffffff;
 				if (width < 32) {
-					mask[idx] = mask[idx] << (32 - width);
+					mask[idx] =
+						rte_cpu_to_be_32(0xffffffff >>
+								 (32 - width));
 					width = 0;
 				} else {
+					mask[idx] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1516,11 +1498,13 @@ mlx5_flow_field_id_to_modify_info
 				info[idx] = (struct field_modify_info){4,
 						8 * idx,
 						MLX5_MODI_OUT_SIPV6_63_32};
-				mask[idx] = 0xffffffff;
 				if (width < 32) {
-					mask[idx] = mask[idx] << (32 - width);
+					mask[idx] =
+						rte_cpu_to_be_32(0xffffffff >>
+								 (32 - width));
 					width = 0;
 				} else {
+					mask[idx] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1529,9 +1513,8 @@ mlx5_flow_field_id_to_modify_info
 			}
 			info[idx] = (struct field_modify_info){4, 12 * idx,
 						MLX5_MODI_OUT_SIPV6_31_0};
-			mask[idx] = 0xffffffff;
-			if (width < 32)
-				mask[idx] = mask[idx] << (32 - width);
+			mask[idx] = rte_cpu_to_be_32(0xffffffff >>
+						     (32 - width));
 		} else {
 			if (data->offset < 32)
 				info[idx++] = (struct field_modify_info){4, 0,
@@ -1552,11 +1535,13 @@ mlx5_flow_field_id_to_modify_info
 			if (data->offset < 32) {
 				info[idx] = (struct field_modify_info){4, 0,
 						MLX5_MODI_OUT_DIPV6_127_96};
-				mask[idx] = 0xffffffff;
 				if (width < 32) {
-					mask[idx] = mask[idx] << (32 - width);
+					mask[idx] =
+						rte_cpu_to_be_32(0xffffffff >>
+								 (32 - width));
 					width = 0;
 				} else {
+					mask[idx] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1567,11 +1552,13 @@ mlx5_flow_field_id_to_modify_info
 				info[idx] = (struct field_modify_info){4,
 						4 * idx,
 						MLX5_MODI_OUT_DIPV6_95_64};
-				mask[idx] = 0xffffffff;
 				if (width < 32) {
-					mask[idx] = mask[idx] << (32 - width);
+					mask[idx] =
+						rte_cpu_to_be_32(0xffffffff >>
+								 (32 - width));
 					width = 0;
 				} else {
+					mask[idx] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1582,11 +1569,13 @@ mlx5_flow_field_id_to_modify_info
 				info[idx] = (struct field_modify_info){4,
 						8 * idx,
 						MLX5_MODI_OUT_DIPV6_63_32};
-				mask[idx] = 0xffffffff;
 				if (width < 32) {
-					mask[idx] = mask[idx] << (32 - width);
+					mask[idx] =
+						rte_cpu_to_be_32(0xffffffff >>
+								 (32 - width));
 					width = 0;
 				} else {
+					mask[idx] = RTE_BE32(0xffffffff);
 					width -= 32;
 				}
 				if (!width)
@@ -1595,9 +1584,8 @@ mlx5_flow_field_id_to_modify_info
 			}
 			info[idx] = (struct field_modify_info){4, 12 * idx,
 						MLX5_MODI_OUT_DIPV6_31_0};
-			mask[idx] = 0xffffffff;
-			if (width < 32)
-				mask[idx] = mask[idx] << (32 - width);
+			mask[idx] = rte_cpu_to_be_32(0xffffffff >>
+						     (32 - width));
 		} else {
 			if (data->offset < 32)
 				info[idx++] = (struct field_modify_info){4, 0,
@@ -1616,70 +1604,51 @@ mlx5_flow_field_id_to_modify_info
 	case RTE_FLOW_FIELD_TCP_PORT_SRC:
 		info[idx] = (struct field_modify_info){2, 0,
 					MLX5_MODI_OUT_TCP_SPORT};
-		if (mask) {
-			mask[idx] = 0x0000ffff;
-			if (width < 16)
-				mask[idx] = (mask[idx] << (16 - width)) &
-						0x0000ffff;
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0x0000ffff >>
+						     (16 - width));
 		break;
 	case RTE_FLOW_FIELD_TCP_PORT_DST:
 		info[idx] = (struct field_modify_info){2, 0,
 					MLX5_MODI_OUT_TCP_DPORT};
-		if (mask) {
-			mask[idx] = 0x0000ffff;
-			if (width < 16)
-				mask[idx] = (mask[idx] << (16 - width)) &
-						0x0000ffff;
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0x0000ffff >>
+						     (16 - width));
 		break;
 	case RTE_FLOW_FIELD_TCP_SEQ_NUM:
 		info[idx] = (struct field_modify_info){4, 0,
 					MLX5_MODI_OUT_TCP_SEQ_NUM};
-		if (mask) {
-			mask[idx] = 0xffffffff;
-			if (width < 32)
-				mask[idx] = (mask[idx] << (32 - width));
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0xffffffff >>
+						     (32 - width));
 		break;
 	case RTE_FLOW_FIELD_TCP_ACK_NUM:
 		info[idx] = (struct field_modify_info){4, 0,
 					MLX5_MODI_OUT_TCP_ACK_NUM};
-		if (mask) {
-			mask[idx] = 0xffffffff;
-			if (width < 32)
-				mask[idx] = (mask[idx] << (32 - width));
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0xffffffff >>
+						     (32 - width));
 		break;
 	case RTE_FLOW_FIELD_TCP_FLAGS:
 		info[idx] = (struct field_modify_info){1, 0,
 					MLX5_MODI_OUT_TCP_FLAGS};
-		if (mask) {
-			mask[idx] = 0x0000003f;
-			if (width < 6)
-				mask[idx] = (mask[idx] << (6 - width)) &
-						0x0000003f;
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0x0000003f >>
+						     (6 - width));
 		break;
 	case RTE_FLOW_FIELD_UDP_PORT_SRC:
 		info[idx] = (struct field_modify_info){2, 0,
 					MLX5_MODI_OUT_UDP_SPORT};
-		if (mask) {
-			mask[idx] = 0x0000ffff;
-			if (width < 16)
-				mask[idx] = (mask[idx] << (16 - width)) &
-						0x0000ffff;
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0x0000ffff >>
+						     (16 - width));
 		break;
 	case RTE_FLOW_FIELD_UDP_PORT_DST:
 		info[idx] = (struct field_modify_info){2, 0,
 					MLX5_MODI_OUT_UDP_DPORT};
-		if (mask) {
-			mask[idx] = 0x0000ffff;
-			if (width < 16)
-				mask[idx] = (mask[idx] << (16 - width)) &
-						0x0000ffff;
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0x0000ffff >>
+						     (16 - width));
 		break;
 	case RTE_FLOW_FIELD_VXLAN_VNI:
 		/* not supported yet */
@@ -1690,11 +1659,9 @@ mlx5_flow_field_id_to_modify_info
 	case RTE_FLOW_FIELD_GTP_TEID:
 		info[idx] = (struct field_modify_info){4, 0,
 					MLX5_MODI_GTP_TEID};
-		if (mask) {
-			mask[idx] = 0xffffffff;
-			if (width < 32)
-				mask[idx] = mask[idx] << (32 - width);
-		}
+		if (mask)
+			mask[idx] = rte_cpu_to_be_32(0xffffffff >>
+						     (32 - width));
 		break;
 	case RTE_FLOW_FIELD_TAG:
 		{
@@ -1706,11 +1673,10 @@ mlx5_flow_field_id_to_modify_info
 			MLX5_ASSERT((unsigned int)reg < RTE_DIM(reg_to_field));
 			info[idx] = (struct field_modify_info){4, 0,
 						reg_to_field[reg]};
-			if (mask) {
-				mask[idx] = 0xffffffff;
-				if (width < 32)
-					mask[idx] = mask[idx] << (32 - width);
-			}
+			if (mask)
+				mask[idx] =
+					rte_cpu_to_be_32(0xffffffff >>
+							 (32 - width));
 		}
 		break;
 	case RTE_FLOW_FIELD_MARK:
@@ -1723,11 +1689,10 @@ mlx5_flow_field_id_to_modify_info
 			MLX5_ASSERT((unsigned int)reg < RTE_DIM(reg_to_field));
 			info[idx] = (struct field_modify_info){4, 0,
 						reg_to_field[reg]};
-			if (mask) {
-				mask[idx] = 0xffffffff;
-				if (width < 32)
-					mask[idx] = mask[idx] << (32 - width);
-			}
+			if (mask)
+				mask[idx] =
+					rte_cpu_to_be_32(0xffffffff >>
+							 (32 - width));
 		}
 		break;
 	case RTE_FLOW_FIELD_META:
@@ -1739,11 +1704,10 @@ mlx5_flow_field_id_to_modify_info
 			MLX5_ASSERT((unsigned int)reg < RTE_DIM(reg_to_field));
 			info[idx] = (struct field_modify_info){4, 0,
 						reg_to_field[reg]};
-			if (mask) {
-				mask[idx] = 0xffffffff;
-				if (width < 32)
-					mask[idx] = mask[idx] << (32 - width);
-			}
+			if (mask)
+				mask[idx] =
+					rte_cpu_to_be_32(0xffffffff >>
+							 (32 - width));
 		}
 		break;
 	case RTE_FLOW_FIELD_POINTER:
@@ -1751,7 +1715,7 @@ mlx5_flow_field_id_to_modify_info
 			if (mask[idx]) {
 				memcpy(&value[idx],
 					(void *)(uintptr_t)data->value, 32);
-				value[idx] = RTE_BE32(value[idx]);
+				value[idx] = rte_cpu_to_be_32(value[idx]);
 				break;
 			}
 		}
@@ -1759,7 +1723,8 @@ mlx5_flow_field_id_to_modify_info
 	case RTE_FLOW_FIELD_VALUE:
 		for (idx = 0; idx < MLX5_ACT_MAX_MOD_FIELDS; idx++) {
 			if (mask[idx]) {
-				value[idx] = RTE_BE32((uint32_t)data->value);
+				value[idx] =
+					rte_cpu_to_be_32((uint32_t)data->value);
 				break;
 			}
 		}
-- 
2.24.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v2 3/6] net/mlx5: check extended metadata for mark modififcation
  2021-03-24 15:04 [dpdk-dev] [PATCH v2 0/6] modify field action enhancements Alexander Kozyrev
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 1/6] net/mlx5: check for a field size in modify field action Alexander Kozyrev
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 2/6] net/mlx5: adjust modify field action endianess Alexander Kozyrev
@ 2021-03-24 15:04 ` Alexander Kozyrev
  2021-03-30  7:09   ` Slava Ovsiienko
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 4/6] net/mlx5: allow group 0 modify field action Alexander Kozyrev
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Alexander Kozyrev @ 2021-03-24 15:04 UTC (permalink / raw)
  To: dev; +Cc: rasland, viacheslavo, matan, orika, stable

The MODIFY_FIELD RTE action requires the extended metadata support
in order to manipulate on MARK register. Check if it is supported
and reject the MODIFY_FIELD action if it is not.

Fixes: 641dbe4fb0 ("net/mlx5: support modify field flow action")
Cc: stable@dpdk.org

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index a1e4e2e5df..f2bc3162c1 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -4542,7 +4542,8 @@ mlx5_flow_item_field_width(enum rte_flow_field_id field)
 
 /**
  * Validate the generic modify field actions.
- *
+ * @param[in] dev
+ *   Pointer to the rte_eth_dev structure.
  * @param[in] action_flags
  *   Holds the actions detected until now.
  * @param[in] action
@@ -4557,11 +4558,14 @@ mlx5_flow_item_field_width(enum rte_flow_field_id field)
  *   a negative errno value otherwise and rte_errno is set.
  */
 static int
-flow_dv_validate_action_modify_field(const uint64_t action_flags,
+flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
+				   const uint64_t action_flags,
 				   const struct rte_flow_action *action,
 				   struct rte_flow_error *error)
 {
 	int ret = 0;
+	struct mlx5_priv *priv = dev->data->dev_private;
+	struct mlx5_dev_config *config = &priv->config;
 	const struct rte_flow_action_modify_field *action_modify_field =
 		action->conf;
 	uint32_t dst_width =
@@ -4640,6 +4644,15 @@ flow_dv_validate_action_modify_field(const uint64_t action_flags,
 				NULL,
 				"modifications of an arbitrary"
 				" place in a packet is not supported");
+	if (action_modify_field->dst.field == RTE_FLOW_FIELD_MARK ||
+	    action_modify_field->src.field == RTE_FLOW_FIELD_MARK) {
+		if (config->dv_xmeta_en == MLX5_XMETA_MODE_LEGACY ||
+		    !mlx5_flow_ext_mreg_supported(dev))
+			return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"cannot modify mark without extended"
+					" metadata register support");
+	}
 	if (action_modify_field->operation != RTE_FLOW_MODIFY_SET)
 		return rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ACTION,
@@ -6914,9 +6927,10 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 						RTE_FLOW_ERROR_TYPE_ACTION,
 						NULL, "modify field action "
 						"is not supported for group 0");
-			ret = flow_dv_validate_action_modify_field(action_flags,
-								 actions,
-								 error);
+			ret = flow_dv_validate_action_modify_field(dev,
+								   action_flags,
+								   actions,
+								   error);
 			if (ret < 0)
 				return ret;
 			/* Count all modify-header actions as one action. */
-- 
2.24.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v2 4/6] net/mlx5: allow group 0 modify field action
  2021-03-24 15:04 [dpdk-dev] [PATCH v2 0/6] modify field action enhancements Alexander Kozyrev
                   ` (2 preceding siblings ...)
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 3/6] net/mlx5: check extended metadata for mark modififcation Alexander Kozyrev
@ 2021-03-24 15:04 ` Alexander Kozyrev
  2021-03-30  7:10   ` Slava Ovsiienko
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 5/6] doc: add list of supported Field IDs to modify Alexander Kozyrev
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Alexander Kozyrev @ 2021-03-24 15:04 UTC (permalink / raw)
  To: dev; +Cc: rasland, viacheslavo, matan, orika

There is a limitation about copying one header field to another for
the Flow group 0. Such copy action is not allowed there. But setting
a header field with an immediate value is perfrectly fine.
Allow the MODIFY_FIELD RTE action on group 0 in case the source field
is an immediate value or a pointer to it.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index f2bc3162c1..ecabf63f53 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -4548,8 +4548,8 @@ mlx5_flow_item_field_width(enum rte_flow_field_id field)
  *   Holds the actions detected until now.
  * @param[in] action
  *   Pointer to the modify action.
- * @param[in] item_flags
- *   Holds the items detected.
+ * @param[in] attr
+ *   Pointer to the flow attributes.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -4561,6 +4561,7 @@ static int
 flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 				   const uint64_t action_flags,
 				   const struct rte_flow_action *action,
+				   const struct rte_flow_attr *attr,
 				   struct rte_flow_error *error)
 {
 	int ret = 0;
@@ -4608,6 +4609,11 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 	}
 	if (action_modify_field->src.field != RTE_FLOW_FIELD_VALUE &&
 	    action_modify_field->src.field != RTE_FLOW_FIELD_POINTER) {
+		if (!attr->transfer && !attr->group)
+			return rte_flow_error_set(error, ENOTSUP,
+					RTE_FLOW_ERROR_TYPE_ACTION,
+					NULL, "modify field action "
+					"is not supported for group 0");
 		if ((action_modify_field->src.offset +
 		     action_modify_field->width > src_width) ||
 		    (action_modify_field->src.offset % 32))
@@ -6922,14 +6928,10 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 			action_flags |= MLX5_FLOW_ACTION_TUNNEL_SET;
 			break;
 		case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD:
-			if (!attr->transfer && !attr->group)
-				return rte_flow_error_set(error, ENOTSUP,
-						RTE_FLOW_ERROR_TYPE_ACTION,
-						NULL, "modify field action "
-						"is not supported for group 0");
 			ret = flow_dv_validate_action_modify_field(dev,
 								   action_flags,
 								   actions,
+								   attr,
 								   error);
 			if (ret < 0)
 				return ret;
-- 
2.24.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v2 5/6] doc: add list of supported Field IDs to modify
  2021-03-24 15:04 [dpdk-dev] [PATCH v2 0/6] modify field action enhancements Alexander Kozyrev
                   ` (3 preceding siblings ...)
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 4/6] net/mlx5: allow group 0 modify field action Alexander Kozyrev
@ 2021-03-24 15:04 ` Alexander Kozyrev
  2021-03-30  7:10   ` Slava Ovsiienko
  2021-03-31 15:53   ` Ferruh Yigit
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 6/6] net/mlx5: reject VXLAN ID's modifications Alexander Kozyrev
  2021-03-31 13:03 ` [dpdk-dev] [PATCH v2 0/6] modify field action enhancements Raslan Darawsheh
  6 siblings, 2 replies; 16+ messages in thread
From: Alexander Kozyrev @ 2021-03-24 15:04 UTC (permalink / raw)
  To: dev; +Cc: rasland, viacheslavo, matan, orika

Include the rte_flow_field_id enumeration into the
documentation to provide the full list of all supported
Field IDs available for the MODIFY_FIELD RTE action.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst | 45 ++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 62a57919eb..4265b7bfb8 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -2784,6 +2784,41 @@ can be used as both source and destination fields as set by ``field``.
 The immediate value ``RTE_FLOW_FIELD_VALUE`` (or a pointer to it
 ``RTE_FLOW_FIELD_POINTER``) is allowed as a source only.
 ``RTE_FLOW_FIELD_START`` is used to point to the beginning of a packet.
+See ``enum rte_flow_field_id`` for the list of supported fields:
+
+.. code-block:: c
+
+   enum rte_flow_field_id {
+        RTE_FLOW_FIELD_START = 0,       /**< Start of a packet. */
+        RTE_FLOW_FIELD_MAC_DST,         /**< Destination MAC Address. */
+        RTE_FLOW_FIELD_MAC_SRC,         /**< Source MAC Address. */
+        RTE_FLOW_FIELD_VLAN_TYPE,       /**< 802.1Q Tag Identifier. */
+        RTE_FLOW_FIELD_VLAN_ID,         /**< 802.1Q VLAN Identifier. */
+        RTE_FLOW_FIELD_MAC_TYPE,        /**< EtherType. */
+        RTE_FLOW_FIELD_IPV4_DSCP,       /**< IPv4 DSCP. */
+        RTE_FLOW_FIELD_IPV4_TTL,        /**< IPv4 Time To Live. */
+        RTE_FLOW_FIELD_IPV4_SRC,        /**< IPv4 Source Address. */
+        RTE_FLOW_FIELD_IPV4_DST,        /**< IPv4 Destination Address. */
+        RTE_FLOW_FIELD_IPV6_DSCP,       /**< IPv6 DSCP. */
+        RTE_FLOW_FIELD_IPV6_HOPLIMIT,   /**< IPv6 Hop Limit. */
+        RTE_FLOW_FIELD_IPV6_SRC,        /**< IPv6 Source Address. */
+        RTE_FLOW_FIELD_IPV6_DST,        /**< IPv6 Destination Address. */
+        RTE_FLOW_FIELD_TCP_PORT_SRC,    /**< TCP Source Port Number. */
+        RTE_FLOW_FIELD_TCP_PORT_DST,    /**< TCP Destination Port Number. */
+        RTE_FLOW_FIELD_TCP_SEQ_NUM,     /**< TCP Sequence Number. */
+        RTE_FLOW_FIELD_TCP_ACK_NUM,     /**< TCP Acknowledgment Number. */
+        RTE_FLOW_FIELD_TCP_FLAGS,       /**< TCP Flags. */
+        RTE_FLOW_FIELD_UDP_PORT_SRC,    /**< UDP Source Port Number. */
+        RTE_FLOW_FIELD_UDP_PORT_DST,    /**< UDP Destination Port Number. */
+        RTE_FLOW_FIELD_VXLAN_VNI,       /**< VXLAN Network Identifier. */
+        RTE_FLOW_FIELD_GENEVE_VNI,      /**< GENEVE Network Identifier. */
+        RTE_FLOW_FIELD_GTP_TEID,        /**< GTP Tunnel Endpoint Identifier. */
+        RTE_FLOW_FIELD_TAG,             /**< Tag value. */
+        RTE_FLOW_FIELD_MARK,            /**< Mark value. */
+        RTE_FLOW_FIELD_META,            /**< Metadata value. */
+        RTE_FLOW_FIELD_POINTER,         /**< Memory pointer. */
+        RTE_FLOW_FIELD_VALUE,           /**< Immediate value. */
+   };
 
 ``op`` selects the operation to perform on a destination field.
 - ``set`` copies the data from ``src`` field to ``dst`` field.
@@ -2817,12 +2852,15 @@ for ``RTE_FLOW_FIELD_VALUE`` and ``RTE_FLOW_FIELD_POINTER`` respectively.
 
 .. table:: MODIFY_FIELD
 
-   +-----------------------------------------+
+   +---------------+-------------------------+
    | Field         | Value                   |
    +===============+=========================+
    | ``op``        | operation to perform    |
+   +---------------+-------------------------+
    | ``dst``       | destination field       |
+   +---------------+-------------------------+
    | ``src``       | source field            |
+   +---------------+-------------------------+
    | ``width``     | number of bits to use   |
    +---------------+-------------------------+
 
@@ -2830,12 +2868,15 @@ for ``RTE_FLOW_FIELD_VALUE`` and ``RTE_FLOW_FIELD_POINTER`` respectively.
 
 .. table:: destination/source field definition
 
-   +--------------------------------------------------------------------------+
+   +---------------+----------------------------------------------------------+
    | Field         | Value                                                    |
    +===============+==========================================================+
    | ``field``     | ID: packet field, mark, meta, tag, immediate, pointer    |
+   +---------------+----------------------------------------------------------+
    | ``level``     | encapsulation level of a packet field or tag array index |
+   +---------------+----------------------------------------------------------+
    | ``offset``    | number of bits to skip at the beginning                  |
+   +---------------+----------------------------------------------------------+
    | ``value``     | immediate value or a pointer to this value               |
    +---------------+----------------------------------------------------------+
 
-- 
2.24.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v2 6/6] net/mlx5: reject VXLAN ID's modifications
  2021-03-24 15:04 [dpdk-dev] [PATCH v2 0/6] modify field action enhancements Alexander Kozyrev
                   ` (4 preceding siblings ...)
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 5/6] doc: add list of supported Field IDs to modify Alexander Kozyrev
@ 2021-03-24 15:04 ` Alexander Kozyrev
  2021-03-30  7:10   ` Slava Ovsiienko
  2021-03-31 13:03 ` [dpdk-dev] [PATCH v2 0/6] modify field action enhancements Raslan Darawsheh
  6 siblings, 1 reply; 16+ messages in thread
From: Alexander Kozyrev @ 2021-03-24 15:04 UTC (permalink / raw)
  To: dev; +Cc: rasland, viacheslavo, matan, orika, stable

Modification of the 802.1Q Tag Identificator, VXLAN Network
Identificator or GENEVE Network Identificator is not supported.
Reject attempt to modify these fields via the MODIFY_FIELD
action and document this mlx5 driver limitation.

Fixes: 641dbe4fb0 ("net/mlx5: support modify field flow action")
Cc: stable@dpdk.org

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 doc/guides/nics/mlx5.rst        |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index a2cfc51b2a..92369fa5ee 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -383,6 +383,7 @@ Limitations
 
   - Supports the 'set' operation only for ``RTE_FLOW_ACTION_TYPE_MODIFY_FIELD`` action.
   - Modification of an arbitrary place in a packet via the special ``RTE_FLOW_FIELD_START`` Field ID is not supported.
+  - Modification of the 802.1Q Tag, VXLAN Network or GENEVE Network ID's is not supported.
   - Encapsulation levels are not supported, can modify outermost header fields only.
   - Offsets must be 32-bits aligned, cannot skip past the boundary of a field.
 
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index ecabf63f53..223a7d0e36 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -4650,6 +4650,27 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 				NULL,
 				"modifications of an arbitrary"
 				" place in a packet is not supported");
+	if (action_modify_field->dst.field == RTE_FLOW_FIELD_VLAN_TYPE ||
+	    action_modify_field->src.field == RTE_FLOW_FIELD_VLAN_TYPE)
+		return rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ACTION,
+				NULL,
+				"modifications of the 802.1Q Tag"
+				" Identifier is not supported");
+	if (action_modify_field->dst.field == RTE_FLOW_FIELD_VXLAN_VNI ||
+	    action_modify_field->src.field == RTE_FLOW_FIELD_VXLAN_VNI)
+		return rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ACTION,
+				NULL,
+				"modifications of the VXLAN Network"
+				" Identifier is not supported");
+	if (action_modify_field->dst.field == RTE_FLOW_FIELD_GENEVE_VNI ||
+	    action_modify_field->src.field == RTE_FLOW_FIELD_GENEVE_VNI)
+		return rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ACTION,
+				NULL,
+				"modifications of the GENEVE Network"
+				" Identifier is not supported");
 	if (action_modify_field->dst.field == RTE_FLOW_FIELD_MARK ||
 	    action_modify_field->src.field == RTE_FLOW_FIELD_MARK) {
 		if (config->dv_xmeta_en == MLX5_XMETA_MODE_LEGACY ||
-- 
2.24.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/6] net/mlx5: check for a field size in modify field action
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 1/6] net/mlx5: check for a field size in modify field action Alexander Kozyrev
@ 2021-03-30  7:09   ` Slava Ovsiienko
  0 siblings, 0 replies; 16+ messages in thread
From: Slava Ovsiienko @ 2021-03-30  7:09 UTC (permalink / raw)
  To: Alexander Kozyrev, dev; +Cc: Raslan Darawsheh, Matan Azrad, Ori Kam, stable

> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@nvidia.com>
> Sent: Wednesday, March 24, 2021 17:05
> To: dev@dpdk.org
> Cc: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Ori Kam
> <orika@nvidia.com>; stable@dpdk.org
> Subject: [PATCH v2 1/6] net/mlx5: check for a field size in modify field action
> 
> Add a validation check to make sure that the specified width for
> MODIFY_FIELD RTE action is not bigger than a field size.
> 
> Fixes: 641dbe4fb0 ("net/mlx5: support modify field flow action")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/6] net/mlx5: adjust modify field action endianess
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 2/6] net/mlx5: adjust modify field action endianess Alexander Kozyrev
@ 2021-03-30  7:09   ` Slava Ovsiienko
  0 siblings, 0 replies; 16+ messages in thread
From: Slava Ovsiienko @ 2021-03-30  7:09 UTC (permalink / raw)
  To: Alexander Kozyrev, dev; +Cc: Raslan Darawsheh, Matan Azrad, Ori Kam, stable

> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@nvidia.com>
> Sent: Wednesday, March 24, 2021 17:05
> To: dev@dpdk.org
> Cc: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Ori Kam
> <orika@nvidia.com>; stable@dpdk.org
> Subject: [PATCH v2 2/6] net/mlx5: adjust modify field action endianess
> 
> Masks that used to modify a packet field must be in a big endian format.
> Convert then to BE to ensure proper modification.
> 
> Fixes: 641dbe4fb0 ("net/mlx5: support modify field flow action")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/6] net/mlx5: check extended metadata for mark modififcation
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 3/6] net/mlx5: check extended metadata for mark modififcation Alexander Kozyrev
@ 2021-03-30  7:09   ` Slava Ovsiienko
  0 siblings, 0 replies; 16+ messages in thread
From: Slava Ovsiienko @ 2021-03-30  7:09 UTC (permalink / raw)
  To: Alexander Kozyrev, dev; +Cc: Raslan Darawsheh, Matan Azrad, Ori Kam, stable

> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@nvidia.com>
> Sent: Wednesday, March 24, 2021 17:05
> To: dev@dpdk.org
> Cc: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Ori Kam
> <orika@nvidia.com>; stable@dpdk.org
> Subject: [PATCH v2 3/6] net/mlx5: check extended metadata for mark
> modififcation
> 
> The MODIFY_FIELD RTE action requires the extended metadata support in
> order to manipulate on MARK register. Check if it is supported and reject the
> MODIFY_FIELD action if it is not.
> 
> Fixes: 641dbe4fb0 ("net/mlx5: support modify field flow action")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 4/6] net/mlx5: allow group 0 modify field action
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 4/6] net/mlx5: allow group 0 modify field action Alexander Kozyrev
@ 2021-03-30  7:10   ` Slava Ovsiienko
  0 siblings, 0 replies; 16+ messages in thread
From: Slava Ovsiienko @ 2021-03-30  7:10 UTC (permalink / raw)
  To: Alexander Kozyrev, dev; +Cc: Raslan Darawsheh, Matan Azrad, Ori Kam

> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@nvidia.com>
> Sent: Wednesday, March 24, 2021 17:05
> To: dev@dpdk.org
> Cc: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Ori Kam
> <orika@nvidia.com>
> Subject: [PATCH v2 4/6] net/mlx5: allow group 0 modify field action
> 
> There is a limitation about copying one header field to another for the Flow
> group 0. Such copy action is not allowed there. But setting a header field with
> an immediate value is perfrectly fine.
> Allow the MODIFY_FIELD RTE action on group 0 in case the source field is an
> immediate value or a pointer to it.
> 
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 5/6] doc: add list of supported Field IDs to modify
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 5/6] doc: add list of supported Field IDs to modify Alexander Kozyrev
@ 2021-03-30  7:10   ` Slava Ovsiienko
  2021-03-31 15:53   ` Ferruh Yigit
  1 sibling, 0 replies; 16+ messages in thread
From: Slava Ovsiienko @ 2021-03-30  7:10 UTC (permalink / raw)
  To: Alexander Kozyrev, dev; +Cc: Raslan Darawsheh, Matan Azrad, Ori Kam

> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@nvidia.com>
> Sent: Wednesday, March 24, 2021 17:05
> To: dev@dpdk.org
> Cc: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Ori Kam
> <orika@nvidia.com>
> Subject: [PATCH v2 5/6] doc: add list of supported Field IDs to modify
> 
> Include the rte_flow_field_id enumeration into the documentation to
> provide the full list of all supported Field IDs available for the MODIFY_FIELD
> RTE action.
> 
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 6/6] net/mlx5: reject VXLAN ID's modifications
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 6/6] net/mlx5: reject VXLAN ID's modifications Alexander Kozyrev
@ 2021-03-30  7:10   ` Slava Ovsiienko
  0 siblings, 0 replies; 16+ messages in thread
From: Slava Ovsiienko @ 2021-03-30  7:10 UTC (permalink / raw)
  To: Alexander Kozyrev, dev; +Cc: Raslan Darawsheh, Matan Azrad, Ori Kam, stable

> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@nvidia.com>
> Sent: Wednesday, March 24, 2021 17:05
> To: dev@dpdk.org
> Cc: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Ori Kam
> <orika@nvidia.com>; stable@dpdk.org
> Subject: [PATCH v2 6/6] net/mlx5: reject VXLAN ID's modifications
> 
> Modification of the 802.1Q Tag Identificator, VXLAN Network Identificator or
> GENEVE Network Identificator is not supported.
> Reject attempt to modify these fields via the MODIFY_FIELD action and
> document this mlx5 driver limitation.
> 
> Fixes: 641dbe4fb0 ("net/mlx5: support modify field flow action")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/6] modify field action enhancements
  2021-03-24 15:04 [dpdk-dev] [PATCH v2 0/6] modify field action enhancements Alexander Kozyrev
                   ` (5 preceding siblings ...)
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 6/6] net/mlx5: reject VXLAN ID's modifications Alexander Kozyrev
@ 2021-03-31 13:03 ` Raslan Darawsheh
  6 siblings, 0 replies; 16+ messages in thread
From: Raslan Darawsheh @ 2021-03-31 13:03 UTC (permalink / raw)
  To: Alexander Kozyrev, dev; +Cc: Slava Ovsiienko, Matan Azrad, Ori Kam

Hi,

> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@nvidia.com>
> Sent: Wednesday, March 24, 2021 5:05 PM
> To: dev@dpdk.org
> Cc: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Ori Kam
> <orika@nvidia.com>
> Subject: [PATCH v2 0/6] modify field action enhancements
> 
> Various fixes/improvements for RTE MODIFY_FIELD Flow Action.
> 
> v2: added the patch with rejection of VXLAN IDs modification
> 
> Alexander Kozyrev (6):
>   net/mlx5: check for a field size in modify field action
>   net/mlx5: adjust modify field action endianess
>   net/mlx5: check extended metadata for mark modififcation
>   net/mlx5: allow group 0 modify field action
>   doc: add list of supported Field IDs to modify
>   net/mlx5: reject VXLAN ID's modifications
> 
>  doc/guides/nics/mlx5.rst           |   1 +
>  doc/guides/prog_guide/rte_flow.rst |  45 +++-
>  drivers/net/mlx5/mlx5_flow_dv.c    | 325 +++++++++++++++--------------
>  3 files changed, 212 insertions(+), 159 deletions(-)
> 
> --
> 2.24.1

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 5/6] doc: add list of supported Field IDs to modify
  2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 5/6] doc: add list of supported Field IDs to modify Alexander Kozyrev
  2021-03-30  7:10   ` Slava Ovsiienko
@ 2021-03-31 15:53   ` Ferruh Yigit
  2021-04-08  3:20     ` Alexander Kozyrev
  1 sibling, 1 reply; 16+ messages in thread
From: Ferruh Yigit @ 2021-03-31 15:53 UTC (permalink / raw)
  To: Alexander Kozyrev, dev; +Cc: rasland, viacheslavo, matan, orika

On 3/24/2021 3:04 PM, Alexander Kozyrev wrote:
> Include the rte_flow_field_id enumeration into the
> documentation to provide the full list of all supported
> Field IDs available for the MODIFY_FIELD RTE action.
> 
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
> ---
>   doc/guides/prog_guide/rte_flow.rst | 45 ++++++++++++++++++++++++++++--
>   1 file changed, 43 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> index 62a57919eb..4265b7bfb8 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -2784,6 +2784,41 @@ can be used as both source and destination fields as set by ``field``.
>   The immediate value ``RTE_FLOW_FIELD_VALUE`` (or a pointer to it
>   ``RTE_FLOW_FIELD_POINTER``) is allowed as a source only.
>   ``RTE_FLOW_FIELD_START`` is used to point to the beginning of a packet.
> +See ``enum rte_flow_field_id`` for the list of supported fields:
> +
> +.. code-block:: c
> +
> +   enum rte_flow_field_id {
> +        RTE_FLOW_FIELD_START = 0,       /**< Start of a packet. */
> +        RTE_FLOW_FIELD_MAC_DST,         /**< Destination MAC Address. */
> +        RTE_FLOW_FIELD_MAC_SRC,         /**< Source MAC Address. */
> +        RTE_FLOW_FIELD_VLAN_TYPE,       /**< 802.1Q Tag Identifier. */
> +        RTE_FLOW_FIELD_VLAN_ID,         /**< 802.1Q VLAN Identifier. */
> +        RTE_FLOW_FIELD_MAC_TYPE,        /**< EtherType. */
> +        RTE_FLOW_FIELD_IPV4_DSCP,       /**< IPv4 DSCP. */
> +        RTE_FLOW_FIELD_IPV4_TTL,        /**< IPv4 Time To Live. */
> +        RTE_FLOW_FIELD_IPV4_SRC,        /**< IPv4 Source Address. */
> +        RTE_FLOW_FIELD_IPV4_DST,        /**< IPv4 Destination Address. */
> +        RTE_FLOW_FIELD_IPV6_DSCP,       /**< IPv6 DSCP. */
> +        RTE_FLOW_FIELD_IPV6_HOPLIMIT,   /**< IPv6 Hop Limit. */
> +        RTE_FLOW_FIELD_IPV6_SRC,        /**< IPv6 Source Address. */
> +        RTE_FLOW_FIELD_IPV6_DST,        /**< IPv6 Destination Address. */
> +        RTE_FLOW_FIELD_TCP_PORT_SRC,    /**< TCP Source Port Number. */
> +        RTE_FLOW_FIELD_TCP_PORT_DST,    /**< TCP Destination Port Number. */
> +        RTE_FLOW_FIELD_TCP_SEQ_NUM,     /**< TCP Sequence Number. */
> +        RTE_FLOW_FIELD_TCP_ACK_NUM,     /**< TCP Acknowledgment Number. */
> +        RTE_FLOW_FIELD_TCP_FLAGS,       /**< TCP Flags. */
> +        RTE_FLOW_FIELD_UDP_PORT_SRC,    /**< UDP Source Port Number. */
> +        RTE_FLOW_FIELD_UDP_PORT_DST,    /**< UDP Destination Port Number. */
> +        RTE_FLOW_FIELD_VXLAN_VNI,       /**< VXLAN Network Identifier. */
> +        RTE_FLOW_FIELD_GENEVE_VNI,      /**< GENEVE Network Identifier. */
> +        RTE_FLOW_FIELD_GTP_TEID,        /**< GTP Tunnel Endpoint Identifier. */
> +        RTE_FLOW_FIELD_TAG,             /**< Tag value. */
> +        RTE_FLOW_FIELD_MARK,            /**< Mark value. */
> +        RTE_FLOW_FIELD_META,            /**< Metadata value. */
> +        RTE_FLOW_FIELD_POINTER,         /**< Memory pointer. */
> +        RTE_FLOW_FIELD_VALUE,           /**< Immediate value. */
> +   };

The code in the documentation proved to be problem in long term, they get out of 
date most of the times. So what do you think to just keep the reference to 
``enum rte_flow_field_id`` but drop the code block?

Dropping the patch in next-net, it can be sent later separately.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2 5/6] doc: add list of supported Field IDs to modify
  2021-03-31 15:53   ` Ferruh Yigit
@ 2021-04-08  3:20     ` Alexander Kozyrev
  0 siblings, 0 replies; 16+ messages in thread
From: Alexander Kozyrev @ 2021-04-08  3:20 UTC (permalink / raw)
  To: Ferruh Yigit, dev; +Cc: Raslan Darawsheh, Slava Ovsiienko, Matan Azrad, Ori Kam

Makes sense, Ferruh, I've send v2 without code snippet. Would you mind to take a look?

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Wednesday, March 31, 2021 11:53
> To: Alexander Kozyrev <akozyrev@nvidia.com>; dev@dpdk.org
> Cc: Raslan Darawsheh <rasland@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Matan Azrad <matan@nvidia.com>; Ori Kam
> <orika@nvidia.com>
> Subject: Re: [dpdk-dev] [PATCH v2 5/6] doc: add list of supported Field IDs to
> modify
> 
> On 3/24/2021 3:04 PM, Alexander Kozyrev wrote:
> > Include the rte_flow_field_id enumeration into the
> > documentation to provide the full list of all supported
> > Field IDs available for the MODIFY_FIELD RTE action.
> >
> > Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
> > ---
> >   doc/guides/prog_guide/rte_flow.rst | 45
> ++++++++++++++++++++++++++++--
> >   1 file changed, 43 insertions(+), 2 deletions(-)
> >
> > diff --git a/doc/guides/prog_guide/rte_flow.rst
> b/doc/guides/prog_guide/rte_flow.rst
> > index 62a57919eb..4265b7bfb8 100644
> > --- a/doc/guides/prog_guide/rte_flow.rst
> > +++ b/doc/guides/prog_guide/rte_flow.rst
> > @@ -2784,6 +2784,41 @@ can be used as both source and destination
> fields as set by ``field``.
> >   The immediate value ``RTE_FLOW_FIELD_VALUE`` (or a pointer to it
> >   ``RTE_FLOW_FIELD_POINTER``) is allowed as a source only.
> >   ``RTE_FLOW_FIELD_START`` is used to point to the beginning of a packet.
> > +See ``enum rte_flow_field_id`` for the list of supported fields:
> > +
> > +.. code-block:: c
> > +
> > +   enum rte_flow_field_id {
> > +        RTE_FLOW_FIELD_START = 0,       /**< Start of a packet. */
> > +        RTE_FLOW_FIELD_MAC_DST,         /**< Destination MAC Address. */
> > +        RTE_FLOW_FIELD_MAC_SRC,         /**< Source MAC Address. */
> > +        RTE_FLOW_FIELD_VLAN_TYPE,       /**< 802.1Q Tag Identifier. */
> > +        RTE_FLOW_FIELD_VLAN_ID,         /**< 802.1Q VLAN Identifier. */
> > +        RTE_FLOW_FIELD_MAC_TYPE,        /**< EtherType. */
> > +        RTE_FLOW_FIELD_IPV4_DSCP,       /**< IPv4 DSCP. */
> > +        RTE_FLOW_FIELD_IPV4_TTL,        /**< IPv4 Time To Live. */
> > +        RTE_FLOW_FIELD_IPV4_SRC,        /**< IPv4 Source Address. */
> > +        RTE_FLOW_FIELD_IPV4_DST,        /**< IPv4 Destination Address. */
> > +        RTE_FLOW_FIELD_IPV6_DSCP,       /**< IPv6 DSCP. */
> > +        RTE_FLOW_FIELD_IPV6_HOPLIMIT,   /**< IPv6 Hop Limit. */
> > +        RTE_FLOW_FIELD_IPV6_SRC,        /**< IPv6 Source Address. */
> > +        RTE_FLOW_FIELD_IPV6_DST,        /**< IPv6 Destination Address. */
> > +        RTE_FLOW_FIELD_TCP_PORT_SRC,    /**< TCP Source Port Number.
> */
> > +        RTE_FLOW_FIELD_TCP_PORT_DST,    /**< TCP Destination Port
> Number. */
> > +        RTE_FLOW_FIELD_TCP_SEQ_NUM,     /**< TCP Sequence Number. */
> > +        RTE_FLOW_FIELD_TCP_ACK_NUM,     /**< TCP Acknowledgment
> Number. */
> > +        RTE_FLOW_FIELD_TCP_FLAGS,       /**< TCP Flags. */
> > +        RTE_FLOW_FIELD_UDP_PORT_SRC,    /**< UDP Source Port Number.
> */
> > +        RTE_FLOW_FIELD_UDP_PORT_DST,    /**< UDP Destination Port
> Number. */
> > +        RTE_FLOW_FIELD_VXLAN_VNI,       /**< VXLAN Network Identifier. */
> > +        RTE_FLOW_FIELD_GENEVE_VNI,      /**< GENEVE Network Identifier.
> */
> > +        RTE_FLOW_FIELD_GTP_TEID,        /**< GTP Tunnel Endpoint
> Identifier. */
> > +        RTE_FLOW_FIELD_TAG,             /**< Tag value. */
> > +        RTE_FLOW_FIELD_MARK,            /**< Mark value. */
> > +        RTE_FLOW_FIELD_META,            /**< Metadata value. */
> > +        RTE_FLOW_FIELD_POINTER,         /**< Memory pointer. */
> > +        RTE_FLOW_FIELD_VALUE,           /**< Immediate value. */
> > +   };
> 
> The code in the documentation proved to be problem in long term, they get
> out of
> date most of the times. So what do you think to just keep the reference to
> ``enum rte_flow_field_id`` but drop the code block?
> 
> Dropping the patch in next-net, it can be sent later separately.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-04-08  3:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 15:04 [dpdk-dev] [PATCH v2 0/6] modify field action enhancements Alexander Kozyrev
2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 1/6] net/mlx5: check for a field size in modify field action Alexander Kozyrev
2021-03-30  7:09   ` Slava Ovsiienko
2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 2/6] net/mlx5: adjust modify field action endianess Alexander Kozyrev
2021-03-30  7:09   ` Slava Ovsiienko
2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 3/6] net/mlx5: check extended metadata for mark modififcation Alexander Kozyrev
2021-03-30  7:09   ` Slava Ovsiienko
2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 4/6] net/mlx5: allow group 0 modify field action Alexander Kozyrev
2021-03-30  7:10   ` Slava Ovsiienko
2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 5/6] doc: add list of supported Field IDs to modify Alexander Kozyrev
2021-03-30  7:10   ` Slava Ovsiienko
2021-03-31 15:53   ` Ferruh Yigit
2021-04-08  3:20     ` Alexander Kozyrev
2021-03-24 15:04 ` [dpdk-dev] [PATCH v2 6/6] net/mlx5: reject VXLAN ID's modifications Alexander Kozyrev
2021-03-30  7:10   ` Slava Ovsiienko
2021-03-31 13:03 ` [dpdk-dev] [PATCH v2 0/6] modify field action enhancements Raslan Darawsheh

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git