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 2/8] net/mlx5/hws: add new type to existing table-types
Date: Sun, 16 Feb 2025 13:04:08 +0200	[thread overview]
Message-ID: <20250216110414.10926-2-hamdani@nvidia.com> (raw)
In-Reply-To: <20250216110414.10926-1-hamdani@nvidia.com>

From: Erez Shitrit <erezsh@nvidia.com>

Type MLX5DR_TABLE_TYPE_FDB handles two types of rules and matching one
for FDB_RX and one for FDB_TX, now we separate FDB type to 3 sub
domains, RX / TX and UNIFIED.
The RX and TX as before, the new one UNIFIED will use for rules /
actions that are common to both RX and TX.

Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Signed-off-by: Hamdan Igbaria <hamdani@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/mlx5_prm.h      |  1 +
 drivers/net/mlx5/hws/mlx5dr.h       |  3 +++
 drivers/net/mlx5/hws/mlx5dr_table.c | 15 +----------
 drivers/net/mlx5/hws/mlx5dr_table.h | 40 ++++++++++++++++++++++++-----
 4 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 6e141b6520..3fc3b0cd2a 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -5122,6 +5122,7 @@ enum {
 	FS_FT_FDB = 0x4,
 	FS_FT_FDB_RX = 0xa,
 	FS_FT_FDB_TX = 0xb,
+	FS_FT_FDB_UNIFIED = 0xc,
 };
 
 struct mlx5_ifc_flow_table_context_bits {
diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 7097d22099..e0e7f5c147 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -17,6 +17,9 @@ enum mlx5dr_table_type {
 	MLX5DR_TABLE_TYPE_NIC_RX,
 	MLX5DR_TABLE_TYPE_NIC_TX,
 	MLX5DR_TABLE_TYPE_FDB,
+	MLX5DR_TABLE_TYPE_FDB_RX,
+	MLX5DR_TABLE_TYPE_FDB_TX,
+	MLX5DR_TABLE_TYPE_FDB_UNIFIED,
 	MLX5DR_TABLE_TYPE_MAX,
 };
 
diff --git a/drivers/net/mlx5/hws/mlx5dr_table.c b/drivers/net/mlx5/hws/mlx5dr_table.c
index 634b484a94..d0df40a6c1 100644
--- a/drivers/net/mlx5/hws/mlx5dr_table.c
+++ b/drivers/net/mlx5/hws/mlx5dr_table.c
@@ -333,20 +333,7 @@ static int mlx5dr_table_init(struct mlx5dr_table *tbl)
 	if (ret)
 		return ret;
 
-	switch (tbl->type) {
-	case MLX5DR_TABLE_TYPE_NIC_RX:
-		tbl->fw_ft_type = FS_FT_NIC_RX;
-		break;
-	case MLX5DR_TABLE_TYPE_NIC_TX:
-		tbl->fw_ft_type = FS_FT_NIC_TX;
-		break;
-	case MLX5DR_TABLE_TYPE_FDB:
-		tbl->fw_ft_type = FS_FT_FDB;
-		break;
-	default:
-		assert(0);
-		break;
-	}
+	mlx5dr_table_get_fw_ft_type(tbl->type, (uint8_t *)&tbl->fw_ft_type);
 
 	pthread_spin_lock(&ctx->ctrl_lock);
 	tbl->ft = mlx5dr_table_create_default_ft(tbl->ctx->ibv_ctx, tbl);
diff --git a/drivers/net/mlx5/hws/mlx5dr_table.h b/drivers/net/mlx5/hws/mlx5dr_table.h
index 32f2574a97..1c0eb6adf8 100644
--- a/drivers/net/mlx5/hws/mlx5dr_table.h
+++ b/drivers/net/mlx5/hws/mlx5dr_table.h
@@ -32,15 +32,21 @@ static inline
 uint32_t mlx5dr_table_get_res_fw_ft_type(enum mlx5dr_table_type tbl_type,
 					 bool is_mirror)
 {
-	if (tbl_type == MLX5DR_TABLE_TYPE_NIC_RX)
+	switch (tbl_type) {
+	case MLX5DR_TABLE_TYPE_NIC_RX:
 		return FS_FT_NIC_RX;
-	else if (tbl_type == MLX5DR_TABLE_TYPE_NIC_TX)
+	case MLX5DR_TABLE_TYPE_NIC_TX:
 		return FS_FT_NIC_TX;
-	else if (tbl_type == MLX5DR_TABLE_TYPE_FDB)
+	case MLX5DR_TABLE_TYPE_FDB:
+	case MLX5DR_TABLE_TYPE_FDB_RX:
+	case MLX5DR_TABLE_TYPE_FDB_TX:
 		return is_mirror ? FS_FT_FDB_TX : FS_FT_FDB_RX;
-
-	assert(0);
-	return 0;
+	case MLX5DR_TABLE_TYPE_FDB_UNIFIED:
+		return FS_FT_FDB_UNIFIED;
+	default:
+		assert(0);
+		return 0;
+	}
 }
 
 static inline bool mlx5dr_table_is_root(struct mlx5dr_table *tbl)
@@ -48,6 +54,28 @@ static inline bool mlx5dr_table_is_root(struct mlx5dr_table *tbl)
 	return (tbl->level == MLX5DR_ROOT_LEVEL);
 }
 
+static inline
+void mlx5dr_table_get_fw_ft_type(enum mlx5dr_table_type type,
+				 uint8_t *ret_type)
+{
+	switch (type) {
+	case MLX5DR_TABLE_TYPE_NIC_RX:
+		*ret_type = FS_FT_NIC_RX;
+		break;
+	case MLX5DR_TABLE_TYPE_NIC_TX:
+		*ret_type = FS_FT_NIC_TX;
+		break;
+	case MLX5DR_TABLE_TYPE_FDB:
+	case MLX5DR_TABLE_TYPE_FDB_RX:
+	case MLX5DR_TABLE_TYPE_FDB_TX:
+	case MLX5DR_TABLE_TYPE_FDB_UNIFIED:
+		*ret_type = FS_FT_FDB;
+		break;
+	default:
+		assert(0);
+	}
+}
+
 struct mlx5dr_devx_obj *mlx5dr_table_create_default_ft(struct ibv_context *ibv,
 						       struct mlx5dr_table *tbl);
 
-- 
2.21.0


  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 ` Hamdan Igbaria [this message]
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 ` [PATCH 5/8] net/mlx5/hws: matcher changes to support unified domain Hamdan Igbaria
2025-02-16 11:04 ` [PATCH 6/8] net/mlx5/hws: action " 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-2-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).