This source file includes following definitions.
- build_leftovers_ft_param
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
41 enum {
42 MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO = 1 << 16,
43 MLX5_FLOW_CONTEXT_ACTION_ENCRYPT = 1 << 17,
44 MLX5_FLOW_CONTEXT_ACTION_DECRYPT = 1 << 18,
45 };
46
47 enum {
48 MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT = BIT(0),
49 MLX5_FLOW_TABLE_TUNNEL_EN_DECAP = BIT(1),
50 MLX5_FLOW_TABLE_TERMINATION = BIT(2),
51 };
52
53 #define LEFTOVERS_RULE_NUM 2
54 static inline void build_leftovers_ft_param(int *priority,
55 int *n_ent,
56 int *n_grp)
57 {
58 *priority = 0;
59 *n_ent = LEFTOVERS_RULE_NUM;
60 *n_grp = LEFTOVERS_RULE_NUM;
61 }
62
63 enum mlx5_flow_namespace_type {
64 MLX5_FLOW_NAMESPACE_BYPASS,
65 MLX5_FLOW_NAMESPACE_LAG,
66 MLX5_FLOW_NAMESPACE_OFFLOADS,
67 MLX5_FLOW_NAMESPACE_ETHTOOL,
68 MLX5_FLOW_NAMESPACE_KERNEL,
69 MLX5_FLOW_NAMESPACE_LEFTOVERS,
70 MLX5_FLOW_NAMESPACE_ANCHOR,
71 MLX5_FLOW_NAMESPACE_FDB,
72 MLX5_FLOW_NAMESPACE_ESW_EGRESS,
73 MLX5_FLOW_NAMESPACE_ESW_INGRESS,
74 MLX5_FLOW_NAMESPACE_SNIFFER_RX,
75 MLX5_FLOW_NAMESPACE_SNIFFER_TX,
76 MLX5_FLOW_NAMESPACE_EGRESS,
77 MLX5_FLOW_NAMESPACE_RDMA_RX,
78 MLX5_FLOW_NAMESPACE_RDMA_RX_KERNEL,
79 };
80
81 enum {
82 FDB_BYPASS_PATH,
83 FDB_FAST_PATH,
84 FDB_SLOW_PATH,
85 };
86
87 struct mlx5_pkt_reformat;
88 struct mlx5_modify_hdr;
89 struct mlx5_flow_table;
90 struct mlx5_flow_group;
91 struct mlx5_flow_namespace;
92 struct mlx5_flow_handle;
93
94 enum {
95 FLOW_CONTEXT_HAS_TAG = BIT(0),
96 };
97
98 struct mlx5_flow_context {
99 u32 flags;
100 u32 flow_tag;
101 u32 flow_source;
102 };
103
104 struct mlx5_flow_spec {
105 u8 match_criteria_enable;
106 u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)];
107 u32 match_value[MLX5_ST_SZ_DW(fte_match_param)];
108 struct mlx5_flow_context flow_context;
109 };
110
111 enum {
112 MLX5_FLOW_DEST_VPORT_VHCA_ID = BIT(0),
113 MLX5_FLOW_DEST_VPORT_REFORMAT_ID = BIT(1),
114 };
115
116 struct mlx5_flow_destination {
117 enum mlx5_flow_destination_type type;
118 union {
119 u32 tir_num;
120 u32 ft_num;
121 struct mlx5_flow_table *ft;
122 u32 counter_id;
123 struct {
124 u16 num;
125 u16 vhca_id;
126 struct mlx5_pkt_reformat *pkt_reformat;
127 u8 flags;
128 } vport;
129 };
130 };
131
132 struct mod_hdr_tbl {
133 struct mutex lock;
134 DECLARE_HASHTABLE(hlist, 8);
135 };
136
137 struct mlx5_flow_namespace *
138 mlx5_get_fdb_sub_ns(struct mlx5_core_dev *dev, int n);
139 struct mlx5_flow_namespace *
140 mlx5_get_flow_namespace(struct mlx5_core_dev *dev,
141 enum mlx5_flow_namespace_type type);
142 struct mlx5_flow_namespace *
143 mlx5_get_flow_vport_acl_namespace(struct mlx5_core_dev *dev,
144 enum mlx5_flow_namespace_type type,
145 int vport);
146
147 struct mlx5_flow_table *
148 mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
149 int prio,
150 int num_flow_table_entries,
151 int max_num_groups,
152 u32 level,
153 u32 flags);
154
155 struct mlx5_flow_table_attr {
156 int prio;
157 int max_fte;
158 u32 level;
159 u32 flags;
160 };
161
162 struct mlx5_flow_table *
163 mlx5_create_flow_table(struct mlx5_flow_namespace *ns,
164 struct mlx5_flow_table_attr *ft_attr);
165
166 struct mlx5_flow_table *
167 mlx5_create_vport_flow_table(struct mlx5_flow_namespace *ns,
168 int prio,
169 int num_flow_table_entries,
170 u32 level, u16 vport);
171 struct mlx5_flow_table *mlx5_create_lag_demux_flow_table(
172 struct mlx5_flow_namespace *ns,
173 int prio, u32 level);
174 int mlx5_destroy_flow_table(struct mlx5_flow_table *ft);
175
176
177
178
179
180
181
182 struct mlx5_flow_group *
183 mlx5_create_flow_group(struct mlx5_flow_table *ft, u32 *in);
184 void mlx5_destroy_flow_group(struct mlx5_flow_group *fg);
185
186 struct mlx5_fs_vlan {
187 u16 ethtype;
188 u16 vid;
189 u8 prio;
190 };
191
192 #define MLX5_FS_VLAN_DEPTH 2
193
194 enum {
195 FLOW_ACT_NO_APPEND = BIT(0),
196 };
197
198 struct mlx5_flow_act {
199 u32 action;
200 struct mlx5_modify_hdr *modify_hdr;
201 struct mlx5_pkt_reformat *pkt_reformat;
202 uintptr_t esp_id;
203 u32 flags;
204 struct mlx5_fs_vlan vlan[MLX5_FS_VLAN_DEPTH];
205 struct ib_counters *counters;
206 };
207
208 #define MLX5_DECLARE_FLOW_ACT(name) \
209 struct mlx5_flow_act name = { .action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\
210 .flags = 0, }
211
212
213
214
215 struct mlx5_flow_handle *
216 mlx5_add_flow_rules(struct mlx5_flow_table *ft,
217 const struct mlx5_flow_spec *spec,
218 struct mlx5_flow_act *flow_act,
219 struct mlx5_flow_destination *dest,
220 int num_dest);
221 void mlx5_del_flow_rules(struct mlx5_flow_handle *fr);
222
223 int mlx5_modify_rule_destination(struct mlx5_flow_handle *handler,
224 struct mlx5_flow_destination *new_dest,
225 struct mlx5_flow_destination *old_dest);
226
227 struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging);
228 void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter);
229 u64 mlx5_fc_query_lastuse(struct mlx5_fc *counter);
230 void mlx5_fc_query_cached(struct mlx5_fc *counter,
231 u64 *bytes, u64 *packets, u64 *lastuse);
232 int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
233 u64 *packets, u64 *bytes);
234 u32 mlx5_fc_id(struct mlx5_fc *counter);
235
236 int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
237 int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn);
238
239 struct mlx5_modify_hdr *mlx5_modify_header_alloc(struct mlx5_core_dev *dev,
240 u8 ns_type, u8 num_actions,
241 void *modify_actions);
242 void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev,
243 struct mlx5_modify_hdr *modify_hdr);
244
245 struct mlx5_pkt_reformat *mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev,
246 int reformat_type,
247 size_t size,
248 void *reformat_data,
249 enum mlx5_flow_namespace_type ns_type);
250 void mlx5_packet_reformat_dealloc(struct mlx5_core_dev *dev,
251 struct mlx5_pkt_reformat *reformat);
252
253 #endif