DPDK patches and discussions
 help / color / mirror / Atom feed
From: Itamar Gozlan <igozlan@nvidia.com>
To: <valex@nvidia.com>, <viacheslavo@nvidia.com>, <matan@nvidia.com>,
	<thomas@monjalon.net>, <suanmingm@nvidia.com>,
	Ori Kam <orika@nvidia.com>
Cc: <dev@dpdk.org>
Subject: [v3 5/5] net/mlx5/hws: support default miss action on FDB
Date: Tue, 4 Jul 2023 19:04:53 +0300	[thread overview]
Message-ID: <20230704160454.4187-5-igozlan@nvidia.com> (raw)
In-Reply-To: <20230704160454.4187-1-igozlan@nvidia.com>

From: Alex Vesker <valex@nvidia.com>

Add the support for default miss on HWS FDB, this implementation
was missing until now. Default miss can be used for more efficient
miss flow instead of going to an empty matcher or some defecated
empty table.

Signed-off-by: Alex Vesker <valex@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_action.c | 27 ++++++++++++++++++++-------
 drivers/net/mlx5/hws/mlx5dr_table.c  |  6 +-----
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 74f4e60863..920099ba5b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -322,10 +322,12 @@ int mlx5dr_action_root_build_attr(struct mlx5dr_rule_action rule_actions[],
 	return 0;
 }
 
