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