aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs.h
blob: bb6b1a979ba132c4044f649353ce6d4e70d9c81f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */

#ifndef __MLX5_EN_TC_CT_FS_H__
#define __MLX5_EN_TC_CT_FS_H__

struct mlx5_ct_fs {
	const struct net_device *netdev;
	struct mlx5_core_dev *dev;

	/* private data */
	void *priv_data[];
};

struct mlx5_ct_fs_rule {
};

struct mlx5_ct_fs_ops {
	int (*init)(struct mlx5_ct_fs *fs, struct mlx5_flow_table *ct,
		    struct mlx5_flow_table *ct_nat, struct mlx5_flow_table *post_ct);
	void (*destroy)(struct mlx5_ct_fs *fs);

	struct mlx5_ct_fs_rule * (*ct_rule_add)(struct mlx5_ct_fs *fs,
						struct mlx5_flow_spec *spec,
						struct mlx5_flow_attr *attr,
						struct flow_rule *flow_rule);
	void (*ct_rule_del)(struct mlx5_ct_fs *fs, struct mlx5_ct_fs_rule *fs_rule);

	size_t priv_size;
};

static inline void *mlx5_ct_fs_priv(struct mlx5_ct_fs *fs)
{
	return &fs->priv_data;
}

struct mlx5_ct_fs_ops *mlx5_ct_fs_dmfs_ops_get(void);

#if IS_ENABLED(CONFIG_MLX5_SW_STEERING)
struct mlx5_ct_fs_ops *mlx5_ct_fs_smfs_ops_get(void);
#else
static inline struct mlx5_ct_fs_ops *
mlx5_ct_fs_smfs_ops_get(void)
{
	return NULL;
}
#endif /* IS_ENABLED(CONFIG_MLX5_SW_STEERING) */

#endif /* __MLX5_EN_TC_CT_FS_H__ */