Lines Matching refs:tbl

28 			action->dest_tbl->tbl->rx.s_anchor->chunk :  in dr_table_set_miss_action_nic()
29 action->dest_tbl->tbl->tx.s_anchor->chunk; in dr_table_set_miss_action_nic()
46 int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl, in mlx5dr_table_set_miss_action() argument
54 mlx5dr_domain_lock(tbl->dmn); in mlx5dr_table_set_miss_action()
56 if (tbl->dmn->type == MLX5DR_DOMAIN_TYPE_NIC_RX || in mlx5dr_table_set_miss_action()
57 tbl->dmn->type == MLX5DR_DOMAIN_TYPE_FDB) { in mlx5dr_table_set_miss_action()
58 ret = dr_table_set_miss_action_nic(tbl->dmn, &tbl->rx, action); in mlx5dr_table_set_miss_action()
63 if (tbl->dmn->type == MLX5DR_DOMAIN_TYPE_NIC_TX || in mlx5dr_table_set_miss_action()
64 tbl->dmn->type == MLX5DR_DOMAIN_TYPE_FDB) { in mlx5dr_table_set_miss_action()
65 ret = dr_table_set_miss_action_nic(tbl->dmn, &tbl->tx, action); in mlx5dr_table_set_miss_action()
74 if (tbl->miss_action) in mlx5dr_table_set_miss_action()
75 refcount_dec(&tbl->miss_action->refcount); in mlx5dr_table_set_miss_action()
78 tbl->miss_action = action; in mlx5dr_table_set_miss_action()
79 if (tbl->miss_action) in mlx5dr_table_set_miss_action()
83 mlx5dr_domain_unlock(tbl->dmn); in mlx5dr_table_set_miss_action()
92 static void dr_table_uninit_fdb(struct mlx5dr_table *tbl) in dr_table_uninit_fdb() argument
94 dr_table_uninit_nic(&tbl->rx); in dr_table_uninit_fdb()
95 dr_table_uninit_nic(&tbl->tx); in dr_table_uninit_fdb()
98 static void dr_table_uninit(struct mlx5dr_table *tbl) in dr_table_uninit() argument
100 mlx5dr_domain_lock(tbl->dmn); in dr_table_uninit()
102 switch (tbl->dmn->type) { in dr_table_uninit()
104 dr_table_uninit_nic(&tbl->rx); in dr_table_uninit()
107 dr_table_uninit_nic(&tbl->tx); in dr_table_uninit()
110 dr_table_uninit_fdb(tbl); in dr_table_uninit()
117 mlx5dr_domain_unlock(tbl->dmn); in dr_table_uninit()
159 static int dr_table_init_fdb(struct mlx5dr_table *tbl) in dr_table_init_fdb() argument
163 ret = dr_table_init_nic(tbl->dmn, &tbl->rx); in dr_table_init_fdb()
167 ret = dr_table_init_nic(tbl->dmn, &tbl->tx); in dr_table_init_fdb()
174 dr_table_uninit_nic(&tbl->rx); in dr_table_init_fdb()
178 static int dr_table_init(struct mlx5dr_table *tbl) in dr_table_init() argument
182 INIT_LIST_HEAD(&tbl->matcher_list); in dr_table_init()
184 mlx5dr_domain_lock(tbl->dmn); in dr_table_init()
186 switch (tbl->dmn->type) { in dr_table_init()
188 tbl->table_type = MLX5_FLOW_TABLE_TYPE_NIC_RX; in dr_table_init()
189 tbl->rx.nic_dmn = &tbl->dmn->info.rx; in dr_table_init()
190 ret = dr_table_init_nic(tbl->dmn, &tbl->rx); in dr_table_init()
193 tbl->table_type = MLX5_FLOW_TABLE_TYPE_NIC_TX; in dr_table_init()
194 tbl->tx.nic_dmn = &tbl->dmn->info.tx; in dr_table_init()
195 ret = dr_table_init_nic(tbl->dmn, &tbl->tx); in dr_table_init()
198 tbl->table_type = MLX5_FLOW_TABLE_TYPE_FDB; in dr_table_init()
199 tbl->rx.nic_dmn = &tbl->dmn->info.rx; in dr_table_init()
200 tbl->tx.nic_dmn = &tbl->dmn->info.tx; in dr_table_init()
201 ret = dr_table_init_fdb(tbl); in dr_table_init()
208 mlx5dr_domain_unlock(tbl->dmn); in dr_table_init()
213 static int dr_table_destroy_sw_owned_tbl(struct mlx5dr_table *tbl) in dr_table_destroy_sw_owned_tbl() argument
215 return mlx5dr_cmd_destroy_flow_table(tbl->dmn->mdev, in dr_table_destroy_sw_owned_tbl()
216 tbl->table_id, in dr_table_destroy_sw_owned_tbl()
217 tbl->table_type); in dr_table_destroy_sw_owned_tbl()
220 static int dr_table_create_sw_owned_tbl(struct mlx5dr_table *tbl, u16 uid) in dr_table_create_sw_owned_tbl() argument
222 bool en_encap = !!(tbl->flags & MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT); in dr_table_create_sw_owned_tbl()
223 bool en_decap = !!(tbl->flags & MLX5_FLOW_TABLE_TUNNEL_EN_DECAP); in dr_table_create_sw_owned_tbl()
229 if (tbl->rx.s_anchor) in dr_table_create_sw_owned_tbl()
230 icm_addr_rx = mlx5dr_icm_pool_get_chunk_icm_addr(tbl->rx.s_anchor->chunk); in dr_table_create_sw_owned_tbl()
232 if (tbl->tx.s_anchor) in dr_table_create_sw_owned_tbl()
233 icm_addr_tx = mlx5dr_icm_pool_get_chunk_icm_addr(tbl->tx.s_anchor->chunk); in dr_table_create_sw_owned_tbl()
235 ft_attr.table_type = tbl->table_type; in dr_table_create_sw_owned_tbl()
238 ft_attr.level = tbl->dmn->info.caps.max_ft_level - 1; in dr_table_create_sw_owned_tbl()
244 ret = mlx5dr_cmd_create_flow_table(tbl->dmn->mdev, &ft_attr, in dr_table_create_sw_owned_tbl()
245 NULL, &tbl->table_id); in dr_table_create_sw_owned_tbl()
253 struct mlx5dr_table *tbl; in mlx5dr_table_create() local
258 tbl = kzalloc(sizeof(*tbl), GFP_KERNEL); in mlx5dr_table_create()
259 if (!tbl) in mlx5dr_table_create()
262 tbl->dmn = dmn; in mlx5dr_table_create()
263 tbl->level = level; in mlx5dr_table_create()
264 tbl->flags = flags; in mlx5dr_table_create()
265 refcount_set(&tbl->refcount, 1); in mlx5dr_table_create()
267 ret = dr_table_init(tbl); in mlx5dr_table_create()
271 ret = dr_table_create_sw_owned_tbl(tbl, uid); in mlx5dr_table_create()
275 INIT_LIST_HEAD(&tbl->dbg_node); in mlx5dr_table_create()
276 mlx5dr_dbg_tbl_add(tbl); in mlx5dr_table_create()
277 return tbl; in mlx5dr_table_create()
280 dr_table_uninit(tbl); in mlx5dr_table_create()
282 kfree(tbl); in mlx5dr_table_create()
288 int mlx5dr_table_destroy(struct mlx5dr_table *tbl) in mlx5dr_table_destroy() argument
292 if (WARN_ON_ONCE(refcount_read(&tbl->refcount) > 1)) in mlx5dr_table_destroy()
295 mlx5dr_dbg_tbl_del(tbl); in mlx5dr_table_destroy()
296 ret = dr_table_destroy_sw_owned_tbl(tbl); in mlx5dr_table_destroy()
298 mlx5dr_err(tbl->dmn, "Failed to destroy sw owned table\n"); in mlx5dr_table_destroy()
300 dr_table_uninit(tbl); in mlx5dr_table_destroy()
302 if (tbl->miss_action) in mlx5dr_table_destroy()
303 refcount_dec(&tbl->miss_action->refcount); in mlx5dr_table_destroy()
305 refcount_dec(&tbl->dmn->refcount); in mlx5dr_table_destroy()
306 kfree(tbl); in mlx5dr_table_destroy()
311 u32 mlx5dr_table_get_id(struct mlx5dr_table *tbl) in mlx5dr_table_get_id() argument
313 return tbl->table_id; in mlx5dr_table_get_id()