net/iavf: enable 5 tuple RSS hash
[dpdk.git] / drivers / net / iavf / iavf_hash.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Intel Corporation
3  */
4
5 #include <sys/queue.h>
6 #include <stdio.h>
7 #include <errno.h>
8 #include <stdint.h>
9 #include <string.h>
10 #include <unistd.h>
11 #include <stdarg.h>
12
13 #include <rte_debug.h>
14 #include <rte_ether.h>
15 #include <rte_ethdev_driver.h>
16 #include <rte_log.h>
17 #include <rte_malloc.h>
18 #include <rte_eth_ctrl.h>
19 #include <rte_tailq.h>
20 #include <rte_flow_driver.h>
21
22 #include "iavf_log.h"
23 #include "iavf.h"
24 #include "iavf_generic_flow.h"
25
26 enum iavf_pattern_hint_type {
27         IAVF_PHINT_NONE                         = 0x00000000,
28         IAVF_PHINT_IPV4                         = 0x00000001,
29         IAVF_PHINT_IPV4_UDP                     = 0x00000002,
30         IAVF_PHINT_IPV4_TCP                     = 0x00000004,
31         IAVF_PHINT_IPV4_SCTP                    = 0x00000008,
32         IAVF_PHINT_IPV6                         = 0x00000010,
33         IAVF_PHINT_IPV6_UDP                     = 0x00000020,
34         IAVF_PHINT_IPV6_TCP                     = 0x00000040,
35         IAVF_PHINT_IPV6_SCTP                    = 0x00000080,
36         IAVF_PHINT_IPV4_GTPU_EH                 = 0x00000100,
37         IAVF_PHINT_IPV4_GTPU_EH_DWNLINK         = 0x00000200,
38         IAVF_PHINT_IPV4_GTPU_EH_UPLINK          = 0x00000400,
39 };
40
41 #define IAVF_GTPU_EH_DWNLINK    0
42 #define IAVF_GTPU_EH_UPLINK     1
43
44 struct iavf_pattern_match_type {
45         uint64_t pattern_hint;
46 };
47
48 struct iavf_hash_match_type {
49         uint64_t hash_type;
50         struct virtchnl_proto_hdrs *proto_hdrs;
51         uint64_t pattern_hint;
52 };
53
54 struct iavf_rss_meta {
55         struct virtchnl_proto_hdrs *proto_hdrs;
56         enum virtchnl_rss_algorithm rss_algorithm;
57 };
58
59 struct iavf_hash_flow_cfg {
60         struct virtchnl_rss_cfg *rss_cfg;
61         bool simple_xor;
62 };
63
64 static int
65 iavf_hash_init(struct iavf_adapter *ad);
66 static int
67 iavf_hash_create(struct iavf_adapter *ad, struct rte_flow *flow, void *meta,
68                  struct rte_flow_error *error);
69 static int
70 iavf_hash_destroy(struct iavf_adapter *ad, struct rte_flow *flow,
71                   struct rte_flow_error *error);
72 static void
73 iavf_hash_uninit(struct iavf_adapter *ad);
74 static void
75 iavf_hash_free(struct rte_flow *flow);
76 static int
77 iavf_hash_parse_pattern_action(struct iavf_adapter *ad,
78                                struct iavf_pattern_match_item *array,
79                                uint32_t array_len,
80                                const struct rte_flow_item pattern[],
81                                const struct rte_flow_action actions[],
82                                void **meta,
83                                struct rte_flow_error *error);
84
85 static struct iavf_pattern_match_type phint_empty = {
86         IAVF_PHINT_NONE};
87 static struct iavf_pattern_match_type phint_eth_ipv4 = {
88         IAVF_PHINT_IPV4};
89 static struct iavf_pattern_match_type phint_eth_ipv4_udp = {
90         IAVF_PHINT_IPV4_UDP};
91 static struct iavf_pattern_match_type phint_eth_ipv4_tcp = {
92         IAVF_PHINT_IPV4_TCP};
93 static struct iavf_pattern_match_type phint_eth_ipv4_sctp = {
94         IAVF_PHINT_IPV4_SCTP};
95 static struct iavf_pattern_match_type phint_eth_ipv4_gtpu_eh_ipv4 = {
96         IAVF_PHINT_IPV4};
97 static struct iavf_pattern_match_type phint_eth_ipv4_gtpu_eh_ipv4_udp = {
98         IAVF_PHINT_IPV4_UDP};
99 static struct iavf_pattern_match_type phint_eth_ipv4_gtpu_eh_ipv4_tcp = {
100         IAVF_PHINT_IPV4_TCP};
101 static struct iavf_pattern_match_type phint_eth_ipv4_esp = {
102         IAVF_PHINT_IPV4};
103 static struct iavf_pattern_match_type phint_eth_ipv4_ah = {
104         IAVF_PHINT_IPV4};
105 static struct iavf_pattern_match_type phint_eth_ipv4_l2tpv3 = {
106         IAVF_PHINT_IPV4};
107 static struct iavf_pattern_match_type phint_eth_ipv4_pfcp = {
108         IAVF_PHINT_IPV4_UDP};
109 static struct iavf_pattern_match_type phint_eth_vlan_ipv4 = {
110         IAVF_PHINT_IPV4};
111 static struct iavf_pattern_match_type phint_eth_vlan_ipv4_udp = {
112         IAVF_PHINT_IPV4_UDP};
113 static struct iavf_pattern_match_type phint_eth_vlan_ipv4_tcp = {
114         IAVF_PHINT_IPV4_TCP};
115 static struct iavf_pattern_match_type phint_eth_vlan_ipv4_sctp = {
116         IAVF_PHINT_IPV4_SCTP};
117 static struct iavf_pattern_match_type phint_eth_ipv6 = {
118         IAVF_PHINT_IPV6};
119 static struct iavf_pattern_match_type phint_eth_ipv6_udp = {
120         IAVF_PHINT_IPV6_UDP};
121 static struct iavf_pattern_match_type phint_eth_ipv6_tcp = {
122         IAVF_PHINT_IPV6_TCP};
123 static struct iavf_pattern_match_type phint_eth_ipv6_sctp = {
124         IAVF_PHINT_IPV6_SCTP};
125 static struct iavf_pattern_match_type phint_eth_ipv6_esp = {
126         IAVF_PHINT_IPV6};
127 static struct iavf_pattern_match_type phint_eth_ipv6_ah = {
128         IAVF_PHINT_IPV6};
129 static struct iavf_pattern_match_type phint_eth_ipv6_l2tpv3 = {
130         IAVF_PHINT_IPV6};
131 static struct iavf_pattern_match_type phint_eth_ipv6_pfcp = {
132         IAVF_PHINT_IPV6_UDP};
133 static struct iavf_pattern_match_type phint_eth_vlan_ipv6 = {
134         IAVF_PHINT_IPV6};
135 static struct iavf_pattern_match_type phint_eth_vlan_ipv6_udp = {
136         IAVF_PHINT_IPV6_UDP};
137 static struct iavf_pattern_match_type phint_eth_vlan_ipv6_tcp = {
138         IAVF_PHINT_IPV6_TCP};
139 static struct iavf_pattern_match_type phint_eth_vlan_ipv6_sctp = {
140         IAVF_PHINT_IPV6_SCTP};
141
142 /**
143  * Supported pattern for hash.
144  * The first member is pattern item type,
145  * the second member is input set mask,
146  * the third member is pattern hint for hash.
147  */
148 static struct iavf_pattern_match_item iavf_hash_pattern_list[] = {
149         {iavf_pattern_eth_ipv4, IAVF_INSET_NONE, &phint_eth_ipv4},
150         {iavf_pattern_eth_ipv4_udp, IAVF_INSET_NONE, &phint_eth_ipv4_udp},
151         {iavf_pattern_eth_ipv4_tcp, IAVF_INSET_NONE, &phint_eth_ipv4_tcp},
152         {iavf_pattern_eth_ipv4_sctp, IAVF_INSET_NONE, &phint_eth_ipv4_sctp},
153         {iavf_pattern_eth_ipv4_gtpu_eh_ipv4, IAVF_INSET_NONE,
154                                         &phint_eth_ipv4_gtpu_eh_ipv4},
155         {iavf_pattern_eth_ipv4_gtpu_eh_ipv4_udp, IAVF_INSET_NONE,
156                                         &phint_eth_ipv4_gtpu_eh_ipv4_udp},
157         {iavf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp, IAVF_INSET_NONE,
158                                         &phint_eth_ipv4_gtpu_eh_ipv4_tcp},
159         {iavf_pattern_eth_ipv4_esp, IAVF_INSET_NONE, &phint_eth_ipv4_esp},
160         {iavf_pattern_eth_ipv4_ah, IAVF_INSET_NONE, &phint_eth_ipv4_ah},
161         {iavf_pattern_eth_ipv4_l2tpv3, IAVF_INSET_NONE,
162                                         &phint_eth_ipv4_l2tpv3},
163         {iavf_pattern_eth_ipv4_pfcp, IAVF_INSET_NONE, &phint_eth_ipv4_pfcp},
164         {iavf_pattern_eth_vlan_ipv4, IAVF_INSET_NONE, &phint_eth_vlan_ipv4},
165         {iavf_pattern_eth_vlan_ipv4_udp, IAVF_INSET_NONE,
166                                         &phint_eth_vlan_ipv4_udp},
167         {iavf_pattern_eth_vlan_ipv4_tcp, IAVF_INSET_NONE,
168                                         &phint_eth_vlan_ipv4_tcp},
169         {iavf_pattern_eth_vlan_ipv4_sctp, IAVF_INSET_NONE,
170                                         &phint_eth_vlan_ipv4_sctp},
171         {iavf_pattern_eth_ipv6, IAVF_INSET_NONE, &phint_eth_ipv6},
172         {iavf_pattern_eth_ipv6_udp, IAVF_INSET_NONE, &phint_eth_ipv6_udp},
173         {iavf_pattern_eth_ipv6_tcp, IAVF_INSET_NONE, &phint_eth_ipv6_tcp},
174         {iavf_pattern_eth_ipv6_sctp, IAVF_INSET_NONE, &phint_eth_ipv6_sctp},
175         {iavf_pattern_eth_ipv6_esp, IAVF_INSET_NONE, &phint_eth_ipv6_esp},
176         {iavf_pattern_eth_ipv6_ah, IAVF_INSET_NONE, &phint_eth_ipv6_ah},
177         {iavf_pattern_eth_ipv6_l2tpv3, IAVF_INSET_NONE,
178                                         &phint_eth_ipv6_l2tpv3},
179         {iavf_pattern_eth_ipv6_pfcp, IAVF_INSET_NONE, &phint_eth_ipv6_pfcp},
180         {iavf_pattern_eth_vlan_ipv6, IAVF_INSET_NONE, &phint_eth_vlan_ipv6},
181         {iavf_pattern_eth_vlan_ipv6_udp, IAVF_INSET_NONE,
182                                         &phint_eth_vlan_ipv6_udp},
183         {iavf_pattern_eth_vlan_ipv6_tcp, IAVF_INSET_NONE,
184                                         &phint_eth_vlan_ipv6_tcp},
185         {iavf_pattern_eth_vlan_ipv6_sctp, IAVF_INSET_NONE,
186                                         &phint_eth_vlan_ipv6_sctp},
187         {iavf_pattern_empty, IAVF_INSET_NONE, &phint_empty},
188 };
189
190 #define TUNNEL_LEVEL_OUTER              0
191 #define TUNNEL_LEVEL_FIRST_INNER        1
192
193 #define PROTO_COUNT_ONE                 1
194 #define PROTO_COUNT_TWO                 2
195 #define PROTO_COUNT_THREE               3
196
197 #define BUFF_NOUSED                     0
198 #define FIELD_FOR_PROTO_ONLY            0
199
200 #define FIELD_SELECTOR(proto_hdr_field) \
201                 (1UL << ((proto_hdr_field) & PROTO_HDR_FIELD_MASK))
202
203 #define proto_hint_eth_src { \
204         VIRTCHNL_PROTO_HDR_ETH, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_ETH_SRC), \
205         {BUFF_NOUSED } }
206
207 #define proto_hint_eth_dst { \
208         VIRTCHNL_PROTO_HDR_ETH, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_ETH_DST), \
209         {BUFF_NOUSED } }
210
211 #define proto_hint_eth_only { \
212         VIRTCHNL_PROTO_HDR_ETH, FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
213
214 #define proto_hint_eth { \
215         VIRTCHNL_PROTO_HDR_ETH, \
216         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_ETH_SRC) | \
217         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_ETH_DST), {BUFF_NOUSED } }
218
219 #define proto_hint_svlan { \
220         VIRTCHNL_PROTO_HDR_S_VLAN, \
221         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_S_VLAN_ID), {BUFF_NOUSED } }
222
223 #define proto_hint_cvlan { \
224         VIRTCHNL_PROTO_HDR_C_VLAN, \
225         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_C_VLAN_ID), {BUFF_NOUSED } }
226
227 #define proto_hint_ipv4_src { \
228         VIRTCHNL_PROTO_HDR_IPV4, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_SRC), \
229         {BUFF_NOUSED } }
230
231 #define proto_hint_ipv4_dst { \
232         VIRTCHNL_PROTO_HDR_IPV4, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_DST), \
233         {BUFF_NOUSED } }
234
235 #define proto_hint_ipv4_only { \
236         VIRTCHNL_PROTO_HDR_IPV4, FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
237
238 #define proto_hint_ipv4 { \
239         VIRTCHNL_PROTO_HDR_IPV4, \
240         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_SRC) | \
241         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_DST), {BUFF_NOUSED } }
242
243 #define proto_hint_ipv4_src_prot { \
244         VIRTCHNL_PROTO_HDR_IPV4, \
245         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_SRC) | \
246         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_PROT), \
247         {BUFF_NOUSED } }
248
249 #define proto_hint_ipv4_dst_prot { \
250         VIRTCHNL_PROTO_HDR_IPV4, \
251         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_DST) | \
252         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_PROT), \
253         {BUFF_NOUSED } }
254
255 #define proto_hint_ipv4_only_prot { \
256         VIRTCHNL_PROTO_HDR_IPV4, \
257         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_PROT), {BUFF_NOUSED } }
258
259 #define proto_hint_ipv4_prot { \
260         VIRTCHNL_PROTO_HDR_IPV4, \
261         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_SRC) | \
262         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_DST) | \
263         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV4_PROT), {BUFF_NOUSED } }
264
265 #define proto_hint_udp_src_port { \
266         VIRTCHNL_PROTO_HDR_UDP, \
267         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_UDP_SRC_PORT), {BUFF_NOUSED } }
268
269 #define proto_hint_udp_dst_port { \
270         VIRTCHNL_PROTO_HDR_UDP, \
271         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_UDP_DST_PORT), {BUFF_NOUSED } }
272
273 #define proto_hint_udp_only { \
274         VIRTCHNL_PROTO_HDR_UDP, FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
275
276 #define proto_hint_udp { \
277         VIRTCHNL_PROTO_HDR_UDP, \
278         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_UDP_SRC_PORT) | \
279         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_UDP_DST_PORT), {BUFF_NOUSED } }
280
281 #define proto_hint_tcp_src_port { \
282         VIRTCHNL_PROTO_HDR_TCP, \
283         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_TCP_SRC_PORT), {BUFF_NOUSED } }
284
285 #define proto_hint_tcp_dst_port { \
286         VIRTCHNL_PROTO_HDR_TCP, \
287         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_TCP_DST_PORT), {BUFF_NOUSED } }
288
289 #define proto_hint_tcp_only { \
290         VIRTCHNL_PROTO_HDR_TCP, FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
291
292 #define proto_hint_tcp { \
293         VIRTCHNL_PROTO_HDR_TCP, \
294         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_TCP_SRC_PORT) | \
295         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_TCP_DST_PORT), {BUFF_NOUSED } }
296
297 #define proto_hint_sctp_src_port { \
298         VIRTCHNL_PROTO_HDR_SCTP, \
299         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT), {BUFF_NOUSED } }
300
301 #define proto_hint_sctp_dst_port { \
302         VIRTCHNL_PROTO_HDR_SCTP, \
303         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_SCTP_DST_PORT), {BUFF_NOUSED } }
304
305 #define proto_hint_sctp_only { \
306         VIRTCHNL_PROTO_HDR_SCTP, FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
307
308 #define proto_hint_sctp { \
309         VIRTCHNL_PROTO_HDR_SCTP, \
310         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT) | \
311         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_SCTP_DST_PORT), {BUFF_NOUSED } }
312
313 #define proto_hint_ipv6_src { \
314         VIRTCHNL_PROTO_HDR_IPV6, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_SRC), \
315         {BUFF_NOUSED } }
316
317 #define proto_hint_ipv6_dst { \
318         VIRTCHNL_PROTO_HDR_IPV6, FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_DST), \
319         {BUFF_NOUSED } }
320
321 #define proto_hint_ipv6_only { \
322         VIRTCHNL_PROTO_HDR_IPV6, FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
323
324 #define proto_hint_ipv6 { \
325         VIRTCHNL_PROTO_HDR_IPV6, \
326         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_SRC) | \
327         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_DST), {BUFF_NOUSED } }
328
329 #define proto_hint_ipv6_src_prot { \
330         VIRTCHNL_PROTO_HDR_IPV6, \
331         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_SRC) | \
332         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_PROT), \
333         {BUFF_NOUSED } }
334
335 #define proto_hint_ipv6_dst_prot { \
336         VIRTCHNL_PROTO_HDR_IPV6, \
337         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_DST) | \
338         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_PROT), \
339         {BUFF_NOUSED } }
340
341 #define proto_hint_ipv6_only_prot { \
342         VIRTCHNL_PROTO_HDR_IPV6, \
343         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_PROT), {BUFF_NOUSED } }
344
345 #define proto_hint_ipv6_prot { \
346         VIRTCHNL_PROTO_HDR_IPV6, \
347         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_SRC) | \
348         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_DST) | \
349         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_IPV6_PROT), {BUFF_NOUSED } }
350
351 #define proto_hint_gtpu_eh_only { \
352         VIRTCHNL_PROTO_HDR_GTPU_EH, \
353         FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
354
355 #define proto_hint_gtpu_up_only { \
356         VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_UP, \
357         FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
358
359 #define proto_hint_gtpu_dwn_only { \
360         VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_DWN, \
361         FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
362
363 #define proto_hint_esp { \
364         VIRTCHNL_PROTO_HDR_ESP, \
365         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_ESP_SPI), {BUFF_NOUSED } }
366
367 #define proto_hint_ah { \
368         VIRTCHNL_PROTO_HDR_AH, \
369         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_AH_SPI), {BUFF_NOUSED } }
370
371 #define proto_hint_l2tpv3 { \
372         VIRTCHNL_PROTO_HDR_L2TPV3, \
373         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_L2TPV3_SESS_ID), {BUFF_NOUSED } }
374
375 #define proto_hint_pfcp { \
376         VIRTCHNL_PROTO_HDR_PFCP, \
377         FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_PFCP_SEID), {BUFF_NOUSED } }
378
379 /* IPV4 */
380
381 struct virtchnl_proto_hdrs hdrs_hint_eth_src_ipv4 = {
382         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_eth_src,
383         proto_hint_ipv4_only }
384 };
385
386 struct virtchnl_proto_hdrs hdrs_hint_eth_src_ipv4_udp = {
387         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth_src,
388         proto_hint_ipv4_only, proto_hint_udp_only }
389 };
390
391 struct virtchnl_proto_hdrs hdrs_hint_eth_src_ipv4_tcp = {
392         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth_src,
393         proto_hint_ipv4_only, proto_hint_tcp_only }
394 };
395
396 struct virtchnl_proto_hdrs hdrs_hint_eth_src_ipv4_sctp = {
397         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth_src,
398         proto_hint_ipv4_only, proto_hint_sctp_only }
399 };
400
401 struct virtchnl_proto_hdrs hdrs_hint_eth_dst_ipv4 = {
402         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_eth_dst,
403         proto_hint_ipv4_only }
404 };
405
406 struct virtchnl_proto_hdrs hdrs_hint_eth_dst_ipv4_udp = {
407         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth_dst,
408         proto_hint_ipv4_only, proto_hint_udp_only }
409 };
410
411 struct virtchnl_proto_hdrs hdrs_hint_eth_dst_ipv4_tcp = {
412         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth_dst,
413         proto_hint_ipv4_only, proto_hint_tcp_only }
414 };
415
416 struct virtchnl_proto_hdrs hdrs_hint_eth_dst_ipv4_sctp = {
417         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth_dst,
418         proto_hint_ipv4_only, proto_hint_sctp_only }
419 };
420
421 struct virtchnl_proto_hdrs hdrs_hint_eth_ipv4 = {
422         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_eth,
423         proto_hint_ipv4_only }
424 };
425
426 struct virtchnl_proto_hdrs hdrs_hint_eth_ipv4_udp = {
427         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth,
428         proto_hint_ipv4_only, proto_hint_udp_only }
429 };
430
431 struct virtchnl_proto_hdrs hdrs_hint_eth_ipv4_tcp = {
432         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth,
433         proto_hint_ipv4_only, proto_hint_tcp_only }
434 };
435
436 struct virtchnl_proto_hdrs hdrs_hint_eth_ipv4_sctp = {
437         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth,
438         proto_hint_ipv4_only, proto_hint_sctp_only }
439 };
440
441 struct virtchnl_proto_hdrs hdrs_hint_svlan_ipv4 = {
442         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_svlan,
443         proto_hint_ipv4_only}
444 };
445
446 struct virtchnl_proto_hdrs hdrs_hint_svlan_ipv4_udp = {
447         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_svlan,
448         proto_hint_ipv4_only, proto_hint_udp_only}
449 };
450
451 struct virtchnl_proto_hdrs hdrs_hint_svlan_ipv4_tcp = {
452         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_svlan,
453         proto_hint_ipv4_only, proto_hint_tcp_only}
454 };
455
456 struct virtchnl_proto_hdrs hdrs_hint_svlan_ipv4_sctp = {
457         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_svlan,
458         proto_hint_ipv4_only, proto_hint_sctp_only}
459 };
460
461 struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv4 = {
462         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_cvlan,
463         proto_hint_ipv4_only}
464 };
465
466 struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv4_udp = {
467         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_cvlan,
468         proto_hint_ipv4_only, proto_hint_udp_only}
469 };
470
471 struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv4_tcp = {
472         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_cvlan,
473         proto_hint_ipv4_only, proto_hint_tcp_only}
474 };
475
476 struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv4_sctp = {
477         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_cvlan,
478         proto_hint_ipv4_only, proto_hint_sctp_only}
479 };
480
481 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src = {
482         TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_ipv4_src }
483 };
484
485 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst = {
486         TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_ipv4_dst }
487 };
488
489 struct virtchnl_proto_hdrs hdrs_hint_ipv4 = {
490         TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_ipv4 }
491 };
492
493 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_udp_src_port = {
494         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_src_prot,
495         proto_hint_udp_src_port }
496 };
497
498 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_udp_dst_port = {
499         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_src_prot,
500         proto_hint_udp_dst_port }
501 };
502
503 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_udp_src_port = {
504         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_dst_prot,
505         proto_hint_udp_src_port }
506 };
507
508 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_udp_dst_port = {
509         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_dst_prot,
510         proto_hint_udp_dst_port }
511 };
512
513 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_src_port = {
514         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only_prot,
515         proto_hint_udp_src_port }
516 };
517
518 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_dst_port = {
519         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only_prot,
520         proto_hint_udp_dst_port }
521 };
522
523 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp = {
524         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_prot,
525         proto_hint_udp }
526 };
527
528 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_tcp_src_port = {
529         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_src_prot,
530         proto_hint_tcp_src_port }
531 };
532
533 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_tcp_dst_port = {
534         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_src_prot,
535         proto_hint_tcp_dst_port }
536 };
537
538 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_tcp_src_port = {
539         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_dst_prot,
540         proto_hint_tcp_src_port }
541 };
542
543 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_tcp_dst_port = {
544         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_dst_prot,
545         proto_hint_tcp_dst_port }
546 };
547
548 struct virtchnl_proto_hdrs hdrs_hint_ipv4_tcp_src_port = {
549         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only_prot,
550         proto_hint_tcp_src_port }
551 };
552
553 struct virtchnl_proto_hdrs hdrs_hint_ipv4_tcp_dst_port = {
554         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only_prot,
555         proto_hint_tcp_dst_port }
556 };
557
558 struct virtchnl_proto_hdrs hdrs_hint_ipv4_tcp = {
559         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_prot,
560         proto_hint_tcp }
561 };
562
563 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_sctp_src_port = {
564         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_src,
565         proto_hint_sctp_src_port }
566 };
567
568 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_sctp_dst_port = {
569         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_src,
570         proto_hint_sctp_dst_port }
571 };
572
573 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_sctp_src_port = {
574         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_dst,
575         proto_hint_sctp_src_port }
576 };
577
578 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_sctp_dst_port = {
579         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_dst,
580         proto_hint_sctp_dst_port }
581 };
582
583 struct virtchnl_proto_hdrs hdrs_hint_ipv4_sctp_src_port = {
584         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
585         proto_hint_sctp_src_port }
586 };
587
588 struct virtchnl_proto_hdrs hdrs_hint_ipv4_sctp_dst_port = {
589         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
590         proto_hint_sctp_dst_port }
591 };
592
593 struct virtchnl_proto_hdrs hdrs_hint_ipv4_sctp = {
594         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4,
595         proto_hint_sctp }
596 };
597
598 struct virtchnl_proto_hdrs hdrs_hint_ipv4_esp = {
599         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
600         proto_hint_esp }
601 };
602
603 struct virtchnl_proto_hdrs hdrs_hint_ipv4_ah = {
604         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
605         proto_hint_ah }
606 };
607
608 struct virtchnl_proto_hdrs hdrs_hint_ipv4_l2tpv3 = {
609         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
610         proto_hint_l2tpv3 }
611 };
612
613 struct virtchnl_proto_hdrs hdrs_hint_ipv4_pfcp = {
614         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
615         proto_hint_pfcp }
616 };
617
618 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_esp = {
619         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_ipv4_only,
620         proto_hint_udp_only, proto_hint_esp }
621 };
622
623 /* GTPU EH */
624
625 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_src_gtpu_eh = {
626         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
627         proto_hint_ipv4_only_prot, proto_hint_udp_src_port}
628 };
629
630 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_dst_gtpu_eh = {
631         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
632         proto_hint_ipv4_only_prot, proto_hint_udp_dst_port}
633 };
634
635 struct virtchnl_proto_hdrs hdrs_hint_ipv4_tcp_src_gtpu_eh = {
636         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
637         proto_hint_ipv4_only_prot, proto_hint_tcp_src_port}
638 };
639
640 struct virtchnl_proto_hdrs hdrs_hint_ipv4_tcp_dst_gtpu_eh = {
641         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
642         proto_hint_ipv4_only_prot, proto_hint_tcp_dst_port}
643 };
644
645 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_gtpu_eh = {
646         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_eh_only,
647         proto_hint_ipv4_src }
648 };
649
650 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_udp_src_gtpu_eh = {
651         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
652         proto_hint_ipv4_src_prot, proto_hint_udp_src_port}
653 };
654
655 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_udp_dst_gtpu_eh = {
656         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
657         proto_hint_ipv4_src_prot, proto_hint_udp_dst_port}
658 };
659
660 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_tcp_src_gtpu_eh = {
661         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
662         proto_hint_ipv4_src_prot, proto_hint_tcp_src_port}
663 };
664
665 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_tcp_dst_gtpu_eh = {
666         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
667         proto_hint_ipv4_src_prot, proto_hint_tcp_dst_port}
668 };
669
670 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_gtpu_eh = {
671         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_eh_only,
672         proto_hint_ipv4_dst }
673 };
674
675 struct virtchnl_proto_hdrs hdrs_hint_ipv4_gtpu_eh = {
676         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_eh_only,
677         proto_hint_ipv4 }
678 };
679
680 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_udp_src_gtpu_eh = {
681         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
682         proto_hint_ipv4_dst_prot, proto_hint_udp_src_port}
683 };
684
685 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_udp_dst_gtpu_eh = {
686         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
687         proto_hint_ipv4_dst_prot, proto_hint_udp_dst_port}
688 };
689
690 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_tcp_src_gtpu_eh = {
691         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
692         proto_hint_ipv4_dst_prot, proto_hint_tcp_src_port}
693 };
694
695 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_tcp_dst_gtpu_eh = {
696         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
697         proto_hint_ipv4_dst_prot, proto_hint_tcp_dst_port}
698 };
699
700 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_gtpu_eh = {
701         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
702         proto_hint_ipv4_prot, proto_hint_udp}
703 };
704
705 struct virtchnl_proto_hdrs hdrs_hint_ipv4_tcp_gtpu_eh = {
706         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_eh_only,
707         proto_hint_ipv4_prot, proto_hint_tcp}
708 };
709
710 /* GTPU UP */
711
712 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_src_gtpu_up = {
713         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
714         proto_hint_ipv4_only_prot, proto_hint_udp_src_port}
715 };
716
717 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_dst_gtpu_up = {
718         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
719         proto_hint_ipv4_only_prot, proto_hint_udp_dst_port}
720 };
721
722 struct virtchnl_proto_hdrs hdrs_hint_ipv4_tcp_src_gtpu_up = {
723         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
724         proto_hint_ipv4_only_prot, proto_hint_tcp_src_port}
725 };
726
727 struct virtchnl_proto_hdrs hdrs_hint_ipv4_tcp_dst_gtpu_up = {
728         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
729         proto_hint_ipv4_only_prot, proto_hint_tcp_dst_port}
730 };
731
732 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_gtpu_up = {
733         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_up_only,
734         proto_hint_ipv4_src }
735 };
736
737 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_udp_src_gtpu_up = {
738         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
739         proto_hint_ipv4_src_prot, proto_hint_udp_src_port}
740 };
741
742 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_udp_dst_gtpu_up = {
743         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
744         proto_hint_ipv4_src_prot, proto_hint_udp_dst_port}
745 };
746
747 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_tcp_src_gtpu_up = {
748         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
749         proto_hint_ipv4_src_prot, proto_hint_tcp_src_port}
750 };
751
752 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_tcp_dst_gtpu_up = {
753         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
754         proto_hint_ipv4_src_prot, proto_hint_tcp_dst_port}
755 };
756
757 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_gtpu_up = {
758         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_up_only,
759         proto_hint_ipv4_dst }
760 };
761
762 struct virtchnl_proto_hdrs hdrs_hint_ipv4_gtpu_up = {
763         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_up_only,
764         proto_hint_ipv4 }
765 };
766
767 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_udp_src_gtpu_up = {
768         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
769         proto_hint_ipv4_dst_prot, proto_hint_udp_src_port}
770 };
771
772 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_udp_dst_gtpu_up = {
773         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
774         proto_hint_ipv4_dst_prot, proto_hint_udp_dst_port}
775 };
776
777 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_tcp_src_gtpu_up = {
778         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
779         proto_hint_ipv4_dst_prot, proto_hint_tcp_src_port}
780 };
781
782 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_tcp_dst_gtpu_up = {
783         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
784         proto_hint_ipv4_dst_prot, proto_hint_tcp_dst_port}
785 };
786
787 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_gtpu_up = {
788         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
789         proto_hint_ipv4_prot, proto_hint_udp}
790 };
791
792 struct virtchnl_proto_hdrs hdrs_hint_ipv4_tcp_gtpu_up = {
793         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_up_only,
794         proto_hint_ipv4_prot, proto_hint_tcp}
795 };
796
797 /* GTPU DWN */
798
799 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_src_gtpu_dwn = {
800         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
801         proto_hint_ipv4_only_prot, proto_hint_udp_src_port}
802 };
803
804 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_dst_gtpu_dwn = {
805         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
806         proto_hint_ipv4_only_prot, proto_hint_udp_dst_port}
807 };
808
809 struct virtchnl_proto_hdrs hdrs_hint_ipv4_tcp_src_gtpu_dwn = {
810         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
811         proto_hint_ipv4_only_prot, proto_hint_tcp_src_port}
812 };
813
814 struct virtchnl_proto_hdrs hdrs_hint_ipv4_tcp_dst_gtpu_dwn = {
815         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
816         proto_hint_ipv4_only_prot, proto_hint_tcp_dst_port}
817 };
818
819 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_gtpu_dwn = {
820         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_dwn_only,
821         proto_hint_ipv4_src }
822 };
823
824 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_udp_src_gtpu_dwn = {
825         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
826         proto_hint_ipv4_src_prot, proto_hint_udp_src_port}
827 };
828
829 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_udp_dst_gtpu_dwn = {
830         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
831         proto_hint_ipv4_src_prot, proto_hint_udp_dst_port}
832 };
833
834 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_tcp_src_gtpu_dwn = {
835         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
836         proto_hint_ipv4_src_prot, proto_hint_tcp_src_port}
837 };
838
839 struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_tcp_dst_gtpu_dwn = {
840         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
841         proto_hint_ipv4_src_prot, proto_hint_tcp_dst_port}
842 };
843
844 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_gtpu_dwn = {
845         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_dwn_only,
846         proto_hint_ipv4_dst }
847 };
848
849 struct virtchnl_proto_hdrs hdrs_hint_ipv4_gtpu_dwn = {
850         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_dwn_only,
851         proto_hint_ipv4 }
852 };
853
854 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_udp_src_gtpu_dwn = {
855         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
856         proto_hint_ipv4_dst_prot, proto_hint_udp_src_port}
857 };
858
859 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_udp_dst_gtpu_dwn = {
860         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
861         proto_hint_ipv4_dst_prot, proto_hint_udp_dst_port}
862 };
863
864 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_tcp_src_gtpu_dwn = {
865         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
866         proto_hint_ipv4_dst_prot, proto_hint_tcp_src_port}
867 };
868
869 struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_tcp_dst_gtpu_dwn = {
870         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
871         proto_hint_ipv4_dst_prot, proto_hint_tcp_dst_port}
872 };
873
874 struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_gtpu_dwn = {
875         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
876         proto_hint_ipv4_prot, proto_hint_udp}
877 };
878
879 struct virtchnl_proto_hdrs hdrs_hint_ipv4_tcp_gtpu_dwn = {
880         TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_THREE, {proto_hint_gtpu_dwn_only,
881         proto_hint_ipv4_prot, proto_hint_tcp}
882 };
883
884 /* IPV6 */
885
886 struct virtchnl_proto_hdrs hdrs_hint_eth_src_ipv6 = {
887         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_eth_src,
888         proto_hint_ipv6_only }
889 };
890
891 struct virtchnl_proto_hdrs hdrs_hint_eth_src_ipv6_udp = {
892         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth_src,
893         proto_hint_ipv6_only, proto_hint_udp_only }
894 };
895
896 struct virtchnl_proto_hdrs hdrs_hint_eth_src_ipv6_tcp = {
897         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth_src,
898         proto_hint_ipv6_only, proto_hint_tcp_only }
899 };
900
901 struct virtchnl_proto_hdrs hdrs_hint_eth_src_ipv6_sctp = {
902         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth_src,
903         proto_hint_ipv6_only, proto_hint_sctp_only }
904 };
905
906 struct virtchnl_proto_hdrs hdrs_hint_eth_dst_ipv6 = {
907         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_eth_dst,
908         proto_hint_ipv6_only }
909 };
910
911 struct virtchnl_proto_hdrs hdrs_hint_eth_dst_ipv6_udp = {
912         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth_dst,
913         proto_hint_ipv6_only, proto_hint_udp_only }
914 };
915
916 struct virtchnl_proto_hdrs hdrs_hint_eth_dst_ipv6_tcp = {
917         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth_dst,
918         proto_hint_ipv6_only, proto_hint_tcp_only }
919 };
920
921 struct virtchnl_proto_hdrs hdrs_hint_eth_dst_ipv6_sctp = {
922         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth_dst,
923         proto_hint_ipv6_only, proto_hint_sctp_only }
924 };
925
926 struct virtchnl_proto_hdrs hdrs_hint_eth_ipv6 = {
927         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_eth,
928         proto_hint_ipv6_only }
929 };
930
931 struct virtchnl_proto_hdrs hdrs_hint_eth_ipv6_udp = {
932         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth,
933         proto_hint_ipv6_only, proto_hint_udp_only }
934 };
935
936 struct virtchnl_proto_hdrs hdrs_hint_eth_ipv6_tcp = {
937         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth,
938         proto_hint_ipv6_only, proto_hint_tcp_only }
939 };
940
941 struct virtchnl_proto_hdrs hdrs_hint_eth_ipv6_sctp = {
942         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_eth,
943         proto_hint_ipv6_only, proto_hint_sctp_only }
944 };
945
946 struct virtchnl_proto_hdrs hdrs_hint_svlan_ipv6 = {
947         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_svlan,
948         proto_hint_ipv6_only}
949 };
950
951 struct virtchnl_proto_hdrs hdrs_hint_svlan_ipv6_udp = {
952         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_svlan,
953         proto_hint_ipv6_only, proto_hint_udp_only}
954 };
955
956 struct virtchnl_proto_hdrs hdrs_hint_svlan_ipv6_tcp = {
957         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_svlan,
958         proto_hint_ipv6_only, proto_hint_tcp_only}
959 };
960
961 struct virtchnl_proto_hdrs hdrs_hint_svlan_ipv6_sctp = {
962         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_svlan,
963         proto_hint_ipv6_only, proto_hint_sctp_only}
964 };
965
966 struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv6 = {
967         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_cvlan,
968         proto_hint_ipv6_only}
969 };
970
971 struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv6_udp = {
972         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_cvlan,
973         proto_hint_ipv6_only, proto_hint_udp_only}
974 };
975
976 struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv6_tcp = {
977         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_cvlan,
978         proto_hint_ipv6_only, proto_hint_tcp_only}
979 };
980
981 struct virtchnl_proto_hdrs hdrs_hint_cvlan_ipv6_sctp = {
982         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_cvlan,
983         proto_hint_ipv6_only, proto_hint_sctp_only}
984 };
985
986 struct virtchnl_proto_hdrs hdrs_hint_ipv6_src = {
987         TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_ipv6_src }
988 };
989
990 struct virtchnl_proto_hdrs hdrs_hint_ipv6_dst = {
991         TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_ipv6_dst }
992 };
993
994 struct virtchnl_proto_hdrs hdrs_hint_ipv6 = {
995         TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_ipv6 }
996 };
997
998 struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_udp_src_port = {
999         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_src_prot,
1000         proto_hint_udp_src_port }
1001 };
1002
1003 struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_udp_dst_port = {
1004         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_src_prot,
1005         proto_hint_udp_dst_port }
1006 };
1007
1008 struct virtchnl_proto_hdrs hdrs_hint_ipv6_dst_udp_src_port = {
1009         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_dst_prot,
1010         proto_hint_udp_src_port }
1011 };
1012
1013 struct virtchnl_proto_hdrs hdrs_hint_ipv6_dst_udp_dst_port = {
1014         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_dst_prot,
1015         proto_hint_udp_dst_port }
1016 };
1017
1018 struct virtchnl_proto_hdrs hdrs_hint_ipv6_udp_src_port = {
1019         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only_prot,
1020         proto_hint_udp_src_port }
1021 };
1022
1023 struct virtchnl_proto_hdrs hdrs_hint_ipv6_udp_dst_port = {
1024         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only_prot,
1025         proto_hint_udp_dst_port }
1026 };
1027
1028 struct virtchnl_proto_hdrs hdrs_hint_ipv6_udp = {
1029         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_prot,
1030         proto_hint_udp }
1031 };
1032
1033 struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_tcp_src_port = {
1034         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_src_prot,
1035         proto_hint_tcp_src_port }
1036 };
1037
1038 struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_tcp_dst_port = {
1039         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_src_prot,
1040         proto_hint_tcp_dst_port }
1041 };
1042
1043 struct virtchnl_proto_hdrs hdrs_hint_ipv6_dst_tcp_src_port = {
1044         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_dst_prot,
1045         proto_hint_tcp_src_port }
1046 };
1047
1048 struct virtchnl_proto_hdrs hdrs_hint_ipv6_dst_tcp_dst_port = {
1049         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_dst_prot,
1050         proto_hint_tcp_dst_port }
1051 };
1052
1053 struct virtchnl_proto_hdrs hdrs_hint_ipv6_tcp_src_port = {
1054         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only_prot,
1055         proto_hint_tcp_src_port }
1056 };
1057
1058 struct virtchnl_proto_hdrs hdrs_hint_ipv6_tcp_dst_port = {
1059         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only_prot,
1060         proto_hint_tcp_dst_port }
1061 };
1062
1063 struct virtchnl_proto_hdrs hdrs_hint_ipv6_tcp = {
1064         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_prot,
1065         proto_hint_tcp }
1066 };
1067
1068 struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_sctp_src_port = {
1069         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_src,
1070         proto_hint_sctp_src_port }
1071 };
1072
1073 struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_sctp_dst_port = {
1074         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_src,
1075         proto_hint_sctp_dst_port }
1076 };
1077
1078 struct virtchnl_proto_hdrs hdrs_hint_ipv6_dst_sctp_src_port = {
1079         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_dst,
1080         proto_hint_sctp_src_port }
1081 };
1082
1083 struct virtchnl_proto_hdrs hdrs_hint_ipv6_dst_sctp_dst_port = {
1084         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_dst,
1085         proto_hint_sctp_dst_port }
1086 };
1087
1088 struct virtchnl_proto_hdrs hdrs_hint_ipv6_sctp_src_port = {
1089         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only,
1090         proto_hint_sctp_src_port }
1091 };
1092
1093 struct virtchnl_proto_hdrs hdrs_hint_ipv6_sctp_dst_port = {
1094         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only,
1095         proto_hint_sctp_dst_port }
1096 };
1097
1098 struct virtchnl_proto_hdrs hdrs_hint_ipv6_sctp = {
1099         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6,
1100         proto_hint_sctp }
1101 };
1102
1103 struct virtchnl_proto_hdrs hdrs_hint_ipv6_esp = {
1104         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only,
1105         proto_hint_esp }
1106 };
1107
1108 struct virtchnl_proto_hdrs hdrs_hint_ipv6_ah = {
1109         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only,
1110         proto_hint_ah }
1111 };
1112
1113 struct virtchnl_proto_hdrs hdrs_hint_ipv6_l2tpv3 = {
1114         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only,
1115         proto_hint_l2tpv3 }
1116 };
1117
1118 struct virtchnl_proto_hdrs hdrs_hint_ipv6_pfcp = {
1119         TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only,
1120         proto_hint_pfcp }
1121 };
1122
1123 struct virtchnl_proto_hdrs hdrs_hint_ipv6_udp_esp = {
1124         TUNNEL_LEVEL_OUTER, PROTO_COUNT_THREE, {proto_hint_ipv6_only,
1125         proto_hint_udp_only, proto_hint_esp }
1126 };
1127
1128 struct iavf_hash_match_type iavf_hash_map_list[] = {
1129         /* IPV4 */
1130         {ETH_RSS_L2_SRC_ONLY,
1131                 &hdrs_hint_eth_src_ipv4, IAVF_PHINT_IPV4},
1132         {ETH_RSS_L2_DST_ONLY,
1133                 &hdrs_hint_eth_dst_ipv4, IAVF_PHINT_IPV4},
1134         {ETH_RSS_ETH,
1135                 &hdrs_hint_eth_ipv4, IAVF_PHINT_IPV4},
1136         {ETH_RSS_L3_SRC_ONLY,
1137                 &hdrs_hint_ipv4_src, IAVF_PHINT_IPV4},
1138         {ETH_RSS_L3_DST_ONLY,
1139                 &hdrs_hint_ipv4_dst, IAVF_PHINT_IPV4},
1140         {ETH_RSS_IPV4 | ETH_RSS_L3_SRC_ONLY,
1141                 &hdrs_hint_ipv4_src, IAVF_PHINT_IPV4},
1142         {ETH_RSS_IPV4 | ETH_RSS_L3_DST_ONLY,
1143                 &hdrs_hint_ipv4_dst, IAVF_PHINT_IPV4},
1144         {ETH_RSS_IPV4,
1145                 &hdrs_hint_ipv4, IAVF_PHINT_IPV4},
1146         {ETH_RSS_ESP,
1147                 &hdrs_hint_ipv4_esp, IAVF_PHINT_IPV4},
1148         {ETH_RSS_AH,
1149                 &hdrs_hint_ipv4_ah, IAVF_PHINT_IPV4},
1150         {ETH_RSS_L2TPV3,
1151                 &hdrs_hint_ipv4_l2tpv3, IAVF_PHINT_IPV4},
1152         {ETH_RSS_S_VLAN,
1153                 &hdrs_hint_svlan_ipv4, IAVF_PHINT_IPV4},
1154         {ETH_RSS_S_VLAN,
1155                 &hdrs_hint_svlan_ipv4_udp, IAVF_PHINT_IPV4_UDP},
1156         {ETH_RSS_S_VLAN,
1157                 &hdrs_hint_svlan_ipv4_tcp, IAVF_PHINT_IPV4_TCP},
1158         {ETH_RSS_S_VLAN,
1159                 &hdrs_hint_svlan_ipv4_sctp, IAVF_PHINT_IPV4_SCTP},
1160         {ETH_RSS_C_VLAN,
1161                 &hdrs_hint_cvlan_ipv4, IAVF_PHINT_IPV4},
1162         {ETH_RSS_C_VLAN,
1163                 &hdrs_hint_cvlan_ipv4_udp, IAVF_PHINT_IPV4_UDP},
1164         {ETH_RSS_C_VLAN,
1165                 &hdrs_hint_cvlan_ipv4_tcp, IAVF_PHINT_IPV4_TCP},
1166         {ETH_RSS_C_VLAN,
1167                 &hdrs_hint_cvlan_ipv4_sctp, IAVF_PHINT_IPV4_SCTP},
1168         /* IPV4 UDP */
1169         {ETH_RSS_L2_SRC_ONLY,
1170                 &hdrs_hint_eth_src_ipv4_udp, IAVF_PHINT_IPV4_UDP},
1171         {ETH_RSS_L2_DST_ONLY,
1172                 &hdrs_hint_eth_dst_ipv4_udp, IAVF_PHINT_IPV4_UDP},
1173         {ETH_RSS_ETH,
1174                 &hdrs_hint_eth_ipv4_udp, IAVF_PHINT_IPV4_UDP},
1175         {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1176                 &hdrs_hint_ipv4_src_udp_src_port, IAVF_PHINT_IPV4_UDP},
1177         {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1178                 &hdrs_hint_ipv4_src_udp_dst_port, IAVF_PHINT_IPV4_UDP},
1179         {ETH_RSS_L3_SRC_ONLY,
1180                 &hdrs_hint_ipv4_src, IAVF_PHINT_IPV4_UDP},
1181         {ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1182                 &hdrs_hint_ipv4_dst_udp_src_port, IAVF_PHINT_IPV4_UDP},
1183         {ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1184                 &hdrs_hint_ipv4_dst_udp_dst_port, IAVF_PHINT_IPV4_UDP},
1185         {ETH_RSS_L3_DST_ONLY,
1186                 &hdrs_hint_ipv4_dst, IAVF_PHINT_IPV4_UDP},
1187         {ETH_RSS_NONFRAG_IPV4_UDP |
1188                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1189                 &hdrs_hint_ipv4_src_udp_src_port, IAVF_PHINT_IPV4_UDP},
1190         {ETH_RSS_NONFRAG_IPV4_UDP |
1191                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1192                 &hdrs_hint_ipv4_src_udp_dst_port, IAVF_PHINT_IPV4_UDP},
1193         {ETH_RSS_NONFRAG_IPV4_UDP |
1194                 ETH_RSS_L3_SRC_ONLY, &hdrs_hint_ipv4_src,
1195                 IAVF_PHINT_IPV4_UDP},
1196         {ETH_RSS_NONFRAG_IPV4_UDP |
1197                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1198                 &hdrs_hint_ipv4_dst_udp_src_port, IAVF_PHINT_IPV4_UDP},
1199         {ETH_RSS_NONFRAG_IPV4_UDP |
1200                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1201                 &hdrs_hint_ipv4_dst_udp_dst_port, IAVF_PHINT_IPV4_UDP},
1202         {ETH_RSS_NONFRAG_IPV4_UDP |
1203                 ETH_RSS_L3_DST_ONLY, &hdrs_hint_ipv4_dst,
1204                 IAVF_PHINT_IPV4_UDP},
1205         {ETH_RSS_L4_SRC_ONLY,
1206                 &hdrs_hint_ipv4_udp_src_port, IAVF_PHINT_IPV4_UDP},
1207         {ETH_RSS_L4_DST_ONLY,
1208                 &hdrs_hint_ipv4_udp_dst_port, IAVF_PHINT_IPV4_UDP},
1209         {ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_L4_SRC_ONLY,
1210                 &hdrs_hint_ipv4_udp_src_port, IAVF_PHINT_IPV4_UDP},
1211         {ETH_RSS_NONFRAG_IPV4_UDP | ETH_RSS_L4_DST_ONLY,
1212                 &hdrs_hint_ipv4_udp_dst_port, IAVF_PHINT_IPV4_UDP},
1213         {ETH_RSS_PFCP,
1214                 &hdrs_hint_ipv4_pfcp, IAVF_PHINT_IPV4_UDP},
1215         {ETH_RSS_ESP,
1216                 &hdrs_hint_ipv4_udp_esp, IAVF_PHINT_IPV4_UDP},
1217         {ETH_RSS_NONFRAG_IPV4_UDP,
1218                 &hdrs_hint_ipv4_udp, IAVF_PHINT_IPV4_UDP},
1219         /* IPV4 TCP */
1220         {ETH_RSS_L2_SRC_ONLY,
1221                 &hdrs_hint_eth_src_ipv4_tcp, IAVF_PHINT_IPV4_TCP},
1222         {ETH_RSS_L2_DST_ONLY,
1223                 &hdrs_hint_eth_dst_ipv4_tcp, IAVF_PHINT_IPV4_TCP},
1224         {ETH_RSS_ETH,
1225                 &hdrs_hint_eth_ipv4_tcp, IAVF_PHINT_IPV4_TCP},
1226         {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1227                 &hdrs_hint_ipv4_src_tcp_src_port, IAVF_PHINT_IPV4_TCP},
1228         {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1229                 &hdrs_hint_ipv4_src_tcp_dst_port, IAVF_PHINT_IPV4_TCP},
1230         {ETH_RSS_L3_SRC_ONLY,
1231                 &hdrs_hint_ipv4_src, IAVF_PHINT_IPV4_TCP},
1232         {ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1233                 &hdrs_hint_ipv4_dst_tcp_src_port, IAVF_PHINT_IPV4_TCP},
1234         {ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1235                 &hdrs_hint_ipv4_dst_tcp_dst_port, IAVF_PHINT_IPV4_TCP},
1236         {ETH_RSS_L3_DST_ONLY,
1237                 &hdrs_hint_ipv4_dst, IAVF_PHINT_IPV4_TCP},
1238         {ETH_RSS_NONFRAG_IPV4_TCP |
1239                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1240                 &hdrs_hint_ipv4_src_tcp_src_port, IAVF_PHINT_IPV4_TCP},
1241         {ETH_RSS_NONFRAG_IPV4_TCP |
1242                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1243                 &hdrs_hint_ipv4_src_tcp_dst_port, IAVF_PHINT_IPV4_TCP},
1244         {ETH_RSS_NONFRAG_IPV4_TCP |
1245                 ETH_RSS_L3_SRC_ONLY, &hdrs_hint_ipv4_src,
1246                 IAVF_PHINT_IPV4_TCP},
1247         {ETH_RSS_NONFRAG_IPV4_TCP |
1248                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1249                 &hdrs_hint_ipv4_dst_tcp_src_port, IAVF_PHINT_IPV4_TCP},
1250         {ETH_RSS_NONFRAG_IPV4_TCP |
1251                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1252                 &hdrs_hint_ipv4_dst_tcp_dst_port, IAVF_PHINT_IPV4_TCP},
1253         {ETH_RSS_NONFRAG_IPV4_TCP |
1254                 ETH_RSS_L3_DST_ONLY, &hdrs_hint_ipv4_dst,
1255                 IAVF_PHINT_IPV4_TCP},
1256         {ETH_RSS_L4_SRC_ONLY,
1257                 &hdrs_hint_ipv4_tcp_src_port, IAVF_PHINT_IPV4_TCP},
1258         {ETH_RSS_L4_DST_ONLY,
1259                 &hdrs_hint_ipv4_tcp_dst_port, IAVF_PHINT_IPV4_TCP},
1260         {ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_L4_SRC_ONLY,
1261                 &hdrs_hint_ipv4_tcp_src_port, IAVF_PHINT_IPV4_TCP},
1262         {ETH_RSS_NONFRAG_IPV4_TCP | ETH_RSS_L4_DST_ONLY,
1263                 &hdrs_hint_ipv4_tcp_dst_port, IAVF_PHINT_IPV4_TCP},
1264         {ETH_RSS_NONFRAG_IPV4_TCP,
1265                 &hdrs_hint_ipv4_tcp, IAVF_PHINT_IPV4_TCP},
1266         /* IPV4 SCTP */
1267         {ETH_RSS_L2_SRC_ONLY,
1268                 &hdrs_hint_eth_src_ipv4_sctp, IAVF_PHINT_IPV4_SCTP},
1269         {ETH_RSS_L2_DST_ONLY,
1270                 &hdrs_hint_eth_dst_ipv4_sctp, IAVF_PHINT_IPV4_SCTP},
1271         {ETH_RSS_ETH,
1272                 &hdrs_hint_eth_ipv4_sctp, IAVF_PHINT_IPV4_SCTP},
1273         {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1274                 &hdrs_hint_ipv4_src_sctp_src_port, IAVF_PHINT_IPV4_SCTP},
1275         {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1276                 &hdrs_hint_ipv4_src_sctp_dst_port, IAVF_PHINT_IPV4_SCTP},
1277         {ETH_RSS_L3_SRC_ONLY,
1278                 &hdrs_hint_ipv4_src, IAVF_PHINT_IPV4_SCTP},
1279         {ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1280                 &hdrs_hint_ipv4_dst_sctp_src_port, IAVF_PHINT_IPV4_SCTP},
1281         {ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1282                 &hdrs_hint_ipv4_dst_sctp_dst_port, IAVF_PHINT_IPV4_SCTP},
1283         {ETH_RSS_L3_DST_ONLY,
1284                 &hdrs_hint_ipv4_dst, IAVF_PHINT_IPV4_SCTP},
1285         {ETH_RSS_NONFRAG_IPV4_SCTP |
1286                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1287                 &hdrs_hint_ipv4_src_sctp_src_port, IAVF_PHINT_IPV4_SCTP},
1288         {ETH_RSS_NONFRAG_IPV4_SCTP |
1289                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1290                 &hdrs_hint_ipv4_src_sctp_dst_port, IAVF_PHINT_IPV4_SCTP},
1291         {ETH_RSS_NONFRAG_IPV4_SCTP |
1292                 ETH_RSS_L3_SRC_ONLY, &hdrs_hint_ipv4_src,
1293                 IAVF_PHINT_IPV4_SCTP},
1294         {ETH_RSS_NONFRAG_IPV4_SCTP |
1295                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1296                 &hdrs_hint_ipv4_dst_sctp_src_port, IAVF_PHINT_IPV4_SCTP},
1297         {ETH_RSS_NONFRAG_IPV4_SCTP |
1298                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1299                 &hdrs_hint_ipv4_dst_sctp_dst_port, IAVF_PHINT_IPV4_SCTP},
1300         {ETH_RSS_NONFRAG_IPV4_SCTP |
1301                 ETH_RSS_L3_DST_ONLY, &hdrs_hint_ipv4_dst,
1302                 IAVF_PHINT_IPV4_SCTP},
1303         {ETH_RSS_L4_SRC_ONLY,
1304                 &hdrs_hint_ipv4_sctp_src_port, IAVF_PHINT_IPV4_SCTP},
1305         {ETH_RSS_L4_DST_ONLY,
1306                 &hdrs_hint_ipv4_sctp_dst_port, IAVF_PHINT_IPV4_SCTP},
1307         {ETH_RSS_NONFRAG_IPV4_SCTP | ETH_RSS_L4_SRC_ONLY,
1308                 &hdrs_hint_ipv4_sctp_src_port, IAVF_PHINT_IPV4_SCTP},
1309         {ETH_RSS_NONFRAG_IPV4_SCTP | ETH_RSS_L4_DST_ONLY,
1310                 &hdrs_hint_ipv4_sctp_dst_port, IAVF_PHINT_IPV4_SCTP},
1311         {ETH_RSS_NONFRAG_IPV4_SCTP,
1312                 &hdrs_hint_ipv4_sctp, IAVF_PHINT_IPV4_SCTP},
1313         /* IPV6 */
1314         {ETH_RSS_L2_SRC_ONLY,
1315                 &hdrs_hint_eth_src_ipv6, IAVF_PHINT_IPV6},
1316         {ETH_RSS_L2_DST_ONLY,
1317                 &hdrs_hint_eth_dst_ipv6, IAVF_PHINT_IPV6},
1318         {ETH_RSS_ETH,
1319                 &hdrs_hint_eth_ipv6, IAVF_PHINT_IPV6},
1320         {ETH_RSS_L3_SRC_ONLY,
1321                 &hdrs_hint_ipv6_src, IAVF_PHINT_IPV6},
1322         {ETH_RSS_L3_DST_ONLY,
1323                 &hdrs_hint_ipv6_dst, IAVF_PHINT_IPV6},
1324         {ETH_RSS_IPV6 | ETH_RSS_L3_SRC_ONLY,
1325                 &hdrs_hint_ipv6_src, IAVF_PHINT_IPV6},
1326         {ETH_RSS_IPV6 | ETH_RSS_L3_DST_ONLY,
1327                 &hdrs_hint_ipv6_dst, IAVF_PHINT_IPV6},
1328         {ETH_RSS_IPV6,
1329                 &hdrs_hint_ipv6, IAVF_PHINT_IPV6},
1330         {ETH_RSS_ESP,
1331                 &hdrs_hint_ipv6_esp, IAVF_PHINT_IPV6},
1332         {ETH_RSS_AH,
1333                 &hdrs_hint_ipv6_ah, IAVF_PHINT_IPV6},
1334         {ETH_RSS_L2TPV3,
1335                 &hdrs_hint_ipv6_l2tpv3, IAVF_PHINT_IPV6},
1336         /* IPV6 UDP */
1337         {ETH_RSS_L2_SRC_ONLY,
1338                 &hdrs_hint_eth_src_ipv6_udp, IAVF_PHINT_IPV6_UDP},
1339         {ETH_RSS_L2_DST_ONLY,
1340                 &hdrs_hint_eth_dst_ipv6_udp, IAVF_PHINT_IPV6_UDP},
1341         {ETH_RSS_ETH,
1342                 &hdrs_hint_eth_ipv6_udp, IAVF_PHINT_IPV6_UDP},
1343         {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1344                 &hdrs_hint_ipv6_src_udp_src_port, IAVF_PHINT_IPV6_UDP},
1345         {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1346                 &hdrs_hint_ipv6_src_udp_dst_port, IAVF_PHINT_IPV6_UDP},
1347         {ETH_RSS_L3_SRC_ONLY,
1348                 &hdrs_hint_ipv6_src, IAVF_PHINT_IPV6_UDP},
1349         {ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1350                 &hdrs_hint_ipv6_dst_udp_src_port, IAVF_PHINT_IPV6_UDP},
1351         {ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1352                 &hdrs_hint_ipv6_dst_udp_dst_port, IAVF_PHINT_IPV6_UDP},
1353         {ETH_RSS_L3_DST_ONLY,
1354                 &hdrs_hint_ipv6_dst, IAVF_PHINT_IPV6_UDP},
1355         {ETH_RSS_NONFRAG_IPV6_UDP |
1356                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1357                 &hdrs_hint_ipv6_src_udp_src_port, IAVF_PHINT_IPV6_UDP},
1358         {ETH_RSS_NONFRAG_IPV6_UDP |
1359                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1360                 &hdrs_hint_ipv6_src_udp_dst_port, IAVF_PHINT_IPV6_UDP},
1361         {ETH_RSS_NONFRAG_IPV6_UDP |
1362                 ETH_RSS_L3_SRC_ONLY, &hdrs_hint_ipv6_src,
1363                 IAVF_PHINT_IPV6_UDP},
1364         {ETH_RSS_NONFRAG_IPV6_UDP |
1365                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1366                 &hdrs_hint_ipv6_dst_udp_src_port, IAVF_PHINT_IPV6_UDP},
1367         {ETH_RSS_NONFRAG_IPV6_UDP |
1368                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1369                 &hdrs_hint_ipv6_dst_udp_dst_port, IAVF_PHINT_IPV6_UDP},
1370         {ETH_RSS_NONFRAG_IPV6_UDP |
1371                 ETH_RSS_L3_DST_ONLY, &hdrs_hint_ipv6_dst,
1372                 IAVF_PHINT_IPV6_UDP},
1373         {ETH_RSS_L4_SRC_ONLY,
1374                 &hdrs_hint_ipv6_udp_src_port, IAVF_PHINT_IPV6_UDP},
1375         {ETH_RSS_L4_DST_ONLY,
1376                 &hdrs_hint_ipv6_udp_dst_port, IAVF_PHINT_IPV6_UDP},
1377         {ETH_RSS_NONFRAG_IPV6_UDP | ETH_RSS_L4_SRC_ONLY,
1378                 &hdrs_hint_ipv6_udp_src_port, IAVF_PHINT_IPV6_UDP},
1379         {ETH_RSS_NONFRAG_IPV6_UDP | ETH_RSS_L4_DST_ONLY,
1380                 &hdrs_hint_ipv6_udp_dst_port, IAVF_PHINT_IPV6_UDP},
1381         {ETH_RSS_PFCP,
1382                 &hdrs_hint_ipv6_pfcp, IAVF_PHINT_IPV6_UDP},
1383         {ETH_RSS_ESP,
1384                 &hdrs_hint_ipv6_udp_esp, IAVF_PHINT_IPV6_UDP},
1385         {ETH_RSS_NONFRAG_IPV6_UDP,
1386                 &hdrs_hint_ipv6_udp, IAVF_PHINT_IPV6_UDP},
1387         /* IPV6 TCP */
1388         {ETH_RSS_L2_SRC_ONLY,
1389                 &hdrs_hint_eth_src_ipv6_tcp, IAVF_PHINT_IPV6_TCP},
1390         {ETH_RSS_L2_DST_ONLY,
1391                 &hdrs_hint_eth_dst_ipv6_tcp, IAVF_PHINT_IPV6_TCP},
1392         {ETH_RSS_ETH,
1393                 &hdrs_hint_eth_ipv6_tcp, IAVF_PHINT_IPV6_TCP},
1394         {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1395                 &hdrs_hint_ipv6_src_tcp_src_port, IAVF_PHINT_IPV6_TCP},
1396         {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1397                 &hdrs_hint_ipv6_src_tcp_dst_port, IAVF_PHINT_IPV6_TCP},
1398         {ETH_RSS_L3_SRC_ONLY,
1399                 &hdrs_hint_ipv6_src, IAVF_PHINT_IPV6_TCP},
1400         {ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1401                 &hdrs_hint_ipv6_dst_tcp_src_port, IAVF_PHINT_IPV6_TCP},
1402         {ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1403                 &hdrs_hint_ipv6_dst_tcp_dst_port, IAVF_PHINT_IPV6_TCP},
1404         {ETH_RSS_L3_DST_ONLY,
1405                 &hdrs_hint_ipv6_dst, IAVF_PHINT_IPV6_TCP},
1406         {ETH_RSS_NONFRAG_IPV6_TCP |
1407                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1408                 &hdrs_hint_ipv6_src_tcp_src_port, IAVF_PHINT_IPV6_TCP},
1409         {ETH_RSS_NONFRAG_IPV6_TCP |
1410                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1411                 &hdrs_hint_ipv6_src_tcp_dst_port, IAVF_PHINT_IPV6_TCP},
1412         {ETH_RSS_NONFRAG_IPV6_TCP |
1413                 ETH_RSS_L3_SRC_ONLY, &hdrs_hint_ipv6_src,
1414                 IAVF_PHINT_IPV6_TCP},
1415         {ETH_RSS_NONFRAG_IPV6_TCP |
1416                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1417                 &hdrs_hint_ipv6_dst_tcp_src_port, IAVF_PHINT_IPV6_TCP},
1418         {ETH_RSS_NONFRAG_IPV6_TCP |
1419                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1420                 &hdrs_hint_ipv6_dst_tcp_dst_port, IAVF_PHINT_IPV6_TCP},
1421         {ETH_RSS_NONFRAG_IPV6_TCP |
1422                 ETH_RSS_L3_DST_ONLY, &hdrs_hint_ipv6_dst,
1423                 IAVF_PHINT_IPV6_TCP},
1424         {ETH_RSS_L4_SRC_ONLY,
1425                 &hdrs_hint_ipv6_tcp_src_port, IAVF_PHINT_IPV6_TCP},
1426         {ETH_RSS_L4_DST_ONLY,
1427                 &hdrs_hint_ipv6_tcp_dst_port, IAVF_PHINT_IPV6_TCP},
1428         {ETH_RSS_NONFRAG_IPV6_TCP | ETH_RSS_L4_SRC_ONLY,
1429                 &hdrs_hint_ipv6_tcp_src_port, IAVF_PHINT_IPV6_TCP},
1430         {ETH_RSS_NONFRAG_IPV6_TCP | ETH_RSS_L4_DST_ONLY,
1431                 &hdrs_hint_ipv6_tcp_dst_port, IAVF_PHINT_IPV6_TCP},
1432         {ETH_RSS_NONFRAG_IPV6_TCP,
1433                 &hdrs_hint_ipv6_tcp, IAVF_PHINT_IPV6_TCP},
1434         /* IPV6 SCTP */
1435         {ETH_RSS_L2_SRC_ONLY,
1436                 &hdrs_hint_eth_src_ipv6_sctp, IAVF_PHINT_IPV6_SCTP},
1437         {ETH_RSS_L2_DST_ONLY,
1438                 &hdrs_hint_eth_dst_ipv6_sctp, IAVF_PHINT_IPV6_SCTP},
1439         {ETH_RSS_ETH,
1440                 &hdrs_hint_eth_ipv6_sctp, IAVF_PHINT_IPV6_SCTP},
1441         {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1442                 &hdrs_hint_ipv6_src_sctp_src_port, IAVF_PHINT_IPV6_SCTP},
1443         {ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1444                 &hdrs_hint_ipv6_src_sctp_dst_port, IAVF_PHINT_IPV6_SCTP},
1445         {ETH_RSS_L3_SRC_ONLY,
1446                 &hdrs_hint_ipv6_src, IAVF_PHINT_IPV6_SCTP},
1447         {ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1448                 &hdrs_hint_ipv6_dst_sctp_src_port, IAVF_PHINT_IPV6_SCTP},
1449         {ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1450                 &hdrs_hint_ipv6_dst_sctp_dst_port, IAVF_PHINT_IPV6_SCTP},
1451         {ETH_RSS_L3_DST_ONLY,
1452                 &hdrs_hint_ipv6_dst, IAVF_PHINT_IPV6_SCTP},
1453         {ETH_RSS_NONFRAG_IPV6_SCTP |
1454                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1455                 &hdrs_hint_ipv6_src_sctp_src_port, IAVF_PHINT_IPV6_SCTP},
1456         {ETH_RSS_NONFRAG_IPV6_SCTP |
1457                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1458                 &hdrs_hint_ipv6_src_sctp_dst_port, IAVF_PHINT_IPV6_SCTP},
1459         {ETH_RSS_NONFRAG_IPV6_SCTP |
1460                 ETH_RSS_L3_SRC_ONLY, &hdrs_hint_ipv6_src,
1461                 IAVF_PHINT_IPV6_SCTP},
1462         {ETH_RSS_NONFRAG_IPV6_SCTP |
1463                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1464                 &hdrs_hint_ipv6_dst_sctp_src_port, IAVF_PHINT_IPV6_SCTP},
1465         {ETH_RSS_NONFRAG_IPV6_SCTP |
1466                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1467                 &hdrs_hint_ipv6_dst_sctp_dst_port, IAVF_PHINT_IPV6_SCTP},
1468         {ETH_RSS_NONFRAG_IPV6_SCTP |
1469                 ETH_RSS_L3_DST_ONLY, &hdrs_hint_ipv6_dst,
1470                 IAVF_PHINT_IPV6_SCTP},
1471         {ETH_RSS_L4_SRC_ONLY,
1472                 &hdrs_hint_ipv6_sctp_src_port, IAVF_PHINT_IPV6_SCTP},
1473         {ETH_RSS_L4_DST_ONLY,
1474                 &hdrs_hint_ipv6_sctp_dst_port, IAVF_PHINT_IPV6_SCTP},
1475         {ETH_RSS_NONFRAG_IPV6_SCTP | ETH_RSS_L4_SRC_ONLY,
1476                 &hdrs_hint_ipv6_sctp_src_port, IAVF_PHINT_IPV6_SCTP},
1477         {ETH_RSS_NONFRAG_IPV6_SCTP | ETH_RSS_L4_DST_ONLY,
1478                 &hdrs_hint_ipv6_sctp_dst_port, IAVF_PHINT_IPV6_SCTP},
1479         {ETH_RSS_NONFRAG_IPV6_SCTP,
1480                 &hdrs_hint_ipv6_sctp, IAVF_PHINT_IPV6_SCTP},
1481         {ETH_RSS_S_VLAN,
1482                 &hdrs_hint_svlan_ipv6, IAVF_PHINT_IPV6},
1483         {ETH_RSS_S_VLAN,
1484                 &hdrs_hint_svlan_ipv6_udp, IAVF_PHINT_IPV6_UDP},
1485         {ETH_RSS_S_VLAN,
1486                 &hdrs_hint_svlan_ipv6_tcp, IAVF_PHINT_IPV6_TCP},
1487         {ETH_RSS_S_VLAN,
1488                 &hdrs_hint_svlan_ipv6_sctp, IAVF_PHINT_IPV6_SCTP},
1489         {ETH_RSS_C_VLAN,
1490                 &hdrs_hint_cvlan_ipv6, IAVF_PHINT_IPV6},
1491         {ETH_RSS_C_VLAN,
1492                 &hdrs_hint_cvlan_ipv6_udp, IAVF_PHINT_IPV6_UDP},
1493         {ETH_RSS_C_VLAN,
1494                 &hdrs_hint_cvlan_ipv6_tcp, IAVF_PHINT_IPV6_TCP},
1495         {ETH_RSS_C_VLAN,
1496                 &hdrs_hint_cvlan_ipv6_sctp, IAVF_PHINT_IPV6_SCTP},
1497 };
1498
1499 struct iavf_hash_match_type iavf_gtpu_hash_map_list[] = {
1500         /* GTPU */
1501         /* GTPU EH */
1502         /* Inner IPV4 */
1503         {ETH_RSS_L3_SRC_ONLY,
1504                 &hdrs_hint_ipv4_src_gtpu_eh,
1505                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4},
1506         {ETH_RSS_L3_DST_ONLY,
1507                 &hdrs_hint_ipv4_dst_gtpu_eh,
1508                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4},
1509         {ETH_RSS_IPV4 |
1510                 ETH_RSS_L3_SRC_ONLY,
1511                 &hdrs_hint_ipv4_src_gtpu_eh,
1512                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4},
1513         {ETH_RSS_IPV4 |
1514                 ETH_RSS_L3_DST_ONLY,
1515                 &hdrs_hint_ipv4_dst_gtpu_eh,
1516                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4},
1517         {ETH_RSS_IPV4,
1518                 &hdrs_hint_ipv4_gtpu_eh,
1519                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4},
1520         /* Inner IPV4->UDP */
1521         {ETH_RSS_L3_SRC_ONLY |
1522                 ETH_RSS_L4_SRC_ONLY,
1523                 &hdrs_hint_ipv4_src_udp_src_gtpu_eh,
1524                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1525         {ETH_RSS_L3_SRC_ONLY |
1526                 ETH_RSS_L4_DST_ONLY,
1527                 &hdrs_hint_ipv4_src_udp_dst_gtpu_eh,
1528                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1529         {ETH_RSS_L3_SRC_ONLY,
1530                 &hdrs_hint_ipv4_src_gtpu_eh,
1531                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1532         {ETH_RSS_L4_SRC_ONLY,
1533                 &hdrs_hint_ipv4_udp_src_gtpu_eh,
1534                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1535         {ETH_RSS_L3_DST_ONLY |
1536                 ETH_RSS_L4_SRC_ONLY,
1537                 &hdrs_hint_ipv4_dst_udp_src_gtpu_eh,
1538                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1539         {ETH_RSS_L3_DST_ONLY |
1540                 ETH_RSS_L4_DST_ONLY,
1541                 &hdrs_hint_ipv4_dst_udp_dst_gtpu_eh,
1542                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1543         {ETH_RSS_L3_DST_ONLY,
1544                 &hdrs_hint_ipv4_dst_gtpu_eh,
1545                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1546         {ETH_RSS_L4_DST_ONLY,
1547                 &hdrs_hint_ipv4_udp_dst_gtpu_eh,
1548                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1549         {ETH_RSS_NONFRAG_IPV4_UDP |
1550                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1551                 &hdrs_hint_ipv4_src_udp_src_gtpu_eh,
1552                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1553         {ETH_RSS_NONFRAG_IPV4_UDP |
1554                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1555                 &hdrs_hint_ipv4_src_udp_dst_gtpu_eh,
1556                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1557         {ETH_RSS_NONFRAG_IPV4_UDP |
1558                 ETH_RSS_L3_SRC_ONLY,
1559                 &hdrs_hint_ipv4_src_gtpu_eh,
1560                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1561         {ETH_RSS_NONFRAG_IPV4_UDP |
1562                 ETH_RSS_L4_SRC_ONLY,
1563                 &hdrs_hint_ipv4_udp_src_gtpu_eh,
1564                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1565         {ETH_RSS_NONFRAG_IPV4_UDP |
1566                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1567                 &hdrs_hint_ipv4_dst_udp_src_gtpu_eh,
1568                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1569         {ETH_RSS_NONFRAG_IPV4_UDP |
1570                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1571                 &hdrs_hint_ipv4_dst_udp_dst_gtpu_eh,
1572                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1573         {ETH_RSS_NONFRAG_IPV4_UDP |
1574                 ETH_RSS_L3_DST_ONLY,
1575                 &hdrs_hint_ipv4_dst_gtpu_eh,
1576                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1577         {ETH_RSS_NONFRAG_IPV4_UDP |
1578                 ETH_RSS_L4_DST_ONLY,
1579                 &hdrs_hint_ipv4_udp_dst_gtpu_eh,
1580                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1581         {ETH_RSS_NONFRAG_IPV4_UDP,
1582                 &hdrs_hint_ipv4_udp_gtpu_eh,
1583                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_UDP},
1584         /* Inner IPV4->TCP */
1585         {ETH_RSS_L3_SRC_ONLY |
1586                 ETH_RSS_L4_SRC_ONLY,
1587                 &hdrs_hint_ipv4_src_tcp_src_gtpu_eh,
1588                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1589         {ETH_RSS_L3_SRC_ONLY |
1590                 ETH_RSS_L4_DST_ONLY,
1591                 &hdrs_hint_ipv4_src_tcp_dst_gtpu_eh,
1592                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1593         {ETH_RSS_L3_SRC_ONLY,
1594                 &hdrs_hint_ipv4_src_gtpu_eh,
1595                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1596         {ETH_RSS_L4_SRC_ONLY,
1597                 &hdrs_hint_ipv4_tcp_src_gtpu_eh,
1598                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1599         {ETH_RSS_L3_DST_ONLY |
1600                 ETH_RSS_L4_SRC_ONLY,
1601                 &hdrs_hint_ipv4_dst_tcp_src_gtpu_eh,
1602                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1603         {ETH_RSS_L3_DST_ONLY |
1604                 ETH_RSS_L4_DST_ONLY,
1605                 &hdrs_hint_ipv4_dst_tcp_dst_gtpu_eh,
1606                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1607         {ETH_RSS_L3_DST_ONLY,
1608                 &hdrs_hint_ipv4_dst_gtpu_eh,
1609                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1610         {ETH_RSS_L4_DST_ONLY,
1611                 &hdrs_hint_ipv4_tcp_dst_gtpu_eh,
1612                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1613         {ETH_RSS_NONFRAG_IPV4_TCP |
1614                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1615                 &hdrs_hint_ipv4_src_tcp_src_gtpu_eh,
1616                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1617         {ETH_RSS_NONFRAG_IPV4_TCP |
1618                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1619                 &hdrs_hint_ipv4_src_tcp_dst_gtpu_eh,
1620                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1621         {ETH_RSS_NONFRAG_IPV4_TCP |
1622                 ETH_RSS_L3_SRC_ONLY,
1623                 &hdrs_hint_ipv4_src_gtpu_eh,
1624                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1625         {ETH_RSS_NONFRAG_IPV4_TCP |
1626                 ETH_RSS_L4_SRC_ONLY,
1627                 &hdrs_hint_ipv4_tcp_src_gtpu_eh,
1628                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1629         {ETH_RSS_NONFRAG_IPV4_TCP |
1630                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1631                 &hdrs_hint_ipv4_dst_tcp_src_gtpu_eh,
1632                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1633         {ETH_RSS_NONFRAG_IPV4_TCP |
1634                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1635                 &hdrs_hint_ipv4_dst_tcp_dst_gtpu_eh,
1636                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1637         {ETH_RSS_NONFRAG_IPV4_TCP |
1638                 ETH_RSS_L3_DST_ONLY,
1639                 &hdrs_hint_ipv4_dst_gtpu_eh,
1640                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1641         {ETH_RSS_NONFRAG_IPV4_TCP |
1642                 ETH_RSS_L4_DST_ONLY,
1643                 &hdrs_hint_ipv4_tcp_dst_gtpu_eh,
1644                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1645         {ETH_RSS_NONFRAG_IPV4_TCP,
1646                 &hdrs_hint_ipv4_tcp_gtpu_eh,
1647                 IAVF_PHINT_IPV4_GTPU_EH | IAVF_PHINT_IPV4_TCP},
1648         /* GTPU EH UP */
1649         /* Inner IPV4 */
1650         {ETH_RSS_L3_SRC_ONLY,
1651                 &hdrs_hint_ipv4_src_gtpu_up,
1652                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4},
1653         {ETH_RSS_L3_DST_ONLY,
1654                 &hdrs_hint_ipv4_dst_gtpu_up,
1655                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4},
1656         {ETH_RSS_IPV4 |
1657                 ETH_RSS_L3_SRC_ONLY,
1658                 &hdrs_hint_ipv4_src_gtpu_up,
1659                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4},
1660         {ETH_RSS_IPV4 |
1661                 ETH_RSS_L3_DST_ONLY,
1662                 &hdrs_hint_ipv4_dst_gtpu_up,
1663                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4},
1664         {ETH_RSS_IPV4,
1665                 &hdrs_hint_ipv4_gtpu_up,
1666                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4},
1667         /* Inner IPV4->UDP */
1668         {ETH_RSS_L3_SRC_ONLY |
1669                 ETH_RSS_L4_SRC_ONLY,
1670                 &hdrs_hint_ipv4_src_udp_src_gtpu_up,
1671                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1672         {ETH_RSS_L3_SRC_ONLY |
1673                 ETH_RSS_L4_DST_ONLY,
1674                 &hdrs_hint_ipv4_src_udp_dst_gtpu_up,
1675                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1676         {ETH_RSS_L3_SRC_ONLY,
1677                 &hdrs_hint_ipv4_src_gtpu_up,
1678                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1679         {ETH_RSS_L4_SRC_ONLY,
1680                 &hdrs_hint_ipv4_udp_src_gtpu_up,
1681                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1682         {ETH_RSS_L3_DST_ONLY |
1683                 ETH_RSS_L4_SRC_ONLY,
1684                 &hdrs_hint_ipv4_dst_udp_src_gtpu_up,
1685                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1686         {ETH_RSS_L3_DST_ONLY |
1687                 ETH_RSS_L4_DST_ONLY,
1688                 &hdrs_hint_ipv4_dst_udp_dst_gtpu_up,
1689                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1690         {ETH_RSS_L3_DST_ONLY,
1691                 &hdrs_hint_ipv4_dst_gtpu_up,
1692                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1693         {ETH_RSS_L4_DST_ONLY,
1694                 &hdrs_hint_ipv4_udp_dst_gtpu_up,
1695                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1696         {ETH_RSS_NONFRAG_IPV4_UDP |
1697                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1698                 &hdrs_hint_ipv4_src_udp_src_gtpu_up,
1699                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1700         {ETH_RSS_NONFRAG_IPV4_UDP |
1701                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1702                 &hdrs_hint_ipv4_src_udp_dst_gtpu_up,
1703                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1704         {ETH_RSS_NONFRAG_IPV4_UDP |
1705                 ETH_RSS_L3_SRC_ONLY,
1706                 &hdrs_hint_ipv4_src_gtpu_up,
1707                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1708         {ETH_RSS_NONFRAG_IPV4_UDP |
1709                 ETH_RSS_L4_SRC_ONLY,
1710                 &hdrs_hint_ipv4_udp_src_gtpu_up,
1711                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1712         {ETH_RSS_NONFRAG_IPV4_UDP |
1713                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1714                 &hdrs_hint_ipv4_dst_udp_src_gtpu_up,
1715                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1716         {ETH_RSS_NONFRAG_IPV4_UDP |
1717                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1718                 &hdrs_hint_ipv4_dst_udp_dst_gtpu_up,
1719                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1720         {ETH_RSS_NONFRAG_IPV4_UDP |
1721                 ETH_RSS_L3_DST_ONLY,
1722                 &hdrs_hint_ipv4_dst_gtpu_up,
1723                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1724         {ETH_RSS_NONFRAG_IPV4_UDP |
1725                 ETH_RSS_L4_DST_ONLY,
1726                 &hdrs_hint_ipv4_udp_dst_gtpu_up,
1727                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1728         {ETH_RSS_NONFRAG_IPV4_UDP,
1729                 &hdrs_hint_ipv4_udp_gtpu_up,
1730                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_UDP},
1731         /* Inner IPV4->TCP */
1732         {ETH_RSS_L3_SRC_ONLY |
1733                 ETH_RSS_L4_SRC_ONLY,
1734                 &hdrs_hint_ipv4_src_tcp_src_gtpu_up,
1735                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1736         {ETH_RSS_L3_SRC_ONLY |
1737                 ETH_RSS_L4_DST_ONLY,
1738                 &hdrs_hint_ipv4_src_tcp_dst_gtpu_up,
1739                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1740         {ETH_RSS_L3_SRC_ONLY,
1741                 &hdrs_hint_ipv4_src_gtpu_up,
1742                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1743         {ETH_RSS_L4_SRC_ONLY,
1744                 &hdrs_hint_ipv4_tcp_src_gtpu_up,
1745                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1746         {ETH_RSS_L3_DST_ONLY |
1747                 ETH_RSS_L4_SRC_ONLY,
1748                 &hdrs_hint_ipv4_dst_tcp_src_gtpu_up,
1749                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1750         {ETH_RSS_L3_DST_ONLY |
1751                 ETH_RSS_L4_DST_ONLY,
1752                 &hdrs_hint_ipv4_dst_tcp_dst_gtpu_up,
1753                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1754         {ETH_RSS_L3_DST_ONLY,
1755                 &hdrs_hint_ipv4_dst_gtpu_up,
1756                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1757         {ETH_RSS_L4_DST_ONLY,
1758                 &hdrs_hint_ipv4_tcp_dst_gtpu_up,
1759                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1760         {ETH_RSS_NONFRAG_IPV4_TCP |
1761                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1762                 &hdrs_hint_ipv4_src_tcp_src_gtpu_up,
1763                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1764         {ETH_RSS_NONFRAG_IPV4_TCP |
1765                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1766                 &hdrs_hint_ipv4_src_tcp_dst_gtpu_up,
1767                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1768         {ETH_RSS_NONFRAG_IPV4_TCP |
1769                 ETH_RSS_L3_SRC_ONLY,
1770                 &hdrs_hint_ipv4_src_gtpu_up,
1771                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1772         {ETH_RSS_NONFRAG_IPV4_TCP |
1773                 ETH_RSS_L4_SRC_ONLY,
1774                 &hdrs_hint_ipv4_tcp_src_gtpu_up,
1775                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1776         {ETH_RSS_NONFRAG_IPV4_TCP |
1777                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1778                 &hdrs_hint_ipv4_dst_tcp_src_gtpu_up,
1779                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1780         {ETH_RSS_NONFRAG_IPV4_TCP |
1781                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1782                 &hdrs_hint_ipv4_dst_tcp_dst_gtpu_up,
1783                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1784         {ETH_RSS_NONFRAG_IPV4_TCP |
1785                 ETH_RSS_L3_DST_ONLY,
1786                 &hdrs_hint_ipv4_dst_gtpu_up,
1787                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1788         {ETH_RSS_NONFRAG_IPV4_TCP |
1789                 ETH_RSS_L4_DST_ONLY,
1790                 &hdrs_hint_ipv4_tcp_dst_gtpu_up,
1791                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1792         {ETH_RSS_NONFRAG_IPV4_TCP,
1793                 &hdrs_hint_ipv4_tcp_gtpu_up,
1794                 IAVF_PHINT_IPV4_GTPU_EH_UPLINK | IAVF_PHINT_IPV4_TCP},
1795         /* GTPU EH DWN */
1796         /* Inner IPV4 */
1797         {ETH_RSS_L3_SRC_ONLY,
1798                 &hdrs_hint_ipv4_src_gtpu_dwn,
1799                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4},
1800         {ETH_RSS_L3_DST_ONLY,
1801                 &hdrs_hint_ipv4_dst_gtpu_dwn,
1802                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4},
1803         {ETH_RSS_IPV4 |
1804                 ETH_RSS_L3_SRC_ONLY,
1805                 &hdrs_hint_ipv4_src_gtpu_dwn,
1806                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4},
1807         {ETH_RSS_IPV4 |
1808                 ETH_RSS_L3_DST_ONLY,
1809                 &hdrs_hint_ipv4_dst_gtpu_dwn,
1810                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4},
1811         {ETH_RSS_IPV4,
1812                 &hdrs_hint_ipv4_gtpu_dwn,
1813                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4},
1814         /* Inner IPV4->UDP */
1815         {ETH_RSS_L3_SRC_ONLY |
1816                 ETH_RSS_L4_SRC_ONLY,
1817                 &hdrs_hint_ipv4_src_udp_src_gtpu_dwn,
1818                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1819         {ETH_RSS_L3_SRC_ONLY |
1820                 ETH_RSS_L4_DST_ONLY,
1821                 &hdrs_hint_ipv4_src_udp_dst_gtpu_dwn,
1822                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1823         {ETH_RSS_L3_SRC_ONLY,
1824                 &hdrs_hint_ipv4_src_gtpu_dwn,
1825                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1826         {ETH_RSS_L4_SRC_ONLY,
1827                 &hdrs_hint_ipv4_udp_src_gtpu_dwn,
1828                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1829         {ETH_RSS_L3_DST_ONLY |
1830                 ETH_RSS_L4_SRC_ONLY,
1831                 &hdrs_hint_ipv4_dst_udp_src_gtpu_dwn,
1832                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1833         {ETH_RSS_L3_DST_ONLY |
1834                 ETH_RSS_L4_DST_ONLY,
1835                 &hdrs_hint_ipv4_dst_udp_dst_gtpu_dwn,
1836                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1837         {ETH_RSS_L3_DST_ONLY,
1838                 &hdrs_hint_ipv4_dst_gtpu_dwn,
1839                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1840         {ETH_RSS_L4_DST_ONLY,
1841                 &hdrs_hint_ipv4_udp_dst_gtpu_dwn,
1842                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1843         {ETH_RSS_NONFRAG_IPV4_UDP |
1844                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1845                 &hdrs_hint_ipv4_src_udp_src_gtpu_dwn,
1846                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1847         {ETH_RSS_NONFRAG_IPV4_UDP |
1848                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1849                 &hdrs_hint_ipv4_src_udp_dst_gtpu_dwn,
1850                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1851         {ETH_RSS_NONFRAG_IPV4_UDP |
1852                 ETH_RSS_L3_SRC_ONLY,
1853                 &hdrs_hint_ipv4_src_gtpu_dwn,
1854                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1855         {ETH_RSS_NONFRAG_IPV4_UDP |
1856                 ETH_RSS_L4_SRC_ONLY,
1857                 &hdrs_hint_ipv4_udp_src_gtpu_dwn,
1858                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1859         {ETH_RSS_NONFRAG_IPV4_UDP |
1860                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1861                 &hdrs_hint_ipv4_dst_udp_src_gtpu_dwn,
1862                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1863         {ETH_RSS_NONFRAG_IPV4_UDP |
1864                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1865                 &hdrs_hint_ipv4_dst_udp_dst_gtpu_dwn,
1866                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1867         {ETH_RSS_NONFRAG_IPV4_UDP |
1868                 ETH_RSS_L3_DST_ONLY,
1869                 &hdrs_hint_ipv4_dst_gtpu_dwn,
1870                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1871         {ETH_RSS_NONFRAG_IPV4_UDP |
1872                 ETH_RSS_L4_DST_ONLY,
1873                 &hdrs_hint_ipv4_udp_dst_gtpu_dwn,
1874                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1875         {ETH_RSS_NONFRAG_IPV4_UDP,
1876                 &hdrs_hint_ipv4_udp_gtpu_dwn,
1877                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_UDP},
1878         /* Inner IPV4->TCP */
1879         {ETH_RSS_L3_SRC_ONLY |
1880                 ETH_RSS_L4_SRC_ONLY,
1881                 &hdrs_hint_ipv4_src_tcp_src_gtpu_dwn,
1882                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1883         {ETH_RSS_L3_SRC_ONLY |
1884                 ETH_RSS_L4_DST_ONLY,
1885                 &hdrs_hint_ipv4_src_tcp_dst_gtpu_dwn,
1886                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1887         {ETH_RSS_L3_SRC_ONLY,
1888                 &hdrs_hint_ipv4_src_gtpu_dwn,
1889                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1890         {ETH_RSS_L4_SRC_ONLY,
1891                 &hdrs_hint_ipv4_tcp_src_gtpu_dwn,
1892                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1893         {ETH_RSS_L3_DST_ONLY |
1894                 ETH_RSS_L4_SRC_ONLY,
1895                 &hdrs_hint_ipv4_dst_tcp_src_gtpu_dwn,
1896                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1897         {ETH_RSS_L3_DST_ONLY |
1898                 ETH_RSS_L4_DST_ONLY,
1899                 &hdrs_hint_ipv4_dst_tcp_dst_gtpu_dwn,
1900                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1901         {ETH_RSS_L3_DST_ONLY,
1902                 &hdrs_hint_ipv4_dst_gtpu_dwn,
1903                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1904         {ETH_RSS_L4_DST_ONLY,
1905                 &hdrs_hint_ipv4_tcp_dst_gtpu_dwn,
1906                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1907         {ETH_RSS_NONFRAG_IPV4_TCP |
1908                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
1909                 &hdrs_hint_ipv4_src_tcp_src_gtpu_dwn,
1910                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1911         {ETH_RSS_NONFRAG_IPV4_TCP |
1912                 ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
1913                 &hdrs_hint_ipv4_src_tcp_dst_gtpu_dwn,
1914                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1915         {ETH_RSS_NONFRAG_IPV4_TCP |
1916                 ETH_RSS_L3_SRC_ONLY,
1917                 &hdrs_hint_ipv4_src_gtpu_dwn,
1918                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1919         {ETH_RSS_NONFRAG_IPV4_TCP |
1920                 ETH_RSS_L4_SRC_ONLY,
1921                 &hdrs_hint_ipv4_tcp_src_gtpu_dwn,
1922                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1923         {ETH_RSS_NONFRAG_IPV4_TCP |
1924                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
1925                 &hdrs_hint_ipv4_dst_tcp_src_gtpu_dwn,
1926                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1927         {ETH_RSS_NONFRAG_IPV4_TCP |
1928                 ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
1929                 &hdrs_hint_ipv4_dst_tcp_dst_gtpu_dwn,
1930                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1931         {ETH_RSS_NONFRAG_IPV4_TCP |
1932                 ETH_RSS_L3_DST_ONLY,
1933                 &hdrs_hint_ipv4_dst_gtpu_dwn,
1934                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1935         {ETH_RSS_NONFRAG_IPV4_TCP |
1936                 ETH_RSS_L4_DST_ONLY,
1937                 &hdrs_hint_ipv4_tcp_dst_gtpu_dwn,
1938                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1939         {ETH_RSS_NONFRAG_IPV4_TCP,
1940                 &hdrs_hint_ipv4_tcp_gtpu_dwn,
1941                 IAVF_PHINT_IPV4_GTPU_EH_DWNLINK | IAVF_PHINT_IPV4_TCP},
1942 };
1943
1944 struct virtchnl_proto_hdrs *iavf_hash_default_hdrs[] = {
1945         &hdrs_hint_ipv4,
1946         &hdrs_hint_ipv4_udp,
1947         &hdrs_hint_ipv4_tcp,
1948         &hdrs_hint_ipv4_sctp,
1949         &hdrs_hint_ipv6,
1950         &hdrs_hint_ipv6_udp,
1951         &hdrs_hint_ipv6_tcp,
1952         &hdrs_hint_ipv6_sctp,
1953 };
1954
1955 static struct iavf_flow_engine iavf_hash_engine = {
1956         .init = iavf_hash_init,
1957         .create = iavf_hash_create,
1958         .destroy = iavf_hash_destroy,
1959         .uninit = iavf_hash_uninit,
1960         .free = iavf_hash_free,
1961         .type = IAVF_FLOW_ENGINE_HASH,
1962 };
1963
1964 /* Register parser for comms package. */
1965 static struct iavf_flow_parser iavf_hash_parser = {
1966         .engine = &iavf_hash_engine,
1967         .array = iavf_hash_pattern_list,
1968         .array_len = RTE_DIM(iavf_hash_pattern_list),
1969         .parse_pattern_action = iavf_hash_parse_pattern_action,
1970         .stage = IAVF_FLOW_STAGE_RSS,
1971 };
1972
1973 static int
1974 iavf_hash_default_set(struct iavf_adapter *ad, bool add)
1975 {
1976         struct virtchnl_rss_cfg *rss_cfg;
1977         uint16_t i;
1978         int ret;
1979
1980         rss_cfg = rte_zmalloc("iavf rss rule",
1981                               sizeof(struct virtchnl_rss_cfg), 0);
1982         if (!rss_cfg)
1983                 return -ENOMEM;
1984
1985         for (i = 0; i < RTE_DIM(iavf_hash_default_hdrs); i++) {
1986                 rss_cfg->proto_hdrs = *iavf_hash_default_hdrs[i];
1987                 rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
1988
1989                 ret = iavf_add_del_rss_cfg(ad, rss_cfg, add);
1990                 if (ret) {
1991                         PMD_DRV_LOG(ERR, "fail to %s RSS configure",
1992                                     add ? "add" : "delete");
1993                         rte_free(rss_cfg);
1994                         return ret;
1995                 }
1996         }
1997
1998         return ret;
1999 }
2000
2001 RTE_INIT(iavf_hash_engine_init)
2002 {
2003         struct iavf_flow_engine *engine = &iavf_hash_engine;
2004
2005         iavf_register_flow_engine(engine);
2006 }
2007
2008 static int
2009 iavf_hash_init(struct iavf_adapter *ad)
2010 {
2011         struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
2012         struct iavf_flow_parser *parser;
2013         int ret;
2014
2015         if (!vf->vf_res)
2016                 return -EINVAL;
2017
2018         if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF))
2019                 return -ENOTSUP;
2020
2021         parser = &iavf_hash_parser;
2022
2023         ret = iavf_register_parser(parser, ad);
2024         if (ret) {
2025                 PMD_DRV_LOG(ERR, "fail to register hash parser");
2026                 return ret;
2027         }
2028
2029         ret = iavf_hash_default_set(ad, true);
2030         if (ret) {
2031                 PMD_DRV_LOG(ERR, "fail to set default RSS");
2032                 iavf_unregister_parser(parser, ad);
2033         }
2034
2035         return ret;
2036 }
2037
2038 static int
2039 iavf_hash_parse_pattern(struct iavf_pattern_match_item *pattern_match_item,
2040                         const struct rte_flow_item pattern[], uint64_t *phint,
2041                         struct rte_flow_error *error)
2042 {
2043         const struct rte_flow_item *item = pattern;
2044         const struct rte_flow_item_gtp_psc *psc;
2045
2046         for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
2047                 if (item->last) {
2048                         rte_flow_error_set(error, EINVAL,
2049                                            RTE_FLOW_ERROR_TYPE_ITEM, item,
2050                                            "Not support range");
2051                         return -rte_errno;
2052                 }
2053
2054                 switch (item->type) {
2055                 case RTE_FLOW_ITEM_TYPE_GTP_PSC:
2056                         psc = item->spec;
2057                         if (!psc)
2058                                 *phint |= IAVF_PHINT_IPV4_GTPU_EH;
2059                         else if (psc->pdu_type == IAVF_GTPU_EH_UPLINK)
2060                                 *phint |= IAVF_PHINT_IPV4_GTPU_EH_UPLINK;
2061                         else if (psc->pdu_type == IAVF_GTPU_EH_DWNLINK)
2062                                 *phint |= IAVF_PHINT_IPV4_GTPU_EH_DWNLINK;
2063                         break;
2064                 default:
2065                         break;
2066                 }
2067         }
2068
2069         /* update and restore pattern hint */
2070         *phint |= ((struct iavf_pattern_match_type *)
2071                                 (pattern_match_item->meta))->pattern_hint;
2072
2073         return 0;
2074 }
2075
2076 static int
2077 iavf_hash_parse_action(const struct rte_flow_action actions[],
2078                        uint64_t pattern_hint, void **meta,
2079                        struct rte_flow_error *error)
2080 {
2081         struct iavf_rss_meta *rss_meta = (struct iavf_rss_meta *)*meta;
2082         struct iavf_hash_match_type *hash_map_list;
2083         enum rte_flow_action_type action_type;
2084         const struct rte_flow_action_rss *rss;
2085         const struct rte_flow_action *action;
2086         uint32_t mlist_len;
2087         bool item_found = false;
2088         uint64_t rss_type;
2089         uint16_t i;
2090
2091         /* Supported action is RSS. */
2092         for (action = actions; action->type !=
2093                 RTE_FLOW_ACTION_TYPE_END; action++) {
2094                 action_type = action->type;
2095                 switch (action_type) {
2096                 case RTE_FLOW_ACTION_TYPE_RSS:
2097                         rss = action->conf;
2098                         rss_type = rss->types;
2099
2100                         if (rss->func ==
2101                             RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){
2102                                 rss_meta->rss_algorithm =
2103                                         VIRTCHNL_RSS_ALG_XOR_ASYMMETRIC;
2104                         } else if (rss->func ==
2105                                    RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
2106                                 rss_meta->rss_algorithm =
2107                                         VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC;
2108                         } else {
2109                                 rss_meta->rss_algorithm =
2110                                         VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
2111                         }
2112
2113                         if (rss->level)
2114                                 return rte_flow_error_set(error, ENOTSUP,
2115                                         RTE_FLOW_ERROR_TYPE_ACTION, action,
2116                                         "a nonzero RSS encapsulation level is not supported");
2117
2118                         if (rss->key_len)
2119                                 return rte_flow_error_set(error, ENOTSUP,
2120                                         RTE_FLOW_ERROR_TYPE_ACTION, action,
2121                                         "a nonzero RSS key_len is not supported");
2122
2123                         if (rss->queue_num)
2124                                 return rte_flow_error_set(error, ENOTSUP,
2125                                         RTE_FLOW_ERROR_TYPE_ACTION, action,
2126                                         "a non-NULL RSS queue is not supported");
2127
2128                         /**
2129                          * Check simultaneous use of SRC_ONLY and DST_ONLY
2130                          * of the same level.
2131                          */
2132                         rss_type = rte_eth_rss_hf_refine(rss_type);
2133
2134                         if ((pattern_hint & IAVF_PHINT_IPV4_GTPU_EH) ||
2135                             (pattern_hint & IAVF_PHINT_IPV4_GTPU_EH_UPLINK) ||
2136                             (pattern_hint & IAVF_PHINT_IPV4_GTPU_EH_DWNLINK)) {
2137                                 hash_map_list = iavf_gtpu_hash_map_list;
2138                                 mlist_len = RTE_DIM(iavf_gtpu_hash_map_list);
2139                         } else {
2140                                 hash_map_list = iavf_hash_map_list;
2141                                 mlist_len = RTE_DIM(iavf_hash_map_list);
2142                         }
2143
2144                         /* Find matched proto hdrs according to hash type. */
2145                         for (i = 0; i < mlist_len; i++) {
2146                                 struct iavf_hash_match_type *ht_map =
2147                                         &hash_map_list[i];
2148                                 if (rss_type == ht_map->hash_type &&
2149                                     pattern_hint == ht_map->pattern_hint) {
2150                                         rss_meta->proto_hdrs =
2151                                                 ht_map->proto_hdrs;
2152                                         item_found = true;
2153                                         break;
2154                                 }
2155                         }
2156
2157                         if (!item_found)
2158                                 return rte_flow_error_set(error, ENOTSUP,
2159                                         RTE_FLOW_ERROR_TYPE_ACTION, action,
2160                                         "Not supported flow");
2161                         break;
2162
2163                 case RTE_FLOW_ACTION_TYPE_END:
2164                         break;
2165
2166                 default:
2167                         rte_flow_error_set(error, EINVAL,
2168                                            RTE_FLOW_ERROR_TYPE_ACTION, action,
2169                                            "Invalid action.");
2170                         return -rte_errno;
2171                 }
2172         }
2173
2174         return 0;
2175 }
2176
2177 static int
2178 iavf_hash_parse_pattern_action(__rte_unused struct iavf_adapter *ad,
2179                                struct iavf_pattern_match_item *array,
2180                                uint32_t array_len,
2181                                const struct rte_flow_item pattern[],
2182                                const struct rte_flow_action actions[],
2183                                void **meta,
2184                                struct rte_flow_error *error)
2185 {
2186         struct iavf_pattern_match_item *pattern_match_item;
2187         struct iavf_rss_meta *rss_meta_ptr;
2188         uint64_t phint = IAVF_PHINT_NONE;
2189         int ret = 0;
2190
2191         rss_meta_ptr = rte_zmalloc(NULL, sizeof(*rss_meta_ptr), 0);
2192         if (!rss_meta_ptr) {
2193                 rte_flow_error_set(error, EINVAL,
2194                                    RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
2195                                    "No memory for rss_meta_ptr");
2196                 return -ENOMEM;
2197         }
2198
2199         /* Check rss supported pattern and find matched pattern. */
2200         pattern_match_item =
2201                 iavf_search_pattern_match_item(pattern, array, array_len,
2202                                                error);
2203         if (!pattern_match_item) {
2204                 ret = -rte_errno;
2205                 goto error;
2206         }
2207
2208         ret = iavf_hash_parse_pattern(pattern_match_item, pattern, &phint,
2209                                       error);
2210         if (ret)
2211                 goto error;
2212
2213         ret = iavf_hash_parse_action(actions, phint,
2214                                      (void **)&rss_meta_ptr, error);
2215
2216 error:
2217         if (!ret && meta)
2218                 *meta = rss_meta_ptr;
2219         else
2220                 rte_free(rss_meta_ptr);
2221
2222         rte_free(pattern_match_item);
2223
2224         return ret;
2225 }
2226
2227 static int
2228 iavf_hash_create(__rte_unused struct iavf_adapter *ad,
2229                  __rte_unused struct rte_flow *flow, void *meta,
2230                  __rte_unused struct rte_flow_error *error)
2231 {
2232         struct iavf_rss_meta *rss_meta = (struct iavf_rss_meta *)meta;
2233         struct virtchnl_rss_cfg *rss_cfg;
2234         int ret = 0;
2235
2236         rss_cfg = rte_zmalloc("iavf rss rule",
2237                               sizeof(struct virtchnl_rss_cfg), 0);
2238         if (!rss_cfg) {
2239                 rte_flow_error_set(error, EINVAL,
2240                                    RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
2241                                    "No memory for rss rule");
2242                 return -ENOMEM;
2243         }
2244
2245         rss_cfg->proto_hdrs = *rss_meta->proto_hdrs;
2246         rss_cfg->rss_algorithm = rss_meta->rss_algorithm;
2247
2248         ret = iavf_add_del_rss_cfg(ad, rss_cfg, true);
2249         if (!ret) {
2250                 flow->rule = rss_cfg;
2251         } else {
2252                 PMD_DRV_LOG(ERR, "fail to add RSS configure");
2253                 rte_flow_error_set(error, -ret,
2254                                    RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
2255                                    "Failed to add rss rule.");
2256                 rte_free(rss_cfg);
2257                 return -rte_errno;
2258         }
2259
2260         rte_free(meta);
2261
2262         return ret;
2263 }
2264
2265 static int
2266 iavf_hash_destroy(__rte_unused struct iavf_adapter *ad,
2267                   struct rte_flow *flow,
2268                   __rte_unused struct rte_flow_error *error)
2269 {
2270         struct virtchnl_rss_cfg *rss_cfg;
2271         int ret = 0;
2272
2273         rss_cfg = (struct virtchnl_rss_cfg *)flow->rule;
2274
2275         ret = iavf_add_del_rss_cfg(ad, rss_cfg, false);
2276         if (ret) {
2277                 PMD_DRV_LOG(ERR, "fail to del RSS configure");
2278                 rte_flow_error_set(error, -ret,
2279                                    RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
2280                                    "Failed to delete rss rule.");
2281                 return -rte_errno;
2282         }
2283         return ret;
2284 }
2285
2286 static void
2287 iavf_hash_uninit(struct iavf_adapter *ad)
2288 {
2289         if (iavf_hash_default_set(ad, false))
2290                 PMD_DRV_LOG(ERR, "fail to delete default RSS");
2291
2292         iavf_unregister_parser(&iavf_hash_parser, ad);
2293 }
2294
2295 static void
2296 iavf_hash_free(struct rte_flow *flow)
2297 {
2298         rte_free(flow->rule);
2299 }