net/mlx5: add port representor destination to mirror
cover net/mlx5: add port representor destination to mirror
In order to clone the traffic from FDB to NIC TIR, user can set port representor action as mirror clone destination. In that case cloned traffic will be moved to E-Switch manager root table, and goes to software TIR.
This series adds the port representor support to mirror action. This series depends on the indirect list series [1].
[1]: https://patches.dpdk.org/project/dpdk/list/?series=29662
Suanming Mou (3):
net/mlx5: add port representor action net/mlx5: add port representor destination to mirror app/testpmd: add port representor as sample destination
app/test-pmd/cmdline_flow.c | 1 + doc/guides/nics/mlx5.rst | 6 +++ drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.h | 4 +- drivers/net/mlx5/mlx5_flow_hw.c | 74 ++++++++++++++++++++++++++++++++- 5 files changed, 85 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/3 net/mlx5: add port representor action
The packets handled by port representor action will be steered to E-Switch manager and received by software.
This commit adds port representor action.
--- doc/guides/nics/mlx5.rst | 6 ++++ drivers/net/mlx5/mlx5.h | 2 ++ drivers/net/mlx5/mlx5_flow.h | 4 ++- drivers/net/mlx5/mlx5_flow_hw.c | 55 +++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 1 deletion(-)
doc/guides/nics/mlx5.rst +6 -0
@@ -728,6 +728,12 @@ Limitations The flow engine of a process cannot move from active to standby mode if preceding active application rules are still present and vice versa. +- A driver limitation for ``RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR`` action restricts + the ``port_id`` configuration to only accept the value 0xffff, indicating the E-Switch + manager. If the ``repr_matching_en`` flag is enabled, the traffic will be directed + to the representor of the source virtual port (SF/VF), while if it is disabled, the + traffic will be routed based on the steering rules in the ingress domain. + Statistics ----------
drivers/net/mlx5/mlx5.h +2 -0
@@ -1858,6 +1858,8 @@ struct mlx5_priv {struct mlx5dr_action *hw_drop[2 ];/* HW steering global tag action. */ struct mlx5dr_action *hw_tag[2 ]; +/* HW steering global default miss action. */ +struct mlx5dr_action *hw_def_miss;/* HW steering global send to kernel action. */ struct mlx5dr_action *hw_send_to_kernel[MLX5DR_TABLE_TYPE_MAX ];/* HW steering create ongoing rte flow table list header. */
drivers/net/mlx5/mlx5_flow.h +3 -1
@@ -359,6 +359,7 @@ enum mlx5_feature_name {#define MLX5_FLOW_ACTION_INDIRECT_COUNT (1ull << 43)#define MLX5_FLOW_ACTION_INDIRECT_AGE (1ull << 44)#define MLX5_FLOW_ACTION_QUOTA (1ull << 46) +#define MLX5_FLOW_ACTION_PORT_REPRESENTOR (1ull << 47)#define MLX5_FLOW_DROP_INCLUSIVE_ACTIONS \ (MLX5_FLOW_ACTION_COUNT | MLX5_FLOW_ACTION_SAMPLE | MLX5_FLOW_ACTION_AGE)
@@ -368,7 +369,8 @@ enum mlx5_feature_name { MLX5_FLOW_ACTION_RSS | MLX5_FLOW_ACTION_JUMP | \ MLX5_FLOW_ACTION_DEFAULT_MISS | \ MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY | \ - MLX5_FLOW_ACTION_SEND_TO_KERNEL) + MLX5_FLOW_ACTION_SEND_TO_KERNEL | \ + MLX5_FLOW_ACTION_PORT_REPRESENTOR)#define MLX5_FLOW_FATE_ESWITCH_ACTIONS \ (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID | \
drivers/net/mlx5/mlx5_flow_hw.c +55 -0
103 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/3 net/mlx5: add port representor destination to mirror
In reply to Suanming MouIn order to clone the traffic from FDB to NIC TIR, user can set port representor action as mirror clone destination. In that case cloned traffic will be moved to E-Switch manager root table, and goes to software TIR.
This commit adds the port representor support to mirror action.
--- drivers/net/mlx5/mlx5_flow_hw.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow_hw.c +18 -1
@@ -9735,6 +9735,7 @@ mlx5_mirror_destroy_clone(struct rte_eth_dev *dev,flow_hw_jump_release (dev, clone->action_ctx);break ;case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT : +case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR :case RTE_FLOW_ACTION_TYPE_RAW_ENCAP :case RTE_FLOW_ACTION_TYPE_RAW_DECAP :case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :
@@ -9779,6 +9780,7 @@ mlx5_mirror_terminal_action(const struct rte_flow_action *action)case RTE_FLOW_ACTION_TYPE_RSS :case RTE_FLOW_ACTION_TYPE_QUEUE :case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT : +case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR :return true;default :break ;
@@ -9792,19 +9794,30 @@ mlx5_mirror_validate_sample_action(struct rte_eth_dev *dev, const struct rte_flow_action *action) {struct mlx5_priv *priv = dev->data->dev_private; +const struct rte_flow_action_ethdev *port =NULL ; +bool is_proxy =MLX5_HW_PORT_IS_PROXY (priv); +if (!action) +return false;switch (action->type) {case RTE_FLOW_ACTION_TYPE_QUEUE :case RTE_FLOW_ACTION_TYPE_RSS :if (flow_attr->transfer)return false;break ; +case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR : +if (!is_proxy || !flow_attr->transfer) +return false; + port = action->conf; +if (!port || port->port_id !=MLX5_REPRESENTED_PORT_ESW_MGR ) +return false; +break ;case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT :case RTE_FLOW_ACTION_TYPE_RAW_ENCAP :case RTE_FLOW_ACTION_TYPE_RAW_DECAP :case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP : -if (!priv->sh->esw_mode && !flow_attr->transfer) +if (!is_proxy || !flow_attr->transfer)return false;if (action[0 ].type ==RTE_FLOW_ACTION_TYPE_RAW_DECAP && action[1 ].type !=RTE_FLOW_ACTION_TYPE_RAW_ENCAP )
@@ -9962,6 +9975,7 @@ hw_mirror_format_clone(struct rte_eth_dev *dev,struct mlx5dr_action_dest_attr *dest_attr, uint8_t *reformat_buf, struct rte_flow_error *error) { + struct mlx5_priv *priv = dev->data->dev_private;int ret;uint32_t i;bool decap_seen = false;
@@ -9988,6 +10002,9 @@ hw_mirror_format_clone(struct rte_eth_dev *dev,if (ret)return ret;break ; +case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR : + dest_attr->dest = priv->hw_def_miss; +break ;case RTE_FLOW_ACTION_TYPE_RAW_DECAP : decap_seen = true;break ;
Signature · 1 line
2.34.1
PATCH 3/3 app/testpmd: add port representor as sample destination
In reply to Suanming MouThis commit adds the missing port representor support as sample destination.
--- app/test-pmd/cmdline_flow.c | 1 + 1 file changed, 1 insertion(+)
app/test-pmd/cmdline_flow.c +1 -0
@@ -2472,6 +2472,7 @@ static const enum index next_action_sample[] = {ACTION_VXLAN_ENCAP ,ACTION_NVGRE_ENCAP ,ACTION_REPRESENTED_PORT , +ACTION_PORT_REPRESENTOR ,ACTION_NEXT , ZERO, };
Signature · 1 line
2.34.1
Hi Suanming,
Quoted 27 lines
-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Tuesday, October 17, 2023 3:44 AMIn order to clone the traffic from FDB to NIC TIR, user can set port representor action as mirror clone destination. In that case cloned traffic will be moved to E-Switch manager root table, and goes to software TIR.
This series adds the port representor support to mirror action. This series depends on the indirect list series [1].
[1]: https://patches.dpdk.org/project/dpdk/list/?series=29662
Suanming Mou (3):
net/mlx5: add port representor action net/mlx5: add port representor destination to mirror app/testpmd: add port representor as sample destinationapp/test-pmd/cmdline_flow.c | 1 + doc/guides/nics/mlx5.rst | 6 +++ drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.h | 4 +- drivers/net/mlx5/mlx5_flow_hw.c | 74 ++++++++++++++++++++++++++++++++- 5 files changed, 85 insertions(+), 2 deletions(-)
Quoted 1 line
--
Best,
Ori
v2 cover net/mlx5: add port representor destination to mirror
In reply to Suanming MouIn order to clone the traffic from FDB to NIC TIR, user can set port representor action as mirror clone destination. In that case cloned traffic will be moved to E-Switch manager root table, and goes to software TIR.
This series adds the port representor support to mirror action.
v2:
- add Acked-by
- rebase on top of series [1]
[1]: https://patches.dpdk.org/project/dpdk/list/?series=29662
Suanming Mou (3):
net/mlx5: add port representor action net/mlx5: add port representor destination to mirror app/testpmd: add port representor as sample destination
app/test-pmd/cmdline_flow.c | 1 + doc/guides/nics/mlx5.rst | 6 +++ doc/guides/rel_notes/release_23_11.rst | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.h | 4 +- drivers/net/mlx5/mlx5_flow_hw.c | 74 +++++++++++++++++++++++++- 6 files changed, 86 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/3 net/mlx5: add port representor action
The packets handled by port representor action will be steered to E-Switch manager and received by software.
This commit adds port representor action.
--- doc/guides/nics/mlx5.rst | 6 ++++ drivers/net/mlx5/mlx5.h | 2 ++ drivers/net/mlx5/mlx5_flow.h | 4 ++- drivers/net/mlx5/mlx5_flow_hw.c | 55 +++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 1 deletion(-)
doc/guides/nics/mlx5.rst +6 -0
@@ -743,6 +743,12 @@ Limitations The flow engine of a process cannot move from active to standby mode if preceding active application rules are still present and vice versa. +- A driver limitation for ``RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR`` action restricts + the ``port_id`` configuration to only accept the value 0xffff, indicating the E-Switch + manager. If the ``repr_matching_en`` flag is enabled, the traffic will be directed + to the representor of the source virtual port (SF/VF), while if it is disabled, the + traffic will be routed based on the steering rules in the ingress domain. + Statistics ----------
drivers/net/mlx5/mlx5.h +2 -0
@@ -1858,6 +1858,8 @@ struct mlx5_priv {struct mlx5dr_action *hw_drop[2 ];/* HW steering global tag action. */ struct mlx5dr_action *hw_tag[2 ]; +/* HW steering global default miss action. */ +struct mlx5dr_action *hw_def_miss;/* HW steering global send to kernel action. */ struct mlx5dr_action *hw_send_to_kernel[MLX5DR_TABLE_TYPE_MAX ];/* HW steering create ongoing rte flow table list header. */
drivers/net/mlx5/mlx5_flow.h +3 -1
@@ -361,6 +361,7 @@ enum mlx5_feature_name {#define MLX5_FLOW_ACTION_INDIRECT_COUNT (1ull << 43)#define MLX5_FLOW_ACTION_INDIRECT_AGE (1ull << 44)#define MLX5_FLOW_ACTION_QUOTA (1ull << 46) +#define MLX5_FLOW_ACTION_PORT_REPRESENTOR (1ull << 47)#define MLX5_FLOW_DROP_INCLUSIVE_ACTIONS \ (MLX5_FLOW_ACTION_COUNT | MLX5_FLOW_ACTION_SAMPLE | MLX5_FLOW_ACTION_AGE)
@@ -370,7 +371,8 @@ enum mlx5_feature_name { MLX5_FLOW_ACTION_RSS | MLX5_FLOW_ACTION_JUMP | \ MLX5_FLOW_ACTION_DEFAULT_MISS | \ MLX5_FLOW_ACTION_METER_WITH_TERMINATED_POLICY | \ - MLX5_FLOW_ACTION_SEND_TO_KERNEL) + MLX5_FLOW_ACTION_SEND_TO_KERNEL | \ + MLX5_FLOW_ACTION_PORT_REPRESENTOR)#define MLX5_FLOW_FATE_ESWITCH_ACTIONS \ (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID | \
drivers/net/mlx5/mlx5_flow_hw.c +55 -0
103 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 2/3 net/mlx5: add port representor destination to mirror
In reply to Suanming MouIn order to clone the traffic from FDB to NIC TIR, user can set port representor action as mirror clone destination. In that case cloned traffic will be moved to E-Switch manager root table, and goes to software TIR.
This commit adds the port representor support to mirror action.
--- doc/guides/rel_notes/release_23_11.rst | 1 + drivers/net/mlx5/mlx5_flow_hw.c | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_23_11.rst +1 -0
@@ -149,6 +149,7 @@ New Features * Added support for Network Service Header (NSH) flow matching. * Added support for ``RTE_FLOW_ACTION_TYPE_INDIRECT_LIST`` flow action. * Added support for ``RTE_FLOW_ITEM_TYPE_PTYPE`` flow item. + * Added support for ``RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR`` flow action and mirror. * **Updated Solarflare net driver.**
drivers/net/mlx5/mlx5_flow_hw.c +18 -1
@@ -9739,6 +9739,7 @@ mlx5_mirror_destroy_clone(struct rte_eth_dev *dev,flow_hw_jump_release (dev, clone->action_ctx);break ;case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT : +case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR :case RTE_FLOW_ACTION_TYPE_RAW_ENCAP :case RTE_FLOW_ACTION_TYPE_RAW_DECAP :case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :
@@ -9783,6 +9784,7 @@ mlx5_mirror_terminal_action(const struct rte_flow_action *action)case RTE_FLOW_ACTION_TYPE_RSS :case RTE_FLOW_ACTION_TYPE_QUEUE :case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT : +case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR :return true;default :break ;
@@ -9796,19 +9798,30 @@ mlx5_mirror_validate_sample_action(struct rte_eth_dev *dev, const struct rte_flow_action *action) {struct mlx5_priv *priv = dev->data->dev_private; +const struct rte_flow_action_ethdev *port =NULL ; +bool is_proxy =MLX5_HW_PORT_IS_PROXY (priv); +if (!action) +return false;switch (action->type) {case RTE_FLOW_ACTION_TYPE_QUEUE :case RTE_FLOW_ACTION_TYPE_RSS :if (flow_attr->transfer)return false;break ; +case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR : +if (!is_proxy || !flow_attr->transfer) +return false; + port = action->conf; +if (!port || port->port_id !=MLX5_REPRESENTED_PORT_ESW_MGR ) +return false; +break ;case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT :case RTE_FLOW_ACTION_TYPE_RAW_ENCAP :case RTE_FLOW_ACTION_TYPE_RAW_DECAP :case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP :case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP : -if (!priv->sh->esw_mode && !flow_attr->transfer) +if (!is_proxy || !flow_attr->transfer)return false;if (action[0 ].type ==RTE_FLOW_ACTION_TYPE_RAW_DECAP && action[1 ].type !=RTE_FLOW_ACTION_TYPE_RAW_ENCAP )
@@ -9966,6 +9979,7 @@ hw_mirror_format_clone(struct rte_eth_dev *dev,struct mlx5dr_action_dest_attr *dest_attr, uint8_t *reformat_buf, struct rte_flow_error *error) { + struct mlx5_priv *priv = dev->data->dev_private;int ret;uint32_t i;bool decap_seen = false;
@@ -9992,6 +10006,9 @@ hw_mirror_format_clone(struct rte_eth_dev *dev,if (ret)return ret;break ; +case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR : + dest_attr->dest = priv->hw_def_miss; +break ;case RTE_FLOW_ACTION_TYPE_RAW_DECAP : decap_seen = true;break ;
Signature · 1 line
2.34.1
PATCH v2 3/3 app/testpmd: add port representor as sample destination
In reply to Suanming MouThis commit adds the missing port representor support as sample destination.
--- app/test-pmd/cmdline_flow.c | 1 + 1 file changed, 1 insertion(+)
app/test-pmd/cmdline_flow.c +1 -0
@@ -2472,6 +2472,7 @@ static const enum index next_action_sample[] = {ACTION_VXLAN_ENCAP ,ACTION_NVGRE_ENCAP ,ACTION_REPRESENTED_PORT , +ACTION_PORT_REPRESENTOR ,ACTION_NEXT , ZERO, };
Signature · 1 line
2.34.1
Hi,
Quoted 32 lines
-----Original Message-----
From: Suanming Mou <[email protected]>
Sent: Monday, October 30, 2023 4:28 AM
Cc: [email protected]; Raslan Darawsheh <[email protected]>; Ori Kam <[email protected]>
Subject: [PATCH v2 0/3] net/mlx5: add port representor destination to mirrorIn order to clone the traffic from FDB to NIC TIR, user can set port representor action as mirror clone destination. In that case cloned traffic will be moved to E-Switch manager root table, and goes to software TIR.
This series adds the port representor support to mirror action.
v2:
- add Acked-by
- rebase on top of series [1][1]: https://patches.dpdk.org/project/dpdk/list/?series=29662
Suanming Mou (3):
net/mlx5: add port representor action net/mlx5: add port representor destination to mirror app/testpmd: add port representor as sample destinationapp/test-pmd/cmdline_flow.c | 1 + doc/guides/nics/mlx5.rst | 6 +++ doc/guides/rel_notes/release_23_11.rst | 1 + drivers/net/mlx5/mlx5.h | 2 + drivers/net/mlx5/mlx5_flow.h | 4 +- drivers/net/mlx5/mlx5_flow_hw.c | 74 +++++++++++++++++++++++++- 6 files changed, 86 insertions(+), 2 deletions(-)
Quoted 2 lines
--
2.34.1
Missing this update:
doc/guides/nics/features/mlx5.ini +1 -0
@@ -120,6 +120,7 @@ of_push_vlan = Y of_set_vlan_pcp = Y of_set_vlan_vid = Y port_id = Y +port_representor = Y quota = I queue = Y raw_decap = Y
@@ -143,3 +144,4 @@ set_tp_src = Y set_ttl = Y vxlan_decap = Y vxlan_encap = Y
will add during integration,
series applied to next-net-mlx,
Kindest regards
Raslan Darawsheh