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 4/8] net/mlx5/hws: allow table creation from the new types
Date: Sun, 16 Feb 2025 13:04:10 +0200 [thread overview]
Message-ID: <20250216110414.10926-4-hamdani@nvidia.com> (raw)
In-Reply-To: <20250216110414.10926-1-hamdani@nvidia.com>
From: Erez Shitrit <erezsh@nvidia.com>
Take care of table creation from one of the new types that now exposed
to the user (FDB_RX, FDB_TX and FDB_UNIFIED)
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_action.c | 6 ++---
drivers/net/mlx5/hws/mlx5dr_cmd.c | 4 ++--
drivers/net/mlx5/hws/mlx5dr_table.c | 35 ++++++++++++++++++++--------
drivers/net/mlx5/hws/mlx5dr_table.h | 20 ++++++++++++++++
4 files changed, 50 insertions(+), 15 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index b038ca6879..8e95abf7da 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -801,7 +801,7 @@ mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx,
break;
case MLX5_IFC_STC_ACTION_TYPE_ALLOW:
- if (fw_tbl_type == FS_FT_FDB_TX || fw_tbl_type == FS_FT_FDB_RX) {
+ if (mlx5dr_table_is_fw_fdb_any(fw_tbl_type)) {
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;
@@ -817,8 +817,8 @@ mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx,
if (stc_attr->vport.vport_num != WIRE_PORT)
break;
- if (fw_tbl_type == FS_FT_FDB_TX || fw_tbl_type == FS_FT_FDB_RX) {
- /*The FW doesn't allow to go to wire in the TX/RX by JUMP_TO_VPORT*/
+ if (mlx5dr_table_is_fw_fdb_any(fw_tbl_type)) {
+ /* The FW doesn't allow to go to wire in the TX/RX by JUMP_TO_VPORT */
fixup_stc_attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_UPLINK;
fixup_stc_attr->action_offset = stc_attr->action_offset;
fixup_stc_attr->stc_offset = stc_attr->stc_offset;
diff --git a/drivers/net/mlx5/hws/mlx5dr_cmd.c b/drivers/net/mlx5/hws/mlx5dr_cmd.c
index 8a788709b5..f609135ccb 100644
--- a/drivers/net/mlx5/hws/mlx5dr_cmd.c
+++ b/drivers/net/mlx5/hws/mlx5dr_cmd.c
@@ -328,14 +328,14 @@ void mlx5dr_cmd_set_attr_connect_miss_tbl(struct mlx5dr_context *ctx,
{
struct mlx5dr_devx_obj *default_miss_tbl;
- 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;
ft_attr->modify_fs = MLX5_IFC_MODIFY_FLOW_TABLE_MISS_ACTION;
ft_attr->type = fw_ft_type;
ft_attr->table_miss_action = MLX5_IFC_MODIFY_FLOW_TABLE_MISS_ACTION_GOTO_TBL;
- if (type == MLX5DR_TABLE_TYPE_FDB) {
+ if (mlx5dr_table_is_fdb_any(type)) {
default_miss_tbl = ctx->common_res[type].default_miss->ft;
if (!default_miss_tbl) {
assert(false);
diff --git a/drivers/net/mlx5/hws/mlx5dr_table.c b/drivers/net/mlx5/hws/mlx5dr_table.c
index d0df40a6c1..b371f420e6 100644
--- a/drivers/net/mlx5/hws/mlx5dr_table.c
+++ b/drivers/net/mlx5/hws/mlx5dr_table.c
@@ -8,7 +8,7 @@ static void mlx5dr_table_init_next_ft_attr(struct mlx5dr_table *tbl,
struct mlx5dr_cmd_ft_create_attr *ft_attr)
{
ft_attr->type = tbl->fw_ft_type;
- if (tbl->type == MLX5DR_TABLE_TYPE_FDB)
+ if (mlx5dr_table_is_fdb_any(tbl->type))
ft_attr->level = tbl->ctx->caps->fdb_ft.max_level - 1;
else
ft_attr->level = tbl->ctx->caps->nic_ft.max_level - 1;
@@ -26,7 +26,7 @@ mlx5dr_table_up_default_fdb_miss_tbl(struct mlx5dr_table *tbl)
struct mlx5dr_context *ctx = tbl->ctx;
uint8_t tbl_type = tbl->type;
- if (tbl->type != MLX5DR_TABLE_TYPE_FDB)
+ if (!mlx5dr_table_is_fdb_any(tbl_type))
return 0;
if (ctx->common_res[tbl_type].default_miss) {
@@ -63,7 +63,7 @@ static void mlx5dr_table_down_default_fdb_miss_tbl(struct mlx5dr_table *tbl)
struct mlx5dr_context *ctx = tbl->ctx;
uint8_t tbl_type = tbl->type;
- if (tbl->type != MLX5DR_TABLE_TYPE_FDB)
+ if (!mlx5dr_table_is_fdb_any(tbl->type))
return;
default_miss = ctx->common_res[tbl_type].default_miss;
@@ -81,7 +81,7 @@ mlx5dr_table_connect_to_default_miss_tbl(struct mlx5dr_table *tbl,
struct mlx5dr_cmd_ft_modify_attr ft_attr = {0};
int ret;
- assert(tbl->type == MLX5DR_TABLE_TYPE_FDB);
+ assert(mlx5dr_table_is_fdb_any(tbl->type));
mlx5dr_cmd_set_attr_connect_miss_tbl(tbl->ctx,
tbl->fw_ft_type,
@@ -109,16 +109,18 @@ mlx5dr_table_create_default_ft(struct ibv_context *ibv,
mlx5dr_table_init_next_ft_attr(tbl, &ft_attr);
ft_obj = mlx5dr_cmd_flow_table_create(ibv, &ft_attr);
- if (ft_obj && tbl->type == MLX5DR_TABLE_TYPE_FDB) {
+ if (ft_obj && mlx5dr_table_is_fdb_any(tbl->type)) {
/* Take/create ref over the default miss */
ret = mlx5dr_table_up_default_fdb_miss_tbl(tbl);
if (ret) {
- DR_LOG(ERR, "Failed to get default fdb miss");
+ DR_LOG(ERR, "Failed to get default fdb miss for type: %d\n",
+ tbl->type);
goto free_ft_obj;
}
ret = mlx5dr_table_connect_to_default_miss_tbl(tbl, ft_obj);
if (ret) {
- DR_LOG(ERR, "Failed connecting to default miss tbl");
+ DR_LOG(ERR, "Failed connecting to default miss tbl (type: %d)",
+ tbl->type);
goto down_miss_tbl;
}
}
@@ -142,7 +144,7 @@ mlx5dr_table_init_check_hws_support(struct mlx5dr_context *ctx,
return rte_errno;
}
- if (mlx5dr_context_shared_gvmi_used(ctx) && tbl->type == MLX5DR_TABLE_TYPE_FDB) {
+ if (mlx5dr_context_shared_gvmi_used(ctx) && mlx5dr_table_is_fdb_any(tbl->type)) {
DR_LOG(ERR, "FDB with shared port resources is not supported");
rte_errno = EOPNOTSUPP;
return rte_errno;
@@ -380,11 +382,24 @@ struct mlx5dr_table *mlx5dr_table_create(struct mlx5dr_context *ctx,
struct mlx5dr_table *tbl;
int ret;
- if (attr->type > MLX5DR_TABLE_TYPE_FDB) {
+ if (attr->type >= MLX5DR_TABLE_TYPE_MAX) {
DR_LOG(ERR, "Invalid table type %d", attr->type);
return NULL;
}
+ if (attr->type == MLX5DR_TABLE_TYPE_FDB_UNIFIED && !ctx->caps->fdb_unified_en) {
+ DR_LOG(ERR, "Table type %d not supported by current FW", attr->type);
+ rte_errno = ENOTSUP;
+ return NULL;
+ }
+
+ if ((mlx5dr_table_is_fdb_any(attr->type) && attr->type != MLX5DR_TABLE_TYPE_FDB) &&
+ !attr->level) {
+ DR_LOG(ERR, "Table type %d not supported by root table", attr->type);
+ rte_errno = ENOTSUP;
+ return NULL;
+ }
+
tbl = simple_calloc(1, sizeof(*tbl));
if (!tbl) {
rte_errno = ENOMEM;
@@ -464,7 +479,7 @@ int mlx5dr_table_ft_set_default_next_ft(struct mlx5dr_table *tbl,
if (!tbl->ctx->caps->nic_ft.ignore_flow_level_rtc_valid)
return 0;
- if (tbl->type == MLX5DR_TABLE_TYPE_FDB)
+ if (mlx5dr_table_is_fdb_any(tbl->type))
return mlx5dr_table_connect_to_default_miss_tbl(tbl, ft_obj);
ft_attr.type = tbl->fw_ft_type;
diff --git a/drivers/net/mlx5/hws/mlx5dr_table.h b/drivers/net/mlx5/hws/mlx5dr_table.h
index 1c0eb6adf8..6996a90d9b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_table.h
+++ b/drivers/net/mlx5/hws/mlx5dr_table.h
@@ -28,6 +28,26 @@ struct mlx5dr_table {
struct mlx5dr_default_miss default_miss;
};
+static inline bool mlx5dr_table_is_fw_fdb_any(uint32_t fw_tbl_type)
+{
+ if (fw_tbl_type == FS_FT_FDB_TX || fw_tbl_type == FS_FT_FDB_RX ||
+ fw_tbl_type == FS_FT_FDB_UNIFIED)
+ return true;
+
+ return false;
+}
+
+static inline bool mlx5dr_table_is_fdb_any(enum mlx5dr_table_type tbl_type)
+{
+ if (tbl_type == MLX5DR_TABLE_TYPE_FDB ||
+ tbl_type == MLX5DR_TABLE_TYPE_FDB_TX ||
+ tbl_type == MLX5DR_TABLE_TYPE_FDB_RX ||
+ 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
next prev 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 ` Hamdan Igbaria [this message]
2025-02-16 11:04 ` [PATCH 5/8] net/mlx5/hws: matcher " 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-4-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).