All of lore.kernel.org
 help / color / mirror / Atom feed
* [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header
@ 2022-04-02  7:11 Sean Zhang
  2022-04-02  7:11 ` [v1 1/4] ethdev: add IPv4/IPv6 ECN header rewrite action Sean Zhang
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Sean Zhang @ 2022-04-02  7:11 UTC (permalink / raw)
  Cc: dev

This patch set adds support for modifying ECN fields in IPv4/IPv6
header, and also adds support for modify_filed action in meter.

Jiawei Wang (1):
  ethdev: add IPv4/IPv6 ECN header rewrite action

Sean Zhang (3):
  common/mlx5: add modify ECN capability check
  net/mlx5: add support to modify ECN field
  net/mlx5: add modify field support in meter

 app/test-pmd/cmdline_flow.c          |  3 +-
 doc/guides/nics/mlx5.rst             |  4 +-
 drivers/common/mlx5/mlx5_devx_cmds.c |  3 ++
 drivers/common/mlx5/mlx5_devx_cmds.h |  1 +
 drivers/common/mlx5/mlx5_prm.h       | 62 ++++++++++++++++++++++++-
 drivers/net/mlx5/mlx5_flow.c         |  5 +-
 drivers/net/mlx5/mlx5_flow.h         |  2 +
 drivers/net/mlx5/mlx5_flow_dv.c      | 69 ++++++++++++++++++++++++++--
 drivers/net/mlx5/mlx5_flow_meter.c   |  2 +-
 lib/ethdev/rte_flow.h                |  2 +
 10 files changed, 143 insertions(+), 10 deletions(-)

-- 
2.31.1


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

* [v1 1/4] ethdev: add IPv4/IPv6 ECN header rewrite action
  2022-04-02  7:11 [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header Sean Zhang
@ 2022-04-02  7:11 ` Sean Zhang
  2022-06-01 18:51   ` Ferruh Yigit
  2022-04-02  7:11 ` [v1 2/4] common/mlx5: add modify ECN capability check Sean Zhang
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Sean Zhang @ 2022-04-02  7:11 UTC (permalink / raw)
  To: Ori Kam, Xiaoyun Li, Aman Singh, Yuying Zhang, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko
  Cc: dev, Jiawei Wang

From: Jiawei Wang <jiaweiw@nvidia.com>

This patch introduces the IPv4/IPv6 ECN modify field support, and
adds the testpmd CLI commands support.

Usage:
	modify_field op set dst_type ipv4_ecn src_type ...

For example:

flow create 0 ingress group 1 pattern eth / ipv4 /  end actions
	modify_field op set dst_type ipv4_ecn src_type value src_value
	0x03 width 2 / queue index 0 / end

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 3 ++-
 lib/ethdev/rte_flow.h       | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index fc4a6d9cca..3250add834 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -795,7 +795,8 @@ static const char *const modify_field_ids[] = {
 	"tcp_seq_num", "tcp_ack_num", "tcp_flags",
 	"udp_port_src", "udp_port_dst",
 	"vxlan_vni", "geneve_vni", "gtp_teid",
-	"tag", "mark", "meta", "pointer", "value", NULL
+	"tag", "mark", "meta", "pointer", "value",
+	"ipv4_ecn", "ipv6_ecn", NULL
 };
 
 /** Maximum number of subsequent tokens and arguments on the stack. */
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index d8827dd184..1b56f23cba 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -3690,6 +3690,8 @@ enum rte_flow_field_id {
 	RTE_FLOW_FIELD_META,		/**< Metadata value. */
 	RTE_FLOW_FIELD_POINTER,		/**< Memory pointer. */
 	RTE_FLOW_FIELD_VALUE,		/**< Immediate value. */
+	RTE_FLOW_FIELD_IPV4_ECN,	/**< IPv4 ECN. */
+	RTE_FLOW_FIELD_IPV6_ECN,	/**< IPv6 ECN. */
 };
 
 /**
-- 
2.31.1


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

* [v1 2/4] common/mlx5: add modify ECN capability check
  2022-04-02  7:11 [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header Sean Zhang
  2022-04-02  7:11 ` [v1 1/4] ethdev: add IPv4/IPv6 ECN header rewrite action Sean Zhang
@ 2022-04-02  7:11 ` Sean Zhang
  2022-06-06  8:05   ` Slava Ovsiienko
  2022-04-02  7:11 ` [v1 3/4] net/mlx5: add support to modify ECN field Sean Zhang
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Sean Zhang @ 2022-04-02  7:11 UTC (permalink / raw)
  To: Matan Azrad, Viacheslav Ovsiienko; +Cc: dev

Flag outer_ip_ecn in header modify capabilities properties layout is
added in order to check if the firmware supports modification of ecn
field.

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
---
 drivers/common/mlx5/mlx5_devx_cmds.c |  3 ++
 drivers/common/mlx5/mlx5_devx_cmds.h |  1 +
 drivers/common/mlx5/mlx5_prm.h       | 62 +++++++++++++++++++++++++++-
 3 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index d02ac2a678..72296c1ca3 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -1047,6 +1047,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx,
 	attr->flow.tunnel_header_2_3 = MLX5_GET
 		(flow_table_nic_cap, hcattr,
 		 ft_field_support_2_nic_receive.tunnel_header_2_3);
+	attr->modify_outer_ip_ecn = MLX5_GET
+		(flow_table_nic_cap, hcattr,
+		 ft_header_modify_nic_receive.outer_ip_ecn);
 	attr->pkt_integrity_match = mlx5_devx_query_pkt_integrity_match(hcattr);
 	attr->inner_ipv4_ihl = MLX5_GET
 		(flow_table_nic_cap, hcattr,
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h
index 1bac18c59d..6e9e23f593 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.h
+++ b/drivers/common/mlx5/mlx5_devx_cmds.h
@@ -256,6 +256,7 @@ struct mlx5_hca_attr {
 	uint32_t esw_mgr_vport_id_valid:1; /* E-Switch Mgr vport ID is valid. */
 	uint16_t esw_mgr_vport_id; /* E-Switch Mgr vport ID . */
 	uint16_t max_wqe_sz_sq;
+	uint32_t modify_outer_ip_ecn:1;
 };
 
 /* LAG Context. */
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 44b18225f6..caaa4c7fb9 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -744,6 +744,7 @@ enum mlx5_modification_field {
 	MLX5_MODI_OUT_TCP_ACK_NUM,
 	MLX5_MODI_IN_TCP_ACK_NUM = 0x5C,
 	MLX5_MODI_GTP_TEID = 0x6E,
+	MLX5_MODI_OUT_IP_ECN = 0x73,
 };
 
 /* Total number of metadata reg_c's. */