-static bool mlx5dr_action_fixup_stc_attr(struct mlx5dr_cmd_stc_modify_attr *stc_attr,
-					 struct mlx5dr_cmd_stc_modify_attr *fixup_stc_attr,
-					 enum mlx5dr_table_type table_type,
-					 bool is_mirror)
+static bool
+mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx,
+			     struct mlx5dr_cmd_stc_modify_attr *stc_attr,
+			     struct mlx5dr_cmd_stc_modify_attr *fixup_stc_attr,
+			     enum mlx5dr_table_type table_type,
+			     bool is_mirror)
 {
 	struct mlx5dr_devx_obj *devx_obj;
 	bool use_fixup = false;
@@ -348,6 +350,17 @@ static bool mlx5dr_action_fixup_stc_attr(struct mlx5dr_cmd_stc_modify_attr *stc_
 		use_fixup = true;
 		break;
 
+	case MLX5_IFC_STC_ACTION_TYPE_ALLOW:
+		if (fw_tbl_type == FS_FT_FDB_TX || fw_tbl_type == FS_FT_FDB_RX) {
+			fixup_stc_attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_VPORT;
+			fixup_stc_attr->action_offset = stc_attr->action_offset;
+			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;
+			use_fixup = true;
+		}
+		break;
+
 	case MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_VPORT:
 		if (stc_attr->vport.vport_num != WIRE_PORT)
 			break;
@@ -397,7 +410,7 @@ int mlx5dr_action_alloc_single_stc(struct mlx5dr_context *ctx,
 	devx_obj_0 = mlx5dr_pool_chunk_get_base_devx_obj(stc_pool, stc);
 
 	/* According to table/action limitation change the stc_attr */
-	use_fixup = mlx5dr_action_fixup_stc_attr(stc_attr, &fixup_stc_attr, table_type, false);
+	use_fixup = mlx5dr_action_fixup_stc_attr(ctx, stc_attr, &fixup_stc_attr, table_type, false);
 	ret = mlx5dr_cmd_stc_modify(devx_obj_0, use_fixup ? &fixup_stc_attr : stc_attr);
 	if (ret) {
 		DR_LOG(ERR, "Failed to modify STC action_type %d tbl_type %d",
@@ -411,7 +424,8 @@ int mlx5dr_action_alloc_single_stc(struct mlx5dr_context *ctx,
 
 		devx_obj_1 = mlx5dr_pool_chunk_get_base_devx_obj_mirror(stc_pool, stc);
 
-		use_fixup = mlx5dr_action_fixup_stc_attr(stc_attr, &fixup_stc_attr,
+		use_fixup = mlx5dr_action_fixup_stc_attr(ctx, stc_attr,
+							 &fixup_stc_attr,
 							 table_type, true);
 		ret = mlx5dr_cmd_stc_modify(devx_obj_1, use_fixup ? &fixup_stc_attr : stc_attr);
 		if (ret) {
@@ -491,7 +505,6 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
 	case MLX5DR_ACTION_TYP_MISS:
 		attr->action_type = MLX5_IFC_STC_ACTION_TYPE_ALLOW;
 		attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
-		/* TODO Need to support default miss for FDB */
 		break;
 	case MLX5DR_ACTION_TYP_CTR:
 		attr->id = obj->id;
diff --git a/drivers/net/mlx5/hws/mlx5dr_table.c b/drivers/net/mlx5/hws/mlx5dr_table.c
index c18ee7c552..f91f04d924 100644
--- a/drivers/net/mlx5/hws/mlx5dr_table.c
+++ b/drivers/net/mlx5/hws/mlx5dr_table.c
@@ -24,7 +24,6 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)
 	struct mlx5dr_cmd_forward_tbl *default_miss;
 	struct mlx5dr_context *ctx = tbl->ctx;
 	uint8_t tbl_type = tbl->type;
-	uint32_t vport;
 
 	if (tbl->type != MLX5DR_TABLE_TYPE_FDB)
 		return 0;
@@ -38,12 +37,9 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)
 	ft_attr.level = tbl->ctx->caps->fdb_ft.max_level; /* The last level */
 	ft_attr.rtc_valid = false;
 
-	assert(ctx->caps->eswitch_manager);
-	vport = ctx->caps->eswitch_manager_vport_number;
-
 	fte_attr.action_flags = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
 	fte_attr.destination_type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
-	fte_attr.destination_id = vport;
+	fte_attr.destination_id = ctx->caps->eswitch_manager_vport_number;
 
 	default_miss = mlx5dr_cmd_forward_tbl_create(mlx5dr_context_get_local_ibv(ctx),
 						     &ft_attr, &fte_attr);
-- 
2.18.1


  parent reply	other threads:[~2023-07-04 16:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29  7:21 [PATCH 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
2023-06-29  7:21 ` [PATCH 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
2023-06-29  7:21 ` [PATCH 3/5] net/mlx5/hws: remove duplicated reformat type Itamar Gozlan
2023-06-29  7:21 ` [PATCH 4/5] net/mlx5/hws: renaming FT to TBL Itamar Gozlan
2023-06-29  7:21 ` [PATCH 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
2023-07-02  4:57   ` [v2 1/5] net/mlx5: support indirect list METER_MARK action Itamar Gozlan
2023-07-02  4:57     ` [v2 2/5] app/testpmd: support indirect actions list syntax Itamar Gozlan
2023-07-02  4:57     ` [v2 3/5] net/mlx5: add indirect encap decap support Itamar Gozlan
2023-07-02  4:57     ` [v2 4/5] net/mlx5: support symmetric RSS hash function Itamar Gozlan
2023-07-04 10:46       ` [v1 1/5] net/mlx5/hws: remove uneeded new line for DR_LOG Itamar Gozlan
2023-07-04 10:46         ` [v1 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
2023-07-04 10:46         ` [v1 3/5] net/mlx5/hws: remove duplicated reformat type Itamar Gozlan
2023-07-04 10:46         ` [v1 4/5] net/mlx5/hws: renaming FT to TBL Itamar Gozlan
2023-07-04 10:46         ` [v1 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan
2023-07-04 16:04           ` [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG Itamar Gozlan
2023-07-04 16:04             ` [v3 2/5] net/mlx5/hws: allow destroying rule resources on error Itamar Gozlan
2023-07-04 16:04             ` [v3 3/5] net/mlx5/hws: remove duplicated reformat type Itamar Gozlan
2023-07-04 16:04             ` [v3 4/5] net/mlx5/hws: renaming FT to TBL Itamar Gozlan
2023-07-04 16:04             ` Itamar Gozlan [this message]
2023-07-06 14:57             ` [v3 1/5] net/mlx5/hws: remove unneeded new line for DR_LOG Raslan Darawsheh
2023-07-02  4:57     ` [v2 5/5] net/mlx5/hws: support default miss action on FDB Itamar Gozlan

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=20230704160454.4187-5-igozlan@nvidia.com \
    --to=igozlan@nvidia.com \
    --cc=dev@dpdk.org \
    --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).