DPDK patches and discussions
 help / color / mirror / Atom feed
From: Itamar Gozlan <igozlan@nvidia.com>
To: <igozlan@nvidia.com>, <erezsh@nvidia.com>, <hamdani@nvidia.com>,
	<kliteyn@nvidia.com>, <valex@nvidia.com>,
	<viacheslavo@nvidia.com>, <thomas@monjalon.net>,
	<suanmingm@nvidia.com>, Dariusz Sosnowski <dsosnowski@nvidia.com>,
	Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
	Matan Azrad <matan@nvidia.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 03/10] net/mlx5/hws: set eswitch owner vhc ID valid accordingly
Date: Sun, 7 Jul 2024 13:25:24 +0300	[thread overview]
Message-ID: <20240707102532.2045942-3-igozlan@nvidia.com> (raw)
In-Reply-To: <20240707102532.2045942-1-igozlan@nvidia.com>

From: Erez Shitrit <erezsh@nvidia.com>

eswitch_owner_vhca_id_valid value should be set to 1 only on
merged-eswitch device.

Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_action.c | 12 ++++++++++++
 drivers/net/mlx5/hws/mlx5dr_cmd.c    |  3 ++-
 drivers/net/mlx5/hws/mlx5dr_cmd.h    |  1 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 90f2f17bd0..03c3683f71 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -680,6 +680,8 @@ mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx,
 			fixup_stc_attr->stc_offset = stc_attr->stc_offset;
 			fixup_stc_attr->vport.esw_owner_vhca_id = ctx->caps->vhca_id;
 			fixup_stc_attr->vport.vport_num = ctx->caps->eswitch_manager_vport_number;
+			fixup_stc_attr->vport.eswitch_owner_vhca_id_valid =
+				ctx->caps->merged_eswitch;
 			use_fixup = true;
 		}
 		break;
@@ -700,6 +702,8 @@ mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx,
 			fixup_stc_attr->stc_offset = stc_attr->stc_offset;
 			fixup_stc_attr->vport.vport_num = 0;
 			fixup_stc_attr->vport.esw_owner_vhca_id = stc_attr->vport.esw_owner_vhca_id;
+			fixup_stc_attr->vport.eswitch_owner_vhca_id_valid =
+				ctx->caps->merged_eswitch;
 		}
 		use_fixup = true;
 		break;
@@ -1429,6 +1433,14 @@ static int mlx5dr_action_create_dest_vport_hws(struct mlx5dr_context *ctx,
 	action->vport.vport_num = vport_caps.vport_num;
 	action->vport.esw_owner_vhca_id = vport_caps.esw_owner_vhca_id;
 
+	if (!ctx->caps->merged_eswitch &&
+	    action->vport.esw_owner_vhca_id != ctx->caps->vhca_id) {
+		DR_LOG(ERR, "Not merged-eswitch (%d), not allowed to send to other vhca_id (%d)",
+		       ctx->caps->vhca_id, action->vport.esw_owner_vhca_id);
+		rte_errno = ENOTSUP;
+		return rte_errno;
+	}
+
 	ret = mlx5dr_action_create_stcs(action, NULL);
 	if (ret) {
 		DR_LOG(ERR, "Failed creating stc for port %d", ib_port_num);
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index 666d678b42..72fc9e3d91 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -515,7 +515,8 @@ mlx5dr_cmd_stc_modify_set_stc_param(struct mlx5dr_cmd_stc_modify_attr *stc_attr,
 			 stc_attr->vport.vport_num);
 		MLX5_SET(stc_ste_param_vport, stc_param, eswitch_owner_vhca_id,
 			 stc_attr->vport.esw_owner_vhca_id);
-		MLX5_SET(stc_ste_param_vport, stc_param, eswitch_owner_vhca_id_valid, 1);
+		MLX5_SET(stc_ste_param_vport, stc_param, eswitch_owner_vhca_id_valid,
+			 stc_attr->vport.eswitch_owner_vhca_id_valid);
 		break;
 	case MLX5_IFC_STC_ACTION_TYPE_DROP:
 	case MLX5_IFC_STC_ACTION_TYPE_NOP:
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.h b/drivers/net/mlx5/hws/mlx5dr_cmd.h
index ea5d346d8e..54840ec445 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.h
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.h
@@ -133,6 +133,7 @@ struct mlx5dr_cmd_stc_modify_attr {
 		struct {
 			uint16_t vport_num;
 			uint16_t esw_owner_vhca_id;
+			uint8_t eswitch_owner_vhca_id_valid;
 		} vport;
 		struct {
 			struct mlx5dr_pool_chunk ste;
-- 
2.39.3


  parent reply	other threads:[~2024-07-07 10:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-07 10:25 [PATCH 01/10] net/mlx5: add hairpin out of buffer counter Itamar Gozlan
2024-07-07 10:25 ` [PATCH 02/10] net/mlx5: fix matcher object memory leak Itamar Gozlan
2024-07-07 10:25 ` Itamar Gozlan [this message]
2024-07-07 10:25 ` [PATCH 04/10] net/mlx5/hws: fix memory leak in modify header free Itamar Gozlan
2024-07-07 10:25 ` [PATCH 05/10] net/mlx5/hws: strictly range templates check fix Itamar Gozlan
2024-07-07 10:25 ` [PATCH 06/10] net/mlx5/hws: fix deletion of action vport Itamar Gozlan
2024-07-07 10:25 ` [PATCH 07/10] net/mlx5/hws: fix incorrect port ID on root item convert Itamar Gozlan
2024-07-07 10:25 ` [PATCH 08/10] net/mlx5/hws: take out not needed variable Itamar Gozlan
2024-07-07 10:25 ` [PATCH 09/10] net/mlx5/hws: fix NAT64 csum issue Itamar Gozlan
2024-07-07 10:25 ` [PATCH 10/10] net/mlx5/hws: fix NA64 copy TOS field instead of TTL Itamar Gozlan
2024-07-09 12:30   ` [PATCH 0/8] HW steering team updates Itamar Gozlan
2024-07-09 12:30     ` [PATCH 1/8] net/mlx5/hws: set eswitch owner vhc ID valid accordingly Itamar Gozlan
2024-07-09 12:30     ` [PATCH 2/8] net/mlx5/hws: fix memory leak in modify header free Itamar Gozlan
2024-07-09 12:30     ` [PATCH 3/8] net/mlx5/hws: strictly range templates check fix Itamar Gozlan
2024-07-09 12:30     ` [PATCH 4/8] net/mlx5/hws: fix deletion of action vport Itamar Gozlan
2024-07-09 12:31     ` [PATCH 5/8] net/mlx5/hws: fix incorrect port ID on root item convert Itamar Gozlan
2024-07-09 12:31     ` [PATCH 6/8] net/mlx5/hws: take out not needed variable Itamar Gozlan
2024-07-09 12:31     ` [PATCH 7/8] net/mlx5/hws: fix NAT64 csum issue Itamar Gozlan
2024-07-09 12:31     ` [PATCH 8/8] net/mlx5/hws: fix NA64 copy TOS field instead of TTL Itamar Gozlan
2024-07-09 15:25       ` Bing Zhao
2024-07-18  7:28     ` [PATCH 0/8] HW steering team updates 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=20240707102532.2045942-3-igozlan@nvidia.com \
    --to=igozlan@nvidia.com \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=erezsh@nvidia.com \
    --cc=hamdani@nvidia.com \
    --cc=kliteyn@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=valex@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).