| 1 |
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
| 2 |
/* Copyright (c) 2024 NVIDIA Corporation & Affiliates */ |
| 3 |
|
| 4 |
#ifndef MLX5HWS_TABLE_H_ |
| 5 |
#define MLX5HWS_TABLE_H_ |
| 6 |
|
| 7 |
struct mlx5hws_default_miss { |
| 8 |
/* My miss table */ |
| 9 |
struct mlx5hws_table *miss_tbl; |
| 10 |
struct list_head next; |
| 11 |
/* Tables missing to my table */ |
| 12 |
struct list_head head; |
| 13 |
}; |
| 14 |
|
| 15 |
struct mlx5hws_table { |
| 16 |
struct mlx5hws_context *ctx; |
| 17 |
u32 ft_id; |
| 18 |
enum mlx5hws_table_type type; |
| 19 |
u32 fw_ft_type; |
| 20 |
u32 level; |
| 21 |
u16 uid; |
| 22 |
struct list_head matchers_list; |
| 23 |
struct list_head tbl_list_node; |
| 24 |
struct mlx5hws_default_miss default_miss; |
| 25 |
}; |
| 26 |
|
| 27 |
static inline |
| 28 |
u32 mlx5hws_table_get_fw_ft_type(enum mlx5hws_table_type type, |
| 29 |
u8 *ret_type) |
| 30 |
{ |
| 31 |
if (type != MLX5HWS_TABLE_TYPE_FDB) |
| 32 |
return -EOPNOTSUPP; |
| 33 |
|
| 34 |
*ret_type = FS_FT_FDB; |
| 35 |
|
| 36 |
return 0; |
| 37 |
} |
| 38 |
|
| 39 |
static inline |
| 40 |
u32 mlx5hws_table_get_res_fw_ft_type(enum mlx5hws_table_type tbl_type, |
| 41 |
bool is_mirror) |
| 42 |
{ |
| 43 |
if (tbl_type == MLX5HWS_TABLE_TYPE_FDB) |
| 44 |
return is_mirror ? FS_FT_FDB_TX : FS_FT_FDB_RX; |
| 45 |
|
| 46 |
return 0; |
| 47 |
} |
| 48 |
|
| 49 |
int mlx5hws_table_create_default_ft(struct mlx5_core_dev *mdev, |
| 50 |
struct mlx5hws_table *tbl, |
| 51 |
u16 uid, u32 *ft_id); |
| 52 |
|
| 53 |
void mlx5hws_table_destroy_default_ft(struct mlx5hws_table *tbl, |
| 54 |
u32 ft_id); |
| 55 |
|
| 56 |
int mlx5hws_table_connect_to_miss_table(struct mlx5hws_table *src_tbl, |
| 57 |
struct mlx5hws_table *dst_tbl); |
| 58 |
|
| 59 |
int mlx5hws_table_update_connected_miss_tables(struct mlx5hws_table *dst_tbl); |
| 60 |
|
| 61 |
int mlx5hws_table_ft_set_default_next_ft(struct mlx5hws_table *tbl, u32 ft_id); |
| 62 |
|
| 63 |
int mlx5hws_table_ft_set_next_rtc(struct mlx5hws_context *ctx, |
| 64 |
u32 ft_id, |
| 65 |
u32 fw_ft_type, |
| 66 |
u32 rtc_0_id, |
| 67 |
u32 rtc_1_id); |
| 68 |
|
| 69 |
int mlx5hws_table_ft_set_next_ft(struct mlx5hws_context *ctx, |
| 70 |
u32 ft_id, |
| 71 |
u32 fw_ft_type, |
| 72 |
u32 next_ft_id); |
| 73 |
|
| 74 |
#endif /* MLX5HWS_TABLE_H_ */ |