@@ -1884,6 +1885,62 @@ struct mlx5_ifc_roce_caps_bits {
 	u8 reserved_at_20[0x7e0];
 };
 
+struct mlx5_ifc_ft_fields_support_bits {
+	u8 outer_dmac[0x1];
+	u8 outer_smac[0x1];
+	u8 outer_ether_type[0x1];
+	u8 reserved_at_3[0x1];
+	u8 outer_first_prio[0x1];
+	u8 outer_first_cfi[0x1];
+	u8 outer_first_vid[0x1];
+	u8 reserved_at_7[0x1];
+	u8 outer_second_prio[0x1];
+	u8 outer_second_cfi[0x1];
+	u8 outer_second_vid[0x1];
+	u8 reserved_at_b[0x1];
+	u8 outer_sip[0x1];
+	u8 outer_dip[0x1];
+	u8 outer_frag[0x1];
+	u8 outer_ip_protocol[0x1];
+	u8 outer_ip_ecn[0x1];
+	u8 outer_ip_dscp[0x1];
+	u8 outer_udp_sport[0x1];
+	u8 outer_udp_dport[0x1];
+	u8 outer_tcp_sport[0x1];
+	u8 outer_tcp_dport[0x1];
+	u8 outer_tcp_flags[0x1];
+	u8 outer_gre_protocol[0x1];
+	u8 outer_gre_key[0x1];
+	u8 outer_vxlan_vni[0x1];
+	u8 reserved_at_1a[0x5];
+	u8 source_eswitch_port[0x1];
+	u8 inner_dmac[0x1];
+	u8 inner_smac[0x1];
+	u8 inner_ether_type[0x1];
+	u8 reserved_at_23[0x1];
+	u8 inner_first_prio[0x1];
+	u8 inner_first_cfi[0x1];
+	u8 inner_first_vid[0x1];
+	u8 reserved_at_27[0x1];
+	u8 inner_second_prio[0x1];
+	u8 inner_second_cfi[0x1];
+	u8 inner_second_vid[0x1];
+	u8 reserved_at_2b[0x1];
+	u8 inner_sip[0x1];
+	u8 inner_dip[0x1];
+	u8 inner_frag[0x1];
+	u8 inner_ip_protocol[0x1];
+	u8 inner_ip_ecn[0x1];
+	u8 inner_ip_dscp[0x1];
+	u8 inner_udp_sport[0x1];
+	u8 inner_udp_dport[0x1];
+	u8 inner_tcp_sport[0x1];
+	u8 inner_tcp_dport[0x1];
+	u8 inner_tcp_flags[0x1];
+	u8 reserved_at_37[0x9];
+	u8 reserved_at_40[0x40];
+};
+
 /*
  * Table 1872 - Flow Table Fields Supported 2 Format
  */
@@ -1923,7 +1980,10 @@ struct mlx5_ifc_flow_table_nic_cap_bits {
 		flow_table_properties_nic_transmit_rdma;
 	struct mlx5_ifc_flow_table_prop_layout_bits
 		flow_table_properties_nic_transmit_sniffer;
-	u8 reserved_at_e00[0x600];
+	u8 reserved_at_e00[0x200];
+	struct mlx5_ifc_ft_fields_support_bits
+		ft_header_modify_nic_receive;
+	u8 reserved_at_1080[0x380];
 	struct mlx5_ifc_ft_fields_support_2_bits
 		ft_field_support_2_nic_receive;
 };
-- 
2.31.1


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

