* [PATCH 2/8] net/mlx5/hws: add new type to existing table-types
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
2025-02-16 11:04 ` [PATCH 3/8] net/mlx5/hws: context changes to support unified domain Hamdan Igbaria
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Hamdan Igbaria @ 2025-02-16 11:04 UTC (permalink / raw)
To: hamdani, viacheslavo, thomas, suanmingm, Dariusz Sosnowski,
Bing Zhao, Ori Kam, Matan Azrad
Cc: dev, Erez Shitrit
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/8] net/mlx5/hws: context changes to support unified domain
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 ` Hamdan Igbaria
2025-02-16 11:04 ` [PATCH 4/8] net/mlx5/hws: allow table creation from the new types Hamdan Igbaria
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Hamdan Igbaria @ 2025-02-16 11:04 UTC (permalink / raw)
To: hamdani, viacheslavo, thomas, suanmingm, Dariusz Sosnowski,
Bing Zhao, Ori Kam, Matan Azrad
Cc: dev, Erez Shitrit
From: Erez Shitrit <erezsh@nvidia.com>
Context creates its pools according to the table type.
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_context.c | 21 ++++++++++++++++++++-
drivers/net/mlx5/hws/mlx5dr_context.h | 3 +++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_context.c b/drivers/net/mlx5/hws/mlx5dr_context.c
index 24741afe58..91d05f1f86 100644
--- a/drivers/net/mlx5/hws/mlx5dr_context.c
+++ b/drivers/net/mlx5/hws/mlx5dr_context.c
@@ -19,6 +19,24 @@ uint8_t mlx5dr_context_get_reparse_mode(struct mlx5dr_context *ctx)
return MLX5_IFC_RTC_REPARSE_ALWAYS;
}
+void mlx5dr_context_set_pool_tbl_attr(struct mlx5dr_pool_attr *attr,
+ enum mlx5dr_table_type table_type)
+{
+ attr->table_type = table_type;
+
+ switch (table_type) {
+ case MLX5DR_TABLE_TYPE_FDB_TX:
+ attr->opt_type = MLX5DR_POOL_OPTIMIZE_ORIG;
+ break;
+ case MLX5DR_TABLE_TYPE_FDB_RX:
+ attr->opt_type = MLX5DR_POOL_OPTIMIZE_MIRROR;
+ break;
+ default:
+ attr->opt_type = MLX5DR_POOL_OPTIMIZE_NONE;
+ break;
+ }
+}
+
static int mlx5dr_context_pools_init(struct mlx5dr_context *ctx,
struct mlx5dr_context_attr *attr)
{
@@ -41,7 +59,8 @@ static int mlx5dr_context_pools_init(struct mlx5dr_context *ctx,
pool_attr.alloc_log_sz = RTE_MAX(max_log_sz, ctx->caps->stc_alloc_log_gran);
for (i = 0; i < MLX5DR_TABLE_TYPE_MAX; i++) {
- pool_attr.table_type = i;
+ mlx5dr_context_set_pool_tbl_attr(&pool_attr,
+ (enum mlx5dr_table_type)i);
ctx->stc_pool[i] = mlx5dr_pool_create(ctx, &pool_attr);
if (!ctx->stc_pool[i]) {
DR_LOG(ERR, "Failed to allocate STC pool [%d]", i);
diff --git a/drivers/net/mlx5/hws/mlx5dr_context.h b/drivers/net/mlx5/hws/mlx5dr_context.h
index 7678232ecc..e89a093c77 100644
--- a/drivers/net/mlx5/hws/mlx5dr_context.h
+++ b/drivers/net/mlx5/hws/mlx5dr_context.h
@@ -72,4 +72,7 @@ bool mlx5dr_context_cap_dynamic_reparse(struct mlx5dr_context *ctx);
uint8_t mlx5dr_context_get_reparse_mode(struct mlx5dr_context *ctx);
+void mlx5dr_context_set_pool_tbl_attr(struct mlx5dr_pool_attr *attr,
+ enum mlx5dr_table_type table_type);
+
#endif /* MLX5DR_CONTEXT_H_ */
--
2.21.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/8] net/mlx5/hws: allow table creation from the new types
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
2025-02-16 11:04 ` [PATCH 5/8] net/mlx5/hws: matcher changes to support unified domain Hamdan Igbaria
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Hamdan Igbaria @ 2025-02-16 11:04 UTC (permalink / raw)
To: hamdani, viacheslavo, thomas, suanmingm, Dariusz Sosnowski,
Bing Zhao, Ori Kam, Matan Azrad
Cc: dev, Erez Shitrit
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5/8] net/mlx5/hws: matcher changes to support unified domain
2025-02-16 11:04 [PATCH 1/8] net/mlx5/hws: introduce capability for unified mode Hamdan Igbaria
` (2 preceding siblings ...)
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
2025-02-16 11:04 ` [PATCH 6/8] net/mlx5/hws: action " Hamdan Igbaria
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Hamdan Igbaria @ 2025-02-16 11:04 UTC (permalink / raw)
To: hamdani, viacheslavo, thomas, suanmingm, Dariusz Sosnowski,
Bing Zhao, Ori Kam, Matan Azrad
Cc: dev, Erez Shitrit
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 6/8] net/mlx5/hws: action changes to support unified domain
2025-02-16 11:04 [PATCH 1/8] net/mlx5/hws: introduce capability for unified mode Hamdan Igbaria
` (3 preceding siblings ...)
2025-02-16 11:04 ` [PATCH 5/8] net/mlx5/hws: matcher changes to support unified domain Hamdan Igbaria
@ 2025-02-16 11:04 ` 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
6 siblings, 0 replies; 8+ messages in thread
From: Hamdan Igbaria @ 2025-02-16 11:04 UTC (permalink / raw)
To: hamdani, viacheslavo, thomas, suanmingm, Dariusz Sosnowski,
Bing Zhao, Ori Kam, Matan Azrad
Cc: dev, Erez Shitrit
From: Erez Shitrit <erezsh@nvidia.com>
Actions are depended on the sub-domain that will be used.
So handle the actions accordingly.
From now on we don't fix-up for actions that doesn't fit the right
domain, we will let it be failed by the FW while creating the STC for
it.
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.h | 5 +-
drivers/net/mlx5/hws/mlx5dr_action.c | 222 +++++++++++++++++++++++----
drivers/net/mlx5/hws/mlx5dr_action.h | 2 +-
3 files changed, 200 insertions(+), 29 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index e0e7f5c147..58526fc08e 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -66,10 +66,13 @@ enum mlx5dr_action_flags {
MLX5DR_ACTION_FLAG_HWS_RX = 1 << 3,
MLX5DR_ACTION_FLAG_HWS_TX = 1 << 4,
MLX5DR_ACTION_FLAG_HWS_FDB = 1 << 5,
+ MLX5DR_ACTION_FLAG_HWS_FDB_RX = 1 << 6,
+ MLX5DR_ACTION_FLAG_HWS_FDB_TX = 1 << 7,
+ MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED = 1 << 8,
/* Shared action can be used over a few threads, since data is written
* only once at the creation of the action.
*/
- MLX5DR_ACTION_FLAG_SHARED = 1 << 6,
+ MLX5DR_ACTION_FLAG_SHARED = 1 << 9,
};
enum mlx5dr_action_aso_meter_color {
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 8e95abf7da..b9452a3ebc 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -10,6 +10,12 @@
/* Header removal size limited to 128B (64 words) */
#define MLX5DR_ACTION_REMOVE_HEADER_MAX_SIZE 128
+static struct mlx5dr_devx_obj *
+mlx5dr_action_get_stc_obj_by_tbl_type(enum mlx5dr_table_type table_type,
+ struct mlx5dr_pool *stc_pool,
+ struct mlx5dr_pool_chunk *stc,
+ bool is_mirror);
+
/* This is the maximum allowed action order for each table type:
* TX: POP_VLAN, CTR, ASO_METER, AS_CT, PUSH_VLAN, MODIFY, ENCAP, Term
* RX: TAG, DECAP, POP_VLAN, CTR, ASO_METER, ASO_CT, PUSH_VLAN, MODIFY,
@@ -220,8 +226,47 @@ static int mlx5dr_action_get_shared_stc(struct mlx5dr_action *action,
}
}
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_RX) {
+ ret = mlx5dr_action_get_shared_stc_nic(ctx, stc_type,
+ MLX5DR_TABLE_TYPE_FDB_RX);
+ if (ret) {
+ DR_LOG(ERR, "Failed to allocate FDB_RX shared STCs (type: %d)",
+ stc_type);
+ goto clean_nic_fdb_stc;
+ }
+ }
+
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_TX) {
+ ret = mlx5dr_action_get_shared_stc_nic(ctx, stc_type,
+ MLX5DR_TABLE_TYPE_FDB_TX);
+ if (ret) {
+ DR_LOG(ERR, "Failed to allocate FDB_TX shared STCs (type: %d)",
+ stc_type);
+ goto clean_nic_fdb_rx_stc;
+ }
+ }
+
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED) {
+ ret = mlx5dr_action_get_shared_stc_nic(ctx, stc_type,
+ MLX5DR_TABLE_TYPE_FDB_UNIFIED);
+ if (ret) {
+ DR_LOG(ERR, "Failed to allocate FDB_UNIFIED shared STCs (type: %d)",
+ stc_type);
+ goto clean_nic_fdb_tx_stc;
+ }
+ }
+
return 0;
+clean_nic_fdb_tx_stc:
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_TX)
+ mlx5dr_action_put_shared_stc_nic(ctx, stc_type, MLX5DR_TABLE_TYPE_FDB_TX);
+clean_nic_fdb_rx_stc:
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_RX)
+ mlx5dr_action_put_shared_stc_nic(ctx, stc_type, MLX5DR_TABLE_TYPE_FDB_RX);
+clean_nic_fdb_stc:
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB)
+ mlx5dr_action_put_shared_stc_nic(ctx, stc_type, MLX5DR_TABLE_TYPE_FDB);
clean_nic_tx_stc:
if (action->flags & MLX5DR_ACTION_FLAG_HWS_TX)
mlx5dr_action_put_shared_stc_nic(ctx, stc_type, MLX5DR_TABLE_TYPE_NIC_TX);
@@ -250,6 +295,15 @@ static void mlx5dr_action_put_shared_stc(struct mlx5dr_action *action,
if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB)
mlx5dr_action_put_shared_stc_nic(ctx, stc_type, MLX5DR_TABLE_TYPE_FDB);
+
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_RX)
+ mlx5dr_action_put_shared_stc_nic(ctx, stc_type, MLX5DR_TABLE_TYPE_FDB_RX);
+
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_TX)
+ mlx5dr_action_put_shared_stc_nic(ctx, stc_type, MLX5DR_TABLE_TYPE_FDB_TX);
+
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED)
+ mlx5dr_action_put_shared_stc_nic(ctx, stc_type, MLX5DR_TABLE_TYPE_FDB_UNIFIED);
}
static void
@@ -689,14 +743,37 @@ static void mlx5dr_action_print_combo(enum mlx5dr_action_type *user_actions)
}
}
+static const uint32_t *
+mlx5dr_action_get_order_entry(enum mlx5dr_table_type table_type)
+{
+ switch (table_type) {
+ case MLX5DR_TABLE_TYPE_NIC_RX:
+ return action_order_arr[MLX5DR_TABLE_TYPE_NIC_RX];
+ case MLX5DR_TABLE_TYPE_NIC_TX:
+ return action_order_arr[MLX5DR_TABLE_TYPE_NIC_TX];
+ case MLX5DR_TABLE_TYPE_FDB:
+ case MLX5DR_TABLE_TYPE_FDB_RX:
+ case MLX5DR_TABLE_TYPE_FDB_TX:
+ case MLX5DR_TABLE_TYPE_FDB_UNIFIED:
+ return action_order_arr[MLX5DR_TABLE_TYPE_FDB];
+ default:
+ assert(0);
+ DR_LOG(ERR, "no such type: %d", table_type);
+ return NULL;
+ }
+}
+
bool mlx5dr_action_check_combo(enum mlx5dr_action_type *user_actions,
enum mlx5dr_table_type table_type)
{
- const uint32_t *order_arr = action_order_arr[table_type];
+ const uint32_t *order_arr = mlx5dr_action_get_order_entry(table_type);
uint8_t order_idx = 0;
uint8_t user_idx = 0;
bool valid_combo;
+ if (!order_arr)
+ return false;
+
while (order_arr[order_idx] != BIT(MLX5DR_ACTION_TYP_LAST)) {
/* User action order validated move to next user action */
if (BIT(user_actions[user_idx]) & order_arr[order_idx])
@@ -787,13 +864,10 @@ mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx,
switch (stc_attr->action_type) {
case MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_STE_TABLE:
- if (!is_mirror)
- devx_obj = mlx5dr_pool_chunk_get_base_devx_obj(stc_attr->ste_table.ste_pool,
- &stc_attr->ste_table.ste);
- else
- devx_obj =
- mlx5dr_pool_chunk_get_base_devx_obj_mirror(stc_attr->ste_table.ste_pool,
- &stc_attr->ste_table.ste);
+ devx_obj = mlx5dr_action_get_stc_obj_by_tbl_type(table_type,
+ stc_attr->ste_table.ste_pool,
+ &stc_attr->ste_table.ste,
+ is_mirror);
*fixup_stc_attr = *stc_attr;
fixup_stc_attr->ste_table.ste_obj_id = devx_obj->id;
@@ -845,6 +919,19 @@ mlx5dr_action_fixup_stc_attr(struct mlx5dr_context *ctx,
return use_fixup;
}
+static struct mlx5dr_devx_obj *
+mlx5dr_action_get_stc_obj_by_tbl_type(enum mlx5dr_table_type table_type,
+ struct mlx5dr_pool *stc_pool,
+ struct mlx5dr_pool_chunk *stc,
+ bool is_mirror)
+{
+ if (table_type == MLX5DR_TABLE_TYPE_FDB_TX ||
+ (is_mirror && table_type == MLX5DR_TABLE_TYPE_FDB)) /* Optimized ORIG in FDB_TX */
+ return mlx5dr_pool_chunk_get_base_devx_obj_mirror(stc_pool, stc);
+ else
+ return mlx5dr_pool_chunk_get_base_devx_obj(stc_pool, stc);
+}
+
int mlx5dr_action_alloc_single_stc(struct mlx5dr_context *ctx,
struct mlx5dr_cmd_stc_modify_attr *stc_attr,
uint32_t table_type,
@@ -854,6 +941,7 @@ int mlx5dr_action_alloc_single_stc(struct mlx5dr_context *ctx,
struct mlx5dr_pool *stc_pool = ctx->stc_pool[table_type];
struct mlx5dr_cmd_stc_modify_attr fixup_stc_attr = {0};
struct mlx5dr_devx_obj *devx_obj_0;
+ enum mlx5dr_table_type type;
bool use_fixup;
int ret;
@@ -869,10 +957,13 @@ int mlx5dr_action_alloc_single_stc(struct mlx5dr_context *ctx,
if (!mlx5dr_context_cap_dynamic_reparse(ctx))
stc_attr->reparse_mode = MLX5_IFC_STC_REPARSE_IGNORE;
- devx_obj_0 = mlx5dr_pool_chunk_get_base_devx_obj(stc_pool, stc);
+ type = (enum mlx5dr_table_type)table_type;
+ devx_obj_0 = mlx5dr_action_get_stc_obj_by_tbl_type(type, stc_pool, stc, false);
/* According to table/action limitation change the stc_attr */
- use_fixup = mlx5dr_action_fixup_stc_attr(ctx, stc_attr, &fixup_stc_attr, table_type, false);
+ use_fixup = mlx5dr_action_fixup_stc_attr(ctx, stc_attr, &fixup_stc_attr,
+ (enum mlx5dr_table_type)table_type,
+ (table_type == MLX5DR_TABLE_TYPE_FDB_TX));
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",
@@ -916,12 +1007,15 @@ void mlx5dr_action_free_single_stc(struct mlx5dr_context *ctx,
struct mlx5dr_pool *stc_pool = ctx->stc_pool[table_type];
struct mlx5dr_cmd_stc_modify_attr stc_attr = {0};
struct mlx5dr_devx_obj *devx_obj;
+ enum mlx5dr_table_type type;
/* Modify the STC not to point to an object */
stc_attr.action_type = MLX5_IFC_STC_ACTION_TYPE_DROP;
stc_attr.action_offset = MLX5DR_ACTION_OFFSET_HIT;
stc_attr.stc_offset = stc->offset;
- devx_obj = mlx5dr_pool_chunk_get_base_devx_obj(stc_pool, stc);
+ type = (enum mlx5dr_table_type)table_type;
+ devx_obj = mlx5dr_action_get_stc_obj_by_tbl_type(type, stc_pool, stc, false);
+
mlx5dr_cmd_stc_modify(devx_obj, &stc_attr);
if (table_type == MLX5DR_TABLE_TYPE_FDB) {
@@ -1131,7 +1225,7 @@ mlx5dr_action_create_stcs(struct mlx5dr_action *action,
MLX5DR_TABLE_TYPE_NIC_TX,
&action->stc[MLX5DR_TABLE_TYPE_NIC_TX]);
if (ret)
- goto free_nic_rx_stc;
+ goto free_stcs_rx;
}
/* Allocate STC for FDB */
@@ -1140,22 +1234,59 @@ mlx5dr_action_create_stcs(struct mlx5dr_action *action,
MLX5DR_TABLE_TYPE_FDB,
&action->stc[MLX5DR_TABLE_TYPE_FDB]);
if (ret)
- goto free_nic_tx_stc;
+ goto free_stcs_tx;
+ }
+
+ /* Allocate STC for FDB-RX */
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_RX) {
+ ret = mlx5dr_action_alloc_single_stc(ctx, &stc_attr,
+ MLX5DR_TABLE_TYPE_FDB_RX,
+ &action->stc[MLX5DR_TABLE_TYPE_FDB_RX]);
+ if (ret)
+ goto free_stcs_fdb;
+ }
+
+ /* Allocate STC for FDB-TX */
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_TX) {
+ ret = mlx5dr_action_alloc_single_stc(ctx, &stc_attr,
+ MLX5DR_TABLE_TYPE_FDB_TX,
+ &action->stc[MLX5DR_TABLE_TYPE_FDB_TX]);
+ if (ret)
+ goto free_stcs_fdb_rx;
+ }
+
+ /* Allocate STC for FDB Unified */
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED) {
+ ret = mlx5dr_action_alloc_single_stc(ctx, &stc_attr,
+ MLX5DR_TABLE_TYPE_FDB_UNIFIED,
+ &action->stc[MLX5DR_TABLE_TYPE_FDB_UNIFIED]);
+ if (ret)
+ goto free_stcs_fdb_tx;
}
pthread_spin_unlock(&ctx->ctrl_lock);
return 0;
-free_nic_tx_stc:
+free_stcs_fdb_tx:
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_TX)
+ mlx5dr_action_free_single_stc(ctx, MLX5DR_TABLE_TYPE_FDB_TX,
+ &action->stc[MLX5DR_TABLE_TYPE_FDB_TX]);
+free_stcs_fdb_rx:
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_RX)
+ mlx5dr_action_free_single_stc(ctx, MLX5DR_TABLE_TYPE_FDB_RX,
+ &action->stc[MLX5DR_TABLE_TYPE_FDB_RX]);
+free_stcs_fdb:
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB)
+ mlx5dr_action_free_single_stc(ctx, MLX5DR_TABLE_TYPE_FDB,
+ &action->stc[MLX5DR_TABLE_TYPE_FDB]);
+free_stcs_tx:
if (action->flags & MLX5DR_ACTION_FLAG_HWS_TX)
- mlx5dr_action_free_single_stc(ctx,
- MLX5DR_TABLE_TYPE_NIC_TX,
+ mlx5dr_action_free_single_stc(ctx, MLX5DR_TABLE_TYPE_NIC_TX,
&action->stc[MLX5DR_TABLE_TYPE_NIC_TX]);
-free_nic_rx_stc:
+free_stcs_rx:
if (action->flags & MLX5DR_ACTION_FLAG_HWS_RX)
- mlx5dr_action_free_single_stc(ctx,
- MLX5DR_TABLE_TYPE_NIC_RX,
+ mlx5dr_action_free_single_stc(ctx, MLX5DR_TABLE_TYPE_NIC_RX,
&action->stc[MLX5DR_TABLE_TYPE_NIC_RX]);
out_err:
pthread_spin_unlock(&ctx->ctrl_lock);
@@ -1182,6 +1313,18 @@ mlx5dr_action_destroy_stcs(struct mlx5dr_action *action)
mlx5dr_action_free_single_stc(ctx, MLX5DR_TABLE_TYPE_FDB,
&action->stc[MLX5DR_TABLE_TYPE_FDB]);
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_RX)
+ mlx5dr_action_free_single_stc(ctx, MLX5DR_TABLE_TYPE_FDB_RX,
+ &action->stc[MLX5DR_TABLE_TYPE_FDB_RX]);
+
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_TX)
+ mlx5dr_action_free_single_stc(ctx, MLX5DR_TABLE_TYPE_FDB_TX,
+ &action->stc[MLX5DR_TABLE_TYPE_FDB_TX]);
+
+ if (action->flags & MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED)
+ mlx5dr_action_free_single_stc(ctx, MLX5DR_TABLE_TYPE_FDB_UNIFIED,
+ &action->stc[MLX5DR_TABLE_TYPE_FDB_UNIFIED]);
+
pthread_spin_unlock(&ctx->ctrl_lock);
}
@@ -1198,7 +1341,10 @@ mlx5dr_action_is_hws_flags(uint32_t flags)
{
return flags & (MLX5DR_ACTION_FLAG_HWS_RX |
MLX5DR_ACTION_FLAG_HWS_TX |
- MLX5DR_ACTION_FLAG_HWS_FDB);
+ MLX5DR_ACTION_FLAG_HWS_FDB |
+ MLX5DR_ACTION_FLAG_HWS_FDB_RX |
+ MLX5DR_ACTION_FLAG_HWS_FDB_TX |
+ MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED);
}
static struct mlx5dr_action *
@@ -1336,9 +1482,13 @@ mlx5dr_action_create_dest_tir(struct mlx5dr_context *ctx,
return NULL;
}
- if ((flags & MLX5DR_ACTION_FLAG_ROOT_FDB) ||
- (flags & MLX5DR_ACTION_FLAG_HWS_FDB && !ctx->caps->fdb_tir_stc)) {
- DR_LOG(ERR, "TIR action not support on FDB");
+ if ((flags & (MLX5DR_ACTION_FLAG_ROOT_FDB |
+ MLX5DR_ACTION_FLAG_HWS_FDB_TX |
+ MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED)) ||
+ ((flags & (MLX5DR_ACTION_FLAG_HWS_FDB |
+ MLX5DR_ACTION_FLAG_HWS_FDB_RX)) &&
+ !ctx->caps->fdb_tir_stc)) {
+ DR_LOG(ERR, "TIR action not support on FDB or FDB_TX or UNIFIED");
rte_errno = ENOTSUP;
return NULL;
}
@@ -1436,6 +1586,12 @@ mlx5dr_action_create_tag(struct mlx5dr_context *ctx,
struct mlx5dr_action *action;
int ret;
+ if (flags & (MLX5DR_ACTION_FLAG_HWS_FDB_TX | MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED)) {
+ DR_LOG(ERR, "TAG action not supported for UNIFIED or FDB_TX");
+ rte_errno = ENOTSUP;
+ return NULL;
+ }
+
action = mlx5dr_action_create_generic(ctx, flags, MLX5DR_ACTION_TYP_TAG);
if (!action)
return NULL;
@@ -1588,7 +1744,9 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_context *ctx,
struct mlx5dr_action *action;
int ret;
- if (!(flags & MLX5DR_ACTION_FLAG_HWS_FDB)) {
+ if (!(flags & (MLX5DR_ACTION_FLAG_HWS_FDB | MLX5DR_ACTION_FLAG_HWS_FDB_RX |
+ MLX5DR_ACTION_FLAG_HWS_FDB_TX |
+ MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED))) {
DR_LOG(ERR, "Vport action is supported for FDB only");
rte_errno = EINVAL;
return NULL;
@@ -2317,11 +2475,21 @@ mlx5dr_action_create_dest_array(struct mlx5dr_context *ctx,
return NULL;
}
- if (flags == (MLX5DR_ACTION_FLAG_HWS_RX | MLX5DR_ACTION_FLAG_SHARED)) {
+ if (!(flags & MLX5DR_ACTION_FLAG_SHARED)) {
+ DR_LOG(ERR, "Action flags not supported, should include SHARED");
+ rte_errno = ENOTSUP;
+ return NULL;
+ }
+
+ flags = flags & ~MLX5DR_ACTION_FLAG_SHARED;
+
+ if (flags == MLX5DR_ACTION_FLAG_HWS_RX) {
ft_attr.type = FS_FT_NIC_RX;
ft_attr.level = MLX5_IFC_MULTI_PATH_FT_MAX_LEVEL - 1;
table_type = MLX5DR_TABLE_TYPE_NIC_RX;
- } else if (flags == (MLX5DR_ACTION_FLAG_HWS_FDB | MLX5DR_ACTION_FLAG_SHARED)) {
+ } else if (flags & (MLX5DR_ACTION_FLAG_HWS_FDB | MLX5DR_ACTION_FLAG_HWS_FDB_RX |
+ MLX5DR_ACTION_FLAG_HWS_FDB_TX |
+ MLX5DR_ACTION_FLAG_HWS_FDB_UNIFIED)) {
ft_attr.type = FS_FT_FDB;
ft_attr.level = ctx->caps->fdb_ft.max_level - 1;
table_type = MLX5DR_TABLE_TYPE_FDB;
@@ -2363,7 +2531,7 @@ mlx5dr_action_create_dest_array(struct mlx5dr_context *ctx,
fte_attr.ignore_flow_level = 1;
break;
case MLX5DR_ACTION_TYP_MISS:
- if (table_type != MLX5DR_TABLE_TYPE_FDB) {
+ if (!mlx5dr_table_is_fdb_any(table_type)) {
DR_LOG(ERR, "Miss action supported for FDB only");
rte_errno = ENOTSUP;
goto free_dest_list;
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.h b/drivers/net/mlx5/hws/mlx5dr_action.h
index 8ce4ecd5ba..b779e578fd 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.h
+++ b/drivers/net/mlx5/hws/mlx5dr_action.h
@@ -160,7 +160,7 @@ struct mlx5dr_action_template {
struct mlx5dr_action {
uint8_t type;
- uint8_t flags;
+ uint16_t flags;
struct mlx5dr_context *ctx;
union {
struct {
--
2.21.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 7/8] net/mlx5/hws: unified rule changes
2025-02-16 11:04 [PATCH 1/8] net/mlx5/hws: introduce capability for unified mode Hamdan Igbaria
` (4 preceding siblings ...)
2025-02-16 11:04 ` [PATCH 6/8] net/mlx5/hws: action " Hamdan Igbaria
@ 2025-02-16 11:04 ` Hamdan Igbaria
2025-02-16 11:04 ` [PATCH 8/8] net/mlx5/hws: support debug information for new domains Hamdan Igbaria
6 siblings, 0 replies; 8+ messages in thread
From: Hamdan Igbaria @ 2025-02-16 11:04 UTC (permalink / raw)
To: hamdani, viacheslavo, thomas, suanmingm, Dariusz Sosnowski,
Bing Zhao, Ori Kam, Matan Azrad
Cc: dev, Erez Shitrit
From: Erez Shitrit <erezsh@nvidia.com>
Rule is set according to its specific 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_rule.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c
index 519328ccf3..878224d8b3 100644
--- a/drivers/net/mlx5/hws/mlx5dr_rule.c
+++ b/drivers/net/mlx5/hws/mlx5dr_rule.c
@@ -11,18 +11,28 @@ static void mlx5dr_rule_skip(struct mlx5dr_matcher *matcher,
{
const struct flow_hw_port_info *vport;
const struct rte_flow_item_ethdev *v;
+ enum mlx5dr_table_type type;
- /* Flow_src is the 1st priority */
+ /* By default FDB rules are added to both RX and TX */
+ *skip_rx = false;
+ *skip_tx = false;
+
+ type = matcher->tbl->type;
+ if (type == MLX5DR_TABLE_TYPE_FDB_RX || type == MLX5DR_TABLE_TYPE_FDB_UNIFIED) {
+ *skip_tx = true;
+ return;
+ } else if (type == MLX5DR_TABLE_TYPE_FDB_TX) {
+ *skip_rx = true;
+ return;
+ }
+
+ /* Flow_src is the 1st priority after table type */
if (matcher->attr.optimize_flow_src) {
*skip_tx = matcher->attr.optimize_flow_src == MLX5DR_MATCHER_FLOW_SRC_WIRE;
*skip_rx = matcher->attr.optimize_flow_src == MLX5DR_MATCHER_FLOW_SRC_VPORT;
return;
}
- /* By default FDB rules are added to both RX and TX */
- *skip_rx = false;
- *skip_tx = false;
-
if (unlikely(mlx5dr_matcher_is_insert_by_idx(matcher)))
return;
@@ -88,6 +98,9 @@ static void mlx5dr_rule_init_dep_wqe(struct mlx5dr_send_ring_dep_wqe *dep_wqe,
break;
case MLX5DR_TABLE_TYPE_FDB:
+ case MLX5DR_TABLE_TYPE_FDB_RX:
+ case MLX5DR_TABLE_TYPE_FDB_TX:
+ case MLX5DR_TABLE_TYPE_FDB_UNIFIED:
mlx5dr_rule_skip(matcher, mt, items, &skip_rx, &skip_tx);
if (!skip_rx) {
--
2.21.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 8/8] net/mlx5/hws: support debug information for new domains
2025-02-16 11:04 [PATCH 1/8] net/mlx5/hws: introduce capability for unified mode Hamdan Igbaria
` (5 preceding siblings ...)
2025-02-16 11:04 ` [PATCH 7/8] net/mlx5/hws: unified rule changes Hamdan Igbaria
@ 2025-02-16 11:04 ` Hamdan Igbaria
6 siblings, 0 replies; 8+ messages in thread
From: Hamdan Igbaria @ 2025-02-16 11:04 UTC (permalink / raw)
To: hamdani, viacheslavo, thomas, suanmingm, Dariusz Sosnowski,
Bing Zhao, Ori Kam, Matan Azrad
Cc: dev, Erez Shitrit
From: Erez Shitrit <erezsh@nvidia.com>
In order to have the details of the new specific domains.
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_debug.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c
index 8684a8197a..7480300de8 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.c
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c
@@ -232,7 +232,7 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher)
ste_pool = matcher->match_ste.pool;
if (ste_pool) {
ste_0 = mlx5dr_pool_chunk_get_base_devx_obj(ste_pool, ste);
- if (tbl_type == MLX5DR_TABLE_TYPE_FDB)
+ if (tbl_type == MLX5DR_TABLE_TYPE_FDB || tbl_type == MLX5DR_TABLE_TYPE_FDB_TX)
ste_1 = mlx5dr_pool_chunk_get_base_devx_obj_mirror(ste_pool, ste);
} else {
ste_0 = NULL;
@@ -251,7 +251,7 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher)
ste_pool = matcher->action_ste.pool;
if (ste_pool) {
ste_0 = mlx5dr_pool_chunk_get_base_devx_obj(ste_pool, ste);
- if (tbl_type == MLX5DR_TABLE_TYPE_FDB)
+ if (tbl_type == MLX5DR_TABLE_TYPE_FDB || tbl_type == MLX5DR_TABLE_TYPE_FDB_TX)
ste_1 = mlx5dr_pool_chunk_get_base_devx_obj_mirror(ste_pool, ste);
} else {
ste_0 = NULL;
--
2.21.0
^ permalink raw reply [flat|nested] 8+ messages in thread