net/mlx5: add Direct Rules API
[dpdk.git] / drivers / net / mlx5 / mlx5_flow.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2018 Mellanox Technologies, Ltd
3  */
4
5 #ifndef RTE_PMD_MLX5_FLOW_H_
6 #define RTE_PMD_MLX5_FLOW_H_
7
8 #include <netinet/in.h>
9 #include <sys/queue.h>
10 #include <stdalign.h>
11 #include <stdint.h>
12 #include <string.h>
13
14 /* Verbs header. */
15 /* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */
16 #ifdef PEDANTIC
17 #pragma GCC diagnostic ignored "-Wpedantic"
18 #endif
19 #include <infiniband/verbs.h>
20 #ifdef PEDANTIC
21 #pragma GCC diagnostic error "-Wpedantic"
22 #endif
23
24 #include "mlx5.h"
25 #include "mlx5_prm.h"
26
27 /* Pattern outer Layer bits. */
28 #define MLX5_FLOW_LAYER_OUTER_L2 (1u << 0)
29 #define MLX5_FLOW_LAYER_OUTER_L3_IPV4 (1u << 1)
30 #define MLX5_FLOW_LAYER_OUTER_L3_IPV6 (1u << 2)
31 #define MLX5_FLOW_LAYER_OUTER_L4_UDP (1u << 3)
32 #define MLX5_FLOW_LAYER_OUTER_L4_TCP (1u << 4)
33 #define MLX5_FLOW_LAYER_OUTER_VLAN (1u << 5)
34
35 /* Pattern inner Layer bits. */
36 #define MLX5_FLOW_LAYER_INNER_L2 (1u << 6)
37 #define MLX5_FLOW_LAYER_INNER_L3_IPV4 (1u << 7)
38 #define MLX5_FLOW_LAYER_INNER_L3_IPV6 (1u << 8)
39 #define MLX5_FLOW_LAYER_INNER_L4_UDP (1u << 9)
40 #define MLX5_FLOW_LAYER_INNER_L4_TCP (1u << 10)
41 #define MLX5_FLOW_LAYER_INNER_VLAN (1u << 11)
42
43 /* Pattern tunnel Layer bits. */
44 #define MLX5_FLOW_LAYER_VXLAN (1u << 12)
45 #define MLX5_FLOW_LAYER_VXLAN_GPE (1u << 13)
46 #define MLX5_FLOW_LAYER_GRE (1u << 14)
47 #define MLX5_FLOW_LAYER_MPLS (1u << 15)
48
49 /* General pattern items bits. */
50 #define MLX5_FLOW_ITEM_METADATA (1u << 16)
51
52 /* Outer Masks. */
53 #define MLX5_FLOW_LAYER_OUTER_L3 \
54         (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
55 #define MLX5_FLOW_LAYER_OUTER_L4 \
56         (MLX5_FLOW_LAYER_OUTER_L4_UDP | MLX5_FLOW_LAYER_OUTER_L4_TCP)
57 #define MLX5_FLOW_LAYER_OUTER \
58         (MLX5_FLOW_LAYER_OUTER_L2 | MLX5_FLOW_LAYER_OUTER_L3 | \
59          MLX5_FLOW_LAYER_OUTER_L4)
60
61 /* Tunnel Masks. */
62 #define MLX5_FLOW_LAYER_TUNNEL \
63         (MLX5_FLOW_LAYER_VXLAN | MLX5_FLOW_LAYER_VXLAN_GPE | \
64          MLX5_FLOW_LAYER_GRE | MLX5_FLOW_LAYER_MPLS)
65
66 /* Inner Masks. */
67 #define MLX5_FLOW_LAYER_INNER_L3 \
68         (MLX5_FLOW_LAYER_INNER_L3_IPV4 | MLX5_FLOW_LAYER_INNER_L3_IPV6)
69 #define MLX5_FLOW_LAYER_INNER_L4 \
70         (MLX5_FLOW_LAYER_INNER_L4_UDP | MLX5_FLOW_LAYER_INNER_L4_TCP)
71 #define MLX5_FLOW_LAYER_INNER \
72         (MLX5_FLOW_LAYER_INNER_L2 | MLX5_FLOW_LAYER_INNER_L3 | \
73          MLX5_FLOW_LAYER_INNER_L4)
74
75 /* Layer Masks. */
76 #define MLX5_FLOW_LAYER_L2 \
77         (MLX5_FLOW_LAYER_OUTER_L2 | MLX5_FLOW_LAYER_INNER_L2)
78 #define MLX5_FLOW_LAYER_L3_IPV4 \
79         (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_INNER_L3_IPV4)
80 #define MLX5_FLOW_LAYER_L3_IPV6 \
81         (MLX5_FLOW_LAYER_OUTER_L3_IPV6 | MLX5_FLOW_LAYER_INNER_L3_IPV6)
82 #define MLX5_FLOW_LAYER_L3 \
83         (MLX5_FLOW_LAYER_L3_IPV4 | MLX5_FLOW_LAYER_L3_IPV6)
84 #define MLX5_FLOW_LAYER_L4 \
85         (MLX5_FLOW_LAYER_OUTER_L4 | MLX5_FLOW_LAYER_INNER_L4)
86
87 /* Actions */
88 #define MLX5_FLOW_ACTION_DROP (1u << 0)
89 #define MLX5_FLOW_ACTION_QUEUE (1u << 1)
90 #define MLX5_FLOW_ACTION_RSS (1u << 2)
91 #define MLX5_FLOW_ACTION_FLAG (1u << 3)
92 #define MLX5_FLOW_ACTION_MARK (1u << 4)
93 #define MLX5_FLOW_ACTION_COUNT (1u << 5)
94 #define MLX5_FLOW_ACTION_PORT_ID (1u << 6)
95 #define MLX5_FLOW_ACTION_OF_POP_VLAN (1u << 7)
96 #define MLX5_FLOW_ACTION_OF_PUSH_VLAN (1u << 8)
97 #define MLX5_FLOW_ACTION_OF_SET_VLAN_VID (1u << 9)
98 #define MLX5_FLOW_ACTION_OF_SET_VLAN_PCP (1u << 10)
99 #define MLX5_FLOW_ACTION_SET_IPV4_SRC (1u << 11)
100 #define MLX5_FLOW_ACTION_SET_IPV4_DST (1u << 12)
101 #define MLX5_FLOW_ACTION_SET_IPV6_SRC (1u << 13)
102 #define MLX5_FLOW_ACTION_SET_IPV6_DST (1u << 14)
103 #define MLX5_FLOW_ACTION_SET_TP_SRC (1u << 15)
104 #define MLX5_FLOW_ACTION_SET_TP_DST (1u << 16)
105 #define MLX5_FLOW_ACTION_JUMP (1u << 17)
106 #define MLX5_FLOW_ACTION_SET_TTL (1u << 18)
107 #define MLX5_FLOW_ACTION_DEC_TTL (1u << 19)
108 #define MLX5_FLOW_ACTION_SET_MAC_SRC (1u << 20)
109 #define MLX5_FLOW_ACTION_SET_MAC_DST (1u << 21)
110 #define MLX5_FLOW_ACTION_VXLAN_ENCAP (1u << 22)
111 #define MLX5_FLOW_ACTION_VXLAN_DECAP (1u << 23)
112 #define MLX5_FLOW_ACTION_NVGRE_ENCAP (1u << 24)
113 #define MLX5_FLOW_ACTION_NVGRE_DECAP (1u << 25)
114 #define MLX5_FLOW_ACTION_RAW_ENCAP (1u << 26)
115 #define MLX5_FLOW_ACTION_RAW_DECAP (1u << 27)
116
117 #define MLX5_FLOW_FATE_ACTIONS \
118         (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | MLX5_FLOW_ACTION_RSS)
119
120 #define MLX5_FLOW_ENCAP_ACTIONS (MLX5_FLOW_ACTION_VXLAN_ENCAP | \
121                                  MLX5_FLOW_ACTION_NVGRE_ENCAP | \
122                                  MLX5_FLOW_ACTION_RAW_ENCAP)
123
124 #define MLX5_FLOW_DECAP_ACTIONS (MLX5_FLOW_ACTION_VXLAN_DECAP | \
125                                  MLX5_FLOW_ACTION_NVGRE_DECAP | \
126                                  MLX5_FLOW_ACTION_RAW_DECAP)
127
128 #define MLX5_FLOW_MODIFY_HDR_ACTIONS (MLX5_FLOW_ACTION_SET_IPV4_SRC | \
129                                       MLX5_FLOW_ACTION_SET_IPV4_DST | \
130                                       MLX5_FLOW_ACTION_SET_IPV6_SRC | \
131                                       MLX5_FLOW_ACTION_SET_IPV6_DST | \
132                                       MLX5_FLOW_ACTION_SET_TP_SRC | \
133                                       MLX5_FLOW_ACTION_SET_TP_DST | \
134                                       MLX5_FLOW_ACTION_SET_TTL | \
135                                       MLX5_FLOW_ACTION_DEC_TTL | \
136                                       MLX5_FLOW_ACTION_SET_MAC_SRC | \
137                                       MLX5_FLOW_ACTION_SET_MAC_DST)
138
139 #ifndef IPPROTO_MPLS
140 #define IPPROTO_MPLS 137
141 #endif
142
143 /* UDP port number for MPLS */
144 #define MLX5_UDP_PORT_MPLS 6635
145
146 /* UDP port numbers for VxLAN. */
147 #define MLX5_UDP_PORT_VXLAN 4789
148 #define MLX5_UDP_PORT_VXLAN_GPE 4790
149
150 /* Priority reserved for default flows. */
151 #define MLX5_FLOW_PRIO_RSVD ((uint32_t)-1)
152
153 /*
154  * Number of sub priorities.
155  * For each kind of pattern matching i.e. L2, L3, L4 to have a correct
156  * matching on the NIC (firmware dependent) L4 most have the higher priority
157  * followed by L3 and ending with L2.
158  */
159 #define MLX5_PRIORITY_MAP_L2 2
160 #define MLX5_PRIORITY_MAP_L3 1
161 #define MLX5_PRIORITY_MAP_L4 0
162 #define MLX5_PRIORITY_MAP_MAX 3
163
164 /* Valid layer type for IPV4 RSS. */
165 #define MLX5_IPV4_LAYER_TYPES \
166         (ETH_RSS_IPV4 | ETH_RSS_FRAG_IPV4 | \
167          ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_NONFRAG_IPV4_UDP | \
168          ETH_RSS_NONFRAG_IPV4_OTHER)
169
170 /* IBV hash source bits  for IPV4. */
171 #define MLX5_IPV4_IBV_RX_HASH (IBV_RX_HASH_SRC_IPV4 | IBV_RX_HASH_DST_IPV4)
172
173 /* Valid layer type for IPV6 RSS. */
174 #define MLX5_IPV6_LAYER_TYPES \
175         (ETH_RSS_IPV6 | ETH_RSS_FRAG_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP | \
176          ETH_RSS_NONFRAG_IPV6_UDP | ETH_RSS_IPV6_EX  | ETH_RSS_IPV6_TCP_EX | \
177          ETH_RSS_IPV6_UDP_EX | ETH_RSS_NONFRAG_IPV6_OTHER)
178
179 /* IBV hash source bits  for IPV6. */
180 #define MLX5_IPV6_IBV_RX_HASH (IBV_RX_HASH_SRC_IPV6 | IBV_RX_HASH_DST_IPV6)
181
182 enum mlx5_flow_drv_type {
183         MLX5_FLOW_TYPE_MIN,
184         MLX5_FLOW_TYPE_DV,
185         MLX5_FLOW_TYPE_TCF,
186         MLX5_FLOW_TYPE_VERBS,
187         MLX5_FLOW_TYPE_MAX,
188 };
189
190 /* Matcher PRM representation */
191 struct mlx5_flow_dv_match_params {
192         size_t size;
193         /**< Size of match value. Do NOT split size and key! */
194         uint32_t buf[MLX5_ST_SZ_DW(fte_match_param)];
195         /**< Matcher value. This value is used as the mask or as a key. */
196 };
197
198 /* Matcher structure. */
199 struct mlx5_flow_dv_matcher {
200         LIST_ENTRY(mlx5_flow_dv_matcher) next;
201         /* Pointer to the next element. */
202         rte_atomic32_t refcnt; /**< Reference counter. */
203         void *matcher_object; /**< Pointer to DV matcher */
204         uint16_t crc; /**< CRC of key. */
205         uint16_t priority; /**< Priority of matcher. */
206         uint8_t egress; /**< Egress matcher. */
207         uint32_t group; /**< The matcher group. */
208         struct mlx5_flow_dv_match_params mask; /**< Matcher mask. */
209 };
210
211 #define MLX5_ENCAP_MAX_LEN 132
212
213 /* Encap/decap resource structure. */
214 struct mlx5_flow_dv_encap_decap_resource {
215         LIST_ENTRY(mlx5_flow_dv_encap_decap_resource) next;
216         /* Pointer to next element. */
217         rte_atomic32_t refcnt; /**< Reference counter. */
218         void *verbs_action;
219         /**< Verbs encap/decap action object. */
220         uint8_t buf[MLX5_ENCAP_MAX_LEN];
221         size_t size;
222         uint8_t reformat_type;
223         uint8_t ft_type;
224         uint64_t flags; /**< Flags for RDMA API. */
225 };
226
227 /* Tag resource structure. */
228 struct mlx5_flow_dv_tag_resource {
229         LIST_ENTRY(mlx5_flow_dv_tag_resource) next;
230         /* Pointer to next element. */
231         rte_atomic32_t refcnt; /**< Reference counter. */
232         void *action;
233         /**< Verbs tag action object. */
234         uint32_t tag; /**< the tag value. */
235 };
236
237 /* Number of modification commands. */
238 #define MLX5_MODIFY_NUM 8
239
240 /* Modify resource structure */
241 struct mlx5_flow_dv_modify_hdr_resource {
242         LIST_ENTRY(mlx5_flow_dv_modify_hdr_resource) next;
243         /* Pointer to next element. */
244         rte_atomic32_t refcnt; /**< Reference counter. */
245         struct ibv_flow_action *verbs_action;
246         /**< Verbs modify header action object. */
247         uint8_t ft_type; /**< Flow table type, Rx or Tx. */
248         uint32_t actions_num; /**< Number of modification actions. */
249         struct mlx5_modification_cmd actions[MLX5_MODIFY_NUM];
250         /**< Modification actions. */
251 };
252
253 /*
254  * Max number of actions per DV flow.
255  * See CREATE_FLOW_MAX_FLOW_ACTIONS_SUPPORTED
256  * In rdma-core file providers/mlx5/verbs.c
257  */
258 #define MLX5_DV_MAX_NUMBER_OF_ACTIONS 8
259
260 /* DV flows structure. */
261 struct mlx5_flow_dv {
262         uint64_t hash_fields; /**< Fields that participate in the hash. */
263         struct mlx5_hrxq *hrxq; /**< Hash Rx queues. */
264         /* Flow DV api: */
265         struct mlx5_flow_dv_matcher *matcher; /**< Cache to matcher. */
266         struct mlx5_flow_dv_match_params value;
267         /**< Holds the value that the packet is compared to. */
268         struct mlx5_flow_dv_encap_decap_resource *encap_decap;
269         /**< Pointer to encap/decap resource in cache. */
270         struct mlx5_flow_dv_modify_hdr_resource *modify_hdr;
271         /**< Pointer to modify header resource in cache. */
272         struct ibv_flow *flow; /**< Installed flow. */
273 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
274         void *actions[MLX5_DV_MAX_NUMBER_OF_ACTIONS];
275         /**< Action list. */
276 #endif
277         int actions_n; /**< number of actions. */
278 };
279
280 /** Linux TC flower driver for E-Switch flow. */
281 struct mlx5_flow_tcf {
282         struct nlmsghdr *nlh;
283         struct tcmsg *tcm;
284         uint32_t *ptc_flags; /**< tc rule applied flags. */
285         union { /**< Tunnel encap/decap descriptor. */
286                 struct flow_tcf_tunnel_hdr *tunnel;
287                 struct flow_tcf_vxlan_decap *vxlan_decap;
288                 struct flow_tcf_vxlan_encap *vxlan_encap;
289         };
290         uint32_t applied:1; /**< Whether rule is currently applied. */
291 #ifndef NDEBUG
292         uint32_t nlsize; /**< Size of NL message buffer for debug check. */
293 #endif
294 };
295
296 /* Verbs specification header. */
297 struct ibv_spec_header {
298         enum ibv_flow_spec_type type;
299         uint16_t size;
300 };
301
302 /** Handles information leading to a drop fate. */
303 struct mlx5_flow_verbs {
304         LIST_ENTRY(mlx5_flow_verbs) next;
305         unsigned int size; /**< Size of the attribute. */
306         struct {
307                 struct ibv_flow_attr *attr;
308                 /**< Pointer to the Specification buffer. */
309                 uint8_t *specs; /**< Pointer to the specifications. */
310         };
311         struct ibv_flow *flow; /**< Verbs flow pointer. */
312         struct mlx5_hrxq *hrxq; /**< Hash Rx queue object. */
313         uint64_t hash_fields; /**< Verbs hash Rx queue hash fields. */
314 };
315
316 /** Device flow structure. */
317 struct mlx5_flow {
318         LIST_ENTRY(mlx5_flow) next;
319         struct rte_flow *flow; /**< Pointer to the main flow. */
320         uint64_t layers;
321         /**< Bit-fields of present layers, see MLX5_FLOW_LAYER_*. */
322         union {
323 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
324                 struct mlx5_flow_dv dv;
325 #endif
326                 struct mlx5_flow_tcf tcf;
327                 struct mlx5_flow_verbs verbs;
328         };
329 };
330
331 /* Counters information. */
332 struct mlx5_flow_counter {
333         LIST_ENTRY(mlx5_flow_counter) next; /**< Pointer to the next counter. */
334         uint32_t shared:1; /**< Share counter ID with other flow rules. */
335         uint32_t ref_cnt:31; /**< Reference counter. */
336         uint32_t id; /**< Counter ID. */
337         union {  /**< Holds the counters for the rule. */
338 #if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42)
339                 struct ibv_counter_set *cs;
340 #elif defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45)
341                 struct ibv_counters *cs;
342 #endif
343                 struct mlx5_devx_counter_set *dcs;
344         };
345         uint64_t hits; /**< Number of packets matched by the rule. */
346         uint64_t bytes; /**< Number of bytes matched by the rule. */
347         void *action; /**< Pointer to the dv action. */
348 };
349
350 /* Flow structure. */
351 struct rte_flow {
352         TAILQ_ENTRY(rte_flow) next; /**< Pointer to the next flow structure. */
353         enum mlx5_flow_drv_type drv_type; /**< Driver type. */
354         struct mlx5_flow_counter *counter; /**< Holds flow counter. */
355         struct mlx5_flow_dv_tag_resource *tag_resource;
356         /**< pointer to the tag action. */
357         struct rte_flow_action_rss rss;/**< RSS context. */
358         uint8_t key[MLX5_RSS_HASH_KEY_LEN]; /**< RSS hash key. */
359         uint16_t (*queue)[]; /**< Destination queues to redirect traffic to. */
360         LIST_HEAD(dev_flows, mlx5_flow) dev_flows;
361         /**< Device flows that are part of the flow. */
362         uint64_t actions;
363         /**< Bit-fields of detected actions, see MLX5_FLOW_ACTION_*. */
364         struct mlx5_fdir *fdir; /**< Pointer to associated FDIR if any. */
365         uint8_t ingress; /**< 1 if the flow is ingress. */
366         uint32_t group; /**< The group index. */
367 };
368
369 typedef int (*mlx5_flow_validate_t)(struct rte_eth_dev *dev,
370                                     const struct rte_flow_attr *attr,
371                                     const struct rte_flow_item items[],
372                                     const struct rte_flow_action actions[],
373                                     struct rte_flow_error *error);
374 typedef struct mlx5_flow *(*mlx5_flow_prepare_t)
375         (const struct rte_flow_attr *attr, const struct rte_flow_item items[],
376          const struct rte_flow_action actions[], struct rte_flow_error *error);
377 typedef int (*mlx5_flow_translate_t)(struct rte_eth_dev *dev,
378                                      struct mlx5_flow *dev_flow,
379                                      const struct rte_flow_attr *attr,
380                                      const struct rte_flow_item items[],
381                                      const struct rte_flow_action actions[],
382                                      struct rte_flow_error *error);
383 typedef int (*mlx5_flow_apply_t)(struct rte_eth_dev *dev, struct rte_flow *flow,
384                                  struct rte_flow_error *error);
385 typedef void (*mlx5_flow_remove_t)(struct rte_eth_dev *dev,
386                                    struct rte_flow *flow);
387 typedef void (*mlx5_flow_destroy_t)(struct rte_eth_dev *dev,
388                                     struct rte_flow *flow);
389 typedef int (*mlx5_flow_query_t)(struct rte_eth_dev *dev,
390                                  struct rte_flow *flow,
391                                  const struct rte_flow_action *actions,
392                                  void *data,
393                                  struct rte_flow_error *error);
394 struct mlx5_flow_driver_ops {
395         mlx5_flow_validate_t validate;
396         mlx5_flow_prepare_t prepare;
397         mlx5_flow_translate_t translate;
398         mlx5_flow_apply_t apply;
399         mlx5_flow_remove_t remove;
400         mlx5_flow_destroy_t destroy;
401         mlx5_flow_query_t query;
402 };
403
404 /* mlx5_flow.c */
405
406 uint64_t mlx5_flow_hashfields_adjust(struct mlx5_flow *dev_flow, int tunnel,
407                                      uint64_t layer_types,
408                                      uint64_t hash_fields);
409 uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
410                                    uint32_t subpriority);
411 int mlx5_flow_validate_action_count(struct rte_eth_dev *dev,
412                                     const struct rte_flow_attr *attr,
413                                     struct rte_flow_error *error);
414 int mlx5_flow_validate_action_drop(uint64_t action_flags,
415                                    const struct rte_flow_attr *attr,
416                                    struct rte_flow_error *error);
417 int mlx5_flow_validate_action_flag(uint64_t action_flags,
418                                    const struct rte_flow_attr *attr,
419                                    struct rte_flow_error *error);
420 int mlx5_flow_validate_action_mark(const struct rte_flow_action *action,
421                                    uint64_t action_flags,
422                                    const struct rte_flow_attr *attr,
423                                    struct rte_flow_error *error);
424 int mlx5_flow_validate_action_queue(const struct rte_flow_action *action,
425                                     uint64_t action_flags,
426                                     struct rte_eth_dev *dev,
427                                     const struct rte_flow_attr *attr,
428                                     struct rte_flow_error *error);
429 int mlx5_flow_validate_action_rss(const struct rte_flow_action *action,
430                                   uint64_t action_flags,
431                                   struct rte_eth_dev *dev,
432                                   const struct rte_flow_attr *attr,
433                                   struct rte_flow_error *error);
434 int mlx5_flow_validate_attributes(struct rte_eth_dev *dev,
435                                   const struct rte_flow_attr *attributes,
436                                   struct rte_flow_error *error);
437 int mlx5_flow_item_acceptable(const struct rte_flow_item *item,
438                               const uint8_t *mask,
439                               const uint8_t *nic_mask,
440                               unsigned int size,
441                               struct rte_flow_error *error);
442 int mlx5_flow_validate_item_eth(const struct rte_flow_item *item,
443                                 uint64_t item_flags,
444                                 struct rte_flow_error *error);
445 int mlx5_flow_validate_item_gre(const struct rte_flow_item *item,
446                                 uint64_t item_flags,
447                                 uint8_t target_protocol,
448                                 struct rte_flow_error *error);
449 int mlx5_flow_validate_item_ipv4(const struct rte_flow_item *item,
450                                  uint64_t item_flags,
451                                  const struct rte_flow_item_ipv4 *acc_mask,
452                                  struct rte_flow_error *error);
453 int mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
454                                  uint64_t item_flags,
455                                  const struct rte_flow_item_ipv6 *acc_mask,
456                                  struct rte_flow_error *error);
457 int mlx5_flow_validate_item_mpls(struct rte_eth_dev *dev,
458                                  const struct rte_flow_item *item,
459                                  uint64_t item_flags,
460                                  uint64_t prev_layer,
461                                  struct rte_flow_error *error);
462 int mlx5_flow_validate_item_tcp(const struct rte_flow_item *item,
463                                 uint64_t item_flags,
464                                 uint8_t target_protocol,
465                                 const struct rte_flow_item_tcp *flow_mask,
466                                 struct rte_flow_error *error);
467 int mlx5_flow_validate_item_udp(const struct rte_flow_item *item,
468                                 uint64_t item_flags,
469                                 uint8_t target_protocol,
470                                 struct rte_flow_error *error);
471 int mlx5_flow_validate_item_vlan(const struct rte_flow_item *item,
472                                  uint64_t item_flags,
473                                  struct rte_flow_error *error);
474 int mlx5_flow_validate_item_vxlan(const struct rte_flow_item *item,
475                                   uint64_t item_flags,
476                                   struct rte_flow_error *error);
477 int mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item,
478                                       uint64_t item_flags,
479                                       struct rte_eth_dev *dev,
480                                       struct rte_flow_error *error);
481
482 /* mlx5_flow_tcf.c */
483
484 int mlx5_flow_tcf_init(struct mlx5_flow_tcf_context *ctx,
485                        unsigned int ifindex, struct rte_flow_error *error);
486 struct mlx5_flow_tcf_context *mlx5_flow_tcf_context_create(void);
487 void mlx5_flow_tcf_context_destroy(struct mlx5_flow_tcf_context *ctx);
488
489 #endif /* RTE_PMD_MLX5_FLOW_H_ */