Commit 664000b6 authored by Yishai Hadas's avatar Yishai Hadas Committed by Leon Romanovsky

net/mlx5: Add support for flow table destination number

Add support to set a destination from a flow table number.
This functionality will be used in downstream patches from this
series by the DEVX stuff.
Signed-off-by: default avatarYishai Hadas <yishaih@mellanox.com>
Acked-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
parent 2aada6c0
...@@ -240,6 +240,9 @@ const char *parse_fs_dst(struct trace_seq *p, ...@@ -240,6 +240,9 @@ const char *parse_fs_dst(struct trace_seq *p,
case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE:
trace_seq_printf(p, "ft=%p\n", dst->ft); trace_seq_printf(p, "ft=%p\n", dst->ft);
break; break;
case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM:
trace_seq_printf(p, "ft_num=%u\n", dst->ft_num);
break;
case MLX5_FLOW_DESTINATION_TYPE_TIR: case MLX5_FLOW_DESTINATION_TYPE_TIR:
trace_seq_printf(p, "tir=%u\n", dst->tir_num); trace_seq_printf(p, "tir=%u\n", dst->tir_num);
break; break;
......
...@@ -368,18 +368,20 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, ...@@ -368,18 +368,20 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
int list_size = 0; int list_size = 0;
list_for_each_entry(dst, &fte->node.children, node.list) { list_for_each_entry(dst, &fte->node.children, node.list) {
unsigned int id; unsigned int id, type = dst->dest_attr.type;
if (dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) if (type == MLX5_FLOW_DESTINATION_TYPE_COUNTER)
continue; continue;
MLX5_SET(dest_format_struct, in_dests, destination_type, switch (type) {
dst->dest_attr.type); case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM:
if (dst->dest_attr.type == id = dst->dest_attr.ft_num;
MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE) { type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
break;
case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE:
id = dst->dest_attr.ft->id; id = dst->dest_attr.ft->id;
} else if (dst->dest_attr.type == break;
MLX5_FLOW_DESTINATION_TYPE_VPORT) { case MLX5_FLOW_DESTINATION_TYPE_VPORT:
id = dst->dest_attr.vport.num; id = dst->dest_attr.vport.num;
MLX5_SET(dest_format_struct, in_dests, MLX5_SET(dest_format_struct, in_dests,
destination_eswitch_owner_vhca_id_valid, destination_eswitch_owner_vhca_id_valid,
...@@ -387,9 +389,13 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, ...@@ -387,9 +389,13 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev,
MLX5_SET(dest_format_struct, in_dests, MLX5_SET(dest_format_struct, in_dests,
destination_eswitch_owner_vhca_id, destination_eswitch_owner_vhca_id,
dst->dest_attr.vport.vhca_id); dst->dest_attr.vport.vhca_id);
} else { break;
default:
id = dst->dest_attr.tir_num; id = dst->dest_attr.tir_num;
} }
MLX5_SET(dest_format_struct, in_dests, destination_type,
type);
MLX5_SET(dest_format_struct, in_dests, destination_id, id); MLX5_SET(dest_format_struct, in_dests, destination_id, id);
in_dests += MLX5_ST_SZ_BYTES(dest_format_struct); in_dests += MLX5_ST_SZ_BYTES(dest_format_struct);
list_size++; list_size++;
......
...@@ -1356,7 +1356,9 @@ static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1, ...@@ -1356,7 +1356,9 @@ static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
(d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE && (d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE &&
d1->ft == d2->ft) || d1->ft == d2->ft) ||
(d1->type == MLX5_FLOW_DESTINATION_TYPE_TIR && (d1->type == MLX5_FLOW_DESTINATION_TYPE_TIR &&
d1->tir_num == d2->tir_num)) d1->tir_num == d2->tir_num) ||
(d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM &&
d1->ft_num == d2->ft_num))
return true; return true;
} }
......
...@@ -89,6 +89,7 @@ struct mlx5_flow_destination { ...@@ -89,6 +89,7 @@ struct mlx5_flow_destination {
enum mlx5_flow_destination_type type; enum mlx5_flow_destination_type type;
union { union {
u32 tir_num; u32 tir_num;
u32 ft_num;
struct mlx5_flow_table *ft; struct mlx5_flow_table *ft;
struct mlx5_fc *counter; struct mlx5_fc *counter;
struct { struct {
......
...@@ -1180,6 +1180,7 @@ enum mlx5_flow_destination_type { ...@@ -1180,6 +1180,7 @@ enum mlx5_flow_destination_type {
MLX5_FLOW_DESTINATION_TYPE_PORT = 0x99, MLX5_FLOW_DESTINATION_TYPE_PORT = 0x99,
MLX5_FLOW_DESTINATION_TYPE_COUNTER = 0x100, MLX5_FLOW_DESTINATION_TYPE_COUNTER = 0x100,
MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM = 0x101,
}; };
struct mlx5_ifc_dest_format_struct_bits { struct mlx5_ifc_dest_format_struct_bits {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment