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