summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.h
blob: 21d56b49d14bc2b1de74a548fc55cfadcc820fba (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/* Copyright (c) 2021 Mellanox Technologies. */

#ifndef __MLX5_ESW_FT_H__
#define __MLX5_ESW_FT_H__

#ifdef CONFIG_MLX5_CLS_ACT

struct mlx5_esw_indir_table *
mlx5_esw_indir_table_init(void);
void
mlx5_esw_indir_table_destroy(struct mlx5_esw_indir_table *indir);

struct mlx5_flow_table *mlx5_esw_indir_table_get(struct mlx5_eswitch *esw,
						 struct mlx5_flow_attr *attr,
						 struct mlx5_flow_spec *spec,
						 u16 vport, bool decap);
void mlx5_esw_indir_table_put(struct mlx5_eswitch *esw,
			      struct mlx5_flow_attr *attr,
			      u16 vport, bool decap);

bool
mlx5_esw_indir_table_needed(struct mlx5_eswitch *esw,
			    struct mlx5_flow_attr *attr,
			    u16 vport_num,
			    struct mlx5_core_dev *dest_mdev);

u16
mlx5_esw_indir_table_decap_vport(struct mlx5_flow_attr *attr);

#else
/* indir API stubs */
static inline struct mlx5_esw_indir_table *
mlx5_esw_indir_table_init(void)
{
	return NULL;
}

static inline void
mlx5_esw_indir_table_destroy(struct mlx5_esw_indir_table *indir)
{
}

static inline struct mlx5_flow_table *
mlx5_esw_indir_table_get(struct mlx5_eswitch *esw,
			 struct mlx5_flow_attr *attr,
			 struct mlx5_flow_spec *spec,
			 u16 vport, bool decap)
{
	return ERR_PTR(-EOPNOTSUPP);
}

static inline void
mlx5_esw_indir_table_put(struct mlx5_eswitch *esw,
			 struct mlx5_flow_attr *attr,
			 u16 vport, bool decap)
{
}

static inline bool
mlx5_esw_indir_table_needed(struct mlx5_eswitch *esw,
			    struct mlx5_flow_attr *attr,
			    u16 vport_num,
			    struct mlx5_core_dev *dest_mdev)
{
	return false;
}

static inline u16
mlx5_esw_indir_table_decap_vport(struct mlx5_flow_attr *attr)
{
	return 0;
}
#endif

#endif /* __MLX5_ESW_FT_H__ */