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#ifndef _MLX5_FS_
34#define _MLX5_FS_
35
36#include <linux/mlx5/driver.h>
37#include <linux/mlx5/mlx5_ifc.h>
38
39#define MLX5_FS_DEFAULT_FLOW_TAG 0x0
40
41enum {
42 MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO = 1 << 16,
43};
44
45#define LEFTOVERS_RULE_NUM 2
46static inline void build_leftovers_ft_param(int *priority,
47 int *n_ent,
48 int *n_grp)
49{
50 *priority = 0;
51 *n_ent = LEFTOVERS_RULE_NUM;
52 *n_grp = LEFTOVERS_RULE_NUM;
53}
54
55enum mlx5_flow_namespace_type {
56 MLX5_FLOW_NAMESPACE_BYPASS,
57 MLX5_FLOW_NAMESPACE_KERNEL,
58 MLX5_FLOW_NAMESPACE_LEFTOVERS,
59 MLX5_FLOW_NAMESPACE_ANCHOR,
60 MLX5_FLOW_NAMESPACE_FDB,
61};
62
63struct mlx5_flow_table;
64struct mlx5_flow_group;
65struct mlx5_flow_rule;
66struct mlx5_flow_namespace;
67
68struct mlx5_flow_destination {
69 enum mlx5_flow_destination_type type;
70 union {
71 u32 tir_num;
72 struct mlx5_flow_table *ft;
73 u32 vport_num;
74 };
75};
76
77struct mlx5_flow_namespace *
78mlx5_get_flow_namespace(struct mlx5_core_dev *dev,
79 enum mlx5_flow_namespace_type type);
80
81struct mlx5_flow_table *
82mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
83 int prio,
84 int num_flow_table_entries,
85 int max_num_groups);
86
87struct mlx5_flow_table *
88mlx5_create_flow_table(struct mlx5_flow_namespace *ns,
89 int prio,
90 int num_flow_table_entries);
91int mlx5_destroy_flow_table(struct mlx5_flow_table *ft);
92
93
94
95
96
97
98
99struct mlx5_flow_group *
100mlx5_create_flow_group(struct mlx5_flow_table *ft, u32 *in);
101void mlx5_destroy_flow_group(struct mlx5_flow_group *fg);
102
103
104
105
106struct mlx5_flow_rule *
107mlx5_add_flow_rule(struct mlx5_flow_table *ft,
108 u8 match_criteria_enable,
109 u32 *match_criteria,
110 u32 *match_value,
111 u32 action,
112 u32 flow_tag,
113 struct mlx5_flow_destination *dest);
114void mlx5_del_flow_rule(struct mlx5_flow_rule *fr);
115
116#endif
117