16a48faeeSMaor Gottlieb /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
26a48faeeSMaor Gottlieb  * Copyright (c) 2019 Mellanox Technologies
36a48faeeSMaor Gottlieb  */
46a48faeeSMaor Gottlieb 
56a48faeeSMaor Gottlieb #ifndef _MLX5_FS_DR_
66a48faeeSMaor Gottlieb #define _MLX5_FS_DR_
76a48faeeSMaor Gottlieb 
86a48faeeSMaor Gottlieb #include "mlx5dr.h"
96a48faeeSMaor Gottlieb 
106a48faeeSMaor Gottlieb struct mlx5_flow_root_namespace;
116a48faeeSMaor Gottlieb struct fs_fte;
126a48faeeSMaor Gottlieb 
136a48faeeSMaor Gottlieb struct mlx5_fs_dr_action {
146a48faeeSMaor Gottlieb 	struct mlx5dr_action *dr_action;
156a48faeeSMaor Gottlieb };
166a48faeeSMaor Gottlieb 
176a48faeeSMaor Gottlieb struct mlx5_fs_dr_rule {
186a48faeeSMaor Gottlieb 	struct mlx5dr_rule    *dr_rule;
196a48faeeSMaor Gottlieb 	/* Only actions created by fs_dr */
206a48faeeSMaor Gottlieb 	struct mlx5dr_action  **dr_actions;
216a48faeeSMaor Gottlieb 	int                      num_actions;
226a48faeeSMaor Gottlieb };
236a48faeeSMaor Gottlieb 
246a48faeeSMaor Gottlieb struct mlx5_fs_dr_domain {
256a48faeeSMaor Gottlieb 	struct mlx5dr_domain	*dr_domain;
266a48faeeSMaor Gottlieb };
276a48faeeSMaor Gottlieb 
286a48faeeSMaor Gottlieb struct mlx5_fs_dr_matcher {
296a48faeeSMaor Gottlieb 	struct mlx5dr_matcher *dr_matcher;
306a48faeeSMaor Gottlieb };
316a48faeeSMaor Gottlieb 
326a48faeeSMaor Gottlieb struct mlx5_fs_dr_table {
336a48faeeSMaor Gottlieb 	struct mlx5dr_table  *dr_table;
346a48faeeSMaor Gottlieb 	struct mlx5dr_action *miss_action;
356a48faeeSMaor Gottlieb };
366a48faeeSMaor Gottlieb 
376a48faeeSMaor Gottlieb #ifdef CONFIG_MLX5_SW_STEERING
386a48faeeSMaor Gottlieb 
396a48faeeSMaor Gottlieb bool mlx5_fs_dr_is_supported(struct mlx5_core_dev *dev);
406a48faeeSMaor Gottlieb 
41*87cd0649SYevgeny Kliteynik int mlx5_fs_dr_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat);
42*87cd0649SYevgeny Kliteynik 
436a48faeeSMaor Gottlieb const struct mlx5_flow_cmds *mlx5_fs_cmd_get_dr_cmds(void);
446a48faeeSMaor Gottlieb 
456a48faeeSMaor Gottlieb #else
466a48faeeSMaor Gottlieb 
mlx5_fs_cmd_get_dr_cmds(void)476a48faeeSMaor Gottlieb static inline const struct mlx5_flow_cmds *mlx5_fs_cmd_get_dr_cmds(void)
486a48faeeSMaor Gottlieb {
496a48faeeSMaor Gottlieb 	return NULL;
506a48faeeSMaor Gottlieb }
516a48faeeSMaor Gottlieb 
mlx5_fs_dr_action_get_pkt_reformat_id(struct mlx5_pkt_reformat * pkt_reformat)52*87cd0649SYevgeny Kliteynik static inline u32 mlx5_fs_dr_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat)
53*87cd0649SYevgeny Kliteynik {
54*87cd0649SYevgeny Kliteynik 	return 0;
55*87cd0649SYevgeny Kliteynik }
56*87cd0649SYevgeny Kliteynik 
mlx5_fs_dr_is_supported(struct mlx5_core_dev * dev)576a48faeeSMaor Gottlieb static inline bool mlx5_fs_dr_is_supported(struct mlx5_core_dev *dev)
586a48faeeSMaor Gottlieb {
596a48faeeSMaor Gottlieb 	return false;
606a48faeeSMaor Gottlieb }
616a48faeeSMaor Gottlieb 
626a48faeeSMaor Gottlieb #endif /* CONFIG_MLX5_SW_STEERING */
636a48faeeSMaor Gottlieb #endif
64