Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(c) 2001-2023 Intel Corporation
3 : : */
4 : :
5 : : #ifndef _ICE_TYPE_H_
6 : : #define _ICE_TYPE_H_
7 : :
8 : : #include "ice_defs.h"
9 : : #include "ice_status.h"
10 : : #include "ice_hw_autogen.h"
11 : : #include "ice_devids.h"
12 : : #include "ice_osdep.h"
13 : : #include "ice_bitops.h" /* Must come before ice_controlq.h */
14 : : #include "ice_lan_tx_rx.h"
15 : : #include "ice_ddp.h"
16 : : #include "ice_controlq.h"
17 : : #include "ice_flex_type.h"
18 : : #include "ice_protocol_type.h"
19 : : #include "ice_sbq_cmd.h"
20 : : #include "ice_vlan_mode.h"
21 : :
22 : : /**
23 : : * ice_is_pow2 - check if integer value is a power of 2
24 : : * @val: unsigned integer to be validated
25 : : */
26 : : static inline bool ice_is_pow2(u64 val)
27 : : {
28 [ # # # # : 0 : return (val && !(val & (val - 1)));
# # # # #
# # # # #
# # ]
29 : : }
30 : :
31 : : /**
32 : : * ice_ilog2 - Calculates integer log base 2 of a number
33 : : * @n: number on which to perform operation
34 : : */
35 : : static inline int ice_ilog2(u64 n)
36 : : {
37 : : int i;
38 : :
39 [ # # # # ]: 0 : for (i = 63; i >= 0; i--)
40 [ # # # # ]: 0 : if (((u64)1 << i) & n)
41 : : return i;
42 : :
43 : : return -1;
44 : : }
45 : :
46 : : /**
47 : : * ice_fls - find the most significant bit set in a u64
48 : : * @n: u64 value to scan for a bit
49 : : *
50 : : * Returns: 0 if no bits found, otherwise the index of the highest bit that was
51 : : * set, like ice_fls(0x20) == 6. This means this is returning a *1 based*
52 : : * count, and that the maximum largest value returned is 64!
53 : : */
54 : : static inline unsigned int ice_fls(u64 n)
55 : : {
56 : : int ret;
57 : :
58 : : ret = ice_ilog2(n);
59 : :
60 : : /* add one to turn to the ilog2 value into a 1 based index */
61 : : return ret >= 0 ? ret + 1 : 0;
62 : : }
63 : :
64 : : static inline bool ice_is_tc_ena(ice_bitmap_t bitmap, u8 tc)
65 : : {
66 : : return ice_is_bit_set(&bitmap, tc);
67 : : }
68 : :
69 : : /**
70 : : * DIV_S64 - Divide signed 64-bit value with signed 64-bit divisor
71 : : * @dividend: value to divide
72 : : * @divisor: value to divide by
73 : : *
74 : : * Use DIV_S64 for any 64-bit divide which operates on signed 64-bit dividends.
75 : : * Do not use this for unsigned 64-bit dividends as it will not produce
76 : : * correct results if the dividend is larger than S64_MAX.
77 : : */
78 : : static inline s64 DIV_S64(s64 dividend, s64 divisor)
79 : : {
80 [ # # # # : 0 : return dividend / divisor;
# # ]
81 : : }
82 : :
83 : : /**
84 : : * DIV_U64 - Divide unsigned 64-bit value by unsigned 64-bit divisor
85 : : * @dividend: value to divide
86 : : * @divisor: value to divide by
87 : : *
88 : : * Use DIV_U64 for any 64-bit divide which operates on unsigned 64-bit
89 : : * dividends. Do not use this for signed 64-bit dividends as it will not
90 : : * handle negative values correctly.
91 : : */
92 : : static inline u64 DIV_U64(u64 dividend, u64 divisor)
93 : : {
94 [ # # ]: 0 : return dividend / divisor;
95 : : }
96 : :
97 : : static inline u64 round_up_64bit(u64 a, u32 b)
98 : : {
99 [ # # ]: 0 : return DIV_U64(((a) + (b) / 2), (b));
100 : : }
101 : :
102 : : static inline u32 ice_round_to_num(u32 N, u32 R)
103 : : {
104 [ # # # # ]: 0 : return ((((N) % (R)) < ((R) / 2)) ? (((N) / (R)) * (R)) :
105 : 0 : ((((N) + (R) - 1) / (R)) * (R)));
106 : : }
107 : :
108 : : /* Driver always calls main vsi_handle first */
109 : : #define ICE_MAIN_VSI_HANDLE 0
110 : :
111 : : /* Switch from ms to the 1usec global time (this is the GTIME resolution) */
112 : : #define ICE_MS_TO_GTIME(time) ((time) * 1000)
113 : :
114 : : /* Data type manipulation macros. */
115 : : #define ICE_HI_DWORD(x) ((u32)((((x) >> 16) >> 16) & 0xFFFFFFFF))
116 : : #define ICE_LO_DWORD(x) ((u32)((x) & 0xFFFFFFFF))
117 : : #define ICE_HI_WORD(x) ((u16)(((x) >> 16) & 0xFFFF))
118 : : #define ICE_LO_WORD(x) ((u16)((x) & 0xFFFF))
119 : : #define ICE_HI_BYTE(x) ((u8)(((x) >> 8) & 0xFF))
120 : : #define ICE_LO_BYTE(x) ((u8)((x) & 0xFF))
121 : :
122 : : /* debug masks - set these bits in hw->debug_mask to control output */
123 : : #define ICE_DBG_TRACE BIT_ULL(0) /* for function-trace only */
124 : : #define ICE_DBG_INIT BIT_ULL(1)
125 : : #define ICE_DBG_RELEASE BIT_ULL(2)
126 : : #define ICE_DBG_FW_LOG BIT_ULL(3)
127 : : #define ICE_DBG_LINK BIT_ULL(4)
128 : : #define ICE_DBG_PHY BIT_ULL(5)
129 : : #define ICE_DBG_QCTX BIT_ULL(6)
130 : : #define ICE_DBG_NVM BIT_ULL(7)
131 : : #define ICE_DBG_LAN BIT_ULL(8)
132 : : #define ICE_DBG_FLOW BIT_ULL(9)
133 : : #define ICE_DBG_DCB BIT_ULL(10)
134 : : #define ICE_DBG_DIAG BIT_ULL(11)
135 : : #define ICE_DBG_FD BIT_ULL(12)
136 : : #define ICE_DBG_SW BIT_ULL(13)
137 : : #define ICE_DBG_SCHED BIT_ULL(14)
138 : :
139 : : #define ICE_DBG_PKG BIT_ULL(16)
140 : : #define ICE_DBG_RES BIT_ULL(17)
141 : : #define ICE_DBG_ACL BIT_ULL(18)
142 : : #define ICE_DBG_PTP BIT_ULL(19)
143 : : #define ICE_DBG_AQ_MSG BIT_ULL(24)
144 : : #define ICE_DBG_AQ_DESC BIT_ULL(25)
145 : : #define ICE_DBG_AQ_DESC_BUF BIT_ULL(26)
146 : : #define ICE_DBG_AQ_CMD BIT_ULL(27)
147 : : #define ICE_DBG_AQ (ICE_DBG_AQ_MSG | \
148 : : ICE_DBG_AQ_DESC | \
149 : : ICE_DBG_AQ_DESC_BUF | \
150 : : ICE_DBG_AQ_CMD)
151 : : #define ICE_DBG_PARSER BIT_ULL(28)
152 : :
153 : : #define ICE_DBG_USER BIT_ULL(31)
154 : : #define ICE_DBG_ALL 0xFFFFFFFFFFFFFFFFULL
155 : :
156 : : #define __ALWAYS_UNUSED
157 : :
158 : : #define IS_ETHER_ADDR_EQUAL(addr1, addr2) \
159 : : (((bool)((((u16 *)(addr1))[0] == ((u16 *)(addr2))[0]))) && \
160 : : ((bool)((((u16 *)(addr1))[1] == ((u16 *)(addr2))[1]))) && \
161 : : ((bool)((((u16 *)(addr1))[2] == ((u16 *)(addr2))[2]))))
162 : :
163 : : enum ice_aq_res_ids {
164 : : ICE_NVM_RES_ID = 1,
165 : : ICE_SPD_RES_ID,
166 : : ICE_CHANGE_LOCK_RES_ID,
167 : : ICE_GLOBAL_CFG_LOCK_RES_ID
168 : : };
169 : :
170 : : /* FW update timeout definitions are in milliseconds */
171 : : #define ICE_NVM_TIMEOUT 180000
172 : : #define ICE_CHANGE_LOCK_TIMEOUT 1000
173 : : #define ICE_GLOBAL_CFG_LOCK_TIMEOUT 3000
174 : :
175 : : struct ice_driver_ver {
176 : : u8 major_ver;
177 : : u8 minor_ver;
178 : : u8 build_ver;
179 : : u8 subbuild_ver;
180 : : u8 driver_string[32];
181 : : };
182 : :
183 : : enum ice_fc_mode {
184 : : ICE_FC_NONE = 0,
185 : : ICE_FC_RX_PAUSE,
186 : : ICE_FC_TX_PAUSE,
187 : : ICE_FC_FULL,
188 : : ICE_FC_AUTO,
189 : : ICE_FC_PFC,
190 : : ICE_FC_DFLT
191 : : };
192 : :
193 : : enum ice_phy_cache_mode {
194 : : ICE_FC_MODE = 0,
195 : : ICE_SPEED_MODE,
196 : : ICE_FEC_MODE
197 : : };
198 : :
199 : : enum ice_fec_mode {
200 : : ICE_FEC_NONE = 0,
201 : : ICE_FEC_RS,
202 : : ICE_FEC_BASER,
203 : : ICE_FEC_AUTO,
204 : : ICE_FEC_DIS_AUTO
205 : : };
206 : :
207 : : struct ice_phy_cache_mode_data {
208 : : union {
209 : : enum ice_fec_mode curr_user_fec_req;
210 : : enum ice_fc_mode curr_user_fc_req;
211 : : u16 curr_user_speed_req;
212 : : } data;
213 : : };
214 : :
215 : : enum ice_set_fc_aq_failures {
216 : : ICE_SET_FC_AQ_FAIL_NONE = 0,
217 : : ICE_SET_FC_AQ_FAIL_GET,
218 : : ICE_SET_FC_AQ_FAIL_SET,
219 : : ICE_SET_FC_AQ_FAIL_UPDATE
220 : : };
221 : :
222 : : /* These are structs for managing the hardware information and the operations */
223 : : /* MAC types */
224 : : enum ice_mac_type {
225 : : ICE_MAC_UNKNOWN = 0,
226 : : ICE_MAC_E810,
227 : : ICE_MAC_E830,
228 : : ICE_MAC_GENERIC,
229 : : ICE_MAC_GENERIC_3K,
230 : : ICE_MAC_GENERIC_3K_E825,
231 : : };
232 : :
233 : : /* Media Types */
234 : : enum ice_media_type {
235 : : ICE_MEDIA_NONE = 0,
236 : : ICE_MEDIA_UNKNOWN,
237 : : ICE_MEDIA_FIBER,
238 : : ICE_MEDIA_BASET,
239 : : ICE_MEDIA_BACKPLANE,
240 : : ICE_MEDIA_DA,
241 : : ICE_MEDIA_AUI,
242 : : };
243 : :
244 : : #define ICE_MEDIA_BASET_PHY_TYPE_LOW_M (ICE_PHY_TYPE_LOW_100BASE_TX | \
245 : : ICE_PHY_TYPE_LOW_1000BASE_T | \
246 : : ICE_PHY_TYPE_LOW_2500BASE_T | \
247 : : ICE_PHY_TYPE_LOW_5GBASE_T | \
248 : : ICE_PHY_TYPE_LOW_10GBASE_T | \
249 : : ICE_PHY_TYPE_LOW_25GBASE_T)
250 : :
251 : : #define ICE_MEDIA_C2M_PHY_TYPE_LOW_M (ICE_PHY_TYPE_LOW_10G_SFI_AOC_ACC | \
252 : : ICE_PHY_TYPE_LOW_25G_AUI_AOC_ACC | \
253 : : ICE_PHY_TYPE_LOW_40G_XLAUI_AOC_ACC | \
254 : : ICE_PHY_TYPE_LOW_50G_LAUI2_AOC_ACC | \
255 : : ICE_PHY_TYPE_LOW_50G_AUI2_AOC_ACC | \
256 : : ICE_PHY_TYPE_LOW_50G_AUI1_AOC_ACC | \
257 : : ICE_PHY_TYPE_LOW_100G_CAUI4_AOC_ACC | \
258 : : ICE_PHY_TYPE_LOW_100G_AUI4_AOC_ACC)
259 : :
260 : : #define ICE_MEDIA_C2M_PHY_TYPE_HIGH_M (ICE_PHY_TYPE_HIGH_100G_CAUI2_AOC_ACC | \
261 : : ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC | \
262 : : ICE_PHY_TYPE_HIGH_200G_AUI4_AOC_ACC | \
263 : : ICE_PHY_TYPE_HIGH_200G_AUI8_AOC_ACC)
264 : :
265 : : #define ICE_MEDIA_OPT_PHY_TYPE_LOW_M (ICE_PHY_TYPE_LOW_1000BASE_SX | \
266 : : ICE_PHY_TYPE_LOW_1000BASE_LX | \
267 : : ICE_PHY_TYPE_LOW_10GBASE_SR | \
268 : : ICE_PHY_TYPE_LOW_10GBASE_LR | \
269 : : ICE_PHY_TYPE_LOW_25GBASE_SR | \
270 : : ICE_PHY_TYPE_LOW_25GBASE_LR | \
271 : : ICE_PHY_TYPE_LOW_40GBASE_SR4 | \
272 : : ICE_PHY_TYPE_LOW_40GBASE_LR4 | \
273 : : ICE_PHY_TYPE_LOW_50GBASE_SR2 | \
274 : : ICE_PHY_TYPE_LOW_50GBASE_LR2 | \
275 : : ICE_PHY_TYPE_LOW_50GBASE_SR | \
276 : : ICE_PHY_TYPE_LOW_50GBASE_LR | \
277 : : ICE_PHY_TYPE_LOW_100GBASE_SR4 | \
278 : : ICE_PHY_TYPE_LOW_100GBASE_LR4 | \
279 : : ICE_PHY_TYPE_LOW_100GBASE_SR2 | \
280 : : ICE_PHY_TYPE_LOW_50GBASE_FR | \
281 : : ICE_PHY_TYPE_LOW_100GBASE_DR)
282 : :
283 : : #define ICE_MEDIA_OPT_PHY_TYPE_HIGH_M (ICE_PHY_TYPE_HIGH_200G_SR4 | \
284 : : ICE_PHY_TYPE_HIGH_200G_LR4 | \
285 : : ICE_PHY_TYPE_HIGH_200G_FR4 | \
286 : : ICE_PHY_TYPE_HIGH_200G_DR4 | \
287 : : ICE_PHY_TYPE_HIGH_400GBASE_FR8)
288 : :
289 : : #define ICE_MEDIA_BP_PHY_TYPE_LOW_M (ICE_PHY_TYPE_LOW_1000BASE_KX | \
290 : : ICE_PHY_TYPE_LOW_2500BASE_KX | \
291 : : ICE_PHY_TYPE_LOW_5GBASE_KR | \
292 : : ICE_PHY_TYPE_LOW_10GBASE_KR_CR1 | \
293 : : ICE_PHY_TYPE_LOW_25GBASE_KR | \
294 : : ICE_PHY_TYPE_LOW_25GBASE_KR_S | \
295 : : ICE_PHY_TYPE_LOW_25GBASE_KR1 | \
296 : : ICE_PHY_TYPE_LOW_40GBASE_KR4 | \
297 : : ICE_PHY_TYPE_LOW_50GBASE_KR2 | \
298 : : ICE_PHY_TYPE_LOW_50GBASE_KR_PAM4 | \
299 : : ICE_PHY_TYPE_LOW_100GBASE_KR4 | \
300 : : ICE_PHY_TYPE_LOW_100GBASE_KR_PAM4)
301 : :
302 : : #define ICE_MEDIA_BP_PHY_TYPE_HIGH_M (ICE_PHY_TYPE_HIGH_100GBASE_KR2_PAM4 | \
303 : : ICE_PHY_TYPE_HIGH_200G_KR4_PAM4)
304 : :
305 : : #define ICE_MEDIA_DAC_PHY_TYPE_LOW_M (ICE_PHY_TYPE_LOW_10G_SFI_DA | \
306 : : ICE_PHY_TYPE_LOW_25GBASE_CR | \
307 : : ICE_PHY_TYPE_LOW_25GBASE_CR_S | \
308 : : ICE_PHY_TYPE_LOW_25GBASE_CR1 | \
309 : : ICE_PHY_TYPE_LOW_40GBASE_CR4 | \
310 : : ICE_PHY_TYPE_LOW_50GBASE_CR2 | \
311 : : ICE_PHY_TYPE_LOW_100GBASE_CR4 | \
312 : : ICE_PHY_TYPE_LOW_100GBASE_CR_PAM4 | \
313 : : ICE_PHY_TYPE_LOW_50GBASE_CP | \
314 : : ICE_PHY_TYPE_LOW_100GBASE_CP2)
315 : :
316 : : #define ICE_MEDIA_DAC_PHY_TYPE_HIGH_M ICE_PHY_TYPE_HIGH_200G_CR4_PAM4
317 : :
318 : : #define ICE_MEDIA_C2C_PHY_TYPE_LOW_M (ICE_PHY_TYPE_LOW_100M_SGMII | \
319 : : ICE_PHY_TYPE_LOW_1G_SGMII | \
320 : : ICE_PHY_TYPE_LOW_2500BASE_X | \
321 : : ICE_PHY_TYPE_LOW_10G_SFI_C2C | \
322 : : ICE_PHY_TYPE_LOW_25G_AUI_C2C | \
323 : : ICE_PHY_TYPE_LOW_40G_XLAUI | \
324 : : ICE_PHY_TYPE_LOW_50G_LAUI2 | \
325 : : ICE_PHY_TYPE_LOW_50G_AUI2 | \
326 : : ICE_PHY_TYPE_LOW_50G_AUI1 | \
327 : : ICE_PHY_TYPE_LOW_100G_CAUI4 | \
328 : : ICE_PHY_TYPE_LOW_100G_AUI4)
329 : :
330 : : #define ICE_MEDIA_C2C_PHY_TYPE_HIGH_M (ICE_PHY_TYPE_HIGH_100G_CAUI2 | \
331 : : ICE_PHY_TYPE_HIGH_100G_AUI2 | \
332 : : ICE_PHY_TYPE_HIGH_200G_AUI4 | \
333 : : ICE_PHY_TYPE_HIGH_200G_AUI8)
334 : :
335 : : /* Software VSI types. */
336 : : enum ice_vsi_type {
337 : : ICE_VSI_PF = 0,
338 : : ICE_VSI_CTRL = 3, /* equates to ICE_VSI_PF with 1 queue pair */
339 : : ICE_VSI_LB = 6,
340 : : ICE_VSI_ADI = 8,
341 : : };
342 : :
343 : : struct ice_link_status {
344 : : /* Refer to ice_aq_phy_type for bits definition */
345 : : u64 phy_type_low;
346 : : u64 phy_type_high;
347 : : u8 topo_media_conflict;
348 : : u16 max_frame_size;
349 : : u16 link_speed;
350 : : u16 req_speeds;
351 : : u8 link_cfg_err;
352 : : u8 lse_ena; /* Link Status Event notification */
353 : : u8 link_info;
354 : : u8 an_info;
355 : : u8 ext_info;
356 : : u8 fec_info;
357 : : u8 pacing;
358 : : /* Refer to #define from module_type[ICE_MODULE_TYPE_TOTAL_BYTE] of
359 : : * ice_aqc_get_phy_caps structure
360 : : */
361 : : u8 module_type[ICE_MODULE_TYPE_TOTAL_BYTE];
362 : : };
363 : :
364 : : /* Different data queue types: These are mainly for SW consumption. */
365 : : enum ice_q {
366 : : ICE_DATA_Q_DOORBELL,
367 : : ICE_DATA_Q_CMPL,
368 : : ICE_DATA_Q_QUANTA,
369 : : ICE_DATA_Q_RX,
370 : : ICE_DATA_Q_TX,
371 : : };
372 : :
373 : : /* Different reset sources for which a disable queue AQ call has to be made in
374 : : * order to clean the Tx scheduler as a part of the reset
375 : : */
376 : : enum ice_disq_rst_src {
377 : : ICE_NO_RESET = 0,
378 : : ICE_VM_RESET,
379 : : };
380 : :
381 : : /* PHY info such as phy_type, etc... */
382 : : struct ice_phy_info {
383 : : struct ice_link_status link_info;
384 : : struct ice_link_status link_info_old;
385 : : u64 phy_type_low;
386 : : u64 phy_type_high;
387 : : enum ice_media_type media_type;
388 : : u8 get_link_info;
389 : : /* Please refer to struct ice_aqc_get_link_status_data to get
390 : : * detail of enable bit in curr_user_speed_req
391 : : */
392 : : u16 curr_user_speed_req;
393 : : enum ice_fec_mode curr_user_fec_req;
394 : : enum ice_fc_mode curr_user_fc_req;
395 : : struct ice_aqc_set_phy_cfg_data curr_user_phy_cfg;
396 : : };
397 : :
398 : : #define ICE_MAX_NUM_MIRROR_RULES 64
399 : :
400 : : #define ICE_L2TPV2_FLAGS_CTRL 0x8000
401 : : #define ICE_L2TPV2_FLAGS_LEN 0x4000
402 : : #define ICE_L2TPV2_FLAGS_SEQ 0x0800
403 : : #define ICE_L2TPV2_FLAGS_OFF 0x0200
404 : : #define ICE_L2TPV2_FLAGS_VER 0x0002
405 : :
406 : : #define ICE_L2TPV2_PKT_LENGTH 6
407 : : #define ICE_PPP_PKT_LENGTH 4
408 : :
409 : : /* protocol enumeration for filters */
410 : : enum ice_fltr_ptype {
411 : : /* NONE - used for undef/error */
412 : : ICE_FLTR_PTYPE_NONF_NONE = 0,
413 : : ICE_FLTR_PTYPE_NONF_IPV4_UDP,
414 : : ICE_FLTR_PTYPE_NONF_IPV4_TCP,
415 : : ICE_FLTR_PTYPE_NONF_IPV4_SCTP,
416 : : ICE_FLTR_PTYPE_NONF_IPV4_OTHER,
417 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU,
418 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4,
419 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP,
420 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP,
421 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV6,
422 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV6_UDP,
423 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV6_TCP,
424 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH,
425 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4,
426 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_UDP,
427 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_TCP,
428 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV6,
429 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV6_UDP,
430 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV6_TCP,
431 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_DW,
432 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_DW_IPV4,
433 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_DW_IPV4_UDP,
434 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_DW_IPV4_TCP,
435 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_DW_IPV6,
436 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_DW_IPV6_UDP,
437 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_DW_IPV6_TCP,
438 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_UP,
439 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_UP_IPV4,
440 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_UP_IPV4_UDP,
441 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_UP_IPV4_TCP,
442 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_UP_IPV6,
443 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_UP_IPV6_UDP,
444 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_UP_IPV6_TCP,
445 : : ICE_FLTR_PTYPE_NONF_IPV6_GTPU,
446 : : ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH,
447 : : ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_DW,
448 : : ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_UP,
449 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP,
450 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER,
451 : : ICE_FLTR_PTYPE_NONF_IPV6_GTPU_IPV6_OTHER,
452 : : ICE_FLTR_PTYPE_NONF_IPV4_GTPU_EH_IPV4_OTHER,
453 : : ICE_FLTR_PTYPE_NONF_IPV6_GTPU_EH_IPV6_OTHER,
454 : : ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
455 : : ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3,
456 : : ICE_FLTR_PTYPE_NONF_IPV4_ESP,
457 : : ICE_FLTR_PTYPE_NONF_IPV6_ESP,
458 : : ICE_FLTR_PTYPE_NONF_IPV4_AH,
459 : : ICE_FLTR_PTYPE_NONF_IPV6_AH,
460 : : ICE_FLTR_PTYPE_NONF_IPV4_NAT_T_ESP,
461 : : ICE_FLTR_PTYPE_NONF_IPV6_NAT_T_ESP,
462 : : ICE_FLTR_PTYPE_NONF_IPV4_PFCP_NODE,
463 : : ICE_FLTR_PTYPE_NONF_IPV4_PFCP_SESSION,
464 : : ICE_FLTR_PTYPE_NONF_IPV6_PFCP_NODE,
465 : : ICE_FLTR_PTYPE_NONF_IPV6_PFCP_SESSION,
466 : : ICE_FLTR_PTYPE_NON_IP_L2,
467 : : ICE_FLTR_PTYPE_NONF_ECPRI_TP0,
468 : : ICE_FLTR_PTYPE_NONF_IPV4_UDP_ECPRI_TP0,
469 : : ICE_FLTR_PTYPE_FRAG_IPV4,
470 : : ICE_FLTR_PTYPE_FRAG_IPV6,
471 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE,
472 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4,
473 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_UDP,
474 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_TCP,
475 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6,
476 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_UDP,
477 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_TCP,
478 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE,
479 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4,
480 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_UDP,
481 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_TCP,
482 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6,
483 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_UDP,
484 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_TCP,
485 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_GTPU,
486 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_GTPU_IPV4,
487 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_GTPU_IPV4_UDP,
488 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_GTPU_IPV4_TCP,
489 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_GTPU_IPV6,
490 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_GTPU_IPV6_UDP,
491 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_GTPU_IPV6_TCP,
492 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_GTPU,
493 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_GTPU_IPV4,
494 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_GTPU_IPV4_UDP,
495 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_GTPU_IPV4_TCP,
496 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_GTPU_IPV6,
497 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_GTPU_IPV6_UDP,
498 : : ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_GTPU_IPV6_TCP,
499 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_GTPU,
500 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_GTPU_IPV4,
501 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_GTPU_IPV4_UDP,
502 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_GTPU_IPV4_TCP,
503 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_GTPU_IPV6,
504 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_GTPU_IPV6_UDP,
505 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_GTPU_IPV6_TCP,
506 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_GTPU,
507 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_GTPU_IPV4,
508 : : ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_GTPU_IPV4_UDP,
509 : : ICE_FLTR_PTYPE_NONF_IPV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V4_OTHER,
606 : : ICE_FLTR_PTYPE_NONF_IPV4_L2TPV2_CONTROL,
607 : : ICE_FLTR_PTYPE_NONF_IPV4_L2TPV2,
608 : : ICE_FLTR_PTYPE_NONF_IPV4_L2TPV2_PPP,
609 : : ICE_FLTR_PTYPE_NONF_IPV4_L2TPV2_PPP_IPV4,
610 : : ICE_FLTR_PTYPE_NONF_IPV4_L2TPV2_PPP_IPV4_UDP,
611 : : ICE_FLTR_PTYPE_NONF_IPV4_L2TPV2_PPP_IPV4_TCP,
612 : : ICE_FLTR_PTYPE_NONF_IPV4_L2TPV2_PPP_IPV6,
613 : : ICE_FLTR_PTYPE_NONF_IPV4_L2TPV2_PPP_IPV6_UDP,
614 : : ICE_FLTR_PTYPE_NONF_IPV4_L2TPV2_PPP_IPV6_TCP,
615 : : ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2_CONTROL,
616 : : ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2,
617 : : ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2_PPP,
618 : : ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2_PPP_IPV4,
619 : : ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2_PPP_IPV4_UDP,
620 : : ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2_PPP_IPV4_TCP,
621 : : ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2_PPP_IPV6,
622 : : ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2_PPP_IPV6_UDP,
623 : : ICE_FLTR_PTYPE_NONF_IPV6_L2TPV2_PPP_IPV6_TCP,
624 : : ICE_FLTR_PTYPE_MAX,
625 : : };
626 : :
627 : : enum ice_fd_hw_seg {
628 : : ICE_FD_HW_SEG_NON_TUN = 0,
629 : : ICE_FD_HW_SEG_TUN,
630 : : ICE_FD_HW_SEG_MAX,
631 : : };
632 : :
633 : : /* 2 VSI = 1 ICE_VSI_PF + 1 ICE_VSI_CTRL */
634 : : #define ICE_MAX_FDIR_VSI_PER_FILTER 2
635 : :
636 : : struct ice_fd_hw_prof {
637 : : struct ice_flow_seg_info *fdir_seg[ICE_FD_HW_SEG_MAX];
638 : : int cnt;
639 : : u64 entry_h[ICE_MAX_FDIR_VSI_PER_FILTER][ICE_FD_HW_SEG_MAX];
640 : : u16 vsi_h[ICE_MAX_FDIR_VSI_PER_FILTER];
641 : : };
642 : :
643 : : /* Common HW capabilities for SW use */
644 : : struct ice_hw_common_caps {
645 : : /* Write CSR protection */
646 : : u64 wr_csr_prot;
647 : : u32 switching_mode;
648 : : /* switching mode supported - EVB switching (including cloud) */
649 : : #define ICE_NVM_IMAGE_TYPE_EVB 0x0
650 : :
651 : : /* Manageablity mode & supported protocols over MCTP */
652 : : u32 mgmt_mode;
653 : : #define ICE_MGMT_MODE_PASS_THRU_MODE_M 0xF
654 : : #define ICE_MGMT_MODE_CTL_INTERFACE_M 0xF0
655 : : #define ICE_MGMT_MODE_REDIR_SB_INTERFACE_M 0xF00
656 : :
657 : : u32 mgmt_protocols_mctp;
658 : : #define ICE_MGMT_MODE_PROTO_RSVD BIT(0)
659 : : #define ICE_MGMT_MODE_PROTO_PLDM BIT(1)
660 : : #define ICE_MGMT_MODE_PROTO_OEM BIT(2)
661 : : #define ICE_MGMT_MODE_PROTO_NC_SI BIT(3)
662 : :
663 : : u32 os2bmc;
664 : : u32 valid_functions;
665 : : /* DCB capabilities */
666 : : u32 active_tc_bitmap;
667 : : u32 maxtc;
668 : :
669 : : /* RSS related capabilities */
670 : : u32 rss_table_size; /* 512 for PFs and 64 for VFs */
671 : : u32 rss_table_entry_width; /* RSS Entry width in bits */
672 : :
673 : : /* Tx/Rx queues */
674 : : u32 num_rxq; /* Number/Total Rx queues */
675 : : u32 rxq_first_id; /* First queue ID for Rx queues */
676 : : u32 num_txq; /* Number/Total Tx queues */
677 : : u32 txq_first_id; /* First queue ID for Tx queues */
678 : :
679 : : /* MSI-X vectors */
680 : : u32 num_msix_vectors;
681 : : u32 msix_vector_first_id;
682 : :
683 : : /* Max MTU for function or device */
684 : : u32 max_mtu;
685 : :
686 : : /* WOL related */
687 : : u32 num_wol_proxy_fltr;
688 : : u32 wol_proxy_vsi_seid;
689 : :
690 : : /* LED/SDP pin count */
691 : : u32 led_pin_num;
692 : : u32 sdp_pin_num;
693 : :
694 : : /* LED/SDP - Supports up to 12 LED pins and 8 SDP signals */
695 : : #define ICE_MAX_SUPPORTED_GPIO_LED 12
696 : : #define ICE_MAX_SUPPORTED_GPIO_SDP 8
697 : : u8 led[ICE_MAX_SUPPORTED_GPIO_LED];
698 : : u8 sdp[ICE_MAX_SUPPORTED_GPIO_SDP];
699 : :
700 : : /* EVB capabilities */
701 : : u8 evb_802_1_qbg; /* Edge Virtual Bridging */
702 : : u8 evb_802_1_qbh; /* Bridge Port Extension */
703 : :
704 : : u8 dcb;
705 : : u8 iscsi;
706 : : u8 ieee_1588;
707 : : u8 mgmt_cem;
708 : :
709 : : /* WoL and APM support */
710 : : #define ICE_WOL_SUPPORT_M BIT(0)
711 : : #define ICE_ACPI_PROG_MTHD_M BIT(1)
712 : : #define ICE_PROXY_SUPPORT_M BIT(2)
713 : : u8 apm_wol_support;
714 : : u8 acpi_prog_mthd;
715 : : u8 proxy_support;
716 : : bool sec_rev_disabled;
717 : : bool update_disabled;
718 : : bool nvm_unified_update;
719 : : bool netlist_auth;
720 : : #define ICE_NVM_MGMT_SEC_REV_DISABLED BIT(0)
721 : : #define ICE_NVM_MGMT_UPDATE_DISABLED BIT(1)
722 : : #define ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT BIT(3)
723 : : #define ICE_NVM_MGMT_NETLIST_AUTH_SUPPORT BIT(5)
724 : : /* PCIe reset avoidance */
725 : : bool pcie_reset_avoidance; /* false: not supported, true: supported */
726 : : /* Post update reset restriction */
727 : : bool reset_restrict_support; /* false: not supported, true: supported */
728 : :
729 : : /* External topology device images within the NVM */
730 : : #define ICE_EXT_TOPO_DEV_IMG_COUNT 4
731 : : u32 ext_topo_dev_img_ver_high[ICE_EXT_TOPO_DEV_IMG_COUNT];
732 : : u32 ext_topo_dev_img_ver_low[ICE_EXT_TOPO_DEV_IMG_COUNT];
733 : : u8 ext_topo_dev_img_part_num[ICE_EXT_TOPO_DEV_IMG_COUNT];
734 : : #define ICE_EXT_TOPO_DEV_IMG_PART_NUM_S 8
735 : : #define ICE_EXT_TOPO_DEV_IMG_PART_NUM_M \
736 : : MAKEMASK(0xFF, ICE_EXT_TOPO_DEV_IMG_PART_NUM_S)
737 : : bool ext_topo_dev_img_load_en[ICE_EXT_TOPO_DEV_IMG_COUNT];
738 : : #define ICE_EXT_TOPO_DEV_IMG_LOAD_EN BIT(0)
739 : : bool ext_topo_dev_img_prog_en[ICE_EXT_TOPO_DEV_IMG_COUNT];
740 : : #define ICE_EXT_TOPO_DEV_IMG_PROG_EN BIT(1)
741 : : bool ext_topo_dev_img_ver_schema[ICE_EXT_TOPO_DEV_IMG_COUNT];
742 : : #define ICE_EXT_TOPO_DEV_IMG_VER_SCHEMA BIT(2)
743 : : bool tx_sched_topo_comp_mode_en;
744 : : /* Support for OROM update in Recovery Mode */
745 : : bool orom_recovery_update;
746 : : bool next_cluster_id_support;
747 : : };
748 : :
749 : : /* IEEE 1588 TIME_SYNC specific info */
750 : : /* Function specific definitions */
751 : : #define ICE_TS_FUNC_ENA_M BIT(0)
752 : : #define ICE_TS_SRC_TMR_OWND_M BIT(1)
753 : : #define ICE_TS_TMR_ENA_M BIT(2)
754 : : #define ICE_TS_TMR_IDX_OWND_S 4
755 : : #define ICE_TS_TMR_IDX_OWND_M BIT(4)
756 : : #define ICE_TS_GPIO_1PPS_ASSOC BIT(12)
757 : : #define ICE_TS_CLK_FREQ_S 16
758 : : #define ICE_TS_CLK_FREQ_M MAKEMASK(0x7, ICE_TS_CLK_FREQ_S)
759 : : #define ICE_TS_CLK_SRC_S 20
760 : : #define ICE_TS_CLK_SRC_M BIT(20)
761 : : #define ICE_TS_TMR_IDX_ASSOC_S 24
762 : : #define ICE_TS_TMR_IDX_ASSOC_M BIT(24)
763 : :
764 : : /* TIME_REF clock rate specification */
765 : : enum ice_time_ref_freq {
766 : : ICE_TIME_REF_FREQ_25_000 = 0,
767 : : ICE_TIME_REF_FREQ_122_880 = 1,
768 : : ICE_TIME_REF_FREQ_125_000 = 2,
769 : : ICE_TIME_REF_FREQ_153_600 = 3,
770 : : ICE_TIME_REF_FREQ_156_250 = 4,
771 : : ICE_TIME_REF_FREQ_245_760 = 5,
772 : :
773 : : NUM_ICE_TIME_REF_FREQ,
774 : :
775 : : ICE_TIME_REF_FREQ_INVALID = -1,
776 : : };
777 : :
778 : : /* Clock source specification */
779 : : enum ice_clk_src {
780 : : ICE_CLK_SRC_TCX0 = 0, /* Temperature compensated oscillator */
781 : : ICE_CLK_SRC_TIME_REF = 1, /* Use TIME_REF reference clock */
782 : :
783 : : NUM_ICE_CLK_SRC
784 : : };
785 : :
786 : : struct ice_ts_func_info {
787 : : /* Function specific info */
788 : : enum ice_time_ref_freq time_ref;
789 : : u8 clk_src : 1;
790 : : u8 tmr_index_assoc : 1;
791 : : u8 ena : 1;
792 : : u8 tmr_index_owned : 1;
793 : : u8 src_tmr_owned : 1;
794 : : u8 tmr_ena : 1;
795 : : u8 gpio_1pps : 1;
796 : : };
797 : :
798 : : /* Device specific definitions */
799 : : #define ICE_TS_TMR0_OWNR_M 0x7
800 : : #define ICE_TS_TMR0_OWND_M BIT(3)
801 : : #define ICE_TS_TMR1_OWNR_S 4
802 : : #define ICE_TS_TMR1_OWNR_M MAKEMASK(0x7, ICE_TS_TMR1_OWNR_S)
803 : : #define ICE_TS_TMR1_OWND_M BIT(7)
804 : : #define ICE_TS_DEV_ENA_M BIT(24)
805 : : #define ICE_TS_TMR0_ENA_M BIT(25)
806 : : #define ICE_TS_TMR1_ENA_M BIT(26)
807 : : #define ICE_TS_LL_TX_TS_READ_M BIT(28)
808 : : #define ICE_TS_LL_TX_TS_INT_READ_M BIT(29)
809 : :
810 : : struct ice_ts_dev_info {
811 : : /* Device specific info */
812 : : u32 tmr_own_map;
813 : : u8 tmr0_owner;
814 : : u8 tmr1_owner;
815 : : u8 tmr0_owned : 1;
816 : : u8 tmr1_owned : 1;
817 : : u8 ena : 1;
818 : : u8 tmr0_ena : 1;
819 : : u8 tmr1_ena : 1;
820 : : u8 ts_ll_read : 1;
821 : : u8 ts_ll_int_read : 1;
822 : : };
823 : :
824 : : #define ICE_NAC_TOPO_PRIMARY_M BIT(0)
825 : : #define ICE_NAC_TOPO_DUAL_M BIT(1)
826 : : #define ICE_NAC_TOPO_ID_M MAKEMASK(0xf, 0)
827 : :
828 : : struct ice_nac_topology {
829 : : u32 mode;
830 : : u8 id;
831 : : };
832 : :
833 : : /* Function specific capabilities */
834 : : struct ice_hw_func_caps {
835 : : struct ice_hw_common_caps common_cap;
836 : : u32 guar_num_vsi;
837 : : u32 fd_fltr_guar; /* Number of filters guaranteed */
838 : : u32 fd_fltr_best_effort; /* Number of best effort filters */
839 : : struct ice_ts_func_info ts_func_info;
840 : : };
841 : :
842 : : /* Device wide capabilities */
843 : : struct ice_hw_dev_caps {
844 : : struct ice_hw_common_caps common_cap;
845 : : u32 num_vsi_allocd_to_host; /* Excluding EMP VSI */
846 : : u32 num_flow_director_fltr; /* Number of FD filters available */
847 : : struct ice_ts_dev_info ts_dev_info;
848 : : u32 num_funcs;
849 : : struct ice_nac_topology nac_topo;
850 : : /* bitmap of supported sensors */
851 : : u32 supported_sensors;
852 : : #define ICE_SENSOR_SUPPORT_E810_INT_TEMP BIT(0)
853 : : };
854 : :
855 : : /* Information about MAC such as address, etc... */
856 : : struct ice_mac_info {
857 : : u8 lan_addr[ETH_ALEN];
858 : : u8 perm_addr[ETH_ALEN];
859 : : u8 port_addr[ETH_ALEN];
860 : : u8 wol_addr[ETH_ALEN];
861 : : };
862 : :
863 : : /* PCI bus types */
864 : : enum ice_bus_type {
865 : : ice_bus_unknown = 0,
866 : : ice_bus_pci_express,
867 : : ice_bus_embedded, /* Is device Embedded versus card */
868 : : ice_bus_reserved
869 : : };
870 : :
871 : : /* PCI bus speeds */
872 : : enum ice_pcie_bus_speed {
873 : : ice_pcie_speed_unknown = 0xff,
874 : : ice_pcie_speed_2_5GT = 0x14,
875 : : ice_pcie_speed_5_0GT = 0x15,
876 : : ice_pcie_speed_8_0GT = 0x16,
877 : : ice_pcie_speed_16_0GT = 0x17,
878 : : ice_pcie_speed_32_0GT = 0x18,
879 : : };
880 : :
881 : : /* PCI bus widths */
882 : : enum ice_pcie_link_width {
883 : : ice_pcie_lnk_width_resrv = 0x00,
884 : : ice_pcie_lnk_x1 = 0x01,
885 : : ice_pcie_lnk_x2 = 0x02,
886 : : ice_pcie_lnk_x4 = 0x04,
887 : : ice_pcie_lnk_x8 = 0x08,
888 : : ice_pcie_lnk_x12 = 0x0C,
889 : : ice_pcie_lnk_x16 = 0x10,
890 : : ice_pcie_lnk_x32 = 0x20,
891 : : ice_pcie_lnk_width_unknown = 0xff,
892 : : };
893 : :
894 : : /* Reset types used to determine which kind of reset was requested. These
895 : : * defines match what the RESET_TYPE field of the GLGEN_RSTAT register.
896 : : * ICE_RESET_PFR does not match any RESET_TYPE field in the GLGEN_RSTAT register
897 : : * because its reset source is different than the other types listed.
898 : : */
899 : : enum ice_reset_req {
900 : : ICE_RESET_POR = 0,
901 : : ICE_RESET_INVAL = 0,
902 : : ICE_RESET_CORER = 1,
903 : : ICE_RESET_GLOBR = 2,
904 : : ICE_RESET_EMPR = 3,
905 : : ICE_RESET_PFR = 4,
906 : : };
907 : :
908 : : /* Bus parameters */
909 : : struct ice_bus_info {
910 : : enum ice_pcie_bus_speed speed;
911 : : enum ice_pcie_link_width width;
912 : : enum ice_bus_type type;
913 : : u16 domain_num;
914 : : u16 device;
915 : : u8 func;
916 : : u8 bus_num;
917 : : };
918 : :
919 : : /* Flow control (FC) parameters */
920 : : struct ice_fc_info {
921 : : enum ice_fc_mode current_mode; /* FC mode in effect */
922 : : enum ice_fc_mode req_mode; /* FC mode requested by caller */
923 : : };
924 : :
925 : : /* Option ROM version information */
926 : : struct ice_orom_info {
927 : : u8 major; /* Major version of OROM */
928 : : u8 patch; /* Patch version of OROM */
929 : : u16 build; /* Build version of OROM */
930 : : u32 srev; /* Security revision */
931 : : };
932 : :
933 : : /* NVM version information */
934 : : struct ice_nvm_info {
935 : : u32 eetrack;
936 : : u32 srev;
937 : : u8 major;
938 : : u8 minor;
939 : : };
940 : :
941 : : /* Minimum Security Revision information */
942 : : struct ice_minsrev_info {
943 : : u32 nvm;
944 : : u32 orom;
945 : : u8 nvm_valid : 1;
946 : : u8 orom_valid : 1;
947 : : };
948 : :
949 : : /* Enumeration of possible flash banks for the NVM, OROM, and Netlist modules
950 : : * of the flash image.
951 : : */
952 : : enum ice_flash_bank {
953 : : ICE_INVALID_FLASH_BANK,
954 : : ICE_1ST_FLASH_BANK,
955 : : ICE_2ND_FLASH_BANK,
956 : : };
957 : :
958 : : /* Enumeration of which flash bank is desired to read from, either the active
959 : : * bank or the inactive bank. Used to abstract 1st and 2nd bank notion from
960 : : * code which just wants to read the active or inactive flash bank.
961 : : */
962 : : enum ice_bank_select {
963 : : ICE_ACTIVE_FLASH_BANK,
964 : : ICE_INACTIVE_FLASH_BANK,
965 : : };
966 : :
967 : : /* information for accessing NVM, OROM, and Netlist flash banks */
968 : : struct ice_bank_info {
969 : : u32 nvm_ptr; /* Pointer to 1st NVM bank */
970 : : u32 nvm_size; /* Size of NVM bank */
971 : : u32 orom_ptr; /* Pointer to 1st OROM bank */
972 : : u32 orom_size; /* Size of OROM bank */
973 : : u32 netlist_ptr; /* Pointer to 1st Netlist bank */
974 : : u32 netlist_size; /* Size of Netlist bank */
975 : : enum ice_flash_bank nvm_bank; /* Active NVM bank */
976 : : enum ice_flash_bank orom_bank; /* Active OROM bank */
977 : : enum ice_flash_bank netlist_bank; /* Active Netlist bank */
978 : : };
979 : :
980 : : /* Flash Chip Information */
981 : : struct ice_flash_info {
982 : : struct ice_orom_info orom; /* Option ROM version info */
983 : : struct ice_nvm_info nvm; /* NVM version information */
984 : : struct ice_bank_info banks; /* Flash Bank information */
985 : : u16 sr_words; /* Shadow RAM size in words */
986 : : u32 flash_size; /* Size of available flash in bytes */
987 : : u8 blank_nvm_mode; /* is NVM empty (no FW present) */
988 : : };
989 : :
990 : : struct ice_link_default_override_tlv {
991 : : u8 options;
992 : : #define ICE_LINK_OVERRIDE_OPT_M 0x3F
993 : : #define ICE_LINK_OVERRIDE_STRICT_MODE BIT(0)
994 : : #define ICE_LINK_OVERRIDE_EPCT_DIS BIT(1)
995 : : #define ICE_LINK_OVERRIDE_PORT_DIS BIT(2)
996 : : #define ICE_LINK_OVERRIDE_EN BIT(3)
997 : : #define ICE_LINK_OVERRIDE_AUTO_LINK_DIS BIT(4)
998 : : #define ICE_LINK_OVERRIDE_EEE_EN BIT(5)
999 : : u8 phy_config;
1000 : : #define ICE_LINK_OVERRIDE_PHY_CFG_S 8
1001 : : #define ICE_LINK_OVERRIDE_PHY_CFG_M (0xC3 << ICE_LINK_OVERRIDE_PHY_CFG_S)
1002 : : #define ICE_LINK_OVERRIDE_PAUSE_M 0x3
1003 : : #define ICE_LINK_OVERRIDE_LESM_EN BIT(6)
1004 : : #define ICE_LINK_OVERRIDE_AUTO_FEC_EN BIT(7)
1005 : : u8 fec_options;
1006 : : #define ICE_LINK_OVERRIDE_FEC_OPT_M 0xFF
1007 : : u8 rsvd1;
1008 : : u64 phy_type_low;
1009 : : u64 phy_type_high;
1010 : : };
1011 : :
1012 : : #define ICE_NVM_VER_LEN 32
1013 : :
1014 : : /* Max number of port to queue branches w.r.t topology */
1015 : : #define ICE_TXSCHED_MAX_BRANCHES ICE_MAX_TRAFFIC_CLASS
1016 : :
1017 : : #define ice_for_each_traffic_class(_i) \
1018 : : for ((_i) = 0; (_i) < ICE_MAX_TRAFFIC_CLASS; (_i)++)
1019 : :
1020 : : /* ICE_DFLT_AGG_ID means that all new VM(s)/VSI node connects
1021 : : * to driver defined policy for default aggregator
1022 : : */
1023 : : #define ICE_INVAL_TEID 0xFFFFFFFF
1024 : : #define ICE_DFLT_AGG_ID 0
1025 : :
1026 : : struct ice_sched_node {
1027 : : struct ice_sched_node *parent;
1028 : : struct ice_sched_node *sibling; /* next sibling in the same layer */
1029 : : struct ice_sched_node **children;
1030 : : struct ice_aqc_txsched_elem_data info;
1031 : : u32 agg_id; /* aggregator group ID */
1032 : : u16 vsi_handle;
1033 : : u16 num_children;
1034 : : u8 in_use; /* suspended or in use */
1035 : : u8 tx_sched_layer; /* Logical Layer (1-9) */
1036 : : u8 tc_num;
1037 : : u8 owner;
1038 : : #define ICE_SCHED_NODE_OWNER_LAN 0
1039 : : #define ICE_SCHED_NODE_OWNER_AE 1
1040 : : #define ICE_SCHED_NODE_OWNER_RDMA 2
1041 : : };
1042 : :
1043 : : /* Access Macros for Tx Sched Elements data */
1044 : : #define ICE_TXSCHED_GET_NODE_TEID(x) LE32_TO_CPU((x)->info.node_teid)
1045 : : #define ICE_TXSCHED_GET_PARENT_TEID(x) LE32_TO_CPU((x)->info.parent_teid)
1046 : : #define ICE_TXSCHED_GET_CIR_RL_ID(x) \
1047 : : LE16_TO_CPU((x)->info.cir_bw.bw_profile_idx)
1048 : : #define ICE_TXSCHED_GET_EIR_RL_ID(x) \
1049 : : LE16_TO_CPU((x)->info.eir_bw.bw_profile_idx)
1050 : : #define ICE_TXSCHED_GET_SRL_ID(x) LE16_TO_CPU((x)->info.srl_id)
1051 : : #define ICE_TXSCHED_GET_CIR_BWALLOC(x) \
1052 : : LE16_TO_CPU((x)->info.cir_bw.bw_alloc)
1053 : : #define ICE_TXSCHED_GET_EIR_BWALLOC(x) \
1054 : : LE16_TO_CPU((x)->info.eir_bw.bw_alloc)
1055 : :
1056 : : struct ice_sched_rl_profile {
1057 : : u32 rate; /* In Kbps */
1058 : : struct ice_aqc_rl_profile_elem info;
1059 : : };
1060 : :
1061 : : /* The aggregator type determines if identifier is for a VSI group,
1062 : : * aggregator group, aggregator of queues, or queue group.
1063 : : */
1064 : : enum ice_agg_type {
1065 : : ICE_AGG_TYPE_UNKNOWN = 0,
1066 : : ICE_AGG_TYPE_TC,
1067 : : ICE_AGG_TYPE_AGG, /* aggregator */
1068 : : ICE_AGG_TYPE_VSI,
1069 : : ICE_AGG_TYPE_QG,
1070 : : ICE_AGG_TYPE_Q
1071 : : };
1072 : :
1073 : : /* Rate limit types */
1074 : : enum ice_rl_type {
1075 : : ICE_UNKNOWN_BW = 0,
1076 : : ICE_MIN_BW, /* for CIR profile */
1077 : : ICE_MAX_BW, /* for EIR profile */
1078 : : ICE_SHARED_BW /* for shared profile */
1079 : : };
1080 : :
1081 : : #define ICE_SCHED_MIN_BW 500 /* in Kbps */
1082 : : #define ICE_SCHED_MAX_BW 100000000 /* in Kbps */
1083 : : #define ICE_SCHED_DFLT_BW 0xFFFFFFFF /* unlimited */
1084 : : #define ICE_SCHED_NO_PRIORITY 0
1085 : : #define ICE_SCHED_NO_BW_WT 0
1086 : : #define ICE_SCHED_DFLT_RL_PROF_ID 0
1087 : : #define ICE_SCHED_NO_SHARED_RL_PROF_ID 0xFFFF
1088 : : #define ICE_SCHED_DFLT_BW_WT 4
1089 : : #define ICE_SCHED_INVAL_PROF_ID 0xFFFF
1090 : : #define ICE_SCHED_DFLT_BURST_SIZE (15 * 1024) /* in bytes (15k) */
1091 : :
1092 : : /* Access Macros for Tx Sched RL Profile data */
1093 : : #define ICE_TXSCHED_GET_RL_PROF_ID(p) LE16_TO_CPU((p)->info.profile_id)
1094 : : #define ICE_TXSCHED_GET_RL_MBS(p) LE16_TO_CPU((p)->info.max_burst_size)
1095 : : #define ICE_TXSCHED_GET_RL_MULTIPLIER(p) LE16_TO_CPU((p)->info.rl_multiply)
1096 : : #define ICE_TXSCHED_GET_RL_WAKEUP_MV(p) LE16_TO_CPU((p)->info.wake_up_calc)
1097 : : #define ICE_TXSCHED_GET_RL_ENCODE(p) LE16_TO_CPU((p)->info.rl_encode)
1098 : :
1099 : : #define ICE_MAX_PORT_PER_PCI_DEV 8
1100 : :
1101 : : /* The following tree example shows the naming conventions followed under
1102 : : * ice_port_info struct for default scheduler tree topology.
1103 : : *
1104 : : * A tree on a port
1105 : : * * ---> root node
1106 : : * (TC0)/ / / / \ \ \ \(TC7) ---> num_branches (range:1- 8)
1107 : : * * * * * * * * * |
1108 : : * / |
1109 : : * * |
1110 : : * / |-> num_elements (range:1 - 9)
1111 : : * * | implies num_of_layers
1112 : : * / |
1113 : : * (a)* |
1114 : : *
1115 : : * (a) is the last_node_teid(not of type Leaf). A leaf node is created under
1116 : : * (a) as child node where queues get added, add Tx/Rx queue admin commands;
1117 : : * need TEID of (a) to add queues.
1118 : : *
1119 : : * This tree
1120 : : * -> has 8 branches (one for each TC)
1121 : : * -> First branch (TC0) has 4 elements
1122 : : * -> has 4 layers
1123 : : * -> (a) is the topmost layer node created by firmware on branch 0
1124 : : *
1125 : : * Note: Above asterisk tree covers only basic terminology and scenario.
1126 : : * Refer to the documentation for more info.
1127 : : */
1128 : :
1129 : : /* Data structure for saving BW information */
1130 : : enum ice_bw_type {
1131 : : ICE_BW_TYPE_PRIO,
1132 : : ICE_BW_TYPE_CIR,
1133 : : ICE_BW_TYPE_CIR_WT,
1134 : : ICE_BW_TYPE_EIR,
1135 : : ICE_BW_TYPE_EIR_WT,
1136 : : ICE_BW_TYPE_SHARED,
1137 : : ICE_BW_TYPE_CNT /* This must be last */
1138 : : };
1139 : :
1140 : : struct ice_bw {
1141 : : u32 bw;
1142 : : u16 bw_alloc;
1143 : : };
1144 : :
1145 : : struct ice_bw_type_info {
1146 : : ice_declare_bitmap(bw_t_bitmap, ICE_BW_TYPE_CNT);
1147 : : u8 generic;
1148 : : struct ice_bw cir_bw;
1149 : : struct ice_bw eir_bw;
1150 : : u32 shared_bw;
1151 : : };
1152 : :
1153 : : /* VSI queue context structure for given TC */
1154 : : struct ice_q_ctx {
1155 : : u16 q_handle;
1156 : : u32 q_teid;
1157 : : /* bw_t_info saves queue BW information */
1158 : : struct ice_bw_type_info bw_t_info;
1159 : : };
1160 : :
1161 : : /* VSI type list entry to locate corresponding VSI/aggregator nodes */
1162 : : struct ice_sched_vsi_info {
1163 : : struct ice_sched_node *vsi_node[ICE_MAX_TRAFFIC_CLASS];
1164 : : struct ice_sched_node *ag_node[ICE_MAX_TRAFFIC_CLASS];
1165 : : u16 max_lanq[ICE_MAX_TRAFFIC_CLASS];
1166 : : /* bw_t_info saves VSI BW information */
1167 : : struct ice_bw_type_info bw_t_info[ICE_MAX_TRAFFIC_CLASS];
1168 : : };
1169 : :
1170 : : /* CEE or IEEE 802.1Qaz ETS Configuration data */
1171 : : struct ice_dcb_ets_cfg {
1172 : : u8 willing;
1173 : : u8 cbs;
1174 : : u8 maxtcs;
1175 : : u8 prio_table[ICE_MAX_TRAFFIC_CLASS];
1176 : : u8 tcbwtable[ICE_MAX_TRAFFIC_CLASS];
1177 : : u8 tsatable[ICE_MAX_TRAFFIC_CLASS];
1178 : : };
1179 : :
1180 : : /* CEE or IEEE 802.1Qaz PFC Configuration data */
1181 : : struct ice_dcb_pfc_cfg {
1182 : : u8 willing;
1183 : : u8 mbc;
1184 : : u8 pfccap;
1185 : : u8 pfcena;
1186 : : };
1187 : :
1188 : : /* CEE or IEEE 802.1Qaz Application Priority data */
1189 : : struct ice_dcb_app_priority_table {
1190 : : u16 prot_id;
1191 : : u8 priority;
1192 : : u8 selector;
1193 : : };
1194 : :
1195 : : #define ICE_MAX_USER_PRIORITY 8
1196 : : #define ICE_DCBX_MAX_APPS 64
1197 : : #define ICE_DSCP_NUM_VAL 64
1198 : : #define ICE_LLDPDU_SIZE 1500
1199 : : #define ICE_TLV_STATUS_OPER 0x1
1200 : : #define ICE_TLV_STATUS_SYNC 0x2
1201 : : #define ICE_TLV_STATUS_ERR 0x4
1202 : : #define ICE_APP_PROT_ID_FCOE 0x8906
1203 : : #define ICE_APP_PROT_ID_ISCSI 0x0cbc
1204 : : #define ICE_APP_PROT_ID_ISCSI_860 0x035c
1205 : : #define ICE_APP_PROT_ID_FIP 0x8914
1206 : : #define ICE_APP_SEL_ETHTYPE 0x1
1207 : : #define ICE_APP_SEL_TCPIP 0x2
1208 : : #define ICE_CEE_APP_SEL_ETHTYPE 0x0
1209 : : #define ICE_CEE_APP_SEL_TCPIP 0x1
1210 : :
1211 : : struct ice_dcbx_cfg {
1212 : : u32 numapps;
1213 : : u32 tlv_status; /* CEE mode TLV status */
1214 : : struct ice_dcb_ets_cfg etscfg;
1215 : : struct ice_dcb_ets_cfg etsrec;
1216 : : struct ice_dcb_pfc_cfg pfc;
1217 : : #define ICE_QOS_MODE_VLAN 0x0
1218 : : #define ICE_QOS_MODE_DSCP 0x1
1219 : : u8 pfc_mode;
1220 : : struct ice_dcb_app_priority_table app[ICE_DCBX_MAX_APPS];
1221 : : /* when DSCP mapping defined by user set its bit to 1 */
1222 : : ice_declare_bitmap(dscp_mapped, ICE_DSCP_NUM_VAL);
1223 : : /* array holding DSCP -> UP/TC values for DSCP L3 QoS mode */
1224 : : u8 dscp_map[ICE_DSCP_NUM_VAL];
1225 : : u8 dcbx_mode;
1226 : : #define ICE_DCBX_MODE_CEE 0x1
1227 : : #define ICE_DCBX_MODE_IEEE 0x2
1228 : : u8 app_mode;
1229 : : #define ICE_DCBX_APPS_NON_WILLING 0x1
1230 : : };
1231 : :
1232 : : struct ice_qos_cfg {
1233 : : struct ice_dcbx_cfg local_dcbx_cfg; /* Oper/Local Cfg */
1234 : : struct ice_dcbx_cfg desired_dcbx_cfg; /* CEE Desired Cfg */
1235 : : struct ice_dcbx_cfg remote_dcbx_cfg; /* Peer Cfg */
1236 : : u8 dcbx_status : 3; /* see ICE_DCBX_STATUS_DIS */
1237 : : u8 is_sw_lldp : 1;
1238 : : };
1239 : :
1240 : : struct ice_port_info {
1241 : : struct ice_sched_node *root; /* Root Node per Port */
1242 : : struct ice_hw *hw; /* back pointer to HW instance */
1243 : : u32 last_node_teid; /* scheduler last node info */
1244 : : u16 sw_id; /* Initial switch ID belongs to port */
1245 : : u16 pf_vf_num;
1246 : : u8 port_state;
1247 : : u8 loopback_mode;
1248 : : #define ICE_SCHED_PORT_STATE_INIT 0x0
1249 : : #define ICE_SCHED_PORT_STATE_READY 0x1
1250 : : u8 lport;
1251 : : #define ICE_LPORT_MASK 0xff
1252 : : struct ice_fc_info fc;
1253 : : struct ice_mac_info mac;
1254 : : struct ice_phy_info phy;
1255 : : struct ice_lock sched_lock; /* protect access to TXSched tree */
1256 : : struct ice_sched_node *
1257 : : sib_head[ICE_MAX_TRAFFIC_CLASS][ICE_AQC_TOPO_MAX_LEVEL_NUM];
1258 : : struct ice_bw_type_info root_node_bw_t_info;
1259 : : struct ice_bw_type_info tc_node_bw_t_info[ICE_MAX_TRAFFIC_CLASS];
1260 : : struct ice_qos_cfg qos_cfg;
1261 : : u8 is_vf:1;
1262 : : u8 is_custom_tx_enabled:1;
1263 : : u8 has_tc:1;
1264 : : };
1265 : :
1266 : : struct ice_switch_info {
1267 : : struct LIST_HEAD_TYPE vsi_list_map_head;
1268 : : struct ice_sw_recipe *recp_list;
1269 : : u16 prof_res_bm_init;
1270 : : u16 max_used_prof_index;
1271 : :
1272 : : ice_declare_bitmap(prof_res_bm[ICE_MAX_NUM_PROFILES], ICE_MAX_FV_WORDS);
1273 : : };
1274 : :
1275 : : /* PHY model */
1276 : : enum ice_phy_model {
1277 : : ICE_PHY_UNSUP = -1,
1278 : : ICE_PHY_E810 = 1,
1279 : : ICE_PHY_E822,
1280 : : ICE_PHY_ETH56G,
1281 : : ICE_PHY_E830,
1282 : : };
1283 : :
1284 : : enum ice_eth56g_mode {
1285 : : ICE_ETH56G_MODE_0,
1286 : : ICE_ETH56G_MODE_1,
1287 : : };
1288 : :
1289 : : /* Port hardware description */
1290 : : struct ice_hw {
1291 : : u8 *hw_addr;
1292 : : void *back;
1293 : : struct ice_aqc_layer_props *layer_info;
1294 : : struct ice_port_info *port_info;
1295 : : /* 2D Array for each Tx Sched RL Profile type */
1296 : : struct ice_sched_rl_profile **cir_profiles;
1297 : : struct ice_sched_rl_profile **eir_profiles;
1298 : : struct ice_sched_rl_profile **srl_profiles;
1299 : : /* PSM clock frequency for calculating RL profile params */
1300 : : u32 psm_clk_freq;
1301 : : u64 debug_mask; /* BITMAP for debug mask */
1302 : : enum ice_mac_type mac_type;
1303 : :
1304 : : u16 fd_ctr_base; /* FD counter base index */
1305 : : u16 fw_vsi_num;
1306 : : /* pci info */
1307 : : u16 device_id;
1308 : : u16 vendor_id;
1309 : : u16 subsystem_device_id;
1310 : : u16 subsystem_vendor_id;
1311 : : u8 revision_id;
1312 : :
1313 : : u8 pf_id; /* device profile info */
1314 : : enum ice_phy_model phy_model;
1315 : : u8 phy_ports;
1316 : : u8 max_phy_port;
1317 : : #define ICE_PHYS_PER_CPLX_E824S 1
1318 : : #define ICE_PORTS_PER_PHY_E824S 8
1319 : :
1320 : : #define ICE_PHYS_PER_CPLX_C825X 2
1321 : : #define ICE_PORTS_PER_PHY_C825X 4
1322 : :
1323 : : #define MAX_PHYS_PER_ICE 2
1324 : : u8 num_phys;
1325 : : u8 phy_addr[MAX_PHYS_PER_ICE]; /* PHY address */
1326 : : u8 logical_pf_id;
1327 : :
1328 : : u16 max_burst_size; /* driver sets this value */
1329 : :
1330 : : /* Tx Scheduler values */
1331 : : u8 num_tx_sched_layers;
1332 : : u8 num_tx_sched_phys_layers;
1333 : : u8 flattened_layers;
1334 : : u8 max_cgds;
1335 : : u8 sw_entry_point_layer;
1336 : : u16 max_children[ICE_AQC_TOPO_MAX_LEVEL_NUM];
1337 : : struct LIST_HEAD_TYPE agg_list; /* lists all aggregator */
1338 : : /* List contain profile ID(s) and other params per layer */
1339 : : struct LIST_HEAD_TYPE rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM];
1340 : : struct ice_vsi_ctx *vsi_ctx[ICE_MAX_VSI];
1341 : : u8 evb_veb; /* true for VEB, false for VEPA */
1342 : : u8 reset_ongoing; /* true if HW is in reset, false otherwise */
1343 : : struct ice_bus_info bus;
1344 : : struct ice_flash_info flash;
1345 : : struct ice_hw_dev_caps dev_caps; /* device capabilities */
1346 : : struct ice_hw_func_caps func_caps; /* function capabilities */
1347 : :
1348 : : struct ice_switch_info *switch_info; /* switch filter lists */
1349 : :
1350 : : /* Control Queue info */
1351 : : struct ice_ctl_q_info adminq;
1352 : : struct ice_ctl_q_info sbq;
1353 : : struct ice_ctl_q_info mailboxq;
1354 : : /* Additional function to send AdminQ command */
1355 : : int (*aq_send_cmd_fn)(void *param, struct ice_aq_desc *desc,
1356 : : void *buf, u16 buf_size);
1357 : : void *aq_send_cmd_param;
1358 : : u8 dcf_enabled; /* Device Config Function */
1359 : : u8 api_branch; /* API branch version */
1360 : : u8 api_maj_ver; /* API major version */
1361 : : u8 api_min_ver; /* API minor version */
1362 : : u8 api_patch; /* API patch version */
1363 : : u8 fw_branch; /* firmware branch version */
1364 : : u8 fw_maj_ver; /* firmware major version */
1365 : : u8 fw_min_ver; /* firmware minor version */
1366 : : u8 fw_patch; /* firmware patch version */
1367 : : u32 fw_build; /* firmware build number */
1368 : :
1369 : : /* Device max aggregate bandwidths corresponding to the GL_PWR_MODE_CTL
1370 : : * register. Used for determining the ITR/INTRL granularity during
1371 : : * initialization.
1372 : : */
1373 : : #define ICE_MAX_AGG_BW_200G 0x0
1374 : : #define ICE_MAX_AGG_BW_100G 0X1
1375 : : #define ICE_MAX_AGG_BW_50G 0x2
1376 : : #define ICE_MAX_AGG_BW_25G 0x3
1377 : : /* ITR granularity for different speeds */
1378 : : #define ICE_ITR_GRAN_ABOVE_25 2
1379 : : #define ICE_ITR_GRAN_MAX_25 4
1380 : : /* ITR granularity in 1 us */
1381 : : u8 itr_gran;
1382 : : /* INTRL granularity for different speeds */
1383 : : #define ICE_INTRL_GRAN_ABOVE_25 4
1384 : : #define ICE_INTRL_GRAN_MAX_25 8
1385 : : /* INTRL granularity in 1 us */
1386 : : u8 intrl_gran;
1387 : :
1388 : : /* true if VSIs can share unicast MAC addr */
1389 : : u8 umac_shared;
1390 : :
1391 : : #define ICE_PHY_PER_NAC_E822 1
1392 : : #define ICE_MAX_QUAD 2
1393 : : #define ICE_QUADS_PER_PHY_E822 2
1394 : : #define ICE_PORTS_PER_PHY_E822 8
1395 : : #define ICE_PORTS_PER_QUAD 4
1396 : : #define ICE_PORTS_PER_PHY_E810 4
1397 : : #define ICE_NUM_EXTERNAL_PORTS (ICE_MAX_QUAD * ICE_PORTS_PER_QUAD)
1398 : :
1399 : : /* bitmap of enabled logical ports */
1400 : : u32 ena_lports;
1401 : :
1402 : : /* Active package version (currently active) */
1403 : : struct ice_pkg_ver active_pkg_ver;
1404 : : u32 pkg_seg_id;
1405 : : u32 pkg_sign_type;
1406 : : u32 active_track_id;
1407 : : u8 active_pkg_name[ICE_PKG_NAME_SIZE];
1408 : : u8 active_pkg_in_nvm;
1409 : :
1410 : : enum ice_aq_err pkg_dwnld_status;
1411 : :
1412 : : /* Driver's package ver - (from the Ice Metadata section) */
1413 : : struct ice_pkg_ver pkg_ver;
1414 : : u8 pkg_name[ICE_PKG_NAME_SIZE];
1415 : :
1416 : : /* Driver's Ice segment format version and id (from the Ice seg) */
1417 : : struct ice_pkg_ver ice_seg_fmt_ver;
1418 : : u8 ice_seg_id[ICE_SEG_ID_SIZE];
1419 : :
1420 : : /* Pointer to the ice segment */
1421 : : struct ice_seg *seg;
1422 : :
1423 : : /* Pointer to allocated copy of pkg memory */
1424 : : u8 *pkg_copy;
1425 : : u32 pkg_size;
1426 : :
1427 : : /* tunneling info */
1428 : : struct ice_lock tnl_lock;
1429 : : struct ice_tunnel_table tnl;
1430 : :
1431 : : /* dvm boost update information */
1432 : : struct ice_dvm_table dvm_upd;
1433 : :
1434 : : struct ice_acl_tbl *acl_tbl;
1435 : : struct ice_fd_hw_prof **acl_prof;
1436 : : u16 acl_fltr_cnt[ICE_FLTR_PTYPE_MAX];
1437 : : /* HW block tables */
1438 : : struct ice_blk_info blk[ICE_BLK_COUNT];
1439 : : struct ice_lock fl_profs_locks[ICE_BLK_COUNT]; /* lock fltr profiles */
1440 : : struct LIST_HEAD_TYPE fl_profs[ICE_BLK_COUNT];
1441 : : /* Flow Director filter info */
1442 : : int fdir_active_fltr;
1443 : :
1444 : : struct ice_lock fdir_fltr_lock; /* protect Flow Director */
1445 : : struct LIST_HEAD_TYPE fdir_list_head;
1446 : :
1447 : : /* Book-keeping of side-band filter count per flow-type.
1448 : : * This is used to detect and handle input set changes for
1449 : : * respective flow-type.
1450 : : */
1451 : : u16 fdir_fltr_cnt[ICE_FLTR_PTYPE_MAX];
1452 : :
1453 : : struct ice_fd_hw_prof **fdir_prof;
1454 : : ice_declare_bitmap(fdir_perfect_fltr, ICE_FLTR_PTYPE_MAX);
1455 : : struct ice_lock rss_locks; /* protect RSS configuration */
1456 : : struct LIST_HEAD_TYPE rss_list_head;
1457 : : ice_declare_bitmap(hw_ptype, ICE_FLOW_PTYPE_MAX);
1458 : : u8 dvm_ena;
1459 : : u16 io_expander_handle;
1460 : :
1461 : : bool skip_clear_pf;
1462 : : };
1463 : :
1464 : : /* Statistics collected by each port, VSI, VEB, and S-channel */
1465 : : struct ice_eth_stats {
1466 : : u64 rx_bytes; /* gorc */
1467 : : u64 rx_unicast; /* uprc */
1468 : : u64 rx_multicast; /* mprc */
1469 : : u64 rx_broadcast; /* bprc */
1470 : : u64 rx_discards; /* rdpc */
1471 : : u64 rx_unknown_protocol; /* rupp */
1472 : : u64 tx_bytes; /* gotc */
1473 : : u64 tx_unicast; /* uptc */
1474 : : u64 tx_multicast; /* mptc */
1475 : : u64 tx_broadcast; /* bptc */
1476 : : u64 tx_discards; /* tdpc */
1477 : : u64 tx_errors; /* tepc */
1478 : : u64 rx_no_desc; /* repc */
1479 : : u64 rx_errors; /* repc */
1480 : : };
1481 : :
1482 : : #define ICE_MAX_UP 8
1483 : :
1484 : : /* Statistics collected per VEB per User Priority (UP) for up to 8 UPs */
1485 : : struct ice_veb_up_stats {
1486 : : u64 up_rx_pkts[ICE_MAX_UP];
1487 : : u64 up_rx_bytes[ICE_MAX_UP];
1488 : : u64 up_tx_pkts[ICE_MAX_UP];
1489 : : u64 up_tx_bytes[ICE_MAX_UP];
1490 : : };
1491 : :
1492 : : /* Statistics collected by the MAC */
1493 : : struct ice_hw_port_stats {
1494 : : /* eth stats collected by the port */
1495 : : struct ice_eth_stats eth;
1496 : : /* additional port specific stats */
1497 : : u64 tx_dropped_link_down; /* tdold */
1498 : : u64 crc_errors; /* crcerrs */
1499 : : u64 illegal_bytes; /* illerrc */
1500 : : u64 error_bytes; /* errbc */
1501 : : u64 mac_local_faults; /* mlfc */
1502 : : u64 mac_remote_faults; /* mrfc */
1503 : : u64 rx_len_errors; /* rlec */
1504 : : u64 link_xon_rx; /* lxonrxc */
1505 : : u64 link_xoff_rx; /* lxoffrxc */
1506 : : u64 link_xon_tx; /* lxontxc */
1507 : : u64 link_xoff_tx; /* lxofftxc */
1508 : : u64 priority_xon_rx[8]; /* pxonrxc[8] */
1509 : : u64 priority_xoff_rx[8]; /* pxoffrxc[8] */
1510 : : u64 priority_xon_tx[8]; /* pxontxc[8] */
1511 : : u64 priority_xoff_tx[8]; /* pxofftxc[8] */
1512 : : u64 priority_xon_2_xoff[8]; /* pxon2offc[8] */
1513 : : u64 rx_size_64; /* prc64 */
1514 : : u64 rx_size_127; /* prc127 */
1515 : : u64 rx_size_255; /* prc255 */
1516 : : u64 rx_size_511; /* prc511 */
1517 : : u64 rx_size_1023; /* prc1023 */
1518 : : u64 rx_size_1522; /* prc1522 */
1519 : : u64 rx_size_big; /* prc9522 */
1520 : : u64 rx_undersize; /* ruc */
1521 : : u64 rx_fragments; /* rfc */
1522 : : u64 rx_oversize; /* roc */
1523 : : u64 rx_jabber; /* rjc */
1524 : : u64 tx_size_64; /* ptc64 */
1525 : : u64 tx_size_127; /* ptc127 */
1526 : : u64 tx_size_255; /* ptc255 */
1527 : : u64 tx_size_511; /* ptc511 */
1528 : : u64 tx_size_1023; /* ptc1023 */
1529 : : u64 tx_size_1522; /* ptc1522 */
1530 : : u64 tx_size_big; /* ptc9522 */
1531 : : u64 mac_short_pkt_dropped; /* mspdc */
1532 : : /* flow director stats */
1533 : : u32 fd_sb_status;
1534 : : u64 fd_sb_match;
1535 : : };
1536 : :
1537 : : enum ice_sw_fwd_act_type {
1538 : : ICE_FWD_TO_VSI = 0,
1539 : : ICE_FWD_TO_VSI_LIST, /* Do not use this when adding filter */
1540 : : ICE_FWD_TO_Q,
1541 : : ICE_FWD_TO_QGRP,
1542 : : ICE_SET_MARK,
1543 : : ICE_DROP_PACKET,
1544 : : ICE_LG_ACTION,
1545 : : ICE_INVAL_ACT
1546 : : };
1547 : :
1548 : : struct ice_aq_get_set_rss_lut_params {
1549 : : u16 vsi_handle; /* software VSI handle */
1550 : : u16 lut_size; /* size of the LUT buffer */
1551 : : u8 lut_type; /* type of the LUT (i.e. VSI, PF, Global) */
1552 : : u8 *lut; /* input RSS LUT for set and output RSS LUT for get */
1553 : : u8 global_lut_id; /* only valid when lut_type is global */
1554 : : };
1555 : :
1556 : : /* Checksum and Shadow RAM pointers */
1557 : : #define ICE_SR_NVM_CTRL_WORD 0x00
1558 : : #define ICE_SR_PHY_ANALOG_PTR 0x04
1559 : : #define ICE_SR_OPTION_ROM_PTR 0x05
1560 : : #define ICE_SR_RO_PCIR_REGS_AUTO_LOAD_PTR 0x06
1561 : : #define ICE_SR_AUTO_GENERATED_POINTERS_PTR 0x07
1562 : : #define ICE_SR_PCIR_REGS_AUTO_LOAD_PTR 0x08
1563 : : #define ICE_SR_EMP_GLOBAL_MODULE_PTR 0x09
1564 : : #define ICE_SR_EMP_IMAGE_PTR 0x0B
1565 : : #define ICE_SR_PE_IMAGE_PTR 0x0C
1566 : : #define ICE_SR_CSR_PROTECTED_LIST_PTR 0x0D
1567 : : #define ICE_SR_MNG_CFG_PTR 0x0E
1568 : : #define ICE_SR_EMP_MODULE_PTR 0x0F
1569 : : #define ICE_SR_PBA_BLOCK_PTR 0x16
1570 : : #define ICE_SR_BOOT_CFG_PTR 0x132
1571 : : #define ICE_SR_NVM_WOL_CFG 0x19
1572 : : #define ICE_NVM_OROM_VER_OFF 0x02
1573 : : #define ICE_SR_NVM_DEV_STARTER_VER 0x18
1574 : : #define ICE_SR_ALTERNATE_SAN_MAC_ADDR_PTR 0x27
1575 : : #define ICE_SR_PERMANENT_SAN_MAC_ADDR_PTR 0x28
1576 : : #define ICE_SR_NVM_MAP_VER 0x29
1577 : : #define ICE_SR_NVM_IMAGE_VER 0x2A
1578 : : #define ICE_SR_NVM_STRUCTURE_VER 0x2B
1579 : : #define ICE_SR_NVM_EETRACK_LO 0x2D
1580 : : #define ICE_SR_NVM_EETRACK_HI 0x2E
1581 : : #define ICE_NVM_VER_LO_SHIFT 0
1582 : : #define ICE_NVM_VER_LO_MASK (0xff << ICE_NVM_VER_LO_SHIFT)
1583 : : #define ICE_NVM_VER_HI_SHIFT 12
1584 : : #define ICE_NVM_VER_HI_MASK (0xf << ICE_NVM_VER_HI_SHIFT)
1585 : : #define ICE_OEM_EETRACK_ID 0xffffffff
1586 : : #define ICE_OROM_VER_PATCH_SHIFT 0
1587 : : #define ICE_OROM_VER_PATCH_MASK (0xff << ICE_OROM_VER_PATCH_SHIFT)
1588 : : #define ICE_OROM_VER_BUILD_SHIFT 8
1589 : : #define ICE_OROM_VER_BUILD_MASK (0xffff << ICE_OROM_VER_BUILD_SHIFT)
1590 : : #define ICE_OROM_VER_SHIFT 24
1591 : : #define ICE_OROM_VER_MASK (0xff << ICE_OROM_VER_SHIFT)
1592 : : #define ICE_SR_VPD_PTR 0x2F
1593 : : #define ICE_SR_PXE_SETUP_PTR 0x30
1594 : : #define ICE_SR_PXE_CFG_CUST_OPTIONS_PTR 0x31
1595 : : #define ICE_SR_NVM_ORIGINAL_EETRACK_LO 0x34
1596 : : #define ICE_SR_NVM_ORIGINAL_EETRACK_HI 0x35
1597 : : #define ICE_SR_VLAN_CFG_PTR 0x37
1598 : : #define ICE_SR_POR_REGS_AUTO_LOAD_PTR 0x38
1599 : : #define ICE_SR_EMPR_REGS_AUTO_LOAD_PTR 0x3A
1600 : : #define ICE_SR_GLOBR_REGS_AUTO_LOAD_PTR 0x3B
1601 : : #define ICE_SR_CORER_REGS_AUTO_LOAD_PTR 0x3C
1602 : : #define ICE_SR_PHY_CFG_SCRIPT_PTR 0x3D
1603 : : #define ICE_SR_PCIE_ALT_AUTO_LOAD_PTR 0x3E
1604 : : #define ICE_SR_SW_CHECKSUM_WORD 0x3F
1605 : : #define ICE_SR_PFA_PTR 0x40
1606 : : #define ICE_SR_1ST_SCRATCH_PAD_PTR 0x41
1607 : : #define ICE_SR_1ST_NVM_BANK_PTR 0x42
1608 : : #define ICE_SR_NVM_BANK_SIZE 0x43
1609 : : #define ICE_SR_1ST_OROM_BANK_PTR 0x44
1610 : : #define ICE_SR_OROM_BANK_SIZE 0x45
1611 : : #define ICE_SR_NETLIST_BANK_PTR 0x46
1612 : : #define ICE_SR_NETLIST_BANK_SIZE 0x47
1613 : : #define ICE_SR_EMP_SR_SETTINGS_PTR 0x48
1614 : : #define ICE_SR_CONFIGURATION_METADATA_PTR 0x4D
1615 : : #define ICE_SR_IMMEDIATE_VALUES_PTR 0x4E
1616 : : #define ICE_SR_LINK_DEFAULT_OVERRIDE_PTR 0x134
1617 : : #define ICE_SR_POR_REGISTERS_AUTOLOAD_PTR 0x118
1618 : :
1619 : : /* CSS Header words */
1620 : : #define ICE_NVM_CSS_HDR_LEN_L 0x02
1621 : : #define ICE_NVM_CSS_HDR_LEN_H 0x03
1622 : : #define ICE_NVM_CSS_SREV_L 0x14
1623 : : #define ICE_NVM_CSS_SREV_H 0x15
1624 : :
1625 : : /* Length of Authentication header section in words */
1626 : : #define ICE_NVM_AUTH_HEADER_LEN 0x08
1627 : :
1628 : : /* The Link Topology Netlist section is stored as a series of words. It is
1629 : : * stored in the NVM as a TLV, with the first two words containing the type
1630 : : * and length.
1631 : : */
1632 : : #define ICE_NETLIST_LINK_TOPO_MOD_ID 0x011B
1633 : : #define ICE_NETLIST_TYPE_OFFSET 0x0000
1634 : : #define ICE_NETLIST_LEN_OFFSET 0x0001
1635 : :
1636 : : /* The Link Topology section follows the TLV header. When reading the netlist
1637 : : * using ice_read_netlist_module, we need to account for the 2-word TLV
1638 : : * header.
1639 : : */
1640 : : #define ICE_NETLIST_LINK_TOPO_OFFSET(n) ((n) + 2)
1641 : :
1642 : : #define ICE_LINK_TOPO_MODULE_LEN ICE_NETLIST_LINK_TOPO_OFFSET(0x0000)
1643 : : #define ICE_LINK_TOPO_NODE_COUNT ICE_NETLIST_LINK_TOPO_OFFSET(0x0001)
1644 : :
1645 : : #define ICE_LINK_TOPO_NODE_COUNT_M MAKEMASK(0x3FF, 0)
1646 : :
1647 : : /* The Netlist ID Block is located after all of the Link Topology nodes. */
1648 : : #define ICE_NETLIST_ID_BLK_SIZE 0x30
1649 : : #define ICE_NETLIST_ID_BLK_OFFSET(n) ICE_NETLIST_LINK_TOPO_OFFSET(0x0004 + 2 * (n))
1650 : :
1651 : : /* netlist ID block field offsets (word offsets) */
1652 : : #define ICE_NETLIST_ID_BLK_MAJOR_VER_LOW 0x02
1653 : : #define ICE_NETLIST_ID_BLK_MAJOR_VER_HIGH 0x03
1654 : : #define ICE_NETLIST_ID_BLK_MINOR_VER_LOW 0x04
1655 : : #define ICE_NETLIST_ID_BLK_MINOR_VER_HIGH 0x05
1656 : : #define ICE_NETLIST_ID_BLK_TYPE_LOW 0x06
1657 : : #define ICE_NETLIST_ID_BLK_TYPE_HIGH 0x07
1658 : : #define ICE_NETLIST_ID_BLK_REV_LOW 0x08
1659 : : #define ICE_NETLIST_ID_BLK_REV_HIGH 0x09
1660 : : #define ICE_NETLIST_ID_BLK_SHA_HASH_WORD(n) (0x0A + (n))
1661 : : #define ICE_NETLIST_ID_BLK_CUST_VER 0x2F
1662 : :
1663 : : /* Auxiliary field, mask and shift definition for Shadow RAM and NVM Flash */
1664 : : #define ICE_SR_VPD_SIZE_WORDS 512
1665 : : #define ICE_SR_PCIE_ALT_SIZE_WORDS 512
1666 : : #define ICE_SR_CTRL_WORD_1_S 0x06
1667 : : #define ICE_SR_CTRL_WORD_1_M (0x03 << ICE_SR_CTRL_WORD_1_S)
1668 : : #define ICE_SR_CTRL_WORD_VALID 0x1
1669 : : #define ICE_SR_CTRL_WORD_OROM_BANK BIT(3)
1670 : : #define ICE_SR_CTRL_WORD_NETLIST_BANK BIT(4)
1671 : : #define ICE_SR_CTRL_WORD_NVM_BANK BIT(5)
1672 : :
1673 : : #define ICE_SR_NVM_PTR_4KB_UNITS BIT(15)
1674 : :
1675 : : /* Shadow RAM related */
1676 : : #define ICE_SR_SECTOR_SIZE_IN_WORDS 0x800
1677 : : #define ICE_SR_BUF_ALIGNMENT 4096
1678 : : #define ICE_SR_WORDS_IN_1KB 512
1679 : : /* Checksum should be calculated such that after adding all the words,
1680 : : * including the checksum word itself, the sum should be 0xBABA.
1681 : : */
1682 : : #define ICE_SR_SW_CHECKSUM_BASE 0xBABA
1683 : :
1684 : : /* Link override related */
1685 : : #define ICE_SR_PFA_LINK_OVERRIDE_WORDS 10
1686 : : #define ICE_SR_PFA_LINK_OVERRIDE_PHY_WORDS 4
1687 : : #define ICE_SR_PFA_LINK_OVERRIDE_OFFSET 2
1688 : : #define ICE_SR_PFA_LINK_OVERRIDE_FEC_OFFSET 1
1689 : : #define ICE_SR_PFA_LINK_OVERRIDE_PHY_OFFSET 2
1690 : : #define ICE_FW_API_LINK_OVERRIDE_MAJ 1
1691 : : #define ICE_FW_API_LINK_OVERRIDE_MIN 5
1692 : : #define ICE_FW_API_LINK_OVERRIDE_PATCH 2
1693 : :
1694 : : #define ICE_PBA_FLAG_DFLT 0xFAFA
1695 : : /* Hash redirection LUT for VSI - maximum array size */
1696 : : #define ICE_VSIQF_HLUT_ARRAY_SIZE ((VSIQF_HLUT_MAX_INDEX + 1) * 4)
1697 : :
1698 : : /*
1699 : : * Defines for values in the VF_PE_DB_SIZE bits in the GLPCI_LBARCTRL register.
1700 : : * This is needed to determine the BAR0 space for the VFs
1701 : : */
1702 : : #define GLPCI_LBARCTRL_VF_PE_DB_SIZE_0KB 0x0
1703 : : #define GLPCI_LBARCTRL_VF_PE_DB_SIZE_8KB 0x1
1704 : : #define GLPCI_LBARCTRL_VF_PE_DB_SIZE_64KB 0x2
1705 : :
1706 : : /* AQ API version for LLDP_FILTER_CONTROL */
1707 : : #define ICE_FW_API_LLDP_FLTR_MAJ 1
1708 : : #define ICE_FW_API_LLDP_FLTR_MIN 7
1709 : : #define ICE_FW_API_LLDP_FLTR_PATCH 1
1710 : :
1711 : : /* AQ API version for report default configuration */
1712 : : #define ICE_FW_API_REPORT_DFLT_CFG_MAJ 1
1713 : : #define ICE_FW_API_REPORT_DFLT_CFG_MIN 7
1714 : : #define ICE_FW_API_REPORT_DFLT_CFG_PATCH 3
1715 : :
1716 : : /* FW branch number for hardware families */
1717 : : #define ICE_FW_VER_BRANCH_E82X 0
1718 : : #define ICE_FW_VER_BRANCH_E810 1
1719 : :
1720 : : /* FW version for FEC disable in Auto FEC mode */
1721 : : #define ICE_FW_FEC_DIS_AUTO_BRANCH 1
1722 : : #define ICE_FW_FEC_DIS_AUTO_MAJ 7
1723 : : #define ICE_FW_FEC_DIS_AUTO_MIN 0
1724 : : #define ICE_FW_FEC_DIS_AUTO_PATCH 5
1725 : : #define ICE_FW_FEC_DIS_AUTO_MAJ_E82X 7
1726 : : #define ICE_FW_FEC_DIS_AUTO_MIN_E82X 1
1727 : : #define ICE_FW_FEC_DIS_AUTO_PATCH_E82X 2
1728 : :
1729 : : /* AQ API version for FW auto drop reports */
1730 : : #define ICE_FW_API_AUTO_DROP_MAJ 1
1731 : : #define ICE_FW_API_AUTO_DROP_MIN 4
1732 : :
1733 : : static inline bool
1734 : : ice_is_nac_dual(struct ice_hw *hw)
1735 : : {
1736 [ # # ]: 0 : return !!(hw->dev_caps.nac_topo.mode & ICE_NAC_TOPO_DUAL_M);
1737 : : }
1738 : : #endif /* _ICE_TYPE_H_ */
|