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