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 int (*ct_rule_update)(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule,
29 struct mlx5_flow_spec *spec, struct mlx5_flow_attr *attr);
30
31 size_t priv_size;
32 };
33
mlx5_ct_fs_priv(struct mlx5_ct_fs * fs)34 static inline void *mlx5_ct_fs_priv(struct mlx5_ct_fs *fs)
35 {
36 return &fs->priv_data;
37 }
38
39 struct mlx5_ct_fs_ops *mlx5_ct_fs_dmfs_ops_get(void);
40
41 #if IS_ENABLED(CONFIG_MLX5_SW_STEERING)
42 struct mlx5_ct_fs_ops *mlx5_ct_fs_smfs_ops_get(void);
43 #else
44 static inline struct mlx5_ct_fs_ops *
mlx5_ct_fs_smfs_ops_get(void)45 mlx5_ct_fs_smfs_ops_get(void)
46 {
47 return NULL;
48 }
49 #endif /* IS_ENABLED(CONFIG_MLX5_SW_STEERING) */
50
51 #endif /* __MLX5_EN_TC_CT_FS_H__ */
52