DPDK patches and discussions
 help / color / mirror / Atom feed
From: Suanming Mou <suanmingm@nvidia.com>
To: <orika@nvidia.com>, Matan Azrad <matan@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Cc: <rasland@nvidia.com>, <dev@dpdk.org>
Subject: [PATCH 2/3] net/mlx5: add port representor destination to mirror
Date: Tue, 17 Oct 2023 08:44:00 +0800	[thread overview]
Message-ID: <20231017004401.698745-3-suanmingm@nvidia.com> (raw)
In-Reply-To: <20231017004401.698745-1-suanmingm@nvidia.com>

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@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 9feb40ddb3..46af492ac5 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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;
-- 
2.34.1


  parent reply	other threads:[~2023-10-17  0:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17  0:43 [PATCH 0/3] " Suanming Mou
2023-10-17  0:43 ` [PATCH 1/3] net/mlx5: add port representor action Suanming Mou
2023-10-17  0:44 ` Suanming Mou [this message]
2023-10-17  0:44 ` [PATCH 3/3] app/testpmd: add port representor as sample destination Suanming Mou
2023-10-29 13:33 ` [PATCH 0/3] net/mlx5: add port representor destination to mirror Ori Kam
2023-10-30  2:28 ` [PATCH v2 " Suanming Mou
2023-10-30  2:28   ` [PATCH v2 1/3] net/mlx5: add port representor action Suanming Mou
2023-10-30  2:28   ` [PATCH v2 2/3] net/mlx5: add port representor destination to mirror Suanming Mou
2023-10-30  2:28   ` [PATCH v2 3/3] app/testpmd: add port representor as sample destination Suanming Mou
2023-10-30  9:05   ` [PATCH v2 0/3] net/mlx5: add port representor destination to mirror Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231017004401.698745-3-suanmingm@nvidia.com \
    --to=suanmingm@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).