* [v1 3/4] net/mlx5: add support to modify ECN field
  2022-04-02  7:11 [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header Sean Zhang
  2022-04-02  7:11 ` [v1 1/4] ethdev: add IPv4/IPv6 ECN header rewrite action Sean Zhang
  2022-04-02  7:11 ` [v1 2/4] common/mlx5: add modify ECN capability check Sean Zhang
@ 2022-04-02  7:11 ` Sean Zhang
  2022-06-06  7:17   ` Slava Ovsiienko
  2022-04-02  7:11 ` [v1 4/4] net/mlx5: add modify field support in meter Sean Zhang
  2022-06-01 18:51 ` [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header Ferruh Yigit
  4 siblings, 1 reply; 14+ messages in thread
From: Sean Zhang @ 2022-04-02  7:11 UTC (permalink / raw)
  To: Matan Azrad, Viacheslav Ovsiienko; +Cc: dev

This patch is to support modify ECN field in IPv4/IPv6 header.

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 1e9bd63635..e416eb5701 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1449,6 +1449,9 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,
 	case RTE_FLOW_FIELD_POINTER:
 	case RTE_FLOW_FIELD_VALUE:
 		return inherit < 0 ? 0 : inherit;
+	case RTE_FLOW_FIELD_IPV4_ECN:
+	case RTE_FLOW_FIELD_IPV6_ECN:
+		return 2;
 	default:
 		MLX5_ASSERT(false);
 	}
@@ -1826,6 +1829,13 @@ mlx5_flow_field_id_to_modify_info
 					(meta_count - width)) & meta_mask);
 		}
 		break;
+	case RTE_FLOW_FIELD_IPV4_ECN:
+	case RTE_FLOW_FIELD_IPV6_ECN:
+		info[idx] = (struct field_modify_info){1, 0,
+					MLX5_MODI_OUT_IP_ECN};
+		if (mask)
+			mask[idx] = 0x3 >> (2 - width);
+		break;
 	case RTE_FLOW_FIELD_POINTER:
 	case RTE_FLOW_FIELD_VALUE:
 	default:
@@ -4825,6 +4835,7 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 	int ret = 0;
 	struct mlx5_priv *priv = dev->data->dev_private;
 	struct mlx5_sh_config *config = &priv->sh->config;
+	struct mlx5_hca_attr *hca_attr = &priv->sh->cdev->config.hca_attr;
 	const struct rte_flow_action_modify_field *action_modify_field =
 		action->conf;
 	uint32_t dst_width = mlx5_flow_item_field_width(dev,
@@ -4952,6 +4963,15 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 				RTE_FLOW_ERROR_TYPE_ACTION, action,
 				"add and sub operations"
 				" are not supported");
+	if (action_modify_field->dst.field == RTE_FLOW_FIELD_IPV4_ECN ||
+	    action_modify_field->src.field == RTE_FLOW_FIELD_IPV4_ECN ||
+	    action_modify_field->dst.field == RTE_FLOW_FIELD_IPV6_ECN ||
+	    action_modify_field->src.field == RTE_FLOW_FIELD_IPV6_ECN)
+		if (!hca_attr->modify_outer_ip_ecn &&
+		    !attr->transfer && !attr->group)
+			return rte_flow_error_set(error, ENOTSUP,
+				RTE_FLOW_ERROR_TYPE_ACTION, action,
+				"modifications of the ECN for current firmware is not supported");
 	return (action_modify_field->width / 32) +
 	       !!(action_modify_field->width % 32);
 }
-- 
2.31.1


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

