161ae650dSJack F Vogel /****************************************************************************** 261ae650dSJack F Vogel 3*f4cc2d17SEric Joyner Copyright (c) 2013-2018, Intel Corporation 461ae650dSJack F Vogel All rights reserved. 561ae650dSJack F Vogel 661ae650dSJack F Vogel Redistribution and use in source and binary forms, with or without 761ae650dSJack F Vogel modification, are permitted provided that the following conditions are met: 861ae650dSJack F Vogel 961ae650dSJack F Vogel 1. Redistributions of source code must retain the above copyright notice, 1061ae650dSJack F Vogel this list of conditions and the following disclaimer. 1161ae650dSJack F Vogel 1261ae650dSJack F Vogel 2. Redistributions in binary form must reproduce the above copyright 1361ae650dSJack F Vogel notice, this list of conditions and the following disclaimer in the 1461ae650dSJack F Vogel documentation and/or other materials provided with the distribution. 1561ae650dSJack F Vogel 1661ae650dSJack F Vogel 3. Neither the name of the Intel Corporation nor the names of its 1761ae650dSJack F Vogel contributors may be used to endorse or promote products derived from 1861ae650dSJack F Vogel this software without specific prior written permission. 1961ae650dSJack F Vogel 2061ae650dSJack F Vogel THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2161ae650dSJack F Vogel AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2261ae650dSJack F Vogel IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2361ae650dSJack F Vogel ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 2461ae650dSJack F Vogel LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2561ae650dSJack F Vogel CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2661ae650dSJack F Vogel SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2761ae650dSJack F Vogel INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2861ae650dSJack F Vogel CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2961ae650dSJack F Vogel ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3061ae650dSJack F Vogel POSSIBILITY OF SUCH DAMAGE. 3161ae650dSJack F Vogel 3261ae650dSJack F Vogel ******************************************************************************/ 3361ae650dSJack F Vogel 3461ae650dSJack F Vogel #ifndef _I40E_LAN_HMC_H_ 3561ae650dSJack F Vogel #define _I40E_LAN_HMC_H_ 3661ae650dSJack F Vogel 3761ae650dSJack F Vogel /* forward-declare the HW struct for the compiler */ 3861ae650dSJack F Vogel struct i40e_hw; 3961ae650dSJack F Vogel 4061ae650dSJack F Vogel /* HMC element context information */ 4161ae650dSJack F Vogel 4261ae650dSJack F Vogel /* Rx queue context data 4361ae650dSJack F Vogel * 4461ae650dSJack F Vogel * The sizes of the variables may be larger than needed due to crossing byte 4561ae650dSJack F Vogel * boundaries. If we do not have the width of the variable set to the correct 4661ae650dSJack F Vogel * size then we could end up shifting bits off the top of the variable when the 4761ae650dSJack F Vogel * variable is at the top of a byte and crosses over into the next byte. 4861ae650dSJack F Vogel */ 4961ae650dSJack F Vogel struct i40e_hmc_obj_rxq { 5061ae650dSJack F Vogel u16 head; 5161ae650dSJack F Vogel u16 cpuid; /* bigger than needed, see above for reason */ 5261ae650dSJack F Vogel u64 base; 5361ae650dSJack F Vogel u16 qlen; 5461ae650dSJack F Vogel #define I40E_RXQ_CTX_DBUFF_SHIFT 7 5561ae650dSJack F Vogel u16 dbuff; /* bigger than needed, see above for reason */ 5661ae650dSJack F Vogel #define I40E_RXQ_CTX_HBUFF_SHIFT 6 5761ae650dSJack F Vogel u16 hbuff; /* bigger than needed, see above for reason */ 5861ae650dSJack F Vogel u8 dtype; 5961ae650dSJack F Vogel u8 dsize; 6061ae650dSJack F Vogel u8 crcstrip; 6161ae650dSJack F Vogel u8 fc_ena; 6261ae650dSJack F Vogel u8 l2tsel; 6361ae650dSJack F Vogel u8 hsplit_0; 6461ae650dSJack F Vogel u8 hsplit_1; 6561ae650dSJack F Vogel u8 showiv; 6661ae650dSJack F Vogel u32 rxmax; /* bigger than needed, see above for reason */ 6761ae650dSJack F Vogel u8 tphrdesc_ena; 6861ae650dSJack F Vogel u8 tphwdesc_ena; 6961ae650dSJack F Vogel u8 tphdata_ena; 7061ae650dSJack F Vogel u8 tphhead_ena; 7161ae650dSJack F Vogel u16 lrxqthresh; /* bigger than needed, see above for reason */ 7261ae650dSJack F Vogel u8 prefena; /* NOTE: normally must be set to 1 at init */ 7361ae650dSJack F Vogel }; 7461ae650dSJack F Vogel 7561ae650dSJack F Vogel /* Tx queue context data 7661ae650dSJack F Vogel * 7761ae650dSJack F Vogel * The sizes of the variables may be larger than needed due to crossing byte 7861ae650dSJack F Vogel * boundaries. If we do not have the width of the variable set to the correct 7961ae650dSJack F Vogel * size then we could end up shifting bits off the top of the variable when the 8061ae650dSJack F Vogel * variable is at the top of a byte and crosses over into the next byte. 8161ae650dSJack F Vogel */ 8261ae650dSJack F Vogel struct i40e_hmc_obj_txq { 8361ae650dSJack F Vogel u16 head; 8461ae650dSJack F Vogel u8 new_context; 8561ae650dSJack F Vogel u64 base; 8661ae650dSJack F Vogel u8 fc_ena; 8761ae650dSJack F Vogel u8 timesync_ena; 8861ae650dSJack F Vogel u8 fd_ena; 8961ae650dSJack F Vogel u8 alt_vlan_ena; 9061ae650dSJack F Vogel u16 thead_wb; 9161ae650dSJack F Vogel u8 cpuid; 9261ae650dSJack F Vogel u8 head_wb_ena; 9361ae650dSJack F Vogel u16 qlen; 9461ae650dSJack F Vogel u8 tphrdesc_ena; 9561ae650dSJack F Vogel u8 tphrpacket_ena; 9661ae650dSJack F Vogel u8 tphwdesc_ena; 9761ae650dSJack F Vogel u64 head_wb_addr; 9861ae650dSJack F Vogel u32 crc; 9961ae650dSJack F Vogel u16 rdylist; 10061ae650dSJack F Vogel u8 rdylist_act; 10161ae650dSJack F Vogel }; 10261ae650dSJack F Vogel 10361ae650dSJack F Vogel /* for hsplit_0 field of Rx HMC context */ 10461ae650dSJack F Vogel enum i40e_hmc_obj_rx_hsplit_0 { 10561ae650dSJack F Vogel I40E_HMC_OBJ_RX_HSPLIT_0_NO_SPLIT = 0, 10661ae650dSJack F Vogel I40E_HMC_OBJ_RX_HSPLIT_0_SPLIT_L2 = 1, 10761ae650dSJack F Vogel I40E_HMC_OBJ_RX_HSPLIT_0_SPLIT_IP = 2, 10861ae650dSJack F Vogel I40E_HMC_OBJ_RX_HSPLIT_0_SPLIT_TCP_UDP = 4, 10961ae650dSJack F Vogel I40E_HMC_OBJ_RX_HSPLIT_0_SPLIT_SCTP = 8, 11061ae650dSJack F Vogel }; 11161ae650dSJack F Vogel 11261ae650dSJack F Vogel /* fcoe_cntx and fcoe_filt are for debugging purpose only */ 11361ae650dSJack F Vogel struct i40e_hmc_obj_fcoe_cntx { 11461ae650dSJack F Vogel u32 rsv[32]; 11561ae650dSJack F Vogel }; 11661ae650dSJack F Vogel 11761ae650dSJack F Vogel struct i40e_hmc_obj_fcoe_filt { 11861ae650dSJack F Vogel u32 rsv[8]; 11961ae650dSJack F Vogel }; 12061ae650dSJack F Vogel 12161ae650dSJack F Vogel /* Context sizes for LAN objects */ 12261ae650dSJack F Vogel enum i40e_hmc_lan_object_size { 12361ae650dSJack F Vogel I40E_HMC_LAN_OBJ_SZ_8 = 0x3, 12461ae650dSJack F Vogel I40E_HMC_LAN_OBJ_SZ_16 = 0x4, 12561ae650dSJack F Vogel I40E_HMC_LAN_OBJ_SZ_32 = 0x5, 12661ae650dSJack F Vogel I40E_HMC_LAN_OBJ_SZ_64 = 0x6, 12761ae650dSJack F Vogel I40E_HMC_LAN_OBJ_SZ_128 = 0x7, 12861ae650dSJack F Vogel I40E_HMC_LAN_OBJ_SZ_256 = 0x8, 12961ae650dSJack F Vogel I40E_HMC_LAN_OBJ_SZ_512 = 0x9, 13061ae650dSJack F Vogel }; 13161ae650dSJack F Vogel 13261ae650dSJack F Vogel #define I40E_HMC_L2OBJ_BASE_ALIGNMENT 512 13361ae650dSJack F Vogel #define I40E_HMC_OBJ_SIZE_TXQ 128 13461ae650dSJack F Vogel #define I40E_HMC_OBJ_SIZE_RXQ 32 13561ae650dSJack F Vogel #define I40E_HMC_OBJ_SIZE_FCOE_CNTX 64 13661ae650dSJack F Vogel #define I40E_HMC_OBJ_SIZE_FCOE_FILT 64 13761ae650dSJack F Vogel 13861ae650dSJack F Vogel enum i40e_hmc_lan_rsrc_type { 13961ae650dSJack F Vogel I40E_HMC_LAN_FULL = 0, 14061ae650dSJack F Vogel I40E_HMC_LAN_TX = 1, 14161ae650dSJack F Vogel I40E_HMC_LAN_RX = 2, 14261ae650dSJack F Vogel I40E_HMC_FCOE_CTX = 3, 14361ae650dSJack F Vogel I40E_HMC_FCOE_FILT = 4, 14461ae650dSJack F Vogel I40E_HMC_LAN_MAX = 5 14561ae650dSJack F Vogel }; 14661ae650dSJack F Vogel 14761ae650dSJack F Vogel enum i40e_hmc_model { 14861ae650dSJack F Vogel I40E_HMC_MODEL_DIRECT_PREFERRED = 0, 14961ae650dSJack F Vogel I40E_HMC_MODEL_DIRECT_ONLY = 1, 15061ae650dSJack F Vogel I40E_HMC_MODEL_PAGED_ONLY = 2, 15161ae650dSJack F Vogel I40E_HMC_MODEL_UNKNOWN, 15261ae650dSJack F Vogel }; 15361ae650dSJack F Vogel 15461ae650dSJack F Vogel struct i40e_hmc_lan_create_obj_info { 15561ae650dSJack F Vogel struct i40e_hmc_info *hmc_info; 15661ae650dSJack F Vogel u32 rsrc_type; 15761ae650dSJack F Vogel u32 start_idx; 15861ae650dSJack F Vogel u32 count; 15961ae650dSJack F Vogel enum i40e_sd_entry_type entry_type; 16061ae650dSJack F Vogel u64 direct_mode_sz; 16161ae650dSJack F Vogel }; 16261ae650dSJack F Vogel 16361ae650dSJack F Vogel struct i40e_hmc_lan_delete_obj_info { 16461ae650dSJack F Vogel struct i40e_hmc_info *hmc_info; 16561ae650dSJack F Vogel u32 rsrc_type; 16661ae650dSJack F Vogel u32 start_idx; 16761ae650dSJack F Vogel u32 count; 16861ae650dSJack F Vogel }; 16961ae650dSJack F Vogel 17061ae650dSJack F Vogel enum i40e_status_code i40e_init_lan_hmc(struct i40e_hw *hw, u32 txq_num, 17161ae650dSJack F Vogel u32 rxq_num, u32 fcoe_cntx_num, 17261ae650dSJack F Vogel u32 fcoe_filt_num); 17361ae650dSJack F Vogel enum i40e_status_code i40e_configure_lan_hmc(struct i40e_hw *hw, 17461ae650dSJack F Vogel enum i40e_hmc_model model); 17561ae650dSJack F Vogel enum i40e_status_code i40e_shutdown_lan_hmc(struct i40e_hw *hw); 17661ae650dSJack F Vogel 17761ae650dSJack F Vogel u64 i40e_calculate_l2fpm_size(u32 txq_num, u32 rxq_num, 17861ae650dSJack F Vogel u32 fcoe_cntx_num, u32 fcoe_filt_num); 17961ae650dSJack F Vogel enum i40e_status_code i40e_get_lan_tx_queue_context(struct i40e_hw *hw, 18061ae650dSJack F Vogel u16 queue, 18161ae650dSJack F Vogel struct i40e_hmc_obj_txq *s); 18261ae650dSJack F Vogel enum i40e_status_code i40e_clear_lan_tx_queue_context(struct i40e_hw *hw, 18361ae650dSJack F Vogel u16 queue); 18461ae650dSJack F Vogel enum i40e_status_code i40e_set_lan_tx_queue_context(struct i40e_hw *hw, 18561ae650dSJack F Vogel u16 queue, 18661ae650dSJack F Vogel struct i40e_hmc_obj_txq *s); 18761ae650dSJack F Vogel enum i40e_status_code i40e_get_lan_rx_queue_context(struct i40e_hw *hw, 18861ae650dSJack F Vogel u16 queue, 18961ae650dSJack F Vogel struct i40e_hmc_obj_rxq *s); 19061ae650dSJack F Vogel enum i40e_status_code i40e_clear_lan_rx_queue_context(struct i40e_hw *hw, 19161ae650dSJack F Vogel u16 queue); 19261ae650dSJack F Vogel enum i40e_status_code i40e_set_lan_rx_queue_context(struct i40e_hw *hw, 19361ae650dSJack F Vogel u16 queue, 19461ae650dSJack F Vogel struct i40e_hmc_obj_rxq *s); 19561ae650dSJack F Vogel enum i40e_status_code i40e_create_lan_hmc_object(struct i40e_hw *hw, 19661ae650dSJack F Vogel struct i40e_hmc_lan_create_obj_info *info); 19761ae650dSJack F Vogel enum i40e_status_code i40e_delete_lan_hmc_object(struct i40e_hw *hw, 19861ae650dSJack F Vogel struct i40e_hmc_lan_delete_obj_info *info); 19961ae650dSJack F Vogel 20061ae650dSJack F Vogel #endif /* _I40E_LAN_HMC_H_ */ 201