HWS fixes a flow group's DR table type (FDB_UNIFIED,
FDB_RX, FDB_TX, etc.) on first use.
If a later table uses the same group with a different domain
(e.g. transfer wire_orig) the driver returns a generic type mismatch.

- Add mlx5dr_table_type_name() to map table type enum to readable strings
(e.g. FDB_RX(wire_orig), FDB_UNIFIED).

This makes it easier to fix ordering issues
(e.g. create wire_origtable before the table that jumps to the group).

Signed-off-by: Maayan Kashani <[email protected]>
Acked-by: Dariusz Sosnowski <[email protected]>
---
 doc/guides/nics/mlx5.rst        |  4 ++++
 drivers/net/mlx5/mlx5_flow_hw.c | 28 ++++++++++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 9dcc93cc235..a350fdaa160 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -2493,6 +2493,10 @@ DPDK       24.11
 Limitations
 ^^^^^^^^^^^
 
+#. With the async template API, the target table must be pre-created
+   before adding a jump action that redirects to a specialized table.
+   The jump will fail if the destination table does not exist yet.
+
 #. With the async template API, jumping to a template table
    with ``RTE_FLOW_TABLE_SPECIALIZE_TRANSFER_WIRE_ORIG`` specialization
    from a template table with a different specialization
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 041066a94f7..a341cdd34d4 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -322,6 +322,21 @@ get_mlx5dr_table_type(const struct rte_flow_attr *attr, 
uint32_t specialize,
        return type;
 }
 
+/** Human-readable name for mlx5dr_table_type (for error messages). */
+static inline const char *
+mlx5dr_table_type_name(enum mlx5dr_table_type type)
+{
+       switch (type) {
+       case MLX5DR_TABLE_TYPE_NIC_RX: return "NIC_RX";
+       case MLX5DR_TABLE_TYPE_NIC_TX: return "NIC_TX";
+       case MLX5DR_TABLE_TYPE_FDB: return "FDB";
+       case MLX5DR_TABLE_TYPE_FDB_RX: return "FDB_RX(wire_orig)";
+       case MLX5DR_TABLE_TYPE_FDB_TX: return "FDB_TX(vf_orig)";
+       case MLX5DR_TABLE_TYPE_FDB_UNIFIED: return "FDB_UNIFIED";
+       default: return "unknown";
+       }
+}
+
 /* Non template default queue size used for inner ctrl queue. */
 #define MLX5_NT_DEFAULT_QUEUE_SIZE 32
 
@@ -5312,8 +5327,17 @@ flow_hw_table_create(struct rte_eth_dev *dev,
        /* Verify unified fdb sub domains consistency */
        table_type = get_mlx5dr_table_type(&flow_attr, specialize, unified_fdb);
        if (table_type != grp->type) {
-               DRV_LOG(ERR, "Table type (%u) does not match group id (%u) type 
(%u)",
-                       table_type, grp->group_id, grp->type);
+               DRV_LOG(ERR,
+                       "Group %u table type mismatch: group type is fixed on 
first use. "
+                       "This table requires %s but group was first used as %s. 
"
+                       "Create tables with transfer wire_orig or vf_orig 
before tables jumping to it.",
+                       grp->group_id,
+                       mlx5dr_table_type_name(table_type),
+                       mlx5dr_table_type_name(grp->type));
+               rte_flow_error_set(error, EINVAL, 
RTE_FLOW_ERROR_TYPE_ATTR_GROUP,
+                                  NULL,
+                                  "group table type mismatch: type is fixed on 
first use; "
+                                  "create transfer wire_orig/vf_orig tables 
before tables jumping to it");
                rte_errno = EINVAL;
                goto error;
        }
-- 
2.21.0

Reply via email to