1
2
3
4#ifndef _ICE_FLEX_TYPE_H_
5#define _ICE_FLEX_TYPE_H_
6
7#define ICE_FV_OFFSET_INVAL 0x1FF
8
9
10struct ice_fv_word {
11 u8 prot_id;
12 u16 off;
13 u8 resvrd;
14} __packed;
15
16#define ICE_MAX_FV_WORDS 48
17struct ice_fv {
18 struct ice_fv_word ew[ICE_MAX_FV_WORDS];
19};
20
21
22struct ice_pkg_hdr {
23 struct ice_pkg_ver pkg_format_ver;
24 __le32 seg_count;
25 __le32 seg_offset[];
26};
27
28
29struct ice_generic_seg_hdr {
30#define SEGMENT_TYPE_METADATA 0x00000001
31#define SEGMENT_TYPE_ICE 0x00000010
32 __le32 seg_type;
33 struct ice_pkg_ver seg_format_ver;
34 __le32 seg_size;
35 char seg_id[ICE_PKG_NAME_SIZE];
36};
37
38
39
40union ice_device_id {
41 struct {
42 __le16 device_id;
43 __le16 vendor_id;
44 } dev_vend_id;
45 __le32 id;
46};
47
48struct ice_device_id_entry {
49 union ice_device_id device;
50 union ice_device_id sub_device;
51};
52
53struct ice_seg {
54 struct ice_generic_seg_hdr hdr;
55 __le32 device_table_count;
56 struct ice_device_id_entry device_table[];
57};
58
59struct ice_nvm_table {
60 __le32 table_count;
61 __le32 vers[];
62};
63
64struct ice_buf {
65#define ICE_PKG_BUF_SIZE 4096
66 u8 buf[ICE_PKG_BUF_SIZE];
67};
68
69struct ice_buf_table {
70 __le32 buf_count;
71 struct ice_buf buf_array[];
72};
73
74
75struct ice_global_metadata_seg {
76 struct ice_generic_seg_hdr hdr;
77 struct ice_pkg_ver pkg_ver;
78 __le32 rsvd;
79 char pkg_name[ICE_PKG_NAME_SIZE];
80};
81
82#define ICE_MIN_S_OFF 12
83#define ICE_MAX_S_OFF 4095
84#define ICE_MIN_S_SZ 1
85#define ICE_MAX_S_SZ 4084
86
87
88struct ice_section_entry {
89 __le32 type;
90 __le16 offset;
91 __le16 size;
92};
93
94#define ICE_MIN_S_COUNT 1
95#define ICE_MAX_S_COUNT 511
96#define ICE_MIN_S_DATA_END 12
97#define ICE_MAX_S_DATA_END 4096
98
99#define ICE_METADATA_BUF 0x80000000
100
101struct ice_buf_hdr {
102 __le16 section_count;
103 __le16 data_end;
104 struct ice_section_entry section_entry[];
105};
106
107#define ICE_MAX_ENTRIES_IN_BUF(hd_sz, ent_sz) ((ICE_PKG_BUF_SIZE - \
108 struct_size((struct ice_buf_hdr *)0, section_entry, 1) - (hd_sz)) /\
109 (ent_sz))
110
111
112#define ICE_SID_METADATA 1
113#define ICE_SID_XLT0_SW 10
114#define ICE_SID_XLT_KEY_BUILDER_SW 11
115#define ICE_SID_XLT1_SW 12
116#define ICE_SID_XLT2_SW 13
117#define ICE_SID_PROFID_TCAM_SW 14
118#define ICE_SID_PROFID_REDIR_SW 15
119#define ICE_SID_FLD_VEC_SW 16
120#define ICE_SID_CDID_KEY_BUILDER_SW 17
121
122struct ice_meta_sect {
123 struct ice_pkg_ver ver;
124#define ICE_META_SECT_NAME_SIZE 28
125 char name[ICE_META_SECT_NAME_SIZE];
126 __le32 track_id;
127};
128
129#define ICE_SID_CDID_REDIR_SW 18
130
131#define ICE_SID_XLT0_ACL 20
132#define ICE_SID_XLT_KEY_BUILDER_ACL 21
133#define ICE_SID_XLT1_ACL 22
134#define ICE_SID_XLT2_ACL 23
135#define ICE_SID_PROFID_TCAM_ACL 24
136#define ICE_SID_PROFID_REDIR_ACL 25
137#define ICE_SID_FLD_VEC_ACL 26
138#define ICE_SID_CDID_KEY_BUILDER_ACL 27
139#define ICE_SID_CDID_REDIR_ACL 28
140
141#define ICE_SID_XLT0_FD 30
142#define ICE_SID_XLT_KEY_BUILDER_FD 31
143#define ICE_SID_XLT1_FD 32
144#define ICE_SID_XLT2_FD 33
145#define ICE_SID_PROFID_TCAM_FD 34
146#define ICE_SID_PROFID_REDIR_FD 35
147#define ICE_SID_FLD_VEC_FD 36
148#define ICE_SID_CDID_KEY_BUILDER_FD 37
149#define ICE_SID_CDID_REDIR_FD 38
150
151#define ICE_SID_XLT0_RSS 40
152#define ICE_SID_XLT_KEY_BUILDER_RSS 41
153#define ICE_SID_XLT1_RSS 42
154#define ICE_SID_XLT2_RSS 43
155#define ICE_SID_PROFID_TCAM_RSS 44
156#define ICE_SID_PROFID_REDIR_RSS 45
157#define ICE_SID_FLD_VEC_RSS 46
158#define ICE_SID_CDID_KEY_BUILDER_RSS 47
159#define ICE_SID_CDID_REDIR_RSS 48
160
161#define ICE_SID_RXPARSER_BOOST_TCAM 56
162#define ICE_SID_TXPARSER_BOOST_TCAM 66
163
164#define ICE_SID_XLT0_PE 80
165#define ICE_SID_XLT_KEY_BUILDER_PE 81
166#define ICE_SID_XLT1_PE 82
167#define ICE_SID_XLT2_PE 83
168#define ICE_SID_PROFID_TCAM_PE 84
169#define ICE_SID_PROFID_REDIR_PE 85
170#define ICE_SID_FLD_VEC_PE 86
171#define ICE_SID_CDID_KEY_BUILDER_PE 87
172#define ICE_SID_CDID_REDIR_PE 88
173
174
175#define ICE_SID_LBL_FIRST 0x80000010
176#define ICE_SID_LBL_RXPARSER_TMEM 0x80000018
177
178#define ICE_SID_LBL_LAST 0x80000038
179
180enum ice_block {
181 ICE_BLK_SW = 0,
182 ICE_BLK_ACL,
183 ICE_BLK_FD,
184 ICE_BLK_RSS,
185 ICE_BLK_PE,
186 ICE_BLK_COUNT
187};
188
189enum ice_sect {
190 ICE_XLT0 = 0,
191 ICE_XLT_KB,
192 ICE_XLT1,
193 ICE_XLT2,
194 ICE_PROF_TCAM,
195 ICE_PROF_REDIR,
196 ICE_VEC_TBL,
197 ICE_CDID_KB,
198 ICE_CDID_REDIR,
199 ICE_SECT_COUNT
200};
201
202#define ICE_MAC_IPV4_GTPU_IPV4_FRAG 331
203#define ICE_MAC_IPV4_GTPU_IPV4_PAY 332
204#define ICE_MAC_IPV4_GTPU_IPV4_UDP_PAY 333
205#define ICE_MAC_IPV4_GTPU_IPV4_TCP 334
206#define ICE_MAC_IPV4_GTPU_IPV4_ICMP 335
207#define ICE_MAC_IPV6_GTPU_IPV4_FRAG 336
208#define ICE_MAC_IPV6_GTPU_IPV4_PAY 337
209#define ICE_MAC_IPV6_GTPU_IPV4_UDP_PAY 338
210#define ICE_MAC_IPV6_GTPU_IPV4_TCP 339
211#define ICE_MAC_IPV6_GTPU_IPV4_ICMP 340
212#define ICE_MAC_IPV4_GTPU_IPV6_FRAG 341
213#define ICE_MAC_IPV4_GTPU_IPV6_PAY 342
214#define ICE_MAC_IPV4_GTPU_IPV6_UDP_PAY 343
215#define ICE_MAC_IPV4_GTPU_IPV6_TCP 344
216#define ICE_MAC_IPV4_GTPU_IPV6_ICMPV6 345
217#define ICE_MAC_IPV6_GTPU_IPV6_FRAG 346
218#define ICE_MAC_IPV6_GTPU_IPV6_PAY 347
219#define ICE_MAC_IPV6_GTPU_IPV6_UDP_PAY 348
220#define ICE_MAC_IPV6_GTPU_IPV6_TCP 349
221#define ICE_MAC_IPV6_GTPU_IPV6_ICMPV6 350
222
223
224
225
226
227
228
229enum ice_ptype_attrib_type {
230
231 ICE_PTYPE_ATTR_GTP_PDU_EH,
232 ICE_PTYPE_ATTR_GTP_SESSION,
233 ICE_PTYPE_ATTR_GTP_DOWNLINK,
234 ICE_PTYPE_ATTR_GTP_UPLINK,
235};
236
237struct ice_ptype_attrib_info {
238 u16 flags;
239 u16 mask;
240};
241
242
243#define ICE_GTP_PDU BIT(14)
244#define ICE_GTP_PDU_LINK BIT(13)
245
246
247#define ICE_GTP_PDU_FLAG_MASK (ICE_GTP_PDU)
248#define ICE_GTP_PDU_EH ICE_GTP_PDU
249
250#define ICE_GTP_FLAGS_MASK (ICE_GTP_PDU | ICE_GTP_PDU_LINK)
251#define ICE_GTP_SESSION 0
252#define ICE_GTP_DOWNLINK ICE_GTP_PDU
253#define ICE_GTP_UPLINK (ICE_GTP_PDU | ICE_GTP_PDU_LINK)
254
255struct ice_ptype_attributes {
256 u16 ptype;
257 enum ice_ptype_attrib_type attrib;
258};
259
260
261struct ice_label {
262 __le16 value;
263#define ICE_PKG_LABEL_SIZE 64
264 char name[ICE_PKG_LABEL_SIZE];
265};
266
267struct ice_label_section {
268 __le16 count;
269 struct ice_label label[];
270};
271
272#define ICE_MAX_LABELS_IN_BUF ICE_MAX_ENTRIES_IN_BUF( \
273 struct_size((struct ice_label_section *)0, label, 1) - \
274 sizeof(struct ice_label), sizeof(struct ice_label))
275
276struct ice_sw_fv_section {
277 __le16 count;
278 __le16 base_offset;
279 struct ice_fv fv[];
280};
281
282
283
284
285
286struct ice_boost_key_value {
287#define ICE_BOOST_REMAINING_HV_KEY 15
288 u8 remaining_hv_key[ICE_BOOST_REMAINING_HV_KEY];
289 __le16 hv_dst_port_key;
290 __le16 hv_src_port_key;
291 u8 tcam_search_key;
292} __packed;
293
294struct ice_boost_key {
295 struct ice_boost_key_value key;
296 struct ice_boost_key_value key2;
297};
298
299
300struct ice_boost_tcam_entry {
301 __le16 addr;
302 __le16 reserved;
303
304 struct ice_boost_key key;
305 u8 boost_hit_index_group;
306
307
308
309#define ICE_BOOST_BIT_FIELDS 43
310 u8 bit_fields[ICE_BOOST_BIT_FIELDS];
311};
312
313struct ice_boost_tcam_section {
314 __le16 count;
315 __le16 reserved;
316 struct ice_boost_tcam_entry tcam[];
317};
318
319#define ICE_MAX_BST_TCAMS_IN_BUF ICE_MAX_ENTRIES_IN_BUF( \
320 struct_size((struct ice_boost_tcam_section *)0, tcam, 1) - \
321 sizeof(struct ice_boost_tcam_entry), \
322 sizeof(struct ice_boost_tcam_entry))
323
324struct ice_xlt1_section {
325 __le16 count;
326 __le16 offset;
327 u8 value[];
328};
329
330struct ice_xlt2_section {
331 __le16 count;
332 __le16 offset;
333 __le16 value[];
334};
335
336struct ice_prof_redir_section {
337 __le16 count;
338 __le16 offset;
339 u8 redir_value[];
340};
341
342
343
344struct ice_buf_build {
345 struct ice_buf buf;
346 u16 reserved_section_table_entries;
347};
348
349struct ice_pkg_enum {
350 struct ice_buf_table *buf_table;
351 u32 buf_idx;
352
353 u32 type;
354 struct ice_buf_hdr *buf;
355 u32 sect_idx;
356 void *sect;
357 u32 sect_type;
358
359 u32 entry_idx;
360 void *(*handler)(u32 sect_type, void *section, u32 index, u32 *offset);
361};
362
363
364
365enum ice_tunnel_type {
366 TNL_VXLAN = 0,
367 TNL_GENEVE,
368 __TNL_TYPE_CNT,
369 TNL_LAST = 0xFF,
370 TNL_ALL = 0xFF,
371};
372
373struct ice_tunnel_type_scan {
374 enum ice_tunnel_type type;
375 const char *label_prefix;
376};
377
378struct ice_tunnel_entry {
379 enum ice_tunnel_type type;
380 u16 boost_addr;
381 u16 port;
382 struct ice_boost_tcam_entry *boost_entry;
383 u8 valid;
384};
385
386#define ICE_TUNNEL_MAX_ENTRIES 16
387
388struct ice_tunnel_table {
389 struct ice_tunnel_entry tbl[ICE_TUNNEL_MAX_ENTRIES];
390 u16 count;
391 u16 valid_count[__TNL_TYPE_CNT];
392};
393
394struct ice_pkg_es {
395 __le16 count;
396 __le16 offset;
397 struct ice_fv_word es[];
398};
399
400struct ice_es {
401 u32 sid;
402 u16 count;
403 u16 fvw;
404 u16 *ref_count;
405 u32 *mask_ena;
406 struct list_head prof_map;
407 struct ice_fv_word *t;
408 struct mutex prof_map_lock;
409 u8 *written;
410 u8 reverse;
411};
412
413
414
415
416
417
418
419
420
421#define ICE_DEFAULT_PTG 0
422
423struct ice_ptg_entry {
424 struct ice_ptg_ptype *first_ptype;
425 u8 in_use;
426};
427
428struct ice_ptg_ptype {
429 struct ice_ptg_ptype *next_ptype;
430 u8 ptg;
431};
432
433#define ICE_MAX_TCAM_PER_PROFILE 32
434#define ICE_MAX_PTG_PER_PROFILE 32
435
436struct ice_prof_map {
437 struct list_head list;
438 u64 profile_cookie;
439 u64 context;
440 u8 prof_id;
441 u8 ptg_cnt;
442 u8 ptg[ICE_MAX_PTG_PER_PROFILE];
443 struct ice_ptype_attrib_info attr[ICE_MAX_PTG_PER_PROFILE];
444};
445
446#define ICE_INVALID_TCAM 0xFFFF
447
448struct ice_tcam_inf {
449 u16 tcam_idx;
450 struct ice_ptype_attrib_info attr;
451 u8 ptg;
452 u8 prof_id;
453 u8 in_use;
454};
455
456struct ice_vsig_prof {
457 struct list_head list;
458 u64 profile_cookie;
459 u8 prof_id;
460 u8 tcam_count;
461 struct ice_tcam_inf tcam[ICE_MAX_TCAM_PER_PROFILE];
462};
463
464struct ice_vsig_entry {
465 struct list_head prop_lst;
466 struct ice_vsig_vsi *first_vsi;
467 u8 in_use;
468};
469
470struct ice_vsig_vsi {
471 struct ice_vsig_vsi *next_vsi;
472 u32 prop_mask;
473 u16 changed;
474 u16 vsig;
475};
476
477#define ICE_XLT1_CNT 1024
478#define ICE_MAX_PTGS 256
479
480
481struct ice_xlt1 {
482 struct ice_ptg_entry *ptg_tbl;
483 struct ice_ptg_ptype *ptypes;
484 u8 *t;
485 u32 sid;
486 u16 count;
487};
488
489#define ICE_XLT2_CNT 768
490#define ICE_MAX_VSIGS 768
491
492
493
494
495
496#define ICE_VSIG_IDX_M (0x1FFF)
497#define ICE_PF_NUM_S 13
498#define ICE_PF_NUM_M (0x07 << ICE_PF_NUM_S)
499#define ICE_VSIG_VALUE(vsig, pf_id) \
500 ((u16)((((u16)(vsig)) & ICE_VSIG_IDX_M) | \
501 (((u16)(pf_id) << ICE_PF_NUM_S) & ICE_PF_NUM_M)))
502#define ICE_DEFAULT_VSIG 0
503
504
505struct ice_xlt2 {
506 struct ice_vsig_entry *vsig_tbl;
507 struct ice_vsig_vsi *vsis;
508 u16 *t;
509 u32 sid;
510 u16 count;
511};
512
513
514struct ice_prof_id_key {
515 __le16 flags;
516 u8 xlt1;
517 __le16 xlt2_cdid;
518} __packed;
519
520
521
522
523#define ICE_TCAM_KEY_VAL_SZ 5
524#define ICE_TCAM_KEY_SZ (2 * ICE_TCAM_KEY_VAL_SZ)
525
526struct ice_prof_tcam_entry {
527 __le16 addr;
528 u8 key[ICE_TCAM_KEY_SZ];
529 u8 prof_id;
530} __packed;
531
532struct ice_prof_id_section {
533 __le16 count;
534 struct ice_prof_tcam_entry entry[];
535};
536
537struct ice_prof_tcam {
538 u32 sid;
539 u16 count;
540 u16 max_prof_id;
541 struct ice_prof_tcam_entry *t;
542 u8 cdid_bits;
543};
544
545struct ice_prof_redir {
546 u8 *t;
547 u32 sid;
548 u16 count;
549};
550
551struct ice_mask {
552 u16 mask;
553 u16 idx;
554 u16 ref;
555 u8 in_use;
556};
557
558struct ice_masks {
559 struct mutex lock;
560 u16 first;
561 u16 count;
562#define ICE_PROF_MASK_COUNT 32
563 struct ice_mask masks[ICE_PROF_MASK_COUNT];
564};
565
566
567struct ice_blk_info {
568 struct ice_xlt1 xlt1;
569 struct ice_xlt2 xlt2;
570 struct ice_prof_tcam prof;
571 struct ice_prof_redir prof_redir;
572 struct ice_es es;
573 struct ice_masks masks;
574 u8 overwrite;
575 u8 is_list_init;
576};
577
578enum ice_chg_type {
579 ICE_TCAM_NONE = 0,
580 ICE_PTG_ES_ADD,
581 ICE_TCAM_ADD,
582 ICE_VSIG_ADD,
583 ICE_VSIG_REM,
584 ICE_VSI_MOVE,
585};
586
587struct ice_chs_chg {
588 struct list_head list_entry;
589 enum ice_chg_type type;
590
591 u8 add_ptg;
592 u8 add_vsig;
593 u8 add_tcam_idx;
594 u8 add_prof;
595 u16 ptype;
596 u8 ptg;
597 u8 prof_id;
598 u16 vsi;
599 u16 vsig;
600 u16 orig_vsig;
601 u16 tcam_idx;
602 struct ice_ptype_attrib_info attr;
603};
604
605#define ICE_FLOW_PTYPE_MAX ICE_XLT1_CNT
606#endif
607