net/ice/base: increase protocol offset size
[dpdk.git] / drivers / net / ice / base / ice_flex_type.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2001-2019
3  */
4
5 #ifndef _ICE_FLEX_TYPE_H_
6 #define _ICE_FLEX_TYPE_H_
7
8 #define ICE_FV_OFFSET_INVAL    0x1FF
9
10 #pragma pack(1)
11 /* Extraction Sequence (Field Vector) Table */
12 struct ice_fv_word {
13         u8 prot_id;
14         u16 off;                /* Offset within the protocol header */
15         u8 resvrd;
16 };
17
18 #pragma pack()
19
20 #define ICE_MAX_FV_WORDS 48
21 struct ice_fv {
22         struct ice_fv_word ew[ICE_MAX_FV_WORDS];
23 };
24
25 /* Package and segment headers and tables */
26 struct ice_pkg_hdr {
27         struct ice_pkg_ver format_ver;
28         __le32 seg_count;
29         __le32 seg_offset[1];
30 };
31
32 /* generic segment */
33 struct ice_generic_seg_hdr {
34 #define SEGMENT_TYPE_METADATA   0x00000001
35 #define SEGMENT_TYPE_ICE        0x00000010
36         __le32 seg_type;
37         struct ice_pkg_ver seg_ver;
38         __le32 seg_size;
39         char seg_name[ICE_PKG_NAME_SIZE];
40 };
41
42 /* ice specific segment */
43
44 union ice_device_id {
45         struct {
46                 __le16 device_id;
47                 __le16 vendor_id;
48         } dev_vend_id;
49         __le32 id;
50 };
51
52 struct ice_device_id_entry {
53         union ice_device_id device;
54         union ice_device_id sub_device;
55 };
56
57 struct ice_seg {
58         struct ice_generic_seg_hdr hdr;
59         __le32 device_table_count;
60         struct ice_device_id_entry device_table[1];
61 };
62
63 struct ice_nvm_table {
64         __le32 table_count;
65         __le32 vers[1];
66 };
67
68 struct ice_buf {
69 #define ICE_PKG_BUF_SIZE        4096
70         u8 buf[ICE_PKG_BUF_SIZE];
71 };
72
73 struct ice_buf_table {
74         __le32 buf_count;
75         struct ice_buf buf_array[1];
76 };
77
78 /* global metadata specific segment */
79 struct ice_global_metadata_seg {
80         struct ice_generic_seg_hdr hdr;
81         struct ice_pkg_ver pkg_ver;
82         __le32 track_id;
83         char pkg_name[ICE_PKG_NAME_SIZE];
84 };
85
86 #define ICE_MIN_S_OFF           12
87 #define ICE_MAX_S_OFF           4095
88 #define ICE_MIN_S_SZ            1
89 #define ICE_MAX_S_SZ            4084
90
91 /* section information */
92 struct ice_section_entry {
93         __le32 type;
94         __le16 offset;
95         __le16 size;
96 };
97
98 #define ICE_MIN_S_COUNT         1
99 #define ICE_MAX_S_COUNT         511
100 #define ICE_MIN_S_DATA_END      12
101 #define ICE_MAX_S_DATA_END      4096
102
103 #define ICE_METADATA_BUF        0x80000000
104
105 struct ice_buf_hdr {
106         __le16 section_count;
107         __le16 data_end;
108         struct ice_section_entry section_entry[1];
109 };
110
111 #define ICE_MAX_ENTRIES_IN_BUF(hd_sz, ent_sz) ((ICE_PKG_BUF_SIZE - \
112         sizeof(struct ice_buf_hdr) - (hd_sz)) / (ent_sz))
113
114 /* ice package section IDs */
115 #define ICE_SID_XLT0_SW                 10
116 #define ICE_SID_XLT_KEY_BUILDER_SW      11
117 #define ICE_SID_XLT1_SW                 12
118 #define ICE_SID_XLT2_SW                 13
119 #define ICE_SID_PROFID_TCAM_SW          14
120 #define ICE_SID_PROFID_REDIR_SW         15
121 #define ICE_SID_FLD_VEC_SW              16
122 #define ICE_SID_CDID_KEY_BUILDER_SW     17
123 #define ICE_SID_CDID_REDIR_SW           18
124
125 #define ICE_SID_XLT0_ACL                20
126 #define ICE_SID_XLT_KEY_BUILDER_ACL     21
127 #define ICE_SID_XLT1_ACL                22
128 #define ICE_SID_XLT2_ACL                23
129 #define ICE_SID_PROFID_TCAM_ACL         24
130 #define ICE_SID_PROFID_REDIR_ACL        25
131 #define ICE_SID_FLD_VEC_ACL             26
132 #define ICE_SID_CDID_KEY_BUILDER_ACL    27
133 #define ICE_SID_CDID_REDIR_ACL          28
134
135 #define ICE_SID_XLT0_FD                 30
136 #define ICE_SID_XLT_KEY_BUILDER_FD      31
137 #define ICE_SID_XLT1_FD                 32
138 #define ICE_SID_XLT2_FD                 33
139 #define ICE_SID_PROFID_TCAM_FD          34
140 #define ICE_SID_PROFID_REDIR_FD         35
141 #define ICE_SID_FLD_VEC_FD              36
142 #define ICE_SID_CDID_KEY_BUILDER_FD     37
143 #define ICE_SID_CDID_REDIR_FD           38
144
145 #define ICE_SID_XLT0_RSS                40
146 #define ICE_SID_XLT_KEY_BUILDER_RSS     41
147 #define ICE_SID_XLT1_RSS                42
148 #define ICE_SID_XLT2_RSS                43
149 #define ICE_SID_PROFID_TCAM_RSS         44
150 #define ICE_SID_PROFID_REDIR_RSS        45
151 #define ICE_SID_FLD_VEC_RSS             46
152 #define ICE_SID_CDID_KEY_BUILDER_RSS    47
153 #define ICE_SID_CDID_REDIR_RSS          48
154
155 #define ICE_SID_RXPARSER_CAM            50
156 #define ICE_SID_RXPARSER_NOMATCH_CAM    51
157 #define ICE_SID_RXPARSER_IMEM           52
158 #define ICE_SID_RXPARSER_XLT0_BUILDER   53
159 #define ICE_SID_RXPARSER_NODE_PTYPE     54
160 #define ICE_SID_RXPARSER_MARKER_PTYPE   55
161 #define ICE_SID_RXPARSER_BOOST_TCAM     56
162 #define ICE_SID_RXPARSER_PROTO_GRP      57
163 #define ICE_SID_RXPARSER_METADATA_INIT  58
164 #define ICE_SID_RXPARSER_XLT0           59
165
166 #define ICE_SID_TXPARSER_CAM            60
167 #define ICE_SID_TXPARSER_NOMATCH_CAM    61
168 #define ICE_SID_TXPARSER_IMEM           62
169 #define ICE_SID_TXPARSER_XLT0_BUILDER   63
170 #define ICE_SID_TXPARSER_NODE_PTYPE     64
171 #define ICE_SID_TXPARSER_MARKER_PTYPE   65
172 #define ICE_SID_TXPARSER_BOOST_TCAM     66
173 #define ICE_SID_TXPARSER_PROTO_GRP      67
174 #define ICE_SID_TXPARSER_METADATA_INIT  68
175 #define ICE_SID_TXPARSER_XLT0           69
176
177 #define ICE_SID_RXPARSER_INIT_REDIR     70
178 #define ICE_SID_TXPARSER_INIT_REDIR     71
179 #define ICE_SID_RXPARSER_MARKER_GRP     72
180 #define ICE_SID_TXPARSER_MARKER_GRP     73
181 #define ICE_SID_RXPARSER_LAST_PROTO     74
182 #define ICE_SID_TXPARSER_LAST_PROTO     75
183 #define ICE_SID_RXPARSER_PG_SPILL       76
184 #define ICE_SID_TXPARSER_PG_SPILL       77
185 #define ICE_SID_RXPARSER_NOMATCH_SPILL  78
186 #define ICE_SID_TXPARSER_NOMATCH_SPILL  79
187
188 #define ICE_SID_XLT0_PE                 80
189 #define ICE_SID_XLT_KEY_BUILDER_PE      81
190 #define ICE_SID_XLT1_PE                 82
191 #define ICE_SID_XLT2_PE                 83
192 #define ICE_SID_PROFID_TCAM_PE          84
193 #define ICE_SID_PROFID_REDIR_PE         85
194 #define ICE_SID_FLD_VEC_PE              86
195 #define ICE_SID_CDID_KEY_BUILDER_PE     87
196 #define ICE_SID_CDID_REDIR_PE           88
197
198 /* Label Metadata section IDs */
199 #define ICE_SID_LBL_FIRST               0x80000010
200 #define ICE_SID_LBL_RXPARSER_IMEM       0x80000010
201 #define ICE_SID_LBL_TXPARSER_IMEM       0x80000011
202 #define ICE_SID_LBL_RESERVED_12         0x80000012
203 #define ICE_SID_LBL_RESERVED_13         0x80000013
204 #define ICE_SID_LBL_RXPARSER_MARKER     0x80000014
205 #define ICE_SID_LBL_TXPARSER_MARKER     0x80000015
206 #define ICE_SID_LBL_PTYPE               0x80000016
207 #define ICE_SID_LBL_PROTOCOL_ID         0x80000017
208 #define ICE_SID_LBL_RXPARSER_TMEM       0x80000018
209 #define ICE_SID_LBL_TXPARSER_TMEM       0x80000019
210 #define ICE_SID_LBL_RXPARSER_PG         0x8000001A
211 #define ICE_SID_LBL_TXPARSER_PG         0x8000001B
212 #define ICE_SID_LBL_RXPARSER_M_TCAM     0x8000001C
213 #define ICE_SID_LBL_TXPARSER_M_TCAM     0x8000001D
214 #define ICE_SID_LBL_SW_PROFID_TCAM      0x8000001E
215 #define ICE_SID_LBL_ACL_PROFID_TCAM     0x8000001F
216 #define ICE_SID_LBL_PE_PROFID_TCAM      0x80000020
217 #define ICE_SID_LBL_RSS_PROFID_TCAM     0x80000021
218 #define ICE_SID_LBL_FD_PROFID_TCAM      0x80000022
219 #define ICE_SID_LBL_FLAG                0x80000023
220 #define ICE_SID_LBL_REG                 0x80000024
221 #define ICE_SID_LBL_SW_PTG              0x80000025
222 #define ICE_SID_LBL_ACL_PTG             0x80000026
223 #define ICE_SID_LBL_PE_PTG              0x80000027
224 #define ICE_SID_LBL_RSS_PTG             0x80000028
225 #define ICE_SID_LBL_FD_PTG              0x80000029
226 #define ICE_SID_LBL_SW_VSIG             0x8000002A
227 #define ICE_SID_LBL_ACL_VSIG            0x8000002B
228 #define ICE_SID_LBL_PE_VSIG             0x8000002C
229 #define ICE_SID_LBL_RSS_VSIG            0x8000002D
230 #define ICE_SID_LBL_FD_VSIG             0x8000002E
231 #define ICE_SID_LBL_PTYPE_META          0x8000002F
232 #define ICE_SID_LBL_SW_PROFID           0x80000030
233 #define ICE_SID_LBL_ACL_PROFID          0x80000031
234 #define ICE_SID_LBL_PE_PROFID           0x80000032
235 #define ICE_SID_LBL_RSS_PROFID          0x80000033
236 #define ICE_SID_LBL_FD_PROFID           0x80000034
237 #define ICE_SID_LBL_RXPARSER_MARKER_GRP 0x80000035
238 #define ICE_SID_LBL_TXPARSER_MARKER_GRP 0x80000036
239 #define ICE_SID_LBL_RXPARSER_PROTO      0x80000037
240 #define ICE_SID_LBL_TXPARSER_PROTO      0x80000038
241 /* The following define MUST be updated to reflect the last label section ID */
242 #define ICE_SID_LBL_LAST                0x80000038
243
244 enum ice_block {
245         ICE_BLK_SW = 0,
246         ICE_BLK_ACL,
247         ICE_BLK_FD,
248         ICE_BLK_RSS,
249         ICE_BLK_PE,
250         ICE_BLK_COUNT
251 };
252
253 enum ice_sect {
254         ICE_XLT0 = 0,
255         ICE_XLT_KB,
256         ICE_XLT1,
257         ICE_XLT2,
258         ICE_PROF_TCAM,
259         ICE_PROF_REDIR,
260         ICE_VEC_TBL,
261         ICE_CDID_KB,
262         ICE_CDID_REDIR,
263         ICE_SECT_COUNT
264 };
265
266 /* Packet Type (PTYPE) values */
267 #define ICE_PTYPE_MAC_PAY               1
268 #define ICE_PTYPE_IPV4FRAG_PAY          22
269 #define ICE_PTYPE_IPV4_PAY              23
270 #define ICE_PTYPE_IPV4_UDP_PAY          24
271 #define ICE_PTYPE_IPV4_TCP_PAY          26
272 #define ICE_PTYPE_IPV4_SCTP_PAY         27
273 #define ICE_PTYPE_IPV4_ICMP_PAY         28
274 #define ICE_PTYPE_IPV6FRAG_PAY          88
275 #define ICE_PTYPE_IPV6_PAY              89
276 #define ICE_PTYPE_IPV6_UDP_PAY          90
277 #define ICE_PTYPE_IPV6_TCP_PAY          92
278 #define ICE_PTYPE_IPV6_SCTP_PAY         93
279 #define ICE_PTYPE_IPV6_ICMP_PAY         94
280
281 /* Packet Type Groups (PTG) - Inner Most fields (IM) */
282 #define ICE_PTG_IM_IPV4_TCP             16
283 #define ICE_PTG_IM_IPV4_UDP             17
284 #define ICE_PTG_IM_IPV4_SCTP            18
285 #define ICE_PTG_IM_IPV4_PAY             20
286 #define ICE_PTG_IM_IPV4_OTHER           21
287 #define ICE_PTG_IM_IPV6_TCP             32
288 #define ICE_PTG_IM_IPV6_UDP             33
289 #define ICE_PTG_IM_IPV6_SCTP            34
290 #define ICE_PTG_IM_IPV6_OTHER           37
291 #define ICE_PTG_IM_L2_OTHER             67
292
293 struct ice_flex_fields {
294         union {
295                 struct {
296                         u8 src_ip;
297                         u8 dst_ip;
298                         u8 flow_label;  /* valid for IPv6 only */
299                 } ip_fields;
300
301                 struct {
302                         u8 src_prt;
303                         u8 dst_prt;
304                 } tcp_udp_fields;
305
306                 struct {
307                         u8 src_ip;
308                         u8 dst_ip;
309                         u8 src_prt;
310                         u8 dst_prt;
311                 } ip_tcp_udp_fields;
312
313                 struct {
314                         u8 src_prt;
315                         u8 dst_prt;
316                         u8 flow_label;  /* valid for IPv6 only */
317                         u8 spi;
318                 } ip_esp_fields;
319
320                 struct {
321                         u32 offset;
322                         u32 length;
323                 } off_len;
324         } fields;
325 };
326
327 #define ICE_XLT1_DFLT_GRP       0
328 #define ICE_XLT1_TABLE_SIZE     1024
329
330 /* package labels */
331 struct ice_label {
332         __le16 value;
333 #define ICE_PKG_LABEL_SIZE      64
334         char name[ICE_PKG_LABEL_SIZE];
335 };
336
337 struct ice_label_section {
338         __le16 count;
339         struct ice_label label[1];
340 };
341
342 #define ICE_MAX_LABELS_IN_BUF ICE_MAX_ENTRIES_IN_BUF( \
343         sizeof(struct ice_label_section) - sizeof(struct ice_label), \
344         sizeof(struct ice_label))
345
346 struct ice_sw_fv_section {
347         __le16 count;
348         __le16 base_offset;
349         struct ice_fv fv[1];
350 };
351
352 struct ice_sw_fv_list_entry {
353         struct LIST_ENTRY_TYPE list_entry;
354         u32 profile_id;
355         struct ice_fv *fv_ptr;
356 };
357
358 #pragma pack(1)
359 /* The BOOST TCAM stores the match packet header in reverse order, meaning
360  * the fields are reversed; in addition, this means that the normally big endian
361  * fields of the packet are now little endian.
362  */
363 struct ice_boost_key_value {
364 #define ICE_BOOST_REMAINING_HV_KEY      15
365         u8 remaining_hv_key[ICE_BOOST_REMAINING_HV_KEY];
366         __le16 hv_dst_port_key;
367         __le16 hv_src_port_key;
368         u8 tcam_search_key;
369 };
370
371 #pragma pack()
372
373 struct ice_boost_key {
374         struct ice_boost_key_value key;
375         struct ice_boost_key_value key2;
376 };
377
378 /* package Boost TCAM entry */
379 struct ice_boost_tcam_entry {
380         __le16 addr;
381         __le16 reserved;
382         /* break up the 40 bytes of key into different fields */
383         struct ice_boost_key key;
384         u8 boost_hit_index_group;
385         /* The following contains bitfields which are not on byte boundaries.
386          * These fields are currently unused by driver software.
387          */
388 #define ICE_BOOST_BIT_FIELDS            43
389         u8 bit_fields[ICE_BOOST_BIT_FIELDS];
390 };
391
392 struct ice_boost_tcam_section {
393         __le16 count;
394         __le16 reserved;
395         struct ice_boost_tcam_entry tcam[1];
396 };
397
398 #define ICE_MAX_BST_TCAMS_IN_BUF ICE_MAX_ENTRIES_IN_BUF( \
399         sizeof(struct ice_boost_tcam_section) - \
400         sizeof(struct ice_boost_tcam_entry), \
401         sizeof(struct ice_boost_tcam_entry))
402
403 #pragma pack(1)
404 struct ice_xlt1_section {
405         __le16 count;
406         __le16 offset;
407         u8 value[1];
408 };
409
410 #pragma pack()
411
412 #define ICE_XLT1_SIZE(n)        (sizeof(struct ice_xlt1_section) + \
413                                  (sizeof(u8) * ((n) - 1)))
414
415 struct ice_xlt2_section {
416         __le16 count;
417         __le16 offset;
418         __le16 value[1];
419 };
420
421 #define ICE_XLT2_SIZE(n)        (sizeof(struct ice_xlt2_section) + \
422                                  (sizeof(u16) * ((n) - 1)))
423
424 struct ice_prof_redir_section {
425         __le16 count;
426         __le16 offset;
427         u8 redir_value[1];
428 };
429
430 #define ICE_PROF_REDIR_SIZE(n)  (sizeof(struct ice_prof_redir_section) + \
431                                  (sizeof(u8) * ((n) - 1)))
432
433 /* package buffer building */
434
435 struct ice_buf_build {
436         struct ice_buf buf;
437         u16 reserved_section_table_entries;
438 };
439
440 struct ice_pkg_enum {
441         struct ice_buf_table *buf_table;
442         u32 buf_idx;
443
444         u32 type;
445         struct ice_buf_hdr *buf;
446         u32 sect_idx;
447         void *sect;
448         u32 sect_type;
449
450         u32 entry_idx;
451         void *(*handler)(u32 sect_type, void *section, u32 index, u32 *offset);
452 };
453
454 /* Tunnel enabling */
455
456 enum ice_tunnel_type {
457         TNL_VXLAN = 0,
458         TNL_GTPC,
459         TNL_GTPC_TEID,
460         TNL_GTPU,
461         TNL_GTPU_TEID,
462         TNL_VXLAN_GPE,
463         TNL_GENEVE,
464         TNL_NAT,
465         TNL_ROCE_V2,
466         TNL_MPLSO_UDP,
467         TNL_UDP2_END,
468         TNL_UPD_END,
469         TNL_LAST = 0xFF,
470         TNL_ALL = 0xFF,
471 };
472
473 struct ice_tunnel_type_scan {
474         enum ice_tunnel_type type;
475         const char *label_prefix;
476 };
477
478 struct ice_tunnel_entry {
479         enum ice_tunnel_type type;
480         u8 valid;
481         u8 in_use;
482         u8 marked;
483         u16 boost_addr;
484         u16 port;
485         struct ice_boost_tcam_entry *boost_entry;
486 };
487
488 #define ICE_TUNNEL_MAX_ENTRIES  16
489
490 struct ice_tunnel_table {
491         u16 count;
492         struct ice_tunnel_entry tbl[ICE_TUNNEL_MAX_ENTRIES];
493 };
494
495 struct ice_pkg_es {
496         __le16 count;
497         __le16 offset;
498         struct ice_fv_word es[1];
499 };
500
501 struct ice_es {
502         u32 sid;
503         u16 count;
504         u16 fvw;
505         u16 *ref_count;
506         u8 *written;
507         u8 reverse; /* set to true to reverse FV order */
508         struct LIST_HEAD_TYPE prof_map;
509         struct ice_fv_word *t;
510         u8 *resource_used_hack; /* hack for testing */
511 };
512
513 /* PTYPE Group management */
514
515 /* Note: XLT1 table takes 13-bit as input, and results in an 8-bit packet type
516  * group (PTG) ID as output.
517  *
518  * Note: PTG 0 is the default packet type group and it is assumed that all PTYPE
519  * are a part of this group until moved to a new PTG.
520  */
521 #define ICE_DEFAULT_PTG 0
522
523 struct ice_ptg_entry {
524         u8 in_use;
525         struct ice_ptg_ptype *first_ptype;
526 };
527
528 struct ice_ptg_ptype {
529         u8 ptg;
530         struct ice_ptg_ptype *next_ptype;
531 };
532
533 #define ICE_MAX_TCAM_PER_PROFILE        8
534 #define ICE_MAX_PTYPE_PER_PROFILE       8
535
536 struct ice_prof_map {
537         struct LIST_ENTRY_TYPE list;
538         u64 profile_cookie;
539         u64 context;
540         u8 prof_id;
541         u8 ptype_count;
542         u8 ptype[ICE_MAX_PTYPE_PER_PROFILE];
543 };
544
545 #define ICE_INVALID_TCAM        0xFFFF
546
547 struct ice_tcam_inf {
548         u8 ptg;
549         u8 prof_id;
550         u16 tcam_idx;
551         u8 in_use;
552 };
553
554 struct ice_vsig_prof {
555         struct LIST_ENTRY_TYPE list;
556         u64 profile_cookie;
557         u8 prof_id;
558         u8 tcam_count;
559         struct ice_tcam_inf tcam[ICE_MAX_TCAM_PER_PROFILE];
560 };
561
562 struct ice_vsig_entry {
563         u8 in_use;
564         struct LIST_HEAD_TYPE prop_lst;
565         struct ice_vsig_vsi *first_vsi;
566 };
567
568 struct ice_vsig_vsi {
569         u16 changed;
570         u16 vsig;
571         u32 prop_mask;
572         struct ice_vsig_vsi *next_vsi;
573 };
574
575 #define ICE_XLT1_CNT    1024
576 #define ICE_MAX_PTGS    256
577
578 /* XLT1 Table */
579 struct ice_xlt1 {
580         u32 sid;
581         u16 count;
582         struct ice_ptg_entry *ptg_tbl;
583         struct ice_ptg_ptype *ptypes;
584         u8 *t;
585 };
586
587 #define ICE_XLT2_CNT    768
588 #define ICE_MAX_VSIGS   768
589
590 /* Vsig bit layout:
591  * [0:12]: incremental vsig index 1 to ICE_MAX_VSIGS
592  * [13:15]: pf number of device
593  */
594 #define ICE_VSIG_IDX_M  (0x1FFF)
595 #define ICE_PF_NUM_S    13
596 #define ICE_PF_NUM_M    (0x07 << ICE_PF_NUM_S)
597 #define ICE_VSIG_VALUE(vsig, pf_id) \
598         (u16)((((u16)(vsig)) & ICE_VSIG_IDX_M) | \
599               (((u16)(pf_id) << ICE_PF_NUM_S) & ICE_PF_NUM_M))
600 #define ICE_DEFAULT_VSIG        0
601
602 /* XLT2 Table */
603 struct ice_xlt2 {
604         u32 sid;
605         u16 count;
606         struct ice_vsig_entry *vsig_tbl;
607         struct ice_vsig_vsi *vsis;
608         u16 *t;
609 };
610
611 /* Extraction sequence - list of match fields:
612  * protocol ID, offset, profile length
613  */
614 union ice_match_fld {
615         struct {
616                 u8 prot_id;
617                 u8 offset;
618                 u8 length;
619                 u8 reserved; /* must be zero */
620         } fld;
621         u32 val;
622 };
623
624 #define ICE_MATCH_LIST_SZ       20
625 #pragma pack(1)
626 struct ice_match {
627         u8 count;
628         union ice_match_fld list[ICE_MATCH_LIST_SZ];
629 };
630
631 /* Profile ID Management */
632 struct ice_prof_id_key {
633         __le16 flags;
634         u8 xlt1;
635         __le16 xlt2_cdid;
636 };
637
638 /* Keys are made up of two values, each one-half the size of the key.
639  * For TCAM, the entire key is 80 bits wide (or 2, 40-bit wide values)
640  */
641 #define ICE_TCAM_KEY_VAL_SZ     5
642 #define ICE_TCAM_KEY_SZ         (2 * ICE_TCAM_KEY_VAL_SZ)
643
644 struct ice_prof_tcam_entry {
645         __le16 addr;
646         u8 key[ICE_TCAM_KEY_SZ];
647         u8 prof_id;
648 };
649
650 struct ice_prof_id_section {
651         __le16 count;
652         struct ice_prof_tcam_entry entry[1];
653 };
654
655 #pragma pack()
656
657 struct ice_prof_tcam {
658         u32 sid;
659         u16 count;
660         u16 max_prof_id;
661         u8 cdid_bits; /* # cdid bits to use in key, 0, 2, 4, or 8 */
662         struct ice_prof_tcam_entry *t;
663         u8 *resource_used_hack;
664 };
665
666 struct ice_prof_redir {
667         u32 sid;
668         u16 count;
669         u8 *t;
670 };
671
672 /* Tables per block */
673 struct ice_blk_info {
674         struct ice_xlt1 xlt1;
675         struct ice_xlt2 xlt2;
676         struct ice_prof_tcam prof;
677         struct ice_prof_redir prof_redir;
678         struct ice_es es;
679         u8 overwrite; /* set to true to allow overwrite of table entries */
680 };
681
682 enum ice_chg_type {
683         ICE_TCAM_NONE = 0,
684         ICE_PTG_ES_ADD,
685         ICE_TCAM_ADD,
686         ICE_VSIG_ADD,
687         ICE_VSIG_REM,
688         ICE_VSI_MOVE,
689 };
690
691 struct ice_chs_chg {
692         struct LIST_ENTRY_TYPE list_entry;
693         enum ice_chg_type type;
694
695         u8 add_ptg;
696         u8 add_vsig;
697         u8 add_tcam_idx;
698         u8 add_prof;
699         u16 ptype;
700         u8 ptg;
701         u8 prof_id;
702         u16 vsi;
703         u16 vsig;
704         u16 orig_vsig;
705         u16 tcam_idx;
706 };
707
708 #define ICE_FLOW_PTYPE_MAX              ICE_XLT1_CNT
709
710 #endif /* _ICE_FLEX_TYPE_H_ */