net/mlx5: Implement new destination type TABLE_TYPE
authorMark Zhang <markzhang@nvidia.com>
Thu, 5 Jan 2023 04:17:53 +0000 (20:17 -0800)
committerLeon Romanovsky <leon@kernel.org>
Wed, 15 Feb 2023 09:29:52 +0000 (11:29 +0200)
Implement new destination type to support flow transition between
different table types.
e.g. from NIC_RX to RDMA_RX or from RDMA_TX to NIC_TX.
The new destination is described in the tracepoint as follows:
"mlx5_fs_add_rule: rule=00000000d53cd0ed fte=0000000048a8a6ed index=0 sw_action=<> [dst] flow_table_type=7 id:262152"

Signed-off-by: Mark Zhang <markzhang@nvidia.com>
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
include/linux/mlx5/fs.h

index 2732128e7a6ec98167fd1d0e073732195e29d90f..6d73127b7217fdeb1e05ca500125f6111de2e640 100644 (file)
@@ -275,6 +275,10 @@ const char *parse_fs_dst(struct trace_seq *p,
                                 fs_dest_range_field_to_str(dst->range.field),
                                 dst->range.min, dst->range.max);
                break;
+       case MLX5_FLOW_DESTINATION_TYPE_TABLE_TYPE:
+               trace_seq_printf(p, "flow_table_type=%u id:%u\n", dst->ft->type,
+                                dst->ft->id);
+               break;
        case MLX5_FLOW_DESTINATION_TYPE_NONE:
                trace_seq_printf(p, "none\n");
                break;
index 32d4c967469ccc75eceb28d2d6e7701aecacce3a..a3a9cc6f15cafa55cbee90696b73d5390df91e2e 100644 (file)
@@ -653,6 +653,12 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
                                id = dst->dest_attr.sampler_id;
                                ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_SAMPLER;
                                break;
+                       case MLX5_FLOW_DESTINATION_TYPE_TABLE_TYPE:
+                               MLX5_SET(dest_format_struct, in_dests,
+                                        destination_table_type, dst->dest_attr.ft->type);
+                               id = dst->dest_attr.ft->id;
+                               ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_TABLE_TYPE;
+                               break;
                        default:
                                id = dst->dest_attr.tir_num;
                                ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_TIR;
index 5a85d8c1e7975e39ad98b9f77fc00aa346b1c537..2333f835fb70e3d11da3a45b98a788e2d236adeb 100644 (file)
@@ -449,7 +449,8 @@ static bool is_fwd_dest_type(enum mlx5_flow_destination_type type)
                type == MLX5_FLOW_DESTINATION_TYPE_VPORT ||
                type == MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER ||
                type == MLX5_FLOW_DESTINATION_TYPE_TIR ||
-               type == MLX5_FLOW_DESTINATION_TYPE_RANGE;
+               type == MLX5_FLOW_DESTINATION_TYPE_RANGE ||
+               type == MLX5_FLOW_DESTINATION_TYPE_TABLE_TYPE;
 }
 
 static bool check_valid_spec(const struct mlx5_flow_spec *spec)
index ba6958b49a8ed48fc15d86de06893c8ad6c15935..1d2a0638ae74f8d7d221a4d7391785a3061ed259 100644 (file)
@@ -51,6 +51,7 @@ enum mlx5_flow_destination_type {
        MLX5_FLOW_DESTINATION_TYPE_COUNTER,
        MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM,
        MLX5_FLOW_DESTINATION_TYPE_RANGE,
+       MLX5_FLOW_DESTINATION_TYPE_TABLE_TYPE,
 };
 
 enum {