net/mlx5: support represented port item
PATCH 1/1 net/mlx5: support represented port item
Add support for represented_port item in pattern. And if the spec and mask both are NULL, translate function will not add source vport to matcher.
For example, testpmd starts with PF, VF-rep0 and VF-rep1, below command will redirect packets from VF0 and VF1 to wire:
testpmd> flow create 0 ingress transfer group 0 pattern eth / represented_port / end actions represented_port ethdev_id is 0 / end
--- drivers/net/mlx5/mlx5_flow.h | 4 + drivers/net/mlx5/mlx5_flow_dv.c | 160 +++++++++++++++++++++++++++++++- 2 files changed, 163 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.h +4 -0
@@ -186,6 +186,10 @@ enum mlx5_feature_name {#define MLX5_FLOW_ITEM_INNER_FLEX (UINT64_C(1) << 38)#define MLX5_FLOW_ITEM_FLEX_TUNNEL (UINT64_C(1) << 39) +/* Port Representor/Represented Port item */ +#define MLX5_FLOW_ITEM_PORT_REPRESENTOR (UINT64_C(1) << 40) +#define MLX5_FLOW_ITEM_REPRESENTED_PORT (UINT64_C(1) << 41) +/* Outer Masks. */ #define MLX5_FLOW_LAYER_OUTER_L3 \ (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
drivers/net/mlx5/mlx5_flow_dv.c +159 -1
190 lines not on this page · raw message
Signature · 1 line
2.21.0
Quoted 11 lines
-----Original Message-----
From: Sean Zhang (Networking SW) <[email protected]>
Sent: Saturday, April 2, 2022 9:40
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]
Subject: [v1] net/mlx5: support represented port itemAdd support for
represented_portitem in pattern. And if the spec and mask both are NULL, translate function will not add source vport to matcher.
Quoted 6 lines
For example, testpmd starts with PF, VF-rep0 and VF-rep1, below command will redirect packets from VF0 and VF1 to wire:
testpmd> flow create 0 ingress transfer group 0 pattern eth /represented_port/ end actionsrepresented_portethdev_idis 0 / endSigned-off-by Sean Zhang <[email protected]>
PATCH v2 1/1 net/mlx5: support represented port item
In reply to Sean ZhangAdd support for represented_port item in pattern. And if the spec and mask both are NULL, translate function will not add source vport to matcher.
For example, testpmd starts with PF, VF-rep0 and VF-rep1, below command will redirect packets from VF0 and VF1 to wire:
testpmd> flow create 0 ingress transfer group 0 pattern eth / represented_port / end actions represented_port ethdev_id is 0 / end
---
v2 -- add missing doc
--- doc/guides/nics/features/mlx5.ini | 1 + doc/guides/nics/mlx5.rst | 1 + doc/guides/rel_notes/release_22_07.rst | 1 + drivers/net/mlx5/mlx5_flow.h | 4 + drivers/net/mlx5/mlx5_flow_dv.c | 160 ++++++++++++++++++++++++++++++++- 5 files changed, 166 insertions(+), 1 deletion(-)
doc/guides/nics/features/mlx5.ini +1 -0
@@ -84,6 +84,7 @@ udp = Y vlan = Y vxlan = Y vxlan_gpe = Y +represented_port = Y [rte_flow actions] age = I
doc/guides/nics/mlx5.rst +1 -0
@@ -93,6 +93,7 @@ Features - Connection tracking. - Sub-Function representors. - Sub-Function. +- Matching on represented port. Limitations
doc/guides/rel_notes/release_22_07.rst +1 -0
@@ -116,6 +116,7 @@ New Features * Added support for promiscuous mode on Windows. * Added support for MTU on Windows. * Added matching and RSS on IPsec ESP. + * Added matching on represented port. * **Updated VMware vmxnet3 networking driver.**
drivers/net/mlx5/mlx5_flow.h +4 -0
@@ -189,6 +189,10 @@ enum mlx5_feature_name {/* ESP item */ #define MLX5_FLOW_ITEM_ESP (UINT64_C(1) << 40) +/* Port Representor/Represented Port item */ +#define MLX5_FLOW_ITEM_PORT_REPRESENTOR (UINT64_C(1) << 41) +#define MLX5_FLOW_ITEM_REPRESENTED_PORT (UINT64_C(1) << 42) +/* Outer Masks. */ #define MLX5_FLOW_LAYER_OUTER_L3 \ (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
drivers/net/mlx5/mlx5_flow_dv.c +159 -1
190 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Hi,
Quoted 17 lines
-----Original Message-----
From: Sean Zhang <[email protected]>
Sent: Tuesday, June 7, 2022 2:18 PM
To: NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]
Subject: [v2] net/mlx5: support represented port itemAdd support for
represented_portitem in pattern. And if the spec and mask both are NULL, translate function will not add source vport to matcher.For example, testpmd starts with PF, VF-rep0 and VF-rep1, below command will redirect packets from VF0 and VF1 to wire:
testpmd> flow create 0 ingress transfer group 0 pattern eth /represented_port/ end actionsrepresented_portethdev_idis 0 / end
Quoted 4 lines
Signed-off-by Sean Zhang <[email protected]>---
v2 -- add missing doc
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
v2 cover Add support for modifying ECN in IPv4/IPv6 header
In reply to Sean ZhangThis patch set adds support for modifying ECN fields in IPv4/IPv6 header, and also adds support for modify_filed action in meter.
---
v2 --- rebase and add missing doc
---
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
doc/guides/nics/mlx5.rst | 5 ++- doc/guides/rel_notes/release_22_07.rst | 1 + 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 +- 9 files changed, 141 insertions(+), 9 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v2 1/3 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.
--- 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(-)
drivers/common/mlx5/mlx5_devx_cmds.c +3 -0
@@ -1056,6 +1056,9 @@ struct mlx5_devx_obj * 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,
drivers/common/mlx5/mlx5_devx_cmds.h +1 -0
@@ -257,6 +257,7 @@ struct mlx5_hca_attr { uint32_t crypto_wrapped_import_method:1;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. */
drivers/common/mlx5/mlx5_prm.h +61 -1
80 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 2/3 net/mlx5: add support to modify ECN field
In reply to Sean ZhangThis patch is to support modify ECN field in IPv4/IPv6 header.
--- doc/guides/nics/mlx5.rst | 1 + doc/guides/rel_notes/release_22_07.rst | 1 + drivers/net/mlx5/mlx5_flow_dv.c | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+)
doc/guides/nics/mlx5.rst +1 -0
@@ -93,6 +93,7 @@ Features - Connection tracking. - Sub-Function representors. - Sub-Function. +- Modify IPv4/IPv6 ECN field. Limitations
doc/guides/rel_notes/release_22_07.rst +1 -0
@@ -116,6 +116,7 @@ New Features * Added support for promiscuous mode on Windows. * Added support for MTU on Windows. * Added matching and RSS on IPsec ESP. + * Added support for modifying ECN field of IPv4/IPv6. * **Updated VMware vmxnet3 networking driver.**
drivers/net/mlx5/mlx5_flow_dv.c +20 -0
@@ -1450,6 +1450,9 @@ struct field_modify_info modify_tcp[] = {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); }
@@ -1827,6 +1830,13 @@ struct field_modify_info modify_tcp[] = { (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 :
@@ -4826,6 +4836,7 @@ struct mlx5_list_entry *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,
@@ -4953,6 +4964,15 @@ struct mlx5_list_entry *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 ); }
Signature · 1 line
1.8.3.1
PATCH v2 3/3 net/mlx5: add modify field support in meter
In reply to Sean ZhangThis 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 / ...
--- 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(-)
doc/guides/nics/mlx5.rst +2 -2
@@ -445,8 +445,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, METER and SET_TAG. - - yellow: QUEUE, RSS, PORT_ID, REPRESENTED_PORT, JUMP, DROP, MARK, METER and SET_TAG. + - green: QUEUE, RSS, PORT_ID, REPRESENTED_PORT, JUMP, DROP, MODIFY_FIELD, MARK, METER and SET_TAG. + - yellow: QUEUE, RSS, PORT_ID, REPRESENTED_PORT, JUMP, DROP, MODIFY_FIELD, MARK, METER 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.
drivers/net/mlx5/mlx5_flow.c +4 -1
@@ -7910,6 +7910,8 @@ struct mlx5_flow_workspace** 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.
@@ -7921,12 +7923,13 @@ struct mlx5_flow_workspace* 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); }/**
drivers/net/mlx5/mlx5_flow.h +2 -0
@@ -1375,6 +1375,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,
@@ -2033,6 +2034,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);
drivers/net/mlx5/mlx5_flow_dv.c +45 -4
103 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_meter.c +1 -1
@@ -916,7 +916,7 @@ struct mlx5_flow_meter_policy * }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) {
Signature · 1 line
1.8.3.1
RE: [v2 0/3] Add support for modifying ECN in IPv4/IPv6 header
In reply to Sean ZhangHi,
Quoted 31 lines
-----Original Message-----
From: Sean Zhang <[email protected]>
Sent: Tuesday, June 7, 2022 2:19 PM
To: NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>
Cc: [email protected]
Subject: [v2 0/3] Add support for modifying ECN in IPv4/IPv6 headerThis patch set adds support for modifying ECN fields in IPv4/IPv6 header, and also adds support for
modify_filedaction in meter.---
v2 --- rebase and add missing doc
---
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 meterdoc/guides/nics/mlx5.rst | 5 ++- doc/guides/rel_notes/release_22_07.rst | 1 + 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 +- 9 files changed, 141 insertions(+), 9 deletions(-)
Quoted 2 lines
--
1.8.3.1
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh