1 /*******************************************************************************
3 Copyright (c) 2013 - 2015, Intel Corporation
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
16 3. Neither the name of the Intel Corporation nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
32 ***************************************************************************/
34 #ifndef _IAVF_LAN_HMC_H_
35 #define _IAVF_LAN_HMC_H_
37 /* forward-declare the HW struct for the compiler */
40 /* HMC element context information */
42 /* Rx queue context data
44 * The sizes of the variables may be larger than needed due to crossing byte
45 * boundaries. If we do not have the width of the variable set to the correct
46 * size then we could end up shifting bits off the top of the variable when the
47 * variable is at the top of a byte and crosses over into the next byte.
49 struct iavf_hmc_obj_rxq {
51 u16 cpuid; /* bigger than needed, see above for reason */
54 #define IAVF_RXQ_CTX_DBUFF_SHIFT 7
55 u16 dbuff; /* bigger than needed, see above for reason */
56 #define IAVF_RXQ_CTX_HBUFF_SHIFT 6
57 u16 hbuff; /* bigger than needed, see above for reason */
66 u32 rxmax; /* bigger than needed, see above for reason */
71 u16 lrxqthresh; /* bigger than needed, see above for reason */
72 u8 prefena; /* NOTE: normally must be set to 1 at init */
75 /* Tx queue context data
77 * The sizes of the variables may be larger than needed due to crossing byte
78 * boundaries. If we do not have the width of the variable set to the correct
79 * size then we could end up shifting bits off the top of the variable when the
80 * variable is at the top of a byte and crosses over into the next byte.
82 struct iavf_hmc_obj_txq {
103 /* for hsplit_0 field of Rx HMC context */
104 enum iavf_hmc_obj_rx_hsplit_0 {
105 IAVF_HMC_OBJ_RX_HSPLIT_0_NO_SPLIT = 0,
106 IAVF_HMC_OBJ_RX_HSPLIT_0_SPLIT_L2 = 1,
107 IAVF_HMC_OBJ_RX_HSPLIT_0_SPLIT_IP = 2,
108 IAVF_HMC_OBJ_RX_HSPLIT_0_SPLIT_TCP_UDP = 4,
109 IAVF_HMC_OBJ_RX_HSPLIT_0_SPLIT_SCTP = 8,
112 /* fcoe_cntx and fcoe_filt are for debugging purpose only */
113 struct iavf_hmc_obj_fcoe_cntx {
117 struct iavf_hmc_obj_fcoe_filt {
121 /* Context sizes for LAN objects */
122 enum iavf_hmc_lan_object_size {
123 IAVF_HMC_LAN_OBJ_SZ_8 = 0x3,
124 IAVF_HMC_LAN_OBJ_SZ_16 = 0x4,
125 IAVF_HMC_LAN_OBJ_SZ_32 = 0x5,
126 IAVF_HMC_LAN_OBJ_SZ_64 = 0x6,
127 IAVF_HMC_LAN_OBJ_SZ_128 = 0x7,
128 IAVF_HMC_LAN_OBJ_SZ_256 = 0x8,
129 IAVF_HMC_LAN_OBJ_SZ_512 = 0x9,
132 #define IAVF_HMC_L2OBJ_BASE_ALIGNMENT 512
133 #define IAVF_HMC_OBJ_SIZE_TXQ 128
134 #define IAVF_HMC_OBJ_SIZE_RXQ 32
135 #define IAVF_HMC_OBJ_SIZE_FCOE_CNTX 64
136 #define IAVF_HMC_OBJ_SIZE_FCOE_FILT 64
138 enum iavf_hmc_lan_rsrc_type {
139 IAVF_HMC_LAN_FULL = 0,
142 IAVF_HMC_FCOE_CTX = 3,
143 IAVF_HMC_FCOE_FILT = 4,
147 enum iavf_hmc_model {
148 IAVF_HMC_MODEL_DIRECT_PREFERRED = 0,
149 IAVF_HMC_MODEL_DIRECT_ONLY = 1,
150 IAVF_HMC_MODEL_PAGED_ONLY = 2,
151 IAVF_HMC_MODEL_UNKNOWN,
154 struct iavf_hmc_lan_create_obj_info {
155 struct iavf_hmc_info *hmc_info;
159 enum iavf_sd_entry_type entry_type;
163 struct iavf_hmc_lan_delete_obj_info {
164 struct iavf_hmc_info *hmc_info;
170 enum iavf_status_code iavf_init_lan_hmc(struct iavf_hw *hw, u32 txq_num,
171 u32 rxq_num, u32 fcoe_cntx_num,
173 enum iavf_status_code iavf_configure_lan_hmc(struct iavf_hw *hw,
174 enum iavf_hmc_model model);
175 enum iavf_status_code iavf_shutdown_lan_hmc(struct iavf_hw *hw);
177 u64 iavf_calculate_l2fpm_size(u32 txq_num, u32 rxq_num,
178 u32 fcoe_cntx_num, u32 fcoe_filt_num);
179 enum iavf_status_code iavf_get_lan_tx_queue_context(struct iavf_hw *hw,
181 struct iavf_hmc_obj_txq *s);
182 enum iavf_status_code iavf_clear_lan_tx_queue_context(struct iavf_hw *hw,
184 enum iavf_status_code iavf_set_lan_tx_queue_context(struct iavf_hw *hw,
186 struct iavf_hmc_obj_txq *s);
187 enum iavf_status_code iavf_get_lan_rx_queue_context(struct iavf_hw *hw,
189 struct iavf_hmc_obj_rxq *s);
190 enum iavf_status_code iavf_clear_lan_rx_queue_context(struct iavf_hw *hw,
192 enum iavf_status_code iavf_set_lan_rx_queue_context(struct iavf_hw *hw,
194 struct iavf_hmc_obj_rxq *s);
195 enum iavf_status_code iavf_create_lan_hmc_object(struct iavf_hw *hw,
196 struct iavf_hmc_lan_create_obj_info *info);
197 enum iavf_status_code iavf_delete_lan_hmc_object(struct iavf_hw *hw,
198 struct iavf_hmc_lan_delete_obj_info *info);
200 #endif /* _IAVF_LAN_HMC_H_ */