[PATCH v2 2/3] net/mlx5: add port representor destination to mirror
Suanming Mou
suanmingm at nvidia.com
Mon Oct 30 03:28:27 CET 2023
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 commit adds the port representor support to mirror action.
Signed-off-by: Suanming Mou <suanmingm at nvidia.com>
Acked-by: Ori Kam <orika at nvidia.com>
---
doc/guides/rel_notes/release_23_11.rst | 1 +
drivers/net/mlx5/mlx5_flow_hw.c | 19 ++++++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index a895c6b45e..322d8b1e0e 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -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.**
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 813a035e77..77f0e4f977 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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;
--
2.34.1
More information about the dev
mailing list