1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */
3 
4 #ifndef __MLX5_EN_TC_CT_FS_H__
5 #define __MLX5_EN_TC_CT_FS_H__
6 
7 struct mlx5_ct_fs {
8 	const struct net_device *netdev;
9 	struct mlx5_core_dev *dev;
10 
11 	/* private data */
12 	void *priv_data[];
13 };
14 
15 struct mlx5_ct_fs_rule {
16 };
17 
18 struct mlx5_ct_fs_ops {
19 	int (*init)(struct mlx5_ct_fs *fs, struct mlx5_flow_table *ct,
20 		    struct mlx5_flow_table *ct_nat, struct mlx5_flow_table *post_ct);
21 	void (*destroy)(struct mlx5_ct_fs *fs);
22 
23 	struct mlx5_ct_fs_rule * (*ct_rule_add)(struct mlx5_ct_fs *fs,
24 						struct mlx5_flow_spec *spec,
25 						struct mlx5_flow_attr *attr,
26 						struct flow_rule *flow_rule);
27 	void (*ct_rule_del)(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule);
28 
29 	size_t priv_size;
30 };
31 
mlx5_ct_fs_priv(struct mlx5_ct_fs * fs)32 static inline void *mlx5_ct_fs_priv(struct mlx5_ct_fs *fs)
33 {
34 	return &fs->priv_data;
35 }
36 
37 struct mlx5_ct_fs_ops *mlx5_ct_fs_dmfs_ops_get(void);
38 
39 #if IS_ENABLED(CONFIG_MLX5_SW_STEERING)
40 struct mlx5_ct_fs_ops *mlx5_ct_fs_smfs_ops_get(void);
41 #else
42 static inline struct mlx5_ct_fs_ops *
mlx5_ct_fs_smfs_ops_get(void)43 mlx5_ct_fs_smfs_ops_get(void)
44 {
45 	return NULL;
46 }
47 #endif /* IS_ENABLED(CONFIG_MLX5_SW_STEERING) */
48 
49 #endif /* __MLX5_EN_TC_CT_FS_H__ */
50