DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hamdan Igbaria <hamdani@nvidia.com>
To: <hamdani@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>, Erez Shitrit <erezsh@nvidia.com>
Subject: [PATCH 5/8] net/mlx5/hws: matcher changes to support unified domain
Date: Sun, 16 Feb 2025 13:04:11 +0200	[thread overview]
Message-ID: <20250216110414.10926-5-hamdani@nvidia.com> (raw)
In-Reply-To: <20250216110414.10926-1-hamdani@nvidia.com>

From: Erez Shitrit <erezsh@nvidia.com>

Matcher for one of the new FDB sub-domains contains specific
details according to the type of that sub-domain.

Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Signed-off-by: Hamdan Igbaria <hamdani@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_matcher.c | 39 ++++++++++++++++++++++++---
 drivers/net/mlx5/hws/mlx5dr_pool.c    |  4 +--
 drivers/net/mlx5/hws/mlx5dr_table.h   |  9 +++++++
 3 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 54460cc82b..3c84a677d7 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -50,7 +50,7 @@ int mlx5dr_matcher_free_rtc_pointing(struct mlx5dr_context *ctx,
 {
 	int ret;
 
-	if (type != MLX5DR_TABLE_TYPE_FDB && !mlx5dr_context_shared_gvmi_used(ctx))
+	if (!mlx5dr_table_is_fdb_any(type) && !mlx5dr_context_shared_gvmi_used(ctx))
 		return 0;
 
 	ret = mlx5dr_table_ft_set_next_rtc(devx_obj, fw_ft_type, NULL, NULL);
@@ -407,6 +407,25 @@ static bool mlx5dr_matcher_supp_fw_wqe(struct mlx5dr_matcher *matcher)
 	return true;
 }
 
+static void mlx5dr_matcher_fixup_rtc_sizes_by_tbl(enum mlx5dr_table_type tbl_type,
+						  bool is_mirror,
+						  struct mlx5dr_cmd_rtc_create_attr *rtc_attr)
+{
+	if (!is_mirror) {
+		if (tbl_type == MLX5DR_TABLE_TYPE_FDB_TX) {
+			/* rtc_0 for TX flow is minimal */
+			rtc_attr->log_size = 0;
+			rtc_attr->log_depth = 0;
+		}
+	} else {
+		if (tbl_type == MLX5DR_TABLE_TYPE_FDB_RX) {
+			/* rtc_1 for RX flow is minimal */
+			rtc_attr->log_size = 0;
+			rtc_attr->log_depth = 0;
+		}
+	}
+}
+
 static void mlx5dr_matcher_set_rtc_attr_sz(struct mlx5dr_matcher *matcher,
 					   struct mlx5dr_cmd_rtc_create_attr *rtc_attr,
 					   enum mlx5dr_matcher_rtc_type rtc_type,
@@ -426,6 +445,11 @@ static void mlx5dr_matcher_set_rtc_attr_sz(struct mlx5dr_matcher *matcher,
 		rtc_attr->log_size = is_match_rtc ? matcher->attr.table.sz_row_log : ste->order;
 		rtc_attr->log_depth = is_match_rtc ? matcher->attr.table.sz_col_log : 0;
 	}
+
+	/* set values according to tbl->type */
+	mlx5dr_matcher_fixup_rtc_sizes_by_tbl(matcher->tbl->type,
+					      is_mirror,
+					      rtc_attr);
 }
 
 int mlx5dr_matcher_create_aliased_obj(struct mlx5dr_context *ctx,
@@ -604,7 +628,7 @@ static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher,
 		goto free_ste;
 	}
 
-	if (tbl->type == MLX5DR_TABLE_TYPE_FDB) {
+	if (mlx5dr_table_fdb_no_unified(tbl->type)) {
 		devx_obj = mlx5dr_pool_chunk_get_base_devx_obj_mirror(ste_pool, ste);
 		rtc_attr.ste_base = devx_obj->id;
 		rtc_attr.table_type = mlx5dr_table_get_res_fw_ft_type(tbl->type, true);
@@ -619,6 +643,9 @@ static int mlx5dr_matcher_create_rtc(struct mlx5dr_matcher *matcher,
 			       mlx5dr_matcher_rtc_type_to_str(rtc_type));
 			goto destroy_rtc_0;
 		}
+	} else if (tbl->type == MLX5DR_TABLE_TYPE_FDB_UNIFIED) {
+		/* Unified domain has 2 identical RTC's, allow connecting from other domains */
+		*rtc_1 = *rtc_0;
 	}
 
 	return 0;
@@ -656,7 +683,7 @@ static void mlx5dr_matcher_destroy_rtc(struct mlx5dr_matcher *matcher,
 		return;
 	}
 
-	if (tbl->type == MLX5DR_TABLE_TYPE_FDB)
+	if (mlx5dr_table_fdb_no_unified(tbl->type))
 		mlx5dr_cmd_destroy_obj(rtc_1);
 
 	mlx5dr_cmd_destroy_obj(rtc_0);
@@ -703,6 +730,10 @@ static void mlx5dr_matcher_set_pool_attr(struct mlx5dr_pool_attr *attr,
 	default:
 		break;
 	}
+
+	/* Now set attr according to the table type */
+	if (attr->opt_type == MLX5DR_POOL_OPTIMIZE_NONE)
+		mlx5dr_context_set_pool_tbl_attr(attr, matcher->tbl->type);
 }
 
 static int mlx5dr_matcher_check_and_process_at(struct mlx5dr_matcher *matcher,
@@ -1073,7 +1104,7 @@ mlx5dr_matcher_process_attr(struct mlx5dr_cmd_query_caps *caps,
 		return 0;
 	}
 
-	if (matcher->tbl->type != MLX5DR_TABLE_TYPE_FDB  && attr->optimize_flow_src) {
+	if (!mlx5dr_table_is_fdb_any(matcher->tbl->type) && attr->optimize_flow_src) {
 		DR_LOG(ERR, "NIC domain doesn't support flow_src");
 		goto not_supported;
 	}
diff --git a/drivers/net/mlx5/hws/mlx5dr_pool.c b/drivers/net/mlx5/hws/mlx5dr_pool.c
index b7b532c7cf..8e3718ac42 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pool.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pool.c
@@ -20,7 +20,7 @@ static void mlx5dr_pool_resource_free(struct mlx5dr_pool *pool,
 	mlx5dr_pool_free_one_resource(pool->resource[resource_idx]);
 	pool->resource[resource_idx] = NULL;
 
-	if (pool->tbl_type == MLX5DR_TABLE_TYPE_FDB) {
+	if (mlx5dr_table_fdb_no_unified(pool->tbl_type)) {
 		mlx5dr_pool_free_one_resource(pool->mirror_resource[resource_idx]);
 		pool->mirror_resource[resource_idx] = NULL;
 	}
@@ -89,7 +89,7 @@ mlx5dr_pool_resource_alloc(struct mlx5dr_pool *pool, uint32_t log_range, int idx
 	}
 	pool->resource[idx] = resource;
 
-	if (pool->tbl_type == MLX5DR_TABLE_TYPE_FDB) {
+	if (mlx5dr_table_fdb_no_unified(pool->tbl_type)) {
 		struct mlx5dr_pool_resource *mir_resource;
 
 		fw_ft_type = mlx5dr_table_get_res_fw_ft_type(pool->tbl_type, true);
diff --git a/drivers/net/mlx5/hws/mlx5dr_table.h b/drivers/net/mlx5/hws/mlx5dr_table.h
index 6996a90d9b..a7cdef5d78 100644
--- a/drivers/net/mlx5/hws/mlx5dr_table.h
+++ b/drivers/net/mlx5/hws/mlx5dr_table.h
@@ -48,6 +48,15 @@ static inline bool mlx5dr_table_is_fdb_any(enum mlx5dr_table_type tbl_type)
 	return false;
 }
 
+static inline bool mlx5dr_table_fdb_no_unified(enum mlx5dr_table_type tbl_type)
+{
+	if (mlx5dr_table_is_fdb_any(tbl_type) &&
+	    tbl_type != MLX5DR_TABLE_TYPE_FDB_UNIFIED)
+		return true;
+
+	return false;
+}
+
 static inline
 uint32_t mlx5dr_table_get_res_fw_ft_type(enum mlx5dr_table_type tbl_type,
 					 bool is_mirror)
-- 
2.21.0


  parent reply	other threads:[~2025-02-16 11:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-16 11:04 [PATCH 1/8] net/mlx5/hws: introduce capability for unified mode Hamdan Igbaria
2025-02-16 11:04 ` [PATCH 2/8] net/mlx5/hws: add new type to existing table-types Hamdan Igbaria
2025-02-16 11:04 ` [PATCH 3/8] net/mlx5/hws: context changes to support unified domain Hamdan Igbaria
2025-02-16 11:04 ` [PATCH 4/8] net/mlx5/hws: allow table creation from the new types Hamdan Igbaria
2025-02-16 11:04 ` Hamdan Igbaria [this message]
2025-02-16 11:04 ` [PATCH 6/8] net/mlx5/hws: action changes to support unified domain Hamdan Igbaria
2025-02-16 11:04 ` [PATCH 7/8] net/mlx5/hws: unified rule changes Hamdan Igbaria
2025-02-16 11:04 ` [PATCH 8/8] net/mlx5/hws: support debug information for new domains Hamdan Igbaria

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=20250216110414.10926-5-hamdani@nvidia.com \
    --to=hamdani@nvidia.com \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=erezsh@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    --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).