* [v1 4/4] net/mlx5: add modify field support in meter
  2022-04-02  7:11 [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header Sean Zhang
                   ` (2 preceding siblings ...)
  2022-04-02  7:11 ` [v1 3/4] net/mlx5: add support to modify ECN field Sean Zhang
@ 2022-04-02  7:11 ` Sean Zhang
  2022-06-06  7:18   ` Slava Ovsiienko
  2022-06-01 18:51 ` [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header Ferruh Yigit
  4 siblings, 1 reply; 14+ messages in thread
From: Sean Zhang @ 2022-04-02  7:11 UTC (permalink / raw)
  To: Matan Azrad, Viacheslav Ovsiienko; +Cc: dev

This patch introduces MODIFY_FIELD action support in meter. User can
create meter policy with MODIFY_FIELD action in green/yellow action.

For example:

testpmd> add port meter policy 0 21 g_actions modify_field op set
	dst_type ipv4_ecn src_type value src_value 3 width 2 / ...

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
---
 doc/guides/nics/mlx5.rst           |  4 +--
 drivers/net/mlx5/mlx5_flow.c       |  5 ++-
 drivers/net/mlx5/mlx5_flow.h       |  2 ++
 drivers/net/mlx5/mlx5_flow_dv.c    | 49 +++++++++++++++++++++++++++---
 drivers/net/mlx5/mlx5_flow_meter.c |  2 +-
 5 files changed, 54 insertions(+), 8 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 4805d08a76..b6d51dc7c9 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -443,8 +443,8 @@ Limitations
      - yellow: NULL or END.
      - RED: DROP / END.
   - The only supported meter policy actions:
-     - green: QUEUE, RSS, PORT_ID, REPRESENTED_PORT, JUMP, DROP, MARK and SET_TAG.
-     - yellow: QUEUE, RSS, PORT_ID, REPRESENTED_PORT, JUMP, DROP, MARK and SET_TAG.
+     - green: QUEUE, RSS, PORT_ID, REPRESENTED_PORT, JUMP, DROP, MODIFY_FIELD, MARK and SET_TAG.
+     - yellow: QUEUE, RSS, PORT_ID, REPRESENTED_PORT, JUMP, DROP, MODIFY_FIELD, MARK and SET_TAG.
      - RED: must be DROP.
   - Policy actions of RSS for green and yellow should have the same configuration except queues.
   - Policy with RSS/queue action is not supported when ``dv_xmeta_en`` enabled.
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 78cb38d42b..52b5463648 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -7867,6 +7867,8 @@ mlx5_flow_destroy_mtr_acts(struct rte_eth_dev *dev,
  *   Meter policy struct.
  * @param[in] action
  *   Action specification used to create meter actions.
+ * @param[in] attr
+ *   Flow rule attributes.
  * @param[out] error
  *   Perform verbose error reporting if not NULL. Initialized in case of
  *   error only.
@@ -7878,12 +7880,13 @@ int
 mlx5_flow_create_mtr_acts(struct rte_eth_dev *dev,
 		      struct mlx5_flow_meter_policy *mtr_policy,
 		      const struct rte_flow_action *actions[RTE_COLORS],
+		      struct rte_flow_attr *attr,
 		      struct rte_mtr_error *error)
 {
 	const struct mlx5_flow_driver_ops *fops;
 
 	fops = flow_get_drv_ops(MLX5_FLOW_TYPE_DV);
-	return fops->create_mtr_acts(dev, mtr_policy, actions, error);
+	return fops->create_mtr_acts(dev, mtr_policy, actions, attr, error);
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index f56115dd11..ed9b9e4876 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -1359,6 +1359,7 @@ typedef int (*mlx5_flow_create_mtr_acts_t)
 			(struct rte_eth_dev *dev,
 		      struct mlx5_flow_meter_policy *mtr_policy,
 		      const struct rte_flow_action *actions[RTE_COLORS],
+		      struct rte_flow_attr *attr,
 		      struct rte_mtr_error *error);
 typedef void (*mlx5_flow_destroy_mtr_acts_t)
 			(struct rte_eth_dev *dev,
@@ -2017,6 +2018,7 @@ void mlx5_flow_destroy_mtr_acts(struct rte_eth_dev *dev,
 int mlx5_flow_create_mtr_acts(struct rte_eth_dev *dev,
 		      struct mlx5_flow_meter_policy *mtr_policy,
 		      const struct rte_flow_action *actions[RTE_COLORS],
+		      struct rte_flow_attr *attr,
 		      struct rte_mtr_error *error);
 int mlx5_flow_create_policy_rules(struct rte_eth_dev *dev,
 			     struct mlx5_flow_meter_policy *mtr_policy);
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index e416eb5701..a01ba04c3b 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -15579,6 +15579,8 @@ flow_dv_destroy_mtr_policy_acts(struct rte_eth_dev *dev,
  *   Meter policy struct.
  * @param[in] action
  *   Action specification used to create meter actions.
+ * @param[in] attr
+ *   Pointer to the flow attributes.
  * @param[out] error
  *   Perform verbose error reporting if not NULL. Initialized in case of
  *   error only.
@@ -15590,6 +15592,7 @@ static int
 __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev,
 			struct mlx5_flow_meter_policy *mtr_policy,
 			const struct rte_flow_action *actions[RTE_COLORS],
+			struct rte_flow_attr *attr,
 			enum mlx5_meter_domain domain,
 			struct rte_mtr_error *error)
 {
@@ -15886,6 +15889,28 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev,
 				action_flags |= MLX5_FLOW_ACTION_JUMP;
 				break;
 			}
+			case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD:
+			{
+				if (i >= MLX5_MTR_RTE_COLORS)
+					return -rte_mtr_error_set(error,
+					  ENOTSUP,
+					  RTE_MTR_ERROR_TYPE_METER_POLICY,
+					  NULL,
+					  "cannot create policy modify field for this color");
+				if (flow_dv_convert_action_modify_field
+					(dev, mhdr_res, act, attr, &flow_err))
+					return -rte_mtr_error_set(error,
+					ENOTSUP,
+					RTE_MTR_ERROR_TYPE_METER_POLICY,
+					NULL, "cannot setup policy modify field action");
+				if (!mhdr_res->actions_num)
+					return -rte_mtr_error_set(error,
+					ENOTSUP,
+					RTE_MTR_ERROR_TYPE_METER_POLICY,
+					NULL, "cannot find policy modify field action");
+				action_flags |= MLX5_FLOW_ACTION_MODIFY_FIELD;
+				break;
+			}
 			/*
 			 * No need to check meter hierarchy for Y or R colors
 			 * here since it is done in the validation stage.
@@ -15954,7 +15979,8 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev,
 					  RTE_MTR_ERROR_TYPE_METER_POLICY,
 					  NULL, "action type not supported");
 			}
-			if (action_flags & MLX5_FLOW_ACTION_SET_TAG) {
+			if ((action_flags & MLX5_FLOW_ACTION_SET_TAG) ||
+			    (action_flags & MLX5_FLOW_ACTION_MODIFY_FIELD)) {
 				/* create modify action if needed. */
 				dev_flow.dv.group = 1;
 				if (flow_dv_modify_hdr_resource_register
@@ -15962,8 +15988,7 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev,
 					return -rte_mtr_error_set(error,
 						ENOTSUP,
 						RTE_MTR_ERROR_TYPE_METER_POLICY,
-						NULL, "cannot register policy "
-						"set tag action");
+						NULL, "cannot register policy set tag/modify field action");
 				act_cnt->modify_hdr =
 					dev_flow.handle->dvh.modify_hdr;
 			}
@@ -15983,6 +16008,8 @@ __flow_dv_create_domain_policy_acts(struct rte_eth_dev *dev,
  *   Meter policy struct.
  * @param[in] action
  *   Action specification used to create meter actions.
+ * @param[in] attr
+ *   Pointer to the flow attributes.
  * @param[out] error
  *   Perform verbose error reporting if not NULL. Initialized in case of
  *   error only.
@@ -15994,6 +16021,7 @@ static int
 flow_dv_create_mtr_policy_acts(struct rte_eth_dev *dev,
 		      struct mlx5_flow_meter_policy *mtr_policy,
 		      const struct rte_flow_action *actions[RTE_COLORS],
+		      struct rte_flow_attr *attr,
 		      struct rte_mtr_error *error)
 {
 	int ret, i;
@@ -16005,7 +16033,7 @@ flow_dv_create_mtr_policy_acts(struct rte_eth_dev *dev,
 			MLX5_MTR_SUB_POLICY_NUM_MASK;
 		if (sub_policy_num) {
 			ret = __flow_dv_create_domain_policy_acts(dev,
-				mtr_policy, actions,
+				mtr_policy, actions, attr,
 				(enum mlx5_meter_domain)i, error);
 			/* Cleaning resource is done in the caller level. */
 			if (ret)
@@ -18176,6 +18204,19 @@ flow_dv_validate_mtr_policy_acts(struct rte_eth_dev *dev,
 				action_flags[i] |=
 				MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY;
 				break;
+			case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD:
+				ret = flow_dv_validate_action_modify_field(dev,
+					action_flags[i], act, attr, &flow_err);
+				if (ret < 0)
+					return -rte_mtr_error_set(error,
+					  ENOTSUP,
+					  RTE_MTR_ERROR_TYPE_METER_POLICY,
+					  NULL, flow_err.message ?
+					  flow_err.message :
+					  "Modify field action validate check fail");
+				++actions_n;
+				action_flags[i] |= MLX5_FLOW_ACTION_MODIFY_FIELD;
+				break;
 			default:
 				return -rte_mtr_error_set(error, ENOTSUP,
 					RTE_MTR_ERROR_TYPE_METER_POLICY,
diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c
index a3d1f2c08d..75672a4cd2 100644
--- a/drivers/net/mlx5/mlx5_flow_meter.c
+++ b/drivers/net/mlx5/mlx5_flow_meter.c
@@ -885,7 +885,7 @@ mlx5_flow_meter_policy_add(struct rte_eth_dev *dev,
 	}
 	rte_spinlock_init(&mtr_policy->sl);
 	ret = mlx5_flow_create_mtr_acts(dev, mtr_policy,
-					policy->actions, error);
+					policy->actions, &attr, error);
 	if (ret)
 		goto policy_add_err;
 	if (mtr_policy->is_hierarchy) {
-- 
2.31.1


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

* Re: [v1 1/4] ethdev: add IPv4/IPv6 ECN header rewrite action
  2022-04-02  7:11 ` [v1 1/4] ethdev: add IPv4/IPv6 ECN header rewrite action Sean Zhang
@ 2022-06-01 18:51   ` Ferruh Yigit
  2022-06-02  5:48     ` Ori Kam
  0 siblings, 1 reply; 14+ messages in thread
From: Ferruh Yigit @ 2022-06-01 18:51 UTC (permalink / raw)
  To: Sean Zhang, Ori Kam, Xiaoyun Li, Aman Singh, Yuying Zhang,
	Thomas Monjalon, Andrew Rybchenko
  Cc: dev, Jiawei Wang, Alexander Kozyrev

On 4/2/2022 8:11 AM, Sean Zhang wrote:
> From: Jiawei Wang <jiaweiw@nvidia.com>
> 
> This patch introduces the IPv4/IPv6 ECN modify field support, and
> adds the testpmd CLI commands support.
> 
> Usage:
> 	modify_field op set dst_type ipv4_ecn src_type ...
> 
> For example:
> 
> flow create 0 ingress group 1 pattern eth / ipv4 /  end actions
> 	modify_field op set dst_type ipv4_ecn src_type value src_value
> 	0x03 width 2 / queue index 0 / end
> 
> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> ---
>   app/test-pmd/cmdline_flow.c | 3 ++-
>   lib/ethdev/rte_flow.h       | 2 ++
>   2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index fc4a6d9cca..3250add834 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -795,7 +795,8 @@ static const char *const modify_field_ids[] = {
>   	"tcp_seq_num", "tcp_ack_num", "tcp_flags",
>   	"udp_port_src", "udp_port_dst",
>   	"vxlan_vni", "geneve_vni", "gtp_teid",
> -	"tag", "mark", "meta", "pointer", "value", NULL
> +	"tag", "mark", "meta", "pointer", "value",
> +	"ipv4_ecn", "ipv6_ecn", NULL
>   };
>   
>   /** Maximum number of subsequent tokens and arguments on the stack. */
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index d8827dd184..1b56f23cba 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -3690,6 +3690,8 @@ enum rte_flow_field_id {
>   	RTE_FLOW_FIELD_META,		/**< Metadata value. */
>   	RTE_FLOW_FIELD_POINTER,		/**< Memory pointer. */
>   	RTE_FLOW_FIELD_VALUE,		/**< Immediate value. */
> +	RTE_FLOW_FIELD_IPV4_ECN,	/**< IPv4 ECN. */
> +	RTE_FLOW_FIELD_IPV6_ECN,	/**< IPv6 ECN. */
>   };
>   
>   /**

cc'ed Alexander.

Patch looks good to me, only perhaps release notes can be updated, what 
do you think?

@Ori, @Alex, do you have any objection/comment?

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

* Re: [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header
  2022-04-02  7:11 [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header Sean Zhang
                   ` (3 preceding siblings ...)
  2022-04-02  7:11 ` [v1 4/4] net/mlx5: add modify field support in meter Sean Zhang
@ 2022-06-01 18:51 ` Ferruh Yigit
  2022-06-02 11:44   ` Ferruh Yigit
  4 siblings, 1 reply; 14+ messages in thread
From: Ferruh Yigit @ 2022-06-01 18:51 UTC (permalink / raw)
  To: Sean Zhang, Matan Azrad, Viacheslav Ovsiienko; +Cc: dev

On 4/2/2022 8:11 AM, Sean Zhang wrote:
> This patch set adds support for modifying ECN fields in IPv4/IPv6
> header, and also adds support for modify_filed action in meter.
> 
> Jiawei Wang (1):
>    ethdev: add IPv4/IPv6 ECN header rewrite action
> 
> Sean Zhang (3):
>    common/mlx5: add modify ECN capability check
>    net/mlx5: add support to modify ECN field
>    net/mlx5: add modify field support in meter
> 

To be able to merge it as set, mlx5 driver patches requires driver 
maintainer's ack/review.

@Matan, @Slava, can you please check them?

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

* RE: [v1 1/4] ethdev: add IPv4/IPv6 ECN header rewrite action
  2022-06-01 18:51   ` Ferruh Yigit
@ 2022-06-02  5:48     ` Ori Kam
  2022-06-02 11:44       ` Ferruh Yigit
  0 siblings, 1 reply; 14+ messages in thread
From: Ori Kam @ 2022-06-02  5:48 UTC (permalink / raw)
  To: Ferruh Yigit, Sean Zhang (Networking SW),
	Xiaoyun Li, Aman Singh, Yuying Zhang,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Andrew Rybchenko
  Cc: dev, Jiawei(Jonny) Wang, Alexander Kozyrev



> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
> Sent: Wednesday, June 1, 2022 9:51 PM
> To: Sean Zhang (Networking SW) <xiazhang@nvidia.com>; Ori Kam <orika@nvidia.com>; Xiaoyun Li
> <xiaoyun.li@intel.com>; Aman Singh <aman.deep.singh@intel.com>; Yuying Zhang
> <yuying.zhang@intel.com>; NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
> Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Cc: dev@dpdk.org; Jiawei(Jonny) Wang <jiaweiw@nvidia.com>; Alexander Kozyrev
> <akozyrev@nvidia.com>
> Subject: Re: [v1 1/4] ethdev: add IPv4/IPv6 ECN header rewrite action
> 
> On 4/2/2022 8:11 AM, Sean Zhang wrote:
> > From: Jiawei Wang <jiaweiw@nvidia.com>
> >
> > This patch introduces the IPv4/IPv6 ECN modify field support, and
> > adds the testpmd CLI commands support.
> >
> > Usage:
> > 	modify_field op set dst_type ipv4_ecn src_type ...
> >
> > For example:
> >
> > flow create 0 ingress group 1 pattern eth / ipv4 /  end actions
> > 	modify_field op set dst_type ipv4_ecn src_type value src_value
> > 	0x03 width 2 / queue index 0 / end
> >
> > Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
> > ---
> >   app/test-pmd/cmdline_flow.c | 3 ++-
> >   lib/ethdev/rte_flow.h       | 2 ++
> >   2 files changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> > index fc4a6d9cca..3250add834 100644
> > --- a/app/test-pmd/cmdline_flow.c
> > +++ b/app/test-pmd/cmdline_flow.c
> > @@ -795,7 +795,8 @@ static const char *const modify_field_ids[] = {
> >   	"tcp_seq_num", "tcp_ack_num", "tcp_flags",
> >   	"udp_port_src", "udp_port_dst",
> >   	"vxlan_vni", "geneve_vni", "gtp_teid",
> > -	"tag", "mark", "meta", "pointer", "value", NULL
> > +	"tag", "mark", "meta", "pointer", "value",
> > +	"ipv4_ecn", "ipv6_ecn", NULL
> >   };
> >
> >   /** Maximum number of subsequent tokens and arguments on the stack. */
> > diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> > index d8827dd184..1b56f23cba 100644
> > --- a/lib/ethdev/rte_flow.h
> > +++ b/lib/ethdev/rte_flow.h
> > @@ -3690,6 +3690,8 @@ enum rte_flow_field_id {
> >   	RTE_FLOW_FIELD_META,		/**< Metadata value. */
> >   	RTE_FLOW_FIELD_POINTER,		/**< Memory pointer. */
> >   	RTE_FLOW_FIELD_VALUE,		/**< Immediate value. */
> > +	RTE_FLOW_FIELD_IPV4_ECN,	/**< IPv4 ECN. */
> > +	RTE_FLOW_FIELD_IPV6_ECN,	/**< IPv6 ECN. */
> >   };
> >
> >   /**
> 
> cc'ed Alexander.
> 
> Patch looks good to me, only perhaps release notes can be updated, what
> do you think?
> 
> @Ori, @Alex, do you have any objection/comment?

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori

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

* Re: [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header
  2022-06-01 18:51 ` [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header Ferruh Yigit
@ 2022-06-02 11:44   ` Ferruh Yigit
  2022-06-02 13:13     ` Sean Zhang (Networking SW)
  0 siblings, 1 reply; 14+ messages in thread
From: Ferruh Yigit @ 2022-06-02 11:44 UTC (permalink / raw)
  To: Sean Zhang, Matan Azrad, Viacheslav Ovsiienko; +Cc: dev

On 6/1/2022 7:51 PM, Ferruh Yigit wrote:
> On 4/2/2022 8:11 AM, Sean Zhang wrote:
>> This patch set adds support for modifying ECN fields in IPv4/IPv6
>> header, and also adds support for modify_filed action in meter.
>>
>> Jiawei Wang (1):
>>    ethdev: add IPv4/IPv6 ECN header rewrite action
>>
>> Sean Zhang (3):
>>    common/mlx5: add modify ECN capability check
>>    net/mlx5: add support to modify ECN field
>>    net/mlx5: add modify field support in meter
>>
> 
> To be able to merge it as set, mlx5 driver patches requires driver 
> maintainer's ack/review.
> 
> @Matan, @Slava, can you please check them?

Hi Sean,

ethdev patch is merged to have it in -rc1, driver patches can be handled 
separately.


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

* Re: [v1 1/4] ethdev: add IPv4/IPv6 ECN header rewrite action
  2022-06-02  5:48     ` Ori Kam
@ 2022-06-02 11:44       ` Ferruh Yigit
  0 siblings, 0 replies; 14+ messages in thread
From: Ferruh Yigit @ 2022-06-02 11:44 UTC (permalink / raw)
  To: Ori Kam, Sean Zhang (Networking SW),
	Xiaoyun Li, Aman Singh, Yuying Zhang,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Andrew Rybchenko
  Cc: dev, Jiawei(Jonny) Wang, Alexander Kozyrev

On 6/2/2022 6:48 AM, Ori Kam wrote:
> 
> 
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
>> Sent: Wednesday, June 1, 2022 9:51 PM
>> To: Sean Zhang (Networking SW) <xiazhang@nvidia.com>; Ori Kam <orika@nvidia.com>; Xiaoyun Li
>> <xiaoyun.li@intel.com>; Aman Singh <aman.deep.singh@intel.com>; Yuying Zhang
>> <yuying.zhang@intel.com>; NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>;
>> Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>> Cc: dev@dpdk.org; Jiawei(Jonny) Wang <jiaweiw@nvidia.com>; Alexander Kozyrev
>> <akozyrev@nvidia.com>
>> Subject: Re: [v1 1/4] ethdev: add IPv4/IPv6 ECN header rewrite action
>>
>> On 4/2/2022 8:11 AM, Sean Zhang wrote:
>>> From: Jiawei Wang <jiaweiw@nvidia.com>
>>>
>>> This patch introduces the IPv4/IPv6 ECN modify field support, and
>>> adds the testpmd CLI commands support.
>>>
>>> Usage:
>>> 	modify_field op set dst_type ipv4_ecn src_type ...
>>>
>>> For example:
>>>
>>> flow create 0 ingress group 1 pattern eth / ipv4 /  end actions
>>> 	modify_field op set dst_type ipv4_ecn src_type value src_value
>>> 	0x03 width 2 / queue index 0 / end
>>>
>>> Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
>>
>> cc'ed Alexander.
>>
>> Patch looks good to me, only perhaps release notes can be updated, what
>> do you think?
>>
>> @Ori, @Alex, do you have any objection/comment?
> 
> Acked-by: Ori Kam <orika@nvidia.com>

Applied to dpdk-next-net/main, thanks.


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

* RE: [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header
  2022-06-02 11:44   ` Ferruh Yigit
@ 2022-06-02 13:13     ` Sean Zhang (Networking SW)
  0 siblings, 0 replies; 14+ messages in thread
From: Sean Zhang (Networking SW) @ 2022-06-02 13:13 UTC (permalink / raw)
  To: Ferruh Yigit, Matan Azrad, Slava Ovsiienko; +Cc: dev



> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
> Sent: Thursday, June 2, 2022 7:45 PM
> To: Sean Zhang (Networking SW) <xiazhang@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org
> Subject: Re: [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header
> 
> External email: Use caution opening links or attachments
> 
> 
> On 6/1/2022 7:51 PM, Ferruh Yigit wrote:
> > On 4/2/2022 8:11 AM, Sean Zhang wrote:
> >> This patch set adds support for modifying ECN fields in IPv4/IPv6
> >> header, and also adds support for modify_filed action in meter.
> >>
> >> Jiawei Wang (1):
> >>    ethdev: add IPv4/IPv6 ECN header rewrite action
> >>
> >> Sean Zhang (3):
> >>    common/mlx5: add modify ECN capability check
> >>    net/mlx5: add support to modify ECN field
> >>    net/mlx5: add modify field support in meter
> >>
> >
> > To be able to merge it as set, mlx5 driver patches requires driver
> > maintainer's ack/review.
> >
> > @Matan, @Slava, can you please check them?
> 
> Hi Sean,
> 
> ethdev patch is merged to have it in -rc1, driver patches can be handled
> separately.

Got it, thanks. 😊


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

* RE: [v1 3/4] net/mlx5: add support to modify ECN field
  2022-04-02  7:11 ` [v1 3/4] net/mlx5: add support to modify ECN field Sean Zhang
@ 2022-06-06  7:17   ` Slava Ovsiienko
  0 siblings, 0 replies; 14+ messages in thread
From: Slava Ovsiienko @ 2022-06-06  7:17 UTC (permalink / raw)
  To: Sean Zhang (Networking SW), Matan Azrad; +Cc: dev

> -----Original Message-----
> From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> Sent: Saturday, April 2, 2022 10:12
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org
> Subject: [v1 3/4] net/mlx5: add support to modify ECN field
> 
> This patch is to support modify ECN field in IPv4/IPv6 header.
> 
> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

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

* RE: [v1 4/4] net/mlx5: add modify field support in meter
  2022-04-02  7:11 ` [v1 4/4] net/mlx5: add modify field support in meter Sean Zhang
@ 2022-06-06  7:18   ` Slava Ovsiienko
  0 siblings, 0 replies; 14+ messages in thread
From: Slava Ovsiienko @ 2022-06-06  7:18 UTC (permalink / raw)
  To: Sean Zhang (Networking SW), Matan Azrad; +Cc: dev

> -----Original Message-----
> From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> Sent: Saturday, April 2, 2022 10:12
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org
> Subject: [v1 4/4] net/mlx5: add modify field support in meter
> 
> This patch introduces MODIFY_FIELD action support in meter. User can create
> meter policy with MODIFY_FIELD action in green/yellow action.
> 
> For example:
> 
> testpmd> add port meter policy 0 21 g_actions modify_field op set
> 	dst_type ipv4_ecn src_type value src_value 3 width 2 / ...
> 
> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>


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

* RE: [v1 2/4] common/mlx5: add modify ECN capability check
  2022-04-02  7:11 ` [v1 2/4] common/mlx5: add modify ECN capability check Sean Zhang
@ 2022-06-06  8:05   ` Slava Ovsiienko
  0 siblings, 0 replies; 14+ messages in thread
From: Slava Ovsiienko @ 2022-06-06  8:05 UTC (permalink / raw)
  To: Sean Zhang (Networking SW), Matan Azrad; +Cc: dev

> -----Original Message-----
> From: Sean Zhang (Networking SW) <xiazhang@nvidia.com>
> Sent: Saturday, April 2, 2022 10:12
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org
> Subject: [v1 2/4] common/mlx5: add modify ECN capability check
> 
> Flag outer_ip_ecn in header modify capabilities properties layout is added in
> order to check if the firmware supports modification of ecn field.
> 
> Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>


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

end of thread, other threads:[~2022-06-06  8:05 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-02  7:11 [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header Sean Zhang
2022-04-02  7:11 ` [v1 1/4] ethdev: add IPv4/IPv6 ECN header rewrite action Sean Zhang
2022-06-01 18:51   ` Ferruh Yigit
2022-06-02  5:48     ` Ori Kam
2022-06-02 11:44       ` Ferruh Yigit
2022-04-02  7:11 ` [v1 2/4] common/mlx5: add modify ECN capability check Sean Zhang
2022-06-06  8:05   ` Slava Ovsiienko
2022-04-02  7:11 ` [v1 3/4] net/mlx5: add support to modify ECN field Sean Zhang
2022-06-06  7:17   ` Slava Ovsiienko
2022-04-02  7:11 ` [v1 4/4] net/mlx5: add modify field support in meter Sean Zhang
2022-06-06  7:18   ` Slava Ovsiienko
2022-06-01 18:51 ` [v1 0/4] Add support for modifying ECN in IPv4/IPv6 header Ferruh Yigit
2022-06-02 11:44   ` Ferruh Yigit
2022-06-02 13:13     ` Sean Zhang (Networking SW)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.