1*c1d14583SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 2*c1d14583SBruce Richardson * Copyright(c) 2018 Intel Corporation 3*c1d14583SBruce Richardson */ 4*c1d14583SBruce Richardson 5*c1d14583SBruce Richardson #ifndef _ICE_ETHDEV_H_ 6*c1d14583SBruce Richardson #define _ICE_ETHDEV_H_ 7*c1d14583SBruce Richardson 8*c1d14583SBruce Richardson #include <rte_compat.h> 9*c1d14583SBruce Richardson #include <rte_kvargs.h> 10*c1d14583SBruce Richardson #include <rte_time.h> 11*c1d14583SBruce Richardson 12*c1d14583SBruce Richardson #include <ethdev_driver.h> 13*c1d14583SBruce Richardson #include <rte_tm_driver.h> 14*c1d14583SBruce Richardson 15*c1d14583SBruce Richardson #include "base/ice_common.h" 16*c1d14583SBruce Richardson #include "base/ice_adminq_cmd.h" 17*c1d14583SBruce Richardson #include "base/ice_flow.h" 18*c1d14583SBruce Richardson #include "base/ice_sched.h" 19*c1d14583SBruce Richardson 20*c1d14583SBruce Richardson #define ICE_ADMINQ_LEN 32 21*c1d14583SBruce Richardson #define ICE_SBIOQ_LEN 32 22*c1d14583SBruce Richardson #define ICE_MAILBOXQ_LEN 32 23*c1d14583SBruce Richardson #define ICE_SBQ_LEN 64 24*c1d14583SBruce Richardson #define ICE_ADMINQ_BUF_SZ 4096 25*c1d14583SBruce Richardson #define ICE_SBIOQ_BUF_SZ 4096 26*c1d14583SBruce Richardson #define ICE_MAILBOXQ_BUF_SZ 4096 27*c1d14583SBruce Richardson /* Number of queues per TC should be one of 1, 2, 4, 8, 16, 32, 64, 128, 256 */ 28*c1d14583SBruce Richardson #define ICE_MAX_Q_PER_TC 256 29*c1d14583SBruce Richardson #define ICE_NUM_DESC_DEFAULT 512 30*c1d14583SBruce Richardson #define ICE_BUF_SIZE_MIN 1024 31*c1d14583SBruce Richardson #define ICE_FRAME_SIZE_MAX 9728 32*c1d14583SBruce Richardson #define ICE_QUEUE_BASE_ADDR_UNIT 128 33*c1d14583SBruce Richardson /* number of VSIs and queue default setting */ 34*c1d14583SBruce Richardson #define ICE_MAX_QP_NUM_PER_VF 16 35*c1d14583SBruce Richardson #define ICE_DEFAULT_QP_NUM_FDIR 1 36*c1d14583SBruce Richardson #define ICE_UINT32_BIT_SIZE (CHAR_BIT * sizeof(uint32_t)) 37*c1d14583SBruce Richardson #define ICE_VFTA_SIZE (4096 / ICE_UINT32_BIT_SIZE) 38*c1d14583SBruce Richardson /* Maximun number of MAC addresses */ 39*c1d14583SBruce Richardson #define ICE_NUM_MACADDR_MAX 64 40*c1d14583SBruce Richardson /* Maximum number of VFs */ 41*c1d14583SBruce Richardson #define ICE_MAX_VF 128 42*c1d14583SBruce Richardson #define ICE_MAX_INTR_QUEUE_NUM 256 43*c1d14583SBruce Richardson 44*c1d14583SBruce Richardson #define ICE_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET 45*c1d14583SBruce Richardson #define ICE_RX_VEC_ID RTE_INTR_VEC_RXTX_OFFSET 46*c1d14583SBruce Richardson 47*c1d14583SBruce Richardson #define ICE_MAX_PKT_TYPE 1024 48*c1d14583SBruce Richardson 49*c1d14583SBruce Richardson /* DDP package search path */ 50*c1d14583SBruce Richardson #define ICE_PKG_FILE_DEFAULT "/lib/firmware/intel/ice/ddp/ice.pkg" 51*c1d14583SBruce Richardson #define ICE_PKG_FILE_UPDATES "/lib/firmware/updates/intel/ice/ddp/ice.pkg" 52*c1d14583SBruce Richardson #define ICE_PKG_FILE_SEARCH_PATH_DEFAULT "/lib/firmware/intel/ice/ddp/" 53*c1d14583SBruce Richardson #define ICE_PKG_FILE_SEARCH_PATH_UPDATES "/lib/firmware/updates/intel/ice/ddp/" 54*c1d14583SBruce Richardson #define ICE_PKG_FILE_CUSTOMIZED_PATH "/sys/module/firmware_class/parameters/path" 55*c1d14583SBruce Richardson #define ICE_MAX_PKG_FILENAME_SIZE 256 56*c1d14583SBruce Richardson 57*c1d14583SBruce Richardson #define MAX_ACL_NORMAL_ENTRIES 256 58*c1d14583SBruce Richardson 59*c1d14583SBruce Richardson /** 60*c1d14583SBruce Richardson * vlan_id is a 12 bit number. 61*c1d14583SBruce Richardson * The VFTA array is actually a 4096 bit array, 128 of 32bit elements. 62*c1d14583SBruce Richardson * 2^5 = 32. The val of lower 5 bits specifies the bit in the 32bit element. 63*c1d14583SBruce Richardson * The higher 7 bit val specifies VFTA array index. 64*c1d14583SBruce Richardson */ 65*c1d14583SBruce Richardson #define ICE_VFTA_BIT(vlan_id) (1 << ((vlan_id) & 0x1F)) 66*c1d14583SBruce Richardson #define ICE_VFTA_IDX(vlan_id) ((vlan_id) >> 5) 67*c1d14583SBruce Richardson 68*c1d14583SBruce Richardson /* Default TC traffic in case DCB is not enabled */ 69*c1d14583SBruce Richardson #define ICE_DEFAULT_TCMAP 0x1 70*c1d14583SBruce Richardson #define ICE_FDIR_QUEUE_ID 0 71*c1d14583SBruce Richardson 72*c1d14583SBruce Richardson /* Always assign pool 0 to main VSI, VMDQ will start from 1 */ 73*c1d14583SBruce Richardson #define ICE_VMDQ_POOL_BASE 1 74*c1d14583SBruce Richardson 75*c1d14583SBruce Richardson #define ICE_DEFAULT_RX_FREE_THRESH 32 76*c1d14583SBruce Richardson #define ICE_DEFAULT_RX_PTHRESH 8 77*c1d14583SBruce Richardson #define ICE_DEFAULT_RX_HTHRESH 8 78*c1d14583SBruce Richardson #define ICE_DEFAULT_RX_WTHRESH 0 79*c1d14583SBruce Richardson 80*c1d14583SBruce Richardson #define ICE_DEFAULT_TX_FREE_THRESH 32 81*c1d14583SBruce Richardson #define ICE_DEFAULT_TX_PTHRESH 32 82*c1d14583SBruce Richardson #define ICE_DEFAULT_TX_HTHRESH 0 83*c1d14583SBruce Richardson #define ICE_DEFAULT_TX_WTHRESH 0 84*c1d14583SBruce Richardson #define ICE_DEFAULT_TX_RSBIT_THRESH 32 85*c1d14583SBruce Richardson 86*c1d14583SBruce Richardson /* Bit shift and mask */ 87*c1d14583SBruce Richardson #define ICE_4_BIT_WIDTH (CHAR_BIT / 2) 88*c1d14583SBruce Richardson #define ICE_4_BIT_MASK RTE_LEN2MASK(ICE_4_BIT_WIDTH, uint8_t) 89*c1d14583SBruce Richardson #define ICE_8_BIT_WIDTH CHAR_BIT 90*c1d14583SBruce Richardson #define ICE_8_BIT_MASK UINT8_MAX 91*c1d14583SBruce Richardson #define ICE_16_BIT_WIDTH (CHAR_BIT * 2) 92*c1d14583SBruce Richardson #define ICE_16_BIT_MASK UINT16_MAX 93*c1d14583SBruce Richardson #define ICE_32_BIT_WIDTH (CHAR_BIT * 4) 94*c1d14583SBruce Richardson #define ICE_32_BIT_MASK UINT32_MAX 95*c1d14583SBruce Richardson #define ICE_40_BIT_WIDTH (CHAR_BIT * 5) 96*c1d14583SBruce Richardson #define ICE_40_BIT_MASK RTE_LEN2MASK(ICE_40_BIT_WIDTH, uint64_t) 97*c1d14583SBruce Richardson #define ICE_48_BIT_WIDTH (CHAR_BIT * 6) 98*c1d14583SBruce Richardson #define ICE_48_BIT_MASK RTE_LEN2MASK(ICE_48_BIT_WIDTH, uint64_t) 99*c1d14583SBruce Richardson 100*c1d14583SBruce Richardson #define ICE_FLAG_RSS BIT_ULL(0) 101*c1d14583SBruce Richardson #define ICE_FLAG_DCB BIT_ULL(1) 102*c1d14583SBruce Richardson #define ICE_FLAG_VMDQ BIT_ULL(2) 103*c1d14583SBruce Richardson #define ICE_FLAG_SRIOV BIT_ULL(3) 104*c1d14583SBruce Richardson #define ICE_FLAG_HEADER_SPLIT_DISABLED BIT_ULL(4) 105*c1d14583SBruce Richardson #define ICE_FLAG_HEADER_SPLIT_ENABLED BIT_ULL(5) 106*c1d14583SBruce Richardson #define ICE_FLAG_FDIR BIT_ULL(6) 107*c1d14583SBruce Richardson #define ICE_FLAG_VXLAN BIT_ULL(7) 108*c1d14583SBruce Richardson #define ICE_FLAG_RSS_AQ_CAPABLE BIT_ULL(8) 109*c1d14583SBruce Richardson #define ICE_FLAG_VF_MAC_BY_PF BIT_ULL(9) 110*c1d14583SBruce Richardson #define ICE_FLAG_ALL (ICE_FLAG_RSS | \ 111*c1d14583SBruce Richardson ICE_FLAG_DCB | \ 112*c1d14583SBruce Richardson ICE_FLAG_VMDQ | \ 113*c1d14583SBruce Richardson ICE_FLAG_SRIOV | \ 114*c1d14583SBruce Richardson ICE_FLAG_HEADER_SPLIT_DISABLED | \ 115*c1d14583SBruce Richardson ICE_FLAG_HEADER_SPLIT_ENABLED | \ 116*c1d14583SBruce Richardson ICE_FLAG_FDIR | \ 117*c1d14583SBruce Richardson ICE_FLAG_VXLAN | \ 118*c1d14583SBruce Richardson ICE_FLAG_RSS_AQ_CAPABLE | \ 119*c1d14583SBruce Richardson ICE_FLAG_VF_MAC_BY_PF) 120*c1d14583SBruce Richardson 121*c1d14583SBruce Richardson #define ICE_RSS_OFFLOAD_ALL ( \ 122*c1d14583SBruce Richardson RTE_ETH_RSS_IPV4 | \ 123*c1d14583SBruce Richardson RTE_ETH_RSS_FRAG_IPV4 | \ 124*c1d14583SBruce Richardson RTE_ETH_RSS_NONFRAG_IPV4_TCP | \ 125*c1d14583SBruce Richardson RTE_ETH_RSS_NONFRAG_IPV4_UDP | \ 126*c1d14583SBruce Richardson RTE_ETH_RSS_NONFRAG_IPV4_SCTP | \ 127*c1d14583SBruce Richardson RTE_ETH_RSS_NONFRAG_IPV4_OTHER | \ 128*c1d14583SBruce Richardson RTE_ETH_RSS_IPV6 | \ 129*c1d14583SBruce Richardson RTE_ETH_RSS_FRAG_IPV6 | \ 130*c1d14583SBruce Richardson RTE_ETH_RSS_NONFRAG_IPV6_TCP | \ 131*c1d14583SBruce Richardson RTE_ETH_RSS_NONFRAG_IPV6_UDP | \ 132*c1d14583SBruce Richardson RTE_ETH_RSS_NONFRAG_IPV6_SCTP | \ 133*c1d14583SBruce Richardson RTE_ETH_RSS_NONFRAG_IPV6_OTHER | \ 134*c1d14583SBruce Richardson RTE_ETH_RSS_L2_PAYLOAD) 135*c1d14583SBruce Richardson 136*c1d14583SBruce Richardson /** 137*c1d14583SBruce Richardson * The overhead from MTU to max frame size. 138*c1d14583SBruce Richardson * Considering QinQ packet, the VLAN tag needs to be counted twice. 139*c1d14583SBruce Richardson */ 140*c1d14583SBruce Richardson #define ICE_ETH_OVERHEAD \ 141*c1d14583SBruce Richardson (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + RTE_VLAN_HLEN * 2) 142*c1d14583SBruce Richardson #define ICE_ETH_MAX_LEN (RTE_ETHER_MTU + ICE_ETH_OVERHEAD) 143*c1d14583SBruce Richardson 144*c1d14583SBruce Richardson #define ICE_RXTX_BYTES_HIGH(bytes) ((bytes) & ~ICE_40_BIT_MASK) 145*c1d14583SBruce Richardson #define ICE_RXTX_BYTES_LOW(bytes) ((bytes) & ICE_40_BIT_MASK) 146*c1d14583SBruce Richardson 147*c1d14583SBruce Richardson /* Max number of flexible descriptor rxdid */ 148*c1d14583SBruce Richardson #define ICE_FLEX_DESC_RXDID_MAX_NUM 64 149*c1d14583SBruce Richardson 150*c1d14583SBruce Richardson #define ICE_I2C_EEPROM_DEV_ADDR 0xA0 151*c1d14583SBruce Richardson #define ICE_I2C_EEPROM_DEV_ADDR2 0xA2 152*c1d14583SBruce Richardson #define ICE_MODULE_TYPE_SFP 0x03 153*c1d14583SBruce Richardson #define ICE_MODULE_TYPE_QSFP_PLUS 0x0D 154*c1d14583SBruce Richardson #define ICE_MODULE_TYPE_QSFP28 0x11 155*c1d14583SBruce Richardson #define ICE_MODULE_SFF_ADDR_MODE 0x04 156*c1d14583SBruce Richardson #define ICE_MODULE_SFF_DIAG_CAPAB 0x40 157*c1d14583SBruce Richardson #define ICE_MODULE_REVISION_ADDR 0x01 158*c1d14583SBruce Richardson #define ICE_MODULE_SFF_8472_COMP 0x5E 159*c1d14583SBruce Richardson #define ICE_MODULE_SFF_8472_SWAP 0x5C 160*c1d14583SBruce Richardson #define ICE_MODULE_QSFP_MAX_LEN 640 161*c1d14583SBruce Richardson 162*c1d14583SBruce Richardson /* EEPROM Standards for plug in modules */ 163*c1d14583SBruce Richardson #define ICE_MODULE_SFF_8079 0x1 164*c1d14583SBruce Richardson #define ICE_MODULE_SFF_8079_LEN 256 165*c1d14583SBruce Richardson #define ICE_MODULE_SFF_8472 0x2 166*c1d14583SBruce Richardson #define ICE_MODULE_SFF_8472_LEN 512 167*c1d14583SBruce Richardson #define ICE_MODULE_SFF_8636 0x3 168*c1d14583SBruce Richardson #define ICE_MODULE_SFF_8636_LEN 256 169*c1d14583SBruce Richardson #define ICE_MODULE_SFF_8636_MAX_LEN 640 170*c1d14583SBruce Richardson #define ICE_MODULE_SFF_8436 0x4 171*c1d14583SBruce Richardson #define ICE_MODULE_SFF_8436_LEN 256 172*c1d14583SBruce Richardson #define ICE_MODULE_SFF_8436_MAX_LEN 640 173*c1d14583SBruce Richardson 174*c1d14583SBruce Richardson 175*c1d14583SBruce Richardson /* Per-channel register definitions */ 176*c1d14583SBruce Richardson #define GLTSYN_AUX_OUT(_chan, _idx) (GLTSYN_AUX_OUT_0(_idx) + ((_chan) * 8)) 177*c1d14583SBruce Richardson #define GLTSYN_CLKO(_chan, _idx) (GLTSYN_CLKO_0(_idx) + ((_chan) * 8)) 178*c1d14583SBruce Richardson #define GLTSYN_TGT_L(_chan, _idx) (GLTSYN_TGT_L_0(_idx) + ((_chan) * 16)) 179*c1d14583SBruce Richardson #define GLTSYN_TGT_H(_chan, _idx) (GLTSYN_TGT_H_0(_idx) + ((_chan) * 16)) 180*c1d14583SBruce Richardson 181*c1d14583SBruce Richardson /* DDP package type */ 182*c1d14583SBruce Richardson enum ice_pkg_type { 183*c1d14583SBruce Richardson ICE_PKG_TYPE_UNKNOWN, 184*c1d14583SBruce Richardson ICE_PKG_TYPE_OS_DEFAULT, 185*c1d14583SBruce Richardson ICE_PKG_TYPE_COMMS, 186*c1d14583SBruce Richardson }; 187*c1d14583SBruce Richardson 188*c1d14583SBruce Richardson enum pps_type { 189*c1d14583SBruce Richardson PPS_NONE, 190*c1d14583SBruce Richardson PPS_PIN, 191*c1d14583SBruce Richardson PPS_MAX, 192*c1d14583SBruce Richardson }; 193*c1d14583SBruce Richardson 194*c1d14583SBruce Richardson struct ice_adapter; 195*c1d14583SBruce Richardson 196*c1d14583SBruce Richardson /** 197*c1d14583SBruce Richardson * MAC filter structure 198*c1d14583SBruce Richardson */ 199*c1d14583SBruce Richardson struct ice_mac_filter_info { 200*c1d14583SBruce Richardson struct rte_ether_addr mac_addr; 201*c1d14583SBruce Richardson }; 202*c1d14583SBruce Richardson 203*c1d14583SBruce Richardson TAILQ_HEAD(ice_mac_filter_list, ice_mac_filter); 204*c1d14583SBruce Richardson 205*c1d14583SBruce Richardson /* MAC filter list structure */ 206*c1d14583SBruce Richardson struct ice_mac_filter { 207*c1d14583SBruce Richardson TAILQ_ENTRY(ice_mac_filter) next; 208*c1d14583SBruce Richardson struct ice_mac_filter_info mac_info; 209*c1d14583SBruce Richardson }; 210*c1d14583SBruce Richardson 211*c1d14583SBruce Richardson struct ice_vlan { 212*c1d14583SBruce Richardson uint16_t tpid; 213*c1d14583SBruce Richardson uint16_t vid; 214*c1d14583SBruce Richardson }; 215*c1d14583SBruce Richardson 216*c1d14583SBruce Richardson #define ICE_VLAN(tpid, vid) \ 217*c1d14583SBruce Richardson ((struct ice_vlan){ tpid, vid }) 218*c1d14583SBruce Richardson 219*c1d14583SBruce Richardson /** 220*c1d14583SBruce Richardson * VLAN filter structure 221*c1d14583SBruce Richardson */ 222*c1d14583SBruce Richardson struct ice_vlan_filter_info { 223*c1d14583SBruce Richardson struct ice_vlan vlan; 224*c1d14583SBruce Richardson }; 225*c1d14583SBruce Richardson 226*c1d14583SBruce Richardson TAILQ_HEAD(ice_vlan_filter_list, ice_vlan_filter); 227*c1d14583SBruce Richardson 228*c1d14583SBruce Richardson /* VLAN filter list structure */ 229*c1d14583SBruce Richardson struct ice_vlan_filter { 230*c1d14583SBruce Richardson TAILQ_ENTRY(ice_vlan_filter) next; 231*c1d14583SBruce Richardson struct ice_vlan_filter_info vlan_info; 232*c1d14583SBruce Richardson }; 233*c1d14583SBruce Richardson 234*c1d14583SBruce Richardson struct pool_entry { 235*c1d14583SBruce Richardson LIST_ENTRY(pool_entry) next; 236*c1d14583SBruce Richardson uint16_t base; 237*c1d14583SBruce Richardson uint16_t len; 238*c1d14583SBruce Richardson }; 239*c1d14583SBruce Richardson 240*c1d14583SBruce Richardson LIST_HEAD(res_list, pool_entry); 241*c1d14583SBruce Richardson 242*c1d14583SBruce Richardson struct ice_res_pool_info { 243*c1d14583SBruce Richardson uint32_t base; /* Resource start index */ 244*c1d14583SBruce Richardson uint32_t num_alloc; /* Allocated resource number */ 245*c1d14583SBruce Richardson uint32_t num_free; /* Total available resource number */ 246*c1d14583SBruce Richardson struct res_list alloc_list; /* Allocated resource list */ 247*c1d14583SBruce Richardson struct res_list free_list; /* Available resource list */ 248*c1d14583SBruce Richardson }; 249*c1d14583SBruce Richardson 250*c1d14583SBruce Richardson TAILQ_HEAD(ice_vsi_list_head, ice_vsi_list); 251*c1d14583SBruce Richardson 252*c1d14583SBruce Richardson struct ice_vsi; 253*c1d14583SBruce Richardson 254*c1d14583SBruce Richardson /* VSI list structure */ 255*c1d14583SBruce Richardson struct ice_vsi_list { 256*c1d14583SBruce Richardson TAILQ_ENTRY(ice_vsi_list) list; 257*c1d14583SBruce Richardson struct ice_vsi *vsi; 258*c1d14583SBruce Richardson }; 259*c1d14583SBruce Richardson 260*c1d14583SBruce Richardson struct ice_rx_queue; 261*c1d14583SBruce Richardson struct ice_tx_queue; 262*c1d14583SBruce Richardson 263*c1d14583SBruce Richardson /** 264*c1d14583SBruce Richardson * Structure that defines a VSI, associated with a adapter. 265*c1d14583SBruce Richardson */ 266*c1d14583SBruce Richardson struct ice_vsi { 267*c1d14583SBruce Richardson struct ice_adapter *adapter; /* Backreference to associated adapter */ 268*c1d14583SBruce Richardson struct ice_aqc_vsi_props info; /* VSI properties */ 269*c1d14583SBruce Richardson /** 270*c1d14583SBruce Richardson * When drivers loaded, only a default main VSI exists. In case new VSI 271*c1d14583SBruce Richardson * needs to add, HW needs to know the layout that VSIs are organized. 272*c1d14583SBruce Richardson * Besides that, VSI isan element and can't switch packets, which needs 273*c1d14583SBruce Richardson * to add new component VEB to perform switching. So, a new VSI needs 274*c1d14583SBruce Richardson * to specify the uplink VSI (Parent VSI) before created. The 275*c1d14583SBruce Richardson * uplink VSI will check whether it had a VEB to switch packets. If no, 276*c1d14583SBruce Richardson * it will try to create one. Then, uplink VSI will move the new VSI 277*c1d14583SBruce Richardson * into its' sib_vsi_list to manage all the downlink VSI. 278*c1d14583SBruce Richardson * sib_vsi_list: the VSI list that shared the same uplink VSI. 279*c1d14583SBruce Richardson * parent_vsi : the uplink VSI. It's NULL for main VSI. 280*c1d14583SBruce Richardson * veb : the VEB associates with the VSI. 281*c1d14583SBruce Richardson */ 282*c1d14583SBruce Richardson struct ice_vsi_list sib_vsi_list; /* sibling vsi list */ 283*c1d14583SBruce Richardson struct ice_vsi *parent_vsi; 284*c1d14583SBruce Richardson enum ice_vsi_type type; /* VSI types */ 285*c1d14583SBruce Richardson uint16_t vlan_num; /* Total VLAN number */ 286*c1d14583SBruce Richardson uint16_t mac_num; /* Total mac number */ 287*c1d14583SBruce Richardson struct ice_mac_filter_list mac_list; /* macvlan filter list */ 288*c1d14583SBruce Richardson struct ice_vlan_filter_list vlan_list; /* vlan filter list */ 289*c1d14583SBruce Richardson uint16_t nb_qps; /* Number of queue pairs VSI can occupy */ 290*c1d14583SBruce Richardson uint16_t nb_used_qps; /* Number of queue pairs VSI uses */ 291*c1d14583SBruce Richardson uint16_t max_macaddrs; /* Maximum number of MAC addresses */ 292*c1d14583SBruce Richardson uint16_t base_queue; /* The first queue index of this VSI */ 293*c1d14583SBruce Richardson uint16_t vsi_id; /* Hardware Id */ 294*c1d14583SBruce Richardson uint16_t idx; /* vsi_handle: SW index in hw->vsi_ctx */ 295*c1d14583SBruce Richardson /* VF number to which the VSI connects, valid when VSI is VF type */ 296*c1d14583SBruce Richardson uint8_t vf_num; 297*c1d14583SBruce Richardson uint16_t msix_intr; /* The MSIX interrupt binds to VSI */ 298*c1d14583SBruce Richardson uint16_t nb_msix; /* The max number of msix vector */ 299*c1d14583SBruce Richardson uint8_t enabled_tc; /* The traffic class enabled */ 300*c1d14583SBruce Richardson uint8_t vlan_anti_spoof_on; /* The VLAN anti-spoofing enabled */ 301*c1d14583SBruce Richardson uint8_t vlan_filter_on; /* The VLAN filter enabled */ 302*c1d14583SBruce Richardson /* information about rss configuration */ 303*c1d14583SBruce Richardson u32 rss_key_size; 304*c1d14583SBruce Richardson u32 rss_lut_size; 305*c1d14583SBruce Richardson uint8_t *rss_lut; 306*c1d14583SBruce Richardson uint8_t *rss_key; 307*c1d14583SBruce Richardson struct ice_eth_stats eth_stats_offset; 308*c1d14583SBruce Richardson struct ice_eth_stats eth_stats; 309*c1d14583SBruce Richardson bool offset_loaded; 310*c1d14583SBruce Richardson uint64_t old_rx_bytes; 311*c1d14583SBruce Richardson uint64_t old_tx_bytes; 312*c1d14583SBruce Richardson }; 313*c1d14583SBruce Richardson 314*c1d14583SBruce Richardson enum proto_xtr_type { 315*c1d14583SBruce Richardson PROTO_XTR_NONE, 316*c1d14583SBruce Richardson PROTO_XTR_VLAN, 317*c1d14583SBruce Richardson PROTO_XTR_IPV4, 318*c1d14583SBruce Richardson PROTO_XTR_IPV6, 319*c1d14583SBruce Richardson PROTO_XTR_IPV6_FLOW, 320*c1d14583SBruce Richardson PROTO_XTR_TCP, 321*c1d14583SBruce Richardson PROTO_XTR_IP_OFFSET, 322*c1d14583SBruce Richardson PROTO_XTR_MAX /* The last one */ 323*c1d14583SBruce Richardson }; 324*c1d14583SBruce Richardson 325*c1d14583SBruce Richardson enum ice_fdir_tunnel_type { 326*c1d14583SBruce Richardson ICE_FDIR_TUNNEL_TYPE_NONE = 0, 327*c1d14583SBruce Richardson ICE_FDIR_TUNNEL_TYPE_VXLAN, 328*c1d14583SBruce Richardson ICE_FDIR_TUNNEL_TYPE_GTPU, 329*c1d14583SBruce Richardson ICE_FDIR_TUNNEL_TYPE_GTPU_EH, 330*c1d14583SBruce Richardson }; 331*c1d14583SBruce Richardson 332*c1d14583SBruce Richardson struct rte_flow; 333*c1d14583SBruce Richardson TAILQ_HEAD(ice_flow_list, rte_flow); 334*c1d14583SBruce Richardson 335*c1d14583SBruce Richardson struct ice_flow_parser_node; 336*c1d14583SBruce Richardson TAILQ_HEAD(ice_parser_list, ice_flow_parser_node); 337*c1d14583SBruce Richardson 338*c1d14583SBruce Richardson struct ice_fdir_filter_conf { 339*c1d14583SBruce Richardson struct ice_fdir_fltr input; 340*c1d14583SBruce Richardson enum ice_fdir_tunnel_type tunnel_type; 341*c1d14583SBruce Richardson 342*c1d14583SBruce Richardson struct ice_fdir_counter *counter; /* flow specific counter context */ 343*c1d14583SBruce Richardson struct rte_flow_action_count act_count; 344*c1d14583SBruce Richardson 345*c1d14583SBruce Richardson uint64_t input_set_o; /* used for non-tunnel or tunnel outer fields */ 346*c1d14583SBruce Richardson uint64_t input_set_i; /* only for tunnel inner fields */ 347*c1d14583SBruce Richardson uint32_t mark_flag; 348*c1d14583SBruce Richardson 349*c1d14583SBruce Richardson struct ice_parser_profile *prof; 350*c1d14583SBruce Richardson bool parser_ena; 351*c1d14583SBruce Richardson u8 *pkt_buf; 352*c1d14583SBruce Richardson u8 pkt_len; 353*c1d14583SBruce Richardson }; 354*c1d14583SBruce Richardson 355*c1d14583SBruce Richardson struct ice_fdir_fltr_pattern { 356*c1d14583SBruce Richardson enum ice_fltr_ptype flow_type; 357*c1d14583SBruce Richardson 358*c1d14583SBruce Richardson union { 359*c1d14583SBruce Richardson struct ice_fdir_v4 v4; 360*c1d14583SBruce Richardson struct ice_fdir_v6 v6; 361*c1d14583SBruce Richardson } ip, mask; 362*c1d14583SBruce Richardson 363*c1d14583SBruce Richardson struct ice_fdir_udp_gtp gtpu_data; 364*c1d14583SBruce Richardson struct ice_fdir_udp_gtp gtpu_mask; 365*c1d14583SBruce Richardson 366*c1d14583SBruce Richardson struct ice_fdir_extra ext_data; 367*c1d14583SBruce Richardson struct ice_fdir_extra ext_mask; 368*c1d14583SBruce Richardson 369*c1d14583SBruce Richardson enum ice_fdir_tunnel_type tunnel_type; 370*c1d14583SBruce Richardson }; 371*c1d14583SBruce Richardson 372*c1d14583SBruce Richardson #define ICE_FDIR_COUNTER_DEFAULT_POOL_SIZE 1 373*c1d14583SBruce Richardson #define ICE_FDIR_COUNTER_MAX_POOL_SIZE 32 374*c1d14583SBruce Richardson #define ICE_FDIR_COUNTERS_PER_BLOCK 256 375*c1d14583SBruce Richardson #define ICE_FDIR_COUNTER_INDEX(base_idx) \ 376*c1d14583SBruce Richardson ((base_idx) * ICE_FDIR_COUNTERS_PER_BLOCK) 377*c1d14583SBruce Richardson struct ice_fdir_counter_pool; 378*c1d14583SBruce Richardson 379*c1d14583SBruce Richardson struct ice_fdir_counter { 380*c1d14583SBruce Richardson TAILQ_ENTRY(ice_fdir_counter) next; 381*c1d14583SBruce Richardson struct ice_fdir_counter_pool *pool; 382*c1d14583SBruce Richardson uint8_t shared; 383*c1d14583SBruce Richardson uint32_t ref_cnt; 384*c1d14583SBruce Richardson uint32_t id; 385*c1d14583SBruce Richardson uint64_t hits; 386*c1d14583SBruce Richardson uint64_t bytes; 387*c1d14583SBruce Richardson uint32_t hw_index; 388*c1d14583SBruce Richardson }; 389*c1d14583SBruce Richardson 390*c1d14583SBruce Richardson TAILQ_HEAD(ice_fdir_counter_list, ice_fdir_counter); 391*c1d14583SBruce Richardson 392*c1d14583SBruce Richardson struct ice_fdir_counter_pool { 393*c1d14583SBruce Richardson TAILQ_ENTRY(ice_fdir_counter_pool) next; 394*c1d14583SBruce Richardson struct ice_fdir_counter_list counter_list; 395*c1d14583SBruce Richardson struct ice_fdir_counter counters[0]; 396*c1d14583SBruce Richardson }; 397*c1d14583SBruce Richardson 398*c1d14583SBruce Richardson TAILQ_HEAD(ice_fdir_counter_pool_list, ice_fdir_counter_pool); 399*c1d14583SBruce Richardson 400*c1d14583SBruce Richardson struct ice_fdir_counter_pool_container { 401*c1d14583SBruce Richardson struct ice_fdir_counter_pool_list pool_list; 402*c1d14583SBruce Richardson struct ice_fdir_counter_pool *pools[ICE_FDIR_COUNTER_MAX_POOL_SIZE]; 403*c1d14583SBruce Richardson uint8_t index_free; 404*c1d14583SBruce Richardson }; 405*c1d14583SBruce Richardson 406*c1d14583SBruce Richardson /** 407*c1d14583SBruce Richardson * A structure used to define fields of a FDIR related info. 408*c1d14583SBruce Richardson */ 409*c1d14583SBruce Richardson struct ice_fdir_info { 410*c1d14583SBruce Richardson struct ice_vsi *fdir_vsi; /* pointer to fdir VSI structure */ 411*c1d14583SBruce Richardson struct ice_tx_queue *txq; 412*c1d14583SBruce Richardson struct ice_rx_queue *rxq; 413*c1d14583SBruce Richardson void *prg_pkt; /* memory for fdir program packet */ 414*c1d14583SBruce Richardson uint64_t dma_addr; /* physic address of packet memory*/ 415*c1d14583SBruce Richardson const struct rte_memzone *mz; 416*c1d14583SBruce Richardson struct ice_fdir_filter_conf conf; 417*c1d14583SBruce Richardson 418*c1d14583SBruce Richardson struct ice_fdir_filter_conf **hash_map; 419*c1d14583SBruce Richardson struct rte_hash *hash_table; 420*c1d14583SBruce Richardson 421*c1d14583SBruce Richardson struct ice_fdir_counter_pool_container counter; 422*c1d14583SBruce Richardson }; 423*c1d14583SBruce Richardson 424*c1d14583SBruce Richardson #define ICE_HASH_GTPU_CTX_EH_IP 0 425*c1d14583SBruce Richardson #define ICE_HASH_GTPU_CTX_EH_IP_UDP 1 426*c1d14583SBruce Richardson #define ICE_HASH_GTPU_CTX_EH_IP_TCP 2 427*c1d14583SBruce Richardson #define ICE_HASH_GTPU_CTX_UP_IP 3 428*c1d14583SBruce Richardson #define ICE_HASH_GTPU_CTX_UP_IP_UDP 4 429*c1d14583SBruce Richardson #define ICE_HASH_GTPU_CTX_UP_IP_TCP 5 430*c1d14583SBruce Richardson #define ICE_HASH_GTPU_CTX_DW_IP 6 431*c1d14583SBruce Richardson #define ICE_HASH_GTPU_CTX_DW_IP_UDP 7 432*c1d14583SBruce Richardson #define ICE_HASH_GTPU_CTX_DW_IP_TCP 8 433*c1d14583SBruce Richardson #define ICE_HASH_GTPU_CTX_MAX 9 434*c1d14583SBruce Richardson 435*c1d14583SBruce Richardson struct ice_hash_gtpu_ctx { 436*c1d14583SBruce Richardson struct ice_rss_hash_cfg ctx[ICE_HASH_GTPU_CTX_MAX]; 437*c1d14583SBruce Richardson }; 438*c1d14583SBruce Richardson 439*c1d14583SBruce Richardson struct ice_hash_ctx { 440*c1d14583SBruce Richardson struct ice_hash_gtpu_ctx gtpu4; 441*c1d14583SBruce Richardson struct ice_hash_gtpu_ctx gtpu6; 442*c1d14583SBruce Richardson }; 443*c1d14583SBruce Richardson 444*c1d14583SBruce Richardson struct ice_acl_conf { 445*c1d14583SBruce Richardson struct ice_fdir_fltr input; 446*c1d14583SBruce Richardson uint64_t input_set; 447*c1d14583SBruce Richardson }; 448*c1d14583SBruce Richardson 449*c1d14583SBruce Richardson /** 450*c1d14583SBruce Richardson * A structure used to define fields of ACL related info. 451*c1d14583SBruce Richardson */ 452*c1d14583SBruce Richardson struct ice_acl_info { 453*c1d14583SBruce Richardson struct ice_acl_conf conf; 454*c1d14583SBruce Richardson struct rte_bitmap *slots; 455*c1d14583SBruce Richardson uint64_t hw_entry_id[MAX_ACL_NORMAL_ENTRIES]; 456*c1d14583SBruce Richardson }; 457*c1d14583SBruce Richardson 458*c1d14583SBruce Richardson TAILQ_HEAD(ice_shaper_profile_list, ice_tm_shaper_profile); 459*c1d14583SBruce Richardson TAILQ_HEAD(ice_tm_node_list, ice_tm_node); 460*c1d14583SBruce Richardson 461*c1d14583SBruce Richardson #define ICE_TM_MAX_LAYERS ICE_SCHED_9_LAYERS 462*c1d14583SBruce Richardson 463*c1d14583SBruce Richardson struct ice_tm_shaper_profile { 464*c1d14583SBruce Richardson TAILQ_ENTRY(ice_tm_shaper_profile) node; 465*c1d14583SBruce Richardson uint32_t shaper_profile_id; 466*c1d14583SBruce Richardson uint32_t reference_count; 467*c1d14583SBruce Richardson struct rte_tm_shaper_params profile; 468*c1d14583SBruce Richardson }; 469*c1d14583SBruce Richardson 470*c1d14583SBruce Richardson /* Struct to store Traffic Manager node configuration. */ 471*c1d14583SBruce Richardson struct ice_tm_node { 472*c1d14583SBruce Richardson TAILQ_ENTRY(ice_tm_node) node; 473*c1d14583SBruce Richardson uint32_t id; 474*c1d14583SBruce Richardson uint32_t priority; 475*c1d14583SBruce Richardson uint32_t weight; 476*c1d14583SBruce Richardson uint32_t level; 477*c1d14583SBruce Richardson uint32_t reference_count; 478*c1d14583SBruce Richardson struct ice_tm_node *parent; 479*c1d14583SBruce Richardson struct ice_tm_node **children; 480*c1d14583SBruce Richardson struct ice_tm_shaper_profile *shaper_profile; 481*c1d14583SBruce Richardson struct rte_tm_node_params params; 482*c1d14583SBruce Richardson struct ice_sched_node *sched_node; 483*c1d14583SBruce Richardson }; 484*c1d14583SBruce Richardson 485*c1d14583SBruce Richardson /* Struct to store all the Traffic Manager configuration. */ 486*c1d14583SBruce Richardson struct ice_tm_conf { 487*c1d14583SBruce Richardson struct ice_shaper_profile_list shaper_profile_list; 488*c1d14583SBruce Richardson struct ice_tm_node *root; /* root node - port */ 489*c1d14583SBruce Richardson uint8_t hidden_layers; /* the number of hierarchy layers hidden from app */ 490*c1d14583SBruce Richardson bool committed; 491*c1d14583SBruce Richardson bool clear_on_fail; 492*c1d14583SBruce Richardson }; 493*c1d14583SBruce Richardson 494*c1d14583SBruce Richardson struct ice_mbuf_stats { 495*c1d14583SBruce Richardson uint64_t tx_pkt_errors; 496*c1d14583SBruce Richardson }; 497*c1d14583SBruce Richardson 498*c1d14583SBruce Richardson struct ice_pf { 499*c1d14583SBruce Richardson struct ice_adapter *adapter; /* The adapter this PF associate to */ 500*c1d14583SBruce Richardson struct ice_vsi *main_vsi; /* pointer to main VSI structure */ 501*c1d14583SBruce Richardson /* Used for next free software vsi idx. 502*c1d14583SBruce Richardson * To save the effort, we don't recycle the index. 503*c1d14583SBruce Richardson * Suppose the indexes are more than enough. 504*c1d14583SBruce Richardson */ 505*c1d14583SBruce Richardson uint16_t next_vsi_idx; 506*c1d14583SBruce Richardson uint16_t vsis_allocated; 507*c1d14583SBruce Richardson uint16_t vsis_unallocated; 508*c1d14583SBruce Richardson struct ice_res_pool_info qp_pool; /*Queue pair pool */ 509*c1d14583SBruce Richardson struct ice_res_pool_info msix_pool; /* MSIX interrupt pool */ 510*c1d14583SBruce Richardson struct rte_eth_dev_data *dev_data; /* Pointer to the device data */ 511*c1d14583SBruce Richardson struct rte_ether_addr dev_addr; /* PF device mac address */ 512*c1d14583SBruce Richardson uint64_t flags; /* PF feature flags */ 513*c1d14583SBruce Richardson uint16_t hash_lut_size; /* The size of hash lookup table */ 514*c1d14583SBruce Richardson uint16_t lan_nb_qp_max; 515*c1d14583SBruce Richardson uint16_t lan_nb_qps; /* The number of queue pairs of LAN */ 516*c1d14583SBruce Richardson uint16_t base_queue; /* The base queue pairs index in the device */ 517*c1d14583SBruce Richardson uint8_t *proto_xtr; /* Protocol extraction type for all queues */ 518*c1d14583SBruce Richardson uint16_t fdir_nb_qps; /* The number of queue pairs of Flow Director */ 519*c1d14583SBruce Richardson uint16_t fdir_qp_offset; 520*c1d14583SBruce Richardson struct ice_fdir_info fdir; /* flow director info */ 521*c1d14583SBruce Richardson struct ice_acl_info acl; /* ACL info */ 522*c1d14583SBruce Richardson struct ice_hash_ctx hash_ctx; 523*c1d14583SBruce Richardson uint16_t hw_prof_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX]; 524*c1d14583SBruce Richardson uint16_t fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX][ICE_FD_HW_SEG_MAX]; 525*c1d14583SBruce Richardson struct ice_hw_port_stats stats_offset; 526*c1d14583SBruce Richardson struct ice_hw_port_stats stats; 527*c1d14583SBruce Richardson struct ice_mbuf_stats mbuf_stats; 528*c1d14583SBruce Richardson /* internal packet statistics, it should be excluded from the total */ 529*c1d14583SBruce Richardson struct ice_eth_stats internal_stats_offset; 530*c1d14583SBruce Richardson struct ice_eth_stats internal_stats; 531*c1d14583SBruce Richardson bool offset_loaded; 532*c1d14583SBruce Richardson bool adapter_stopped; 533*c1d14583SBruce Richardson struct ice_flow_list flow_list; 534*c1d14583SBruce Richardson rte_spinlock_t flow_ops_lock; 535*c1d14583SBruce Richardson bool init_link_up; 536*c1d14583SBruce Richardson uint64_t old_rx_bytes; 537*c1d14583SBruce Richardson uint64_t old_tx_bytes; 538*c1d14583SBruce Richardson uint64_t supported_rxdid; /* bitmap for supported RXDID */ 539*c1d14583SBruce Richardson uint64_t rss_hf; 540*c1d14583SBruce Richardson struct ice_tm_conf tm_conf; 541*c1d14583SBruce Richardson uint16_t outer_ethertype; 542*c1d14583SBruce Richardson /* lock prevent race condition between lsc interrupt handler 543*c1d14583SBruce Richardson * and link status update during dev_start. 544*c1d14583SBruce Richardson */ 545*c1d14583SBruce Richardson rte_spinlock_t link_lock; 546*c1d14583SBruce Richardson }; 547*c1d14583SBruce Richardson 548*c1d14583SBruce Richardson #define ICE_MAX_QUEUE_NUM 2048 549*c1d14583SBruce Richardson #define ICE_MAX_PIN_NUM 4 550*c1d14583SBruce Richardson 551*c1d14583SBruce Richardson /** 552*c1d14583SBruce Richardson * Cache devargs parse result. 553*c1d14583SBruce Richardson */ 554*c1d14583SBruce Richardson struct ice_devargs { 555*c1d14583SBruce Richardson int rx_low_latency; 556*c1d14583SBruce Richardson int safe_mode_support; 557*c1d14583SBruce Richardson uint8_t proto_xtr_dflt; 558*c1d14583SBruce Richardson uint8_t default_mac_disable; 559*c1d14583SBruce Richardson uint8_t proto_xtr[ICE_MAX_QUEUE_NUM]; 560*c1d14583SBruce Richardson uint8_t pin_idx; 561*c1d14583SBruce Richardson uint8_t pps_out_ena; 562*c1d14583SBruce Richardson uint8_t ddp_load_sched; 563*c1d14583SBruce Richardson uint8_t tm_exposed_levels; 564*c1d14583SBruce Richardson int xtr_field_offs; 565*c1d14583SBruce Richardson uint8_t xtr_flag_offs[PROTO_XTR_MAX]; 566*c1d14583SBruce Richardson /* Name of the field. */ 567*c1d14583SBruce Richardson char xtr_field_name[RTE_MBUF_DYN_NAMESIZE]; 568*c1d14583SBruce Richardson uint64_t mbuf_check; 569*c1d14583SBruce Richardson const char *ddp_filename; 570*c1d14583SBruce Richardson }; 571*c1d14583SBruce Richardson 572*c1d14583SBruce Richardson /** 573*c1d14583SBruce Richardson * Structure to store fdir fv entry. 574*c1d14583SBruce Richardson */ 575*c1d14583SBruce Richardson struct ice_fdir_prof_info { 576*c1d14583SBruce Richardson struct ice_parser_profile prof; 577*c1d14583SBruce Richardson u64 fdir_actived_cnt; 578*c1d14583SBruce Richardson }; 579*c1d14583SBruce Richardson 580*c1d14583SBruce Richardson /** 581*c1d14583SBruce Richardson * Structure to store rss fv entry. 582*c1d14583SBruce Richardson */ 583*c1d14583SBruce Richardson struct ice_rss_prof_info { 584*c1d14583SBruce Richardson struct ice_parser_profile prof; 585*c1d14583SBruce Richardson bool symm; 586*c1d14583SBruce Richardson }; 587*c1d14583SBruce Richardson 588*c1d14583SBruce Richardson #define ICE_MBUF_CHECK_F_TX_MBUF (1ULL << 0) 589*c1d14583SBruce Richardson #define ICE_MBUF_CHECK_F_TX_SIZE (1ULL << 1) 590*c1d14583SBruce Richardson #define ICE_MBUF_CHECK_F_TX_SEGMENT (1ULL << 2) 591*c1d14583SBruce Richardson #define ICE_MBUF_CHECK_F_TX_OFFLOAD (1ULL << 3) 592*c1d14583SBruce Richardson 593*c1d14583SBruce Richardson /** 594*c1d14583SBruce Richardson * Structure to store private data for each PF/VF instance. 595*c1d14583SBruce Richardson */ 596*c1d14583SBruce Richardson struct ice_adapter { 597*c1d14583SBruce Richardson /* Common for both PF and VF */ 598*c1d14583SBruce Richardson struct ice_hw hw; 599*c1d14583SBruce Richardson struct ice_pf pf; 600*c1d14583SBruce Richardson bool rx_bulk_alloc_allowed; 601*c1d14583SBruce Richardson bool rx_vec_allowed; 602*c1d14583SBruce Richardson bool tx_vec_allowed; 603*c1d14583SBruce Richardson bool tx_simple_allowed; 604*c1d14583SBruce Richardson /* ptype mapping table */ 605*c1d14583SBruce Richardson alignas(RTE_CACHE_LINE_MIN_SIZE) uint32_t ptype_tbl[ICE_MAX_PKT_TYPE]; 606*c1d14583SBruce Richardson bool is_safe_mode; 607*c1d14583SBruce Richardson struct ice_devargs devargs; 608*c1d14583SBruce Richardson enum ice_pkg_type active_pkg_type; /* loaded ddp package type */ 609*c1d14583SBruce Richardson uint16_t fdir_ref_cnt; 610*c1d14583SBruce Richardson /* For vector PMD */ 611*c1d14583SBruce Richardson eth_rx_burst_t tx_pkt_burst; 612*c1d14583SBruce Richardson /* For PTP */ 613*c1d14583SBruce Richardson uint8_t ptp_tx_block; 614*c1d14583SBruce Richardson uint8_t ptp_tx_index; 615*c1d14583SBruce Richardson bool ptp_ena; 616*c1d14583SBruce Richardson uint64_t time_hw; 617*c1d14583SBruce Richardson struct ice_fdir_prof_info fdir_prof_info[ICE_MAX_PTGS]; 618*c1d14583SBruce Richardson struct ice_rss_prof_info rss_prof_info[ICE_MAX_PTGS]; 619*c1d14583SBruce Richardson /* True if DCF state of the associated PF is on */ 620*c1d14583SBruce Richardson RTE_ATOMIC(bool) dcf_state_on; 621*c1d14583SBruce Richardson /* Set bit if the engine is disabled */ 622*c1d14583SBruce Richardson unsigned long disabled_engine_mask; 623*c1d14583SBruce Richardson struct ice_parser *psr; 624*c1d14583SBruce Richardson #ifdef RTE_ARCH_X86 625*c1d14583SBruce Richardson bool rx_use_avx2; 626*c1d14583SBruce Richardson bool rx_use_avx512; 627*c1d14583SBruce Richardson bool tx_use_avx2; 628*c1d14583SBruce Richardson bool tx_use_avx512; 629*c1d14583SBruce Richardson bool rx_vec_offload_support; 630*c1d14583SBruce Richardson #endif 631*c1d14583SBruce Richardson }; 632*c1d14583SBruce Richardson 633*c1d14583SBruce Richardson struct ice_vsi_vlan_pvid_info { 634*c1d14583SBruce Richardson uint16_t on; /* Enable or disable pvid */ 635*c1d14583SBruce Richardson union { 636*c1d14583SBruce Richardson uint16_t pvid; /* Valid in case 'on' is set to set pvid */ 637*c1d14583SBruce Richardson struct { 638*c1d14583SBruce Richardson /* Valid in case 'on' is cleared. 'tagged' will reject 639*c1d14583SBruce Richardson * tagged packets, while 'untagged' will reject 640*c1d14583SBruce Richardson * untagged packets. 641*c1d14583SBruce Richardson */ 642*c1d14583SBruce Richardson uint8_t tagged; 643*c1d14583SBruce Richardson uint8_t untagged; 644*c1d14583SBruce Richardson } reject; 645*c1d14583SBruce Richardson } config; 646*c1d14583SBruce Richardson }; 647*c1d14583SBruce Richardson 648*c1d14583SBruce Richardson #define ICE_DEV_TO_PCI(eth_dev) \ 649*c1d14583SBruce Richardson RTE_DEV_TO_PCI((eth_dev)->device) 650*c1d14583SBruce Richardson 651*c1d14583SBruce Richardson /* ICE_DEV_PRIVATE_TO */ 652*c1d14583SBruce Richardson #define ICE_DEV_PRIVATE_TO_PF(adapter) \ 653*c1d14583SBruce Richardson (&((struct ice_adapter *)adapter)->pf) 654*c1d14583SBruce Richardson #define ICE_DEV_PRIVATE_TO_HW(adapter) \ 655*c1d14583SBruce Richardson (&((struct ice_adapter *)adapter)->hw) 656*c1d14583SBruce Richardson #define ICE_DEV_PRIVATE_TO_ADAPTER(adapter) \ 657*c1d14583SBruce Richardson ((struct ice_adapter *)adapter) 658*c1d14583SBruce Richardson 659*c1d14583SBruce Richardson /* ICE_VSI_TO */ 660*c1d14583SBruce Richardson #define ICE_VSI_TO_HW(vsi) \ 661*c1d14583SBruce Richardson (&(((struct ice_vsi *)vsi)->adapter->hw)) 662*c1d14583SBruce Richardson #define ICE_VSI_TO_PF(vsi) \ 663*c1d14583SBruce Richardson (&(((struct ice_vsi *)vsi)->adapter->pf)) 664*c1d14583SBruce Richardson 665*c1d14583SBruce Richardson /* ICE_PF_TO */ 666*c1d14583SBruce Richardson #define ICE_PF_TO_HW(pf) \ 667*c1d14583SBruce Richardson (&((pf)->adapter->hw)) 668*c1d14583SBruce Richardson #define ICE_PF_TO_ADAPTER(pf) \ 669*c1d14583SBruce Richardson ((struct ice_adapter *)(pf)->adapter) 670*c1d14583SBruce Richardson #define ICE_PF_TO_ETH_DEV(pf) \ 671*c1d14583SBruce Richardson (((struct ice_pf *)pf)->adapter->eth_dev) 672*c1d14583SBruce Richardson 673*c1d14583SBruce Richardson bool is_ice_supported(struct rte_eth_dev *dev); 674*c1d14583SBruce Richardson int 675*c1d14583SBruce Richardson ice_load_pkg(struct ice_adapter *adapter, bool use_dsn, uint64_t dsn); 676*c1d14583SBruce Richardson struct ice_vsi * 677*c1d14583SBruce Richardson ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type); 678*c1d14583SBruce Richardson int 679*c1d14583SBruce Richardson ice_release_vsi(struct ice_vsi *vsi); 680*c1d14583SBruce Richardson void ice_vsi_enable_queues_intr(struct ice_vsi *vsi); 681*c1d14583SBruce Richardson void ice_vsi_disable_queues_intr(struct ice_vsi *vsi); 682*c1d14583SBruce Richardson void ice_vsi_queues_bind_intr(struct ice_vsi *vsi); 683*c1d14583SBruce Richardson int ice_add_rss_cfg_wrap(struct ice_pf *pf, uint16_t vsi_id, 684*c1d14583SBruce Richardson struct ice_rss_hash_cfg *cfg); 685*c1d14583SBruce Richardson int ice_rem_rss_cfg_wrap(struct ice_pf *pf, uint16_t vsi_id, 686*c1d14583SBruce Richardson struct ice_rss_hash_cfg *cfg); 687*c1d14583SBruce Richardson void ice_tm_conf_init(struct rte_eth_dev *dev); 688*c1d14583SBruce Richardson void ice_tm_conf_uninit(struct rte_eth_dev *dev); 689*c1d14583SBruce Richardson extern const struct rte_tm_ops ice_tm_ops; 690*c1d14583SBruce Richardson 691*c1d14583SBruce Richardson static inline int 692*c1d14583SBruce Richardson ice_align_floor(int n) 693*c1d14583SBruce Richardson { 694*c1d14583SBruce Richardson if (n == 0) 695*c1d14583SBruce Richardson return 0; 696*c1d14583SBruce Richardson return 1 << (sizeof(n) * CHAR_BIT - 1 - rte_clz32(n)); 697*c1d14583SBruce Richardson } 698*c1d14583SBruce Richardson 699*c1d14583SBruce Richardson #define ICE_PHY_TYPE_SUPPORT_50G(phy_type) \ 700*c1d14583SBruce Richardson (((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_CR2) || \ 701*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_SR2) || \ 702*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_LR2) || \ 703*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_KR2) || \ 704*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50G_LAUI2_AOC_ACC) || \ 705*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50G_LAUI2) || \ 706*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50G_AUI2_AOC_ACC) || \ 707*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50G_AUI2) || \ 708*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_CP) || \ 709*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_SR) || \ 710*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_FR) || \ 711*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_LR) || \ 712*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_KR_PAM4) || \ 713*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50G_AUI1_AOC_ACC) || \ 714*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_50G_AUI1)) 715*c1d14583SBruce Richardson 716*c1d14583SBruce Richardson #define ICE_PHY_TYPE_SUPPORT_100G_LOW(phy_type) \ 717*c1d14583SBruce Richardson (((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_CR4) || \ 718*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_SR4) || \ 719*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_LR4) || \ 720*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_KR4) || \ 721*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_100G_CAUI4_AOC_ACC) || \ 722*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_100G_CAUI4) || \ 723*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_100G_AUI4_AOC_ACC) || \ 724*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_100G_AUI4) || \ 725*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_CR_PAM4) || \ 726*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_KR_PAM4) || \ 727*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_CP2) || \ 728*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_SR2) || \ 729*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_DR)) 730*c1d14583SBruce Richardson 731*c1d14583SBruce Richardson #define ICE_PHY_TYPE_SUPPORT_100G_HIGH(phy_type) \ 732*c1d14583SBruce Richardson (((phy_type) & ICE_PHY_TYPE_HIGH_100GBASE_KR2_PAM4) || \ 733*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_100G_CAUI2_AOC_ACC) || \ 734*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_100G_CAUI2) || \ 735*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC) || \ 736*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_100G_AUI2)) 737*c1d14583SBruce Richardson 738*c1d14583SBruce Richardson #define ICE_PHY_TYPE_SUPPORT_200G_HIGH(phy_type) \ 739*c1d14583SBruce Richardson (((phy_type) & ICE_PHY_TYPE_HIGH_200G_CR4_PAM4) || \ 740*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_200G_SR4) || \ 741*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_200G_FR4) || \ 742*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_200G_LR4) || \ 743*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_200G_DR4) || \ 744*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_200G_KR4_PAM4) || \ 745*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_200G_AUI4_AOC_ACC) || \ 746*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_200G_AUI4) || \ 747*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_200G_AUI8_AOC_ACC) || \ 748*c1d14583SBruce Richardson ((phy_type) & ICE_PHY_TYPE_HIGH_200G_AUI8)) 749*c1d14583SBruce Richardson 750*c1d14583SBruce Richardson __rte_experimental 751*c1d14583SBruce Richardson int rte_pmd_ice_dump_package(uint16_t port, uint8_t **buff, uint32_t *size); 752*c1d14583SBruce Richardson 753*c1d14583SBruce Richardson __rte_experimental 754*c1d14583SBruce Richardson int rte_pmd_ice_dump_switch(uint16_t port, uint8_t **buff, uint32_t *size); 755*c1d14583SBruce Richardson 756*c1d14583SBruce Richardson __rte_experimental 757*c1d14583SBruce Richardson int rte_pmd_ice_dump_txsched(uint16_t port, bool detail, FILE *stream); 758*c1d14583SBruce Richardson 759*c1d14583SBruce Richardson int 760*c1d14583SBruce Richardson ice_tm_setup_txq_node(struct ice_pf *pf, struct ice_hw *hw, uint16_t qid, uint32_t node_teid); 761*c1d14583SBruce Richardson 762*c1d14583SBruce Richardson #endif /* _ICE_ETHDEV_H_ */ 763