New upstream version 18.05
[deb_dpdk.git] / drivers / net / qede / base / ecore_hsi_common.h
1 /*
2  * Copyright (c) 2016 - 2018 Cavium Inc.
3  * All rights reserved.
4  * www.cavium.com
5  *
6  * See LICENSE.qede_pmd for copyright and licensing details.
7  */
8
9 #ifndef __ECORE_HSI_COMMON__
10 #define __ECORE_HSI_COMMON__
11 /********************************/
12 /* Add include to common target */
13 /********************************/
14 #include "common_hsi.h"
15
16
17 /*
18  * opcodes for the event ring
19  */
20 enum common_event_opcode {
21         COMMON_EVENT_PF_START,
22         COMMON_EVENT_PF_STOP,
23         COMMON_EVENT_VF_START,
24         COMMON_EVENT_VF_STOP,
25         COMMON_EVENT_VF_PF_CHANNEL,
26         COMMON_EVENT_VF_FLR,
27         COMMON_EVENT_PF_UPDATE,
28         COMMON_EVENT_MALICIOUS_VF,
29         COMMON_EVENT_RL_UPDATE,
30         COMMON_EVENT_EMPTY,
31         MAX_COMMON_EVENT_OPCODE
32 };
33
34
35 /*
36  * Common Ramrod Command IDs
37  */
38 enum common_ramrod_cmd_id {
39         COMMON_RAMROD_UNUSED,
40         COMMON_RAMROD_PF_START /* PF Function Start Ramrod */,
41         COMMON_RAMROD_PF_STOP /* PF Function Stop Ramrod */,
42         COMMON_RAMROD_VF_START /* VF Function Start */,
43         COMMON_RAMROD_VF_STOP /* VF Function Stop Ramrod */,
44         COMMON_RAMROD_PF_UPDATE /* PF update Ramrod */,
45         COMMON_RAMROD_RL_UPDATE /* QCN/DCQCN RL update Ramrod */,
46         COMMON_RAMROD_EMPTY /* Empty Ramrod */,
47         MAX_COMMON_RAMROD_CMD_ID
48 };
49
50
51 /*
52  * The core storm context for the Ystorm
53  */
54 struct ystorm_core_conn_st_ctx {
55         __le32 reserved[4];
56 };
57
58 /*
59  * The core storm context for the Pstorm
60  */
61 struct pstorm_core_conn_st_ctx {
62         __le32 reserved[4];
63 };
64
65 /*
66  * Core Slowpath Connection storm context of Xstorm
67  */
68 struct xstorm_core_conn_st_ctx {
69         __le32 spq_base_lo /* SPQ Ring Base Address low dword */;
70         __le32 spq_base_hi /* SPQ Ring Base Address high dword */;
71 /* Consolidation Ring Base Address */
72         struct regpair consolid_base_addr;
73         __le16 spq_cons /* SPQ Ring Consumer */;
74         __le16 consolid_cons /* Consolidation Ring Consumer */;
75         __le32 reserved0[55] /* Pad to 15 cycles */;
76 };
77
78 struct e4_xstorm_core_conn_ag_ctx {
79         u8 reserved0 /* cdu_validation */;
80         u8 core_state /* state */;
81         u8 flags0;
82 /* exist_in_qm0 */
83 #define E4_XSTORM_CORE_CONN_AG_CTX_EXIST_IN_QM0_MASK         0x1
84 #define E4_XSTORM_CORE_CONN_AG_CTX_EXIST_IN_QM0_SHIFT        0
85 /* exist_in_qm1 */
86 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED1_MASK            0x1
87 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED1_SHIFT           1
88 /* exist_in_qm2 */
89 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED2_MASK            0x1
90 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED2_SHIFT           2
91 /* exist_in_qm3 */
92 #define E4_XSTORM_CORE_CONN_AG_CTX_EXIST_IN_QM3_MASK         0x1
93 #define E4_XSTORM_CORE_CONN_AG_CTX_EXIST_IN_QM3_SHIFT        3
94 /* bit4 */
95 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED3_MASK            0x1
96 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED3_SHIFT           4
97 /* cf_array_active */
98 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED4_MASK            0x1
99 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED4_SHIFT           5
100 /* bit6 */
101 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED5_MASK            0x1
102 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED5_SHIFT           6
103 /* bit7 */
104 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED6_MASK            0x1
105 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED6_SHIFT           7
106         u8 flags1;
107 /* bit8 */
108 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED7_MASK            0x1
109 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED7_SHIFT           0
110 /* bit9 */
111 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED8_MASK            0x1
112 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED8_SHIFT           1
113 /* bit10 */
114 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED9_MASK            0x1
115 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED9_SHIFT           2
116 /* bit11 */
117 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT11_MASK                0x1
118 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT11_SHIFT               3
119 /* bit12 */
120 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT12_MASK                0x1
121 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT12_SHIFT               4
122 /* bit13 */
123 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT13_MASK                0x1
124 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT13_SHIFT               5
125 /* bit14 */
126 #define E4_XSTORM_CORE_CONN_AG_CTX_TX_RULE_ACTIVE_MASK       0x1
127 #define E4_XSTORM_CORE_CONN_AG_CTX_TX_RULE_ACTIVE_SHIFT      6
128 /* bit15 */
129 #define E4_XSTORM_CORE_CONN_AG_CTX_DQ_CF_ACTIVE_MASK         0x1
130 #define E4_XSTORM_CORE_CONN_AG_CTX_DQ_CF_ACTIVE_SHIFT        7
131         u8 flags2;
132 /* timer0cf */
133 #define E4_XSTORM_CORE_CONN_AG_CTX_CF0_MASK                  0x3
134 #define E4_XSTORM_CORE_CONN_AG_CTX_CF0_SHIFT                 0
135 /* timer1cf */
136 #define E4_XSTORM_CORE_CONN_AG_CTX_CF1_MASK                  0x3
137 #define E4_XSTORM_CORE_CONN_AG_CTX_CF1_SHIFT                 2
138 /* timer2cf */
139 #define E4_XSTORM_CORE_CONN_AG_CTX_CF2_MASK                  0x3
140 #define E4_XSTORM_CORE_CONN_AG_CTX_CF2_SHIFT                 4
141 /* timer_stop_all */
142 #define E4_XSTORM_CORE_CONN_AG_CTX_CF3_MASK                  0x3
143 #define E4_XSTORM_CORE_CONN_AG_CTX_CF3_SHIFT                 6
144         u8 flags3;
145 #define E4_XSTORM_CORE_CONN_AG_CTX_CF4_MASK                  0x3 /* cf4 */
146 #define E4_XSTORM_CORE_CONN_AG_CTX_CF4_SHIFT                 0
147 #define E4_XSTORM_CORE_CONN_AG_CTX_CF5_MASK                  0x3 /* cf5 */
148 #define E4_XSTORM_CORE_CONN_AG_CTX_CF5_SHIFT                 2
149 #define E4_XSTORM_CORE_CONN_AG_CTX_CF6_MASK                  0x3 /* cf6 */
150 #define E4_XSTORM_CORE_CONN_AG_CTX_CF6_SHIFT                 4
151 #define E4_XSTORM_CORE_CONN_AG_CTX_CF7_MASK                  0x3 /* cf7 */
152 #define E4_XSTORM_CORE_CONN_AG_CTX_CF7_SHIFT                 6
153         u8 flags4;
154 #define E4_XSTORM_CORE_CONN_AG_CTX_CF8_MASK                  0x3 /* cf8 */
155 #define E4_XSTORM_CORE_CONN_AG_CTX_CF8_SHIFT                 0
156 #define E4_XSTORM_CORE_CONN_AG_CTX_CF9_MASK                  0x3 /* cf9 */
157 #define E4_XSTORM_CORE_CONN_AG_CTX_CF9_SHIFT                 2
158 /* cf10 */
159 #define E4_XSTORM_CORE_CONN_AG_CTX_CF10_MASK                 0x3
160 #define E4_XSTORM_CORE_CONN_AG_CTX_CF10_SHIFT                4
161 /* cf11 */
162 #define E4_XSTORM_CORE_CONN_AG_CTX_CF11_MASK                 0x3
163 #define E4_XSTORM_CORE_CONN_AG_CTX_CF11_SHIFT                6
164         u8 flags5;
165 /* cf12 */
166 #define E4_XSTORM_CORE_CONN_AG_CTX_CF12_MASK                 0x3
167 #define E4_XSTORM_CORE_CONN_AG_CTX_CF12_SHIFT                0
168 /* cf13 */
169 #define E4_XSTORM_CORE_CONN_AG_CTX_CF13_MASK                 0x3
170 #define E4_XSTORM_CORE_CONN_AG_CTX_CF13_SHIFT                2
171 /* cf14 */
172 #define E4_XSTORM_CORE_CONN_AG_CTX_CF14_MASK                 0x3
173 #define E4_XSTORM_CORE_CONN_AG_CTX_CF14_SHIFT                4
174 /* cf15 */
175 #define E4_XSTORM_CORE_CONN_AG_CTX_CF15_MASK                 0x3
176 #define E4_XSTORM_CORE_CONN_AG_CTX_CF15_SHIFT                6
177         u8 flags6;
178 /* cf16 */
179 #define E4_XSTORM_CORE_CONN_AG_CTX_CONSOLID_PROD_CF_MASK     0x3
180 #define E4_XSTORM_CORE_CONN_AG_CTX_CONSOLID_PROD_CF_SHIFT    0
181 /* cf_array_cf */
182 #define E4_XSTORM_CORE_CONN_AG_CTX_CF17_MASK                 0x3
183 #define E4_XSTORM_CORE_CONN_AG_CTX_CF17_SHIFT                2
184 /* cf18 */
185 #define E4_XSTORM_CORE_CONN_AG_CTX_DQ_CF_MASK                0x3
186 #define E4_XSTORM_CORE_CONN_AG_CTX_DQ_CF_SHIFT               4
187 /* cf19 */
188 #define E4_XSTORM_CORE_CONN_AG_CTX_TERMINATE_CF_MASK         0x3
189 #define E4_XSTORM_CORE_CONN_AG_CTX_TERMINATE_CF_SHIFT        6
190         u8 flags7;
191 /* cf20 */
192 #define E4_XSTORM_CORE_CONN_AG_CTX_FLUSH_Q0_MASK             0x3
193 #define E4_XSTORM_CORE_CONN_AG_CTX_FLUSH_Q0_SHIFT            0
194 /* cf21 */
195 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED10_MASK           0x3
196 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED10_SHIFT          2
197 /* cf22 */
198 #define E4_XSTORM_CORE_CONN_AG_CTX_SLOW_PATH_MASK            0x3
199 #define E4_XSTORM_CORE_CONN_AG_CTX_SLOW_PATH_SHIFT           4
200 /* cf0en */
201 #define E4_XSTORM_CORE_CONN_AG_CTX_CF0EN_MASK                0x1
202 #define E4_XSTORM_CORE_CONN_AG_CTX_CF0EN_SHIFT               6
203 /* cf1en */
204 #define E4_XSTORM_CORE_CONN_AG_CTX_CF1EN_MASK                0x1
205 #define E4_XSTORM_CORE_CONN_AG_CTX_CF1EN_SHIFT               7
206         u8 flags8;
207 /* cf2en */
208 #define E4_XSTORM_CORE_CONN_AG_CTX_CF2EN_MASK                0x1
209 #define E4_XSTORM_CORE_CONN_AG_CTX_CF2EN_SHIFT               0
210 /* cf3en */
211 #define E4_XSTORM_CORE_CONN_AG_CTX_CF3EN_MASK                0x1
212 #define E4_XSTORM_CORE_CONN_AG_CTX_CF3EN_SHIFT               1
213 /* cf4en */
214 #define E4_XSTORM_CORE_CONN_AG_CTX_CF4EN_MASK                0x1
215 #define E4_XSTORM_CORE_CONN_AG_CTX_CF4EN_SHIFT               2
216 /* cf5en */
217 #define E4_XSTORM_CORE_CONN_AG_CTX_CF5EN_MASK                0x1
218 #define E4_XSTORM_CORE_CONN_AG_CTX_CF5EN_SHIFT               3
219 /* cf6en */
220 #define E4_XSTORM_CORE_CONN_AG_CTX_CF6EN_MASK                0x1
221 #define E4_XSTORM_CORE_CONN_AG_CTX_CF6EN_SHIFT               4
222 /* cf7en */
223 #define E4_XSTORM_CORE_CONN_AG_CTX_CF7EN_MASK                0x1
224 #define E4_XSTORM_CORE_CONN_AG_CTX_CF7EN_SHIFT               5
225 /* cf8en */
226 #define E4_XSTORM_CORE_CONN_AG_CTX_CF8EN_MASK                0x1
227 #define E4_XSTORM_CORE_CONN_AG_CTX_CF8EN_SHIFT               6
228 /* cf9en */
229 #define E4_XSTORM_CORE_CONN_AG_CTX_CF9EN_MASK                0x1
230 #define E4_XSTORM_CORE_CONN_AG_CTX_CF9EN_SHIFT               7
231         u8 flags9;
232 /* cf10en */
233 #define E4_XSTORM_CORE_CONN_AG_CTX_CF10EN_MASK               0x1
234 #define E4_XSTORM_CORE_CONN_AG_CTX_CF10EN_SHIFT              0
235 /* cf11en */
236 #define E4_XSTORM_CORE_CONN_AG_CTX_CF11EN_MASK               0x1
237 #define E4_XSTORM_CORE_CONN_AG_CTX_CF11EN_SHIFT              1
238 /* cf12en */
239 #define E4_XSTORM_CORE_CONN_AG_CTX_CF12EN_MASK               0x1
240 #define E4_XSTORM_CORE_CONN_AG_CTX_CF12EN_SHIFT              2
241 /* cf13en */
242 #define E4_XSTORM_CORE_CONN_AG_CTX_CF13EN_MASK               0x1
243 #define E4_XSTORM_CORE_CONN_AG_CTX_CF13EN_SHIFT              3
244 /* cf14en */
245 #define E4_XSTORM_CORE_CONN_AG_CTX_CF14EN_MASK               0x1
246 #define E4_XSTORM_CORE_CONN_AG_CTX_CF14EN_SHIFT              4
247 /* cf15en */
248 #define E4_XSTORM_CORE_CONN_AG_CTX_CF15EN_MASK               0x1
249 #define E4_XSTORM_CORE_CONN_AG_CTX_CF15EN_SHIFT              5
250 /* cf16en */
251 #define E4_XSTORM_CORE_CONN_AG_CTX_CONSOLID_PROD_CF_EN_MASK  0x1
252 #define E4_XSTORM_CORE_CONN_AG_CTX_CONSOLID_PROD_CF_EN_SHIFT 6
253 /* cf_array_cf_en */
254 #define E4_XSTORM_CORE_CONN_AG_CTX_CF17EN_MASK               0x1
255 #define E4_XSTORM_CORE_CONN_AG_CTX_CF17EN_SHIFT              7
256         u8 flags10;
257 /* cf18en */
258 #define E4_XSTORM_CORE_CONN_AG_CTX_DQ_CF_EN_MASK             0x1
259 #define E4_XSTORM_CORE_CONN_AG_CTX_DQ_CF_EN_SHIFT            0
260 /* cf19en */
261 #define E4_XSTORM_CORE_CONN_AG_CTX_TERMINATE_CF_EN_MASK      0x1
262 #define E4_XSTORM_CORE_CONN_AG_CTX_TERMINATE_CF_EN_SHIFT     1
263 /* cf20en */
264 #define E4_XSTORM_CORE_CONN_AG_CTX_FLUSH_Q0_EN_MASK          0x1
265 #define E4_XSTORM_CORE_CONN_AG_CTX_FLUSH_Q0_EN_SHIFT         2
266 /* cf21en */
267 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED11_MASK           0x1
268 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED11_SHIFT          3
269 /* cf22en */
270 #define E4_XSTORM_CORE_CONN_AG_CTX_SLOW_PATH_EN_MASK         0x1
271 #define E4_XSTORM_CORE_CONN_AG_CTX_SLOW_PATH_EN_SHIFT        4
272 /* cf23en */
273 #define E4_XSTORM_CORE_CONN_AG_CTX_CF23EN_MASK               0x1
274 #define E4_XSTORM_CORE_CONN_AG_CTX_CF23EN_SHIFT              5
275 /* rule0en */
276 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED12_MASK           0x1
277 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED12_SHIFT          6
278 /* rule1en */
279 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED13_MASK           0x1
280 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED13_SHIFT          7
281         u8 flags11;
282 /* rule2en */
283 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED14_MASK           0x1
284 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED14_SHIFT          0
285 /* rule3en */
286 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED15_MASK           0x1
287 #define E4_XSTORM_CORE_CONN_AG_CTX_RESERVED15_SHIFT          1
288 /* rule4en */
289 #define E4_XSTORM_CORE_CONN_AG_CTX_TX_DEC_RULE_EN_MASK       0x1
290 #define E4_XSTORM_CORE_CONN_AG_CTX_TX_DEC_RULE_EN_SHIFT      2
291 /* rule5en */
292 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE5EN_MASK              0x1
293 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE5EN_SHIFT             3
294 /* rule6en */
295 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE6EN_MASK              0x1
296 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE6EN_SHIFT             4
297 /* rule7en */
298 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE7EN_MASK              0x1
299 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE7EN_SHIFT             5
300 /* rule8en */
301 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED1_MASK         0x1
302 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED1_SHIFT        6
303 /* rule9en */
304 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE9EN_MASK              0x1
305 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE9EN_SHIFT             7
306         u8 flags12;
307 /* rule10en */
308 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE10EN_MASK             0x1
309 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE10EN_SHIFT            0
310 /* rule11en */
311 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE11EN_MASK             0x1
312 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE11EN_SHIFT            1
313 /* rule12en */
314 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED2_MASK         0x1
315 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED2_SHIFT        2
316 /* rule13en */
317 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED3_MASK         0x1
318 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED3_SHIFT        3
319 /* rule14en */
320 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE14EN_MASK             0x1
321 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE14EN_SHIFT            4
322 /* rule15en */
323 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE15EN_MASK             0x1
324 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE15EN_SHIFT            5
325 /* rule16en */
326 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE16EN_MASK             0x1
327 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE16EN_SHIFT            6
328 /* rule17en */
329 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE17EN_MASK             0x1
330 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE17EN_SHIFT            7
331         u8 flags13;
332 /* rule18en */
333 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE18EN_MASK             0x1
334 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE18EN_SHIFT            0
335 /* rule19en */
336 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE19EN_MASK             0x1
337 #define E4_XSTORM_CORE_CONN_AG_CTX_RULE19EN_SHIFT            1
338 /* rule20en */
339 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED4_MASK         0x1
340 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED4_SHIFT        2
341 /* rule21en */
342 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED5_MASK         0x1
343 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED5_SHIFT        3
344 /* rule22en */
345 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED6_MASK         0x1
346 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED6_SHIFT        4
347 /* rule23en */
348 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED7_MASK         0x1
349 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED7_SHIFT        5
350 /* rule24en */
351 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED8_MASK         0x1
352 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED8_SHIFT        6
353 /* rule25en */
354 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED9_MASK         0x1
355 #define E4_XSTORM_CORE_CONN_AG_CTX_A0_RESERVED9_SHIFT        7
356         u8 flags14;
357 /* bit16 */
358 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT16_MASK                0x1
359 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT16_SHIFT               0
360 /* bit17 */
361 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT17_MASK                0x1
362 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT17_SHIFT               1
363 /* bit18 */
364 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT18_MASK                0x1
365 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT18_SHIFT               2
366 /* bit19 */
367 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT19_MASK                0x1
368 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT19_SHIFT               3
369 /* bit20 */
370 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT20_MASK                0x1
371 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT20_SHIFT               4
372 /* bit21 */
373 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT21_MASK                0x1
374 #define E4_XSTORM_CORE_CONN_AG_CTX_BIT21_SHIFT               5
375 /* cf23 */
376 #define E4_XSTORM_CORE_CONN_AG_CTX_CF23_MASK                 0x3
377 #define E4_XSTORM_CORE_CONN_AG_CTX_CF23_SHIFT                6
378         u8 byte2 /* byte2 */;
379         __le16 physical_q0 /* physical_q0 */;
380         __le16 consolid_prod /* physical_q1 */;
381         __le16 reserved16 /* physical_q2 */;
382         __le16 tx_bd_cons /* word3 */;
383         __le16 tx_bd_or_spq_prod /* word4 */;
384         __le16 updated_qm_pq_id /* word5 */;
385         __le16 conn_dpi /* conn_dpi */;
386         u8 byte3 /* byte3 */;
387         u8 byte4 /* byte4 */;
388         u8 byte5 /* byte5 */;
389         u8 byte6 /* byte6 */;
390         __le32 reg0 /* reg0 */;
391         __le32 reg1 /* reg1 */;
392         __le32 reg2 /* reg2 */;
393         __le32 reg3 /* reg3 */;
394         __le32 reg4 /* reg4 */;
395         __le32 reg5 /* cf_array0 */;
396         __le32 reg6 /* cf_array1 */;
397         __le16 word7 /* word7 */;
398         __le16 word8 /* word8 */;
399         __le16 word9 /* word9 */;
400         __le16 word10 /* word10 */;
401         __le32 reg7 /* reg7 */;
402         __le32 reg8 /* reg8 */;
403         __le32 reg9 /* reg9 */;
404         u8 byte7 /* byte7 */;
405         u8 byte8 /* byte8 */;
406         u8 byte9 /* byte9 */;
407         u8 byte10 /* byte10 */;
408         u8 byte11 /* byte11 */;
409         u8 byte12 /* byte12 */;
410         u8 byte13 /* byte13 */;
411         u8 byte14 /* byte14 */;
412         u8 byte15 /* byte15 */;
413         u8 e5_reserved /* e5_reserved */;
414         __le16 word11 /* word11 */;
415         __le32 reg10 /* reg10 */;
416         __le32 reg11 /* reg11 */;
417         __le32 reg12 /* reg12 */;
418         __le32 reg13 /* reg13 */;
419         __le32 reg14 /* reg14 */;
420         __le32 reg15 /* reg15 */;
421         __le32 reg16 /* reg16 */;
422         __le32 reg17 /* reg17 */;
423         __le32 reg18 /* reg18 */;
424         __le32 reg19 /* reg19 */;
425         __le16 word12 /* word12 */;
426         __le16 word13 /* word13 */;
427         __le16 word14 /* word14 */;
428         __le16 word15 /* word15 */;
429 };
430
431 struct e4_tstorm_core_conn_ag_ctx {
432         u8 byte0 /* cdu_validation */;
433         u8 byte1 /* state */;
434         u8 flags0;
435 #define E4_TSTORM_CORE_CONN_AG_CTX_BIT0_MASK     0x1 /* exist_in_qm0 */
436 #define E4_TSTORM_CORE_CONN_AG_CTX_BIT0_SHIFT    0
437 #define E4_TSTORM_CORE_CONN_AG_CTX_BIT1_MASK     0x1 /* exist_in_qm1 */
438 #define E4_TSTORM_CORE_CONN_AG_CTX_BIT1_SHIFT    1
439 #define E4_TSTORM_CORE_CONN_AG_CTX_BIT2_MASK     0x1 /* bit2 */
440 #define E4_TSTORM_CORE_CONN_AG_CTX_BIT2_SHIFT    2
441 #define E4_TSTORM_CORE_CONN_AG_CTX_BIT3_MASK     0x1 /* bit3 */
442 #define E4_TSTORM_CORE_CONN_AG_CTX_BIT3_SHIFT    3
443 #define E4_TSTORM_CORE_CONN_AG_CTX_BIT4_MASK     0x1 /* bit4 */
444 #define E4_TSTORM_CORE_CONN_AG_CTX_BIT4_SHIFT    4
445 #define E4_TSTORM_CORE_CONN_AG_CTX_BIT5_MASK     0x1 /* bit5 */
446 #define E4_TSTORM_CORE_CONN_AG_CTX_BIT5_SHIFT    5
447 #define E4_TSTORM_CORE_CONN_AG_CTX_CF0_MASK      0x3 /* timer0cf */
448 #define E4_TSTORM_CORE_CONN_AG_CTX_CF0_SHIFT     6
449         u8 flags1;
450 #define E4_TSTORM_CORE_CONN_AG_CTX_CF1_MASK      0x3 /* timer1cf */
451 #define E4_TSTORM_CORE_CONN_AG_CTX_CF1_SHIFT     0
452 #define E4_TSTORM_CORE_CONN_AG_CTX_CF2_MASK      0x3 /* timer2cf */
453 #define E4_TSTORM_CORE_CONN_AG_CTX_CF2_SHIFT     2
454 #define E4_TSTORM_CORE_CONN_AG_CTX_CF3_MASK      0x3 /* timer_stop_all */
455 #define E4_TSTORM_CORE_CONN_AG_CTX_CF3_SHIFT     4
456 #define E4_TSTORM_CORE_CONN_AG_CTX_CF4_MASK      0x3 /* cf4 */
457 #define E4_TSTORM_CORE_CONN_AG_CTX_CF4_SHIFT     6
458         u8 flags2;
459 #define E4_TSTORM_CORE_CONN_AG_CTX_CF5_MASK      0x3 /* cf5 */
460 #define E4_TSTORM_CORE_CONN_AG_CTX_CF5_SHIFT     0
461 #define E4_TSTORM_CORE_CONN_AG_CTX_CF6_MASK      0x3 /* cf6 */
462 #define E4_TSTORM_CORE_CONN_AG_CTX_CF6_SHIFT     2
463 #define E4_TSTORM_CORE_CONN_AG_CTX_CF7_MASK      0x3 /* cf7 */
464 #define E4_TSTORM_CORE_CONN_AG_CTX_CF7_SHIFT     4
465 #define E4_TSTORM_CORE_CONN_AG_CTX_CF8_MASK      0x3 /* cf8 */
466 #define E4_TSTORM_CORE_CONN_AG_CTX_CF8_SHIFT     6
467         u8 flags3;
468 #define E4_TSTORM_CORE_CONN_AG_CTX_CF9_MASK      0x3 /* cf9 */
469 #define E4_TSTORM_CORE_CONN_AG_CTX_CF9_SHIFT     0
470 #define E4_TSTORM_CORE_CONN_AG_CTX_CF10_MASK     0x3 /* cf10 */
471 #define E4_TSTORM_CORE_CONN_AG_CTX_CF10_SHIFT    2
472 #define E4_TSTORM_CORE_CONN_AG_CTX_CF0EN_MASK    0x1 /* cf0en */
473 #define E4_TSTORM_CORE_CONN_AG_CTX_CF0EN_SHIFT   4
474 #define E4_TSTORM_CORE_CONN_AG_CTX_CF1EN_MASK    0x1 /* cf1en */
475 #define E4_TSTORM_CORE_CONN_AG_CTX_CF1EN_SHIFT   5
476 #define E4_TSTORM_CORE_CONN_AG_CTX_CF2EN_MASK    0x1 /* cf2en */
477 #define E4_TSTORM_CORE_CONN_AG_CTX_CF2EN_SHIFT   6
478 #define E4_TSTORM_CORE_CONN_AG_CTX_CF3EN_MASK    0x1 /* cf3en */
479 #define E4_TSTORM_CORE_CONN_AG_CTX_CF3EN_SHIFT   7
480         u8 flags4;
481 #define E4_TSTORM_CORE_CONN_AG_CTX_CF4EN_MASK    0x1 /* cf4en */
482 #define E4_TSTORM_CORE_CONN_AG_CTX_CF4EN_SHIFT   0
483 #define E4_TSTORM_CORE_CONN_AG_CTX_CF5EN_MASK    0x1 /* cf5en */
484 #define E4_TSTORM_CORE_CONN_AG_CTX_CF5EN_SHIFT   1
485 #define E4_TSTORM_CORE_CONN_AG_CTX_CF6EN_MASK    0x1 /* cf6en */
486 #define E4_TSTORM_CORE_CONN_AG_CTX_CF6EN_SHIFT   2
487 #define E4_TSTORM_CORE_CONN_AG_CTX_CF7EN_MASK    0x1 /* cf7en */
488 #define E4_TSTORM_CORE_CONN_AG_CTX_CF7EN_SHIFT   3
489 #define E4_TSTORM_CORE_CONN_AG_CTX_CF8EN_MASK    0x1 /* cf8en */
490 #define E4_TSTORM_CORE_CONN_AG_CTX_CF8EN_SHIFT   4
491 #define E4_TSTORM_CORE_CONN_AG_CTX_CF9EN_MASK    0x1 /* cf9en */
492 #define E4_TSTORM_CORE_CONN_AG_CTX_CF9EN_SHIFT   5
493 #define E4_TSTORM_CORE_CONN_AG_CTX_CF10EN_MASK   0x1 /* cf10en */
494 #define E4_TSTORM_CORE_CONN_AG_CTX_CF10EN_SHIFT  6
495 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE0EN_MASK  0x1 /* rule0en */
496 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE0EN_SHIFT 7
497         u8 flags5;
498 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE1EN_MASK  0x1 /* rule1en */
499 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE1EN_SHIFT 0
500 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE2EN_MASK  0x1 /* rule2en */
501 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE2EN_SHIFT 1
502 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE3EN_MASK  0x1 /* rule3en */
503 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE3EN_SHIFT 2
504 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE4EN_MASK  0x1 /* rule4en */
505 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE4EN_SHIFT 3
506 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE5EN_MASK  0x1 /* rule5en */
507 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE5EN_SHIFT 4
508 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE6EN_MASK  0x1 /* rule6en */
509 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE6EN_SHIFT 5
510 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE7EN_MASK  0x1 /* rule7en */
511 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE7EN_SHIFT 6
512 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE8EN_MASK  0x1 /* rule8en */
513 #define E4_TSTORM_CORE_CONN_AG_CTX_RULE8EN_SHIFT 7
514         __le32 reg0 /* reg0 */;
515         __le32 reg1 /* reg1 */;
516         __le32 reg2 /* reg2 */;
517         __le32 reg3 /* reg3 */;
518         __le32 reg4 /* reg4 */;
519         __le32 reg5 /* reg5 */;
520         __le32 reg6 /* reg6 */;
521         __le32 reg7 /* reg7 */;
522         __le32 reg8 /* reg8 */;
523         u8 byte2 /* byte2 */;
524         u8 byte3 /* byte3 */;
525         __le16 word0 /* word0 */;
526         u8 byte4 /* byte4 */;
527         u8 byte5 /* byte5 */;
528         __le16 word1 /* word1 */;
529         __le16 word2 /* conn_dpi */;
530         __le16 word3 /* word3 */;
531         __le32 reg9 /* reg9 */;
532         __le32 reg10 /* reg10 */;
533 };
534
535 struct e4_ustorm_core_conn_ag_ctx {
536         u8 reserved /* cdu_validation */;
537         u8 byte1 /* state */;
538         u8 flags0;
539 #define E4_USTORM_CORE_CONN_AG_CTX_BIT0_MASK     0x1 /* exist_in_qm0 */
540 #define E4_USTORM_CORE_CONN_AG_CTX_BIT0_SHIFT    0
541 #define E4_USTORM_CORE_CONN_AG_CTX_BIT1_MASK     0x1 /* exist_in_qm1 */
542 #define E4_USTORM_CORE_CONN_AG_CTX_BIT1_SHIFT    1
543 #define E4_USTORM_CORE_CONN_AG_CTX_CF0_MASK      0x3 /* timer0cf */
544 #define E4_USTORM_CORE_CONN_AG_CTX_CF0_SHIFT     2
545 #define E4_USTORM_CORE_CONN_AG_CTX_CF1_MASK      0x3 /* timer1cf */
546 #define E4_USTORM_CORE_CONN_AG_CTX_CF1_SHIFT     4
547 #define E4_USTORM_CORE_CONN_AG_CTX_CF2_MASK      0x3 /* timer2cf */
548 #define E4_USTORM_CORE_CONN_AG_CTX_CF2_SHIFT     6
549         u8 flags1;
550 #define E4_USTORM_CORE_CONN_AG_CTX_CF3_MASK      0x3 /* timer_stop_all */
551 #define E4_USTORM_CORE_CONN_AG_CTX_CF3_SHIFT     0
552 #define E4_USTORM_CORE_CONN_AG_CTX_CF4_MASK      0x3 /* cf4 */
553 #define E4_USTORM_CORE_CONN_AG_CTX_CF4_SHIFT     2
554 #define E4_USTORM_CORE_CONN_AG_CTX_CF5_MASK      0x3 /* cf5 */
555 #define E4_USTORM_CORE_CONN_AG_CTX_CF5_SHIFT     4
556 #define E4_USTORM_CORE_CONN_AG_CTX_CF6_MASK      0x3 /* cf6 */
557 #define E4_USTORM_CORE_CONN_AG_CTX_CF6_SHIFT     6
558         u8 flags2;
559 #define E4_USTORM_CORE_CONN_AG_CTX_CF0EN_MASK    0x1 /* cf0en */
560 #define E4_USTORM_CORE_CONN_AG_CTX_CF0EN_SHIFT   0
561 #define E4_USTORM_CORE_CONN_AG_CTX_CF1EN_MASK    0x1 /* cf1en */
562 #define E4_USTORM_CORE_CONN_AG_CTX_CF1EN_SHIFT   1
563 #define E4_USTORM_CORE_CONN_AG_CTX_CF2EN_MASK    0x1 /* cf2en */
564 #define E4_USTORM_CORE_CONN_AG_CTX_CF2EN_SHIFT   2
565 #define E4_USTORM_CORE_CONN_AG_CTX_CF3EN_MASK    0x1 /* cf3en */
566 #define E4_USTORM_CORE_CONN_AG_CTX_CF3EN_SHIFT   3
567 #define E4_USTORM_CORE_CONN_AG_CTX_CF4EN_MASK    0x1 /* cf4en */
568 #define E4_USTORM_CORE_CONN_AG_CTX_CF4EN_SHIFT   4
569 #define E4_USTORM_CORE_CONN_AG_CTX_CF5EN_MASK    0x1 /* cf5en */
570 #define E4_USTORM_CORE_CONN_AG_CTX_CF5EN_SHIFT   5
571 #define E4_USTORM_CORE_CONN_AG_CTX_CF6EN_MASK    0x1 /* cf6en */
572 #define E4_USTORM_CORE_CONN_AG_CTX_CF6EN_SHIFT   6
573 #define E4_USTORM_CORE_CONN_AG_CTX_RULE0EN_MASK  0x1 /* rule0en */
574 #define E4_USTORM_CORE_CONN_AG_CTX_RULE0EN_SHIFT 7
575         u8 flags3;
576 #define E4_USTORM_CORE_CONN_AG_CTX_RULE1EN_MASK  0x1 /* rule1en */
577 #define E4_USTORM_CORE_CONN_AG_CTX_RULE1EN_SHIFT 0
578 #define E4_USTORM_CORE_CONN_AG_CTX_RULE2EN_MASK  0x1 /* rule2en */
579 #define E4_USTORM_CORE_CONN_AG_CTX_RULE2EN_SHIFT 1
580 #define E4_USTORM_CORE_CONN_AG_CTX_RULE3EN_MASK  0x1 /* rule3en */
581 #define E4_USTORM_CORE_CONN_AG_CTX_RULE3EN_SHIFT 2
582 #define E4_USTORM_CORE_CONN_AG_CTX_RULE4EN_MASK  0x1 /* rule4en */
583 #define E4_USTORM_CORE_CONN_AG_CTX_RULE4EN_SHIFT 3
584 #define E4_USTORM_CORE_CONN_AG_CTX_RULE5EN_MASK  0x1 /* rule5en */
585 #define E4_USTORM_CORE_CONN_AG_CTX_RULE5EN_SHIFT 4
586 #define E4_USTORM_CORE_CONN_AG_CTX_RULE6EN_MASK  0x1 /* rule6en */
587 #define E4_USTORM_CORE_CONN_AG_CTX_RULE6EN_SHIFT 5
588 #define E4_USTORM_CORE_CONN_AG_CTX_RULE7EN_MASK  0x1 /* rule7en */
589 #define E4_USTORM_CORE_CONN_AG_CTX_RULE7EN_SHIFT 6
590 #define E4_USTORM_CORE_CONN_AG_CTX_RULE8EN_MASK  0x1 /* rule8en */
591 #define E4_USTORM_CORE_CONN_AG_CTX_RULE8EN_SHIFT 7
592         u8 byte2 /* byte2 */;
593         u8 byte3 /* byte3 */;
594         __le16 word0 /* conn_dpi */;
595         __le16 word1 /* word1 */;
596         __le32 rx_producers /* reg0 */;
597         __le32 reg1 /* reg1 */;
598         __le32 reg2 /* reg2 */;
599         __le32 reg3 /* reg3 */;
600         __le16 word2 /* word2 */;
601         __le16 word3 /* word3 */;
602 };
603
604 /*
605  * The core storm context for the Mstorm
606  */
607 struct mstorm_core_conn_st_ctx {
608         __le32 reserved[24];
609 };
610
611 /*
612  * The core storm context for the Ustorm
613  */
614 struct ustorm_core_conn_st_ctx {
615         __le32 reserved[4];
616 };
617
618 /*
619  * core connection context
620  */
621 struct e4_core_conn_context {
622 /* ystorm storm context */
623         struct ystorm_core_conn_st_ctx ystorm_st_context;
624         struct regpair ystorm_st_padding[2] /* padding */;
625 /* pstorm storm context */
626         struct pstorm_core_conn_st_ctx pstorm_st_context;
627         struct regpair pstorm_st_padding[2] /* padding */;
628 /* xstorm storm context */
629         struct xstorm_core_conn_st_ctx xstorm_st_context;
630 /* xstorm aggregative context */
631         struct e4_xstorm_core_conn_ag_ctx xstorm_ag_context;
632 /* tstorm aggregative context */
633         struct e4_tstorm_core_conn_ag_ctx tstorm_ag_context;
634 /* ustorm aggregative context */
635         struct e4_ustorm_core_conn_ag_ctx ustorm_ag_context;
636 /* mstorm storm context */
637         struct mstorm_core_conn_st_ctx mstorm_st_context;
638 /* ustorm storm context */
639         struct ustorm_core_conn_st_ctx ustorm_st_context;
640         struct regpair ustorm_st_padding[2] /* padding */;
641 };
642
643
644 /*
645  * How ll2 should deal with packet upon errors
646  */
647 enum core_error_handle {
648         LL2_DROP_PACKET /* If error occurs drop packet */,
649         LL2_DO_NOTHING /* If error occurs do nothing */,
650         LL2_ASSERT /* If error occurs assert */,
651         MAX_CORE_ERROR_HANDLE
652 };
653
654
655 /*
656  * opcodes for the event ring
657  */
658 enum core_event_opcode {
659         CORE_EVENT_TX_QUEUE_START,
660         CORE_EVENT_TX_QUEUE_STOP,
661         CORE_EVENT_RX_QUEUE_START,
662         CORE_EVENT_RX_QUEUE_STOP,
663         CORE_EVENT_RX_QUEUE_FLUSH,
664         CORE_EVENT_TX_QUEUE_UPDATE,
665         MAX_CORE_EVENT_OPCODE
666 };
667
668
669 /*
670  * The L4 pseudo checksum mode for Core
671  */
672 enum core_l4_pseudo_checksum_mode {
673 /* Pseudo Checksum on packet is calculated with the correct packet length. */
674         CORE_L4_PSEUDO_CSUM_CORRECT_LENGTH,
675 /* Pseudo Checksum on packet is calculated with zero length. */
676         CORE_L4_PSEUDO_CSUM_ZERO_LENGTH,
677         MAX_CORE_L4_PSEUDO_CHECKSUM_MODE
678 };
679
680
681 /*
682  * Light-L2 RX Producers in Tstorm RAM
683  */
684 struct core_ll2_port_stats {
685         struct regpair gsi_invalid_hdr;
686         struct regpair gsi_invalid_pkt_length;
687         struct regpair gsi_unsupported_pkt_typ;
688         struct regpair gsi_crcchksm_error;
689 };
690
691
692 /*
693  * Ethernet TX Per Queue Stats
694  */
695 struct core_ll2_pstorm_per_queue_stat {
696 /* number of total bytes sent without errors */
697         struct regpair sent_ucast_bytes;
698 /* number of total bytes sent without errors */
699         struct regpair sent_mcast_bytes;
700 /* number of total bytes sent without errors */
701         struct regpair sent_bcast_bytes;
702 /* number of total packets sent without errors */
703         struct regpair sent_ucast_pkts;
704 /* number of total packets sent without errors */
705         struct regpair sent_mcast_pkts;
706 /* number of total packets sent without errors */
707         struct regpair sent_bcast_pkts;
708 };
709
710
711 /*
712  * Light-L2 RX Producers in Tstorm RAM
713  */
714 struct core_ll2_rx_prod {
715         __le16 bd_prod /* BD Producer */;
716         __le16 cqe_prod /* CQE Producer */;
717         __le32 reserved;
718 };
719
720
721 struct core_ll2_tstorm_per_queue_stat {
722 /* Number of packets discarded because they are bigger than MTU */
723         struct regpair packet_too_big_discard;
724 /* Number of packets discarded due to lack of host buffers */
725         struct regpair no_buff_discard;
726 };
727
728
729 struct core_ll2_ustorm_per_queue_stat {
730         struct regpair rcv_ucast_bytes;
731         struct regpair rcv_mcast_bytes;
732         struct regpair rcv_bcast_bytes;
733         struct regpair rcv_ucast_pkts;
734         struct regpair rcv_mcast_pkts;
735         struct regpair rcv_bcast_pkts;
736 };
737
738
739 /*
740  * Core Ramrod Command IDs (light L2)
741  */
742 enum core_ramrod_cmd_id {
743         CORE_RAMROD_UNUSED,
744         CORE_RAMROD_RX_QUEUE_START /* RX Queue Start Ramrod */,
745         CORE_RAMROD_TX_QUEUE_START /* TX Queue Start Ramrod */,
746         CORE_RAMROD_RX_QUEUE_STOP /* RX Queue Stop Ramrod */,
747         CORE_RAMROD_TX_QUEUE_STOP /* TX Queue Stop Ramrod */,
748         CORE_RAMROD_RX_QUEUE_FLUSH /* RX Flush queue Ramrod */,
749         CORE_RAMROD_TX_QUEUE_UPDATE /* TX Queue Update Ramrod */,
750         MAX_CORE_RAMROD_CMD_ID
751 };
752
753
754 /*
755  * Core RX CQE Type for Light L2
756  */
757 enum core_roce_flavor_type {
758         CORE_ROCE,
759         CORE_RROCE,
760         MAX_CORE_ROCE_FLAVOR_TYPE
761 };
762
763
764 /*
765  * Specifies how ll2 should deal with packets errors: packet_too_big and no_buff
766  */
767 struct core_rx_action_on_error {
768         u8 error_type;
769 /* ll2 how to handle error packet_too_big (use enum core_error_handle) */
770 #define CORE_RX_ACTION_ON_ERROR_PACKET_TOO_BIG_MASK  0x3
771 #define CORE_RX_ACTION_ON_ERROR_PACKET_TOO_BIG_SHIFT 0
772 /* ll2 how to handle error with no_buff  (use enum core_error_handle) */
773 #define CORE_RX_ACTION_ON_ERROR_NO_BUFF_MASK         0x3
774 #define CORE_RX_ACTION_ON_ERROR_NO_BUFF_SHIFT        2
775 #define CORE_RX_ACTION_ON_ERROR_RESERVED_MASK        0xF
776 #define CORE_RX_ACTION_ON_ERROR_RESERVED_SHIFT       4
777 };
778
779
780 /*
781  * Core RX BD for Light L2
782  */
783 struct core_rx_bd {
784         struct regpair addr;
785         __le16 reserved[4];
786 };
787
788
789 /*
790  * Core RX CM offload BD for Light L2
791  */
792 struct core_rx_bd_with_buff_len {
793         struct regpair addr;
794         __le16 buff_length;
795         __le16 reserved[3];
796 };
797
798 /*
799  * Core RX CM offload BD for Light L2
800  */
801 union core_rx_bd_union {
802         struct core_rx_bd rx_bd /* Core Rx Bd static buffer size */;
803 /* Core Rx Bd with dynamic buffer length */
804         struct core_rx_bd_with_buff_len rx_bd_with_len;
805 };
806
807
808
809 /*
810  * Opaque Data for Light L2 RX CQE .
811  */
812 struct core_rx_cqe_opaque_data {
813         __le32 data[2] /* Opaque CQE Data */;
814 };
815
816
817 /*
818  * Core RX CQE Type for Light L2
819  */
820 enum core_rx_cqe_type {
821         CORE_RX_CQE_ILLIGAL_TYPE /* Bad RX Cqe type */,
822         CORE_RX_CQE_TYPE_REGULAR /* Regular Core RX CQE */,
823         CORE_RX_CQE_TYPE_GSI_OFFLOAD /* Fp Gsi offload RX CQE */,
824         CORE_RX_CQE_TYPE_SLOW_PATH /* Slow path Core RX CQE */,
825         MAX_CORE_RX_CQE_TYPE
826 };
827
828
829 /*
830  * Core RX CQE for Light L2 .
831  */
832 struct core_rx_fast_path_cqe {
833         u8 type /* CQE type */;
834 /* Offset (in bytes) of the packet from start of the buffer */
835         u8 placement_offset;
836 /* Parsing and error flags from the parser */
837         struct parsing_and_err_flags parse_flags;
838         __le16 packet_length /* Total packet length (from the parser) */;
839         __le16 vlan /* 802.1q VLAN tag */;
840         struct core_rx_cqe_opaque_data opaque_data /* Opaque Data */;
841 /* bit- map: each bit represents a specific error. errors indications are
842  * provided by the cracker. see spec for detailed description
843  */
844         struct parsing_err_flags err_flags;
845         __le16 reserved0;
846         __le32 reserved1[3];
847 };
848
849 /*
850  * Core Rx CM offload CQE .
851  */
852 struct core_rx_gsi_offload_cqe {
853         u8 type /* CQE type */;
854         u8 data_length_error /* set if gsi data is bigger than buff */;
855 /* Parsing and error flags from the parser */
856         struct parsing_and_err_flags parse_flags;
857         __le16 data_length /* Total packet length (from the parser) */;
858         __le16 vlan /* 802.1q VLAN tag */;
859         __le32 src_mac_addrhi /* hi 4 bytes source mac address */;
860         __le16 src_mac_addrlo /* lo 2 bytes of source mac address */;
861 /* These are the lower 16 bit of QP id in RoCE BTH header */
862         __le16 qp_id;
863         __le32 src_qp /* Source QP from DETH header */;
864         __le32 reserved[3];
865 };
866
867 /*
868  * Core RX CQE for Light L2 .
869  */
870 struct core_rx_slow_path_cqe {
871         u8 type /* CQE type */;
872         u8 ramrod_cmd_id;
873         __le16 echo;
874         struct core_rx_cqe_opaque_data opaque_data /* Opaque Data */;
875         __le32 reserved1[5];
876 };
877
878 /*
879  * Core RX CM offload BD for Light L2
880  */
881 union core_rx_cqe_union {
882         struct core_rx_fast_path_cqe rx_cqe_fp /* Fast path CQE */;
883         struct core_rx_gsi_offload_cqe rx_cqe_gsi /* GSI offload CQE */;
884         struct core_rx_slow_path_cqe rx_cqe_sp /* Slow path CQE */;
885 };
886
887
888
889
890
891 /*
892  * Ramrod data for rx queue start ramrod
893  */
894 struct core_rx_start_ramrod_data {
895         struct regpair bd_base /* bd address of the first bd page */;
896         struct regpair cqe_pbl_addr /* Base address on host of CQE PBL */;
897         __le16 mtu /* Maximum transmission unit */;
898         __le16 sb_id /* Status block ID */;
899         u8 sb_index /* index of the protocol index */;
900         u8 complete_cqe_flg /* post completion to the CQE ring if set */;
901         u8 complete_event_flg /* post completion to the event ring if set */;
902         u8 drop_ttl0_flg /* drop packet with ttl0 if set */;
903         __le16 num_of_pbl_pages /* Num of pages in CQE PBL */;
904 /* if set, 802.1q tags will be removed and copied to CQE */
905 /* if set, 802.1q tags will be removed and copied to CQE */
906         u8 inner_vlan_stripping_en;
907 /* if set and inner vlan does not exist, the outer vlan will copied to CQE as
908  * inner vlan. should be used in MF_OVLAN mode only.
909  */
910         u8 report_outer_vlan;
911         u8 queue_id /* Light L2 RX Queue ID */;
912         u8 main_func_queue /* Is this the main queue for the PF */;
913 /* Duplicate broadcast packets to LL2 main queue in mf_si mode. Valid if
914  * main_func_queue is set.
915  */
916         u8 mf_si_bcast_accept_all;
917 /* Duplicate multicast packets to LL2 main queue in mf_si mode. Valid if
918  * main_func_queue is set.
919  */
920         u8 mf_si_mcast_accept_all;
921 /* Specifies how ll2 should deal with packets errors: packet_too_big and
922  * no_buff
923  */
924         struct core_rx_action_on_error action_on_error;
925 /* set when in GSI offload mode on ROCE connection */
926         u8 gsi_offload_flag;
927         u8 reserved[6];
928 };
929
930
931 /*
932  * Ramrod data for rx queue stop ramrod
933  */
934 struct core_rx_stop_ramrod_data {
935         u8 complete_cqe_flg /* post completion to the CQE ring if set */;
936         u8 complete_event_flg /* post completion to the event ring if set */;
937         u8 queue_id /* Light L2 RX Queue ID */;
938         u8 reserved1;
939         __le16 reserved2[2];
940 };
941
942
943 /*
944  * Flags for Core TX BD
945  */
946 struct core_tx_bd_data {
947         __le16 as_bitfield;
948 /* Do not allow additional VLAN manipulations on this packet (DCB) */
949 #define CORE_TX_BD_DATA_FORCE_VLAN_MODE_MASK         0x1
950 #define CORE_TX_BD_DATA_FORCE_VLAN_MODE_SHIFT        0
951 /* Insert VLAN into packet. Cannot be set for LB packets
952  * (tx_dst == CORE_TX_DEST_LB)
953  */
954 #define CORE_TX_BD_DATA_VLAN_INSERTION_MASK          0x1
955 #define CORE_TX_BD_DATA_VLAN_INSERTION_SHIFT         1
956 /* This is the first BD of the packet (for debug) */
957 #define CORE_TX_BD_DATA_START_BD_MASK                0x1
958 #define CORE_TX_BD_DATA_START_BD_SHIFT               2
959 /* Calculate the IP checksum for the packet */
960 #define CORE_TX_BD_DATA_IP_CSUM_MASK                 0x1
961 #define CORE_TX_BD_DATA_IP_CSUM_SHIFT                3
962 /* Calculate the L4 checksum for the packet */
963 #define CORE_TX_BD_DATA_L4_CSUM_MASK                 0x1
964 #define CORE_TX_BD_DATA_L4_CSUM_SHIFT                4
965 /* Packet is IPv6 with extensions */
966 #define CORE_TX_BD_DATA_IPV6_EXT_MASK                0x1
967 #define CORE_TX_BD_DATA_IPV6_EXT_SHIFT               5
968 /* If IPv6+ext, and if l4_csum is 1, than this field indicates L4 protocol:
969  * 0-TCP, 1-UDP
970  */
971 #define CORE_TX_BD_DATA_L4_PROTOCOL_MASK             0x1
972 #define CORE_TX_BD_DATA_L4_PROTOCOL_SHIFT            6
973 /* The pseudo checksum mode to place in the L4 checksum field. Required only
974  * when IPv6+ext and l4_csum is set. (use enum core_l4_pseudo_checksum_mode)
975  */
976 #define CORE_TX_BD_DATA_L4_PSEUDO_CSUM_MODE_MASK     0x1
977 #define CORE_TX_BD_DATA_L4_PSEUDO_CSUM_MODE_SHIFT    7
978 /* Number of BDs that make up one packet - width wide enough to present
979  * CORE_LL2_TX_MAX_BDS_PER_PACKET
980  */
981 #define CORE_TX_BD_DATA_NBDS_MASK                    0xF
982 #define CORE_TX_BD_DATA_NBDS_SHIFT                   8
983 /* Use roce_flavor enum - Differentiate between Roce flavors is valid when
984  * connType is ROCE (use enum core_roce_flavor_type)
985  */
986 #define CORE_TX_BD_DATA_ROCE_FLAV_MASK               0x1
987 #define CORE_TX_BD_DATA_ROCE_FLAV_SHIFT              12
988 /* Calculate ip length */
989 #define CORE_TX_BD_DATA_IP_LEN_MASK                  0x1
990 #define CORE_TX_BD_DATA_IP_LEN_SHIFT                 13
991 /* disables the STAG insertion, relevant only in MF OVLAN mode. */
992 #define CORE_TX_BD_DATA_DISABLE_STAG_INSERTION_MASK  0x1
993 #define CORE_TX_BD_DATA_DISABLE_STAG_INSERTION_SHIFT 14
994 #define CORE_TX_BD_DATA_RESERVED0_MASK               0x1
995 #define CORE_TX_BD_DATA_RESERVED0_SHIFT              15
996 };
997
998 /*
999  * Core TX BD for Light L2
1000  */
1001 struct core_tx_bd {
1002         struct regpair addr /* Buffer Address */;
1003         __le16 nbytes /* Number of Bytes in Buffer */;
1004 /* Network packets: VLAN to insert to packet (if insertion flag set) LoopBack
1005  * packets: echo data to pass to Rx
1006  */
1007         __le16 nw_vlan_or_lb_echo;
1008         struct core_tx_bd_data bd_data /* BD Flags */;
1009         __le16 bitfield1;
1010 /* L4 Header Offset from start of packet (in Words). This is needed if both
1011  * l4_csum and ipv6_ext are set
1012  */
1013 #define CORE_TX_BD_L4_HDR_OFFSET_W_MASK  0x3FFF
1014 #define CORE_TX_BD_L4_HDR_OFFSET_W_SHIFT 0
1015 /* Packet destination - Network, Loopback or Drop (use enum core_tx_dest) */
1016 #define CORE_TX_BD_TX_DST_MASK           0x3
1017 #define CORE_TX_BD_TX_DST_SHIFT          14
1018 };
1019
1020
1021
1022 /*
1023  * Light L2 TX Destination
1024  */
1025 enum core_tx_dest {
1026         CORE_TX_DEST_NW /* TX Destination to the Network */,
1027         CORE_TX_DEST_LB /* TX Destination to the Loopback */,
1028         CORE_TX_DEST_RESERVED,
1029         CORE_TX_DEST_DROP /* TX Drop */,
1030         MAX_CORE_TX_DEST
1031 };
1032
1033
1034 /*
1035  * Ramrod data for tx queue start ramrod
1036  */
1037 struct core_tx_start_ramrod_data {
1038         struct regpair pbl_base_addr /* Address of the pbl page */;
1039         __le16 mtu /* Maximum transmission unit */;
1040         __le16 sb_id /* Status block ID */;
1041         u8 sb_index /* Status block protocol index */;
1042         u8 stats_en /* Statistics Enable */;
1043         u8 stats_id /* Statistics Counter ID */;
1044         u8 conn_type /* connection type that loaded ll2 */;
1045         __le16 pbl_size /* Number of BD pages pointed by PBL */;
1046         __le16 qm_pq_id /* QM PQ ID */;
1047 /* set when in GSI offload mode on ROCE connection */
1048         u8 gsi_offload_flag;
1049         u8 resrved[3];
1050 };
1051
1052
1053 /*
1054  * Ramrod data for tx queue stop ramrod
1055  */
1056 struct core_tx_stop_ramrod_data {
1057         __le32 reserved0[2];
1058 };
1059
1060
1061 /*
1062  * Ramrod data for tx queue update ramrod
1063  */
1064 struct core_tx_update_ramrod_data {
1065         u8 update_qm_pq_id_flg /* Flag to Update QM PQ ID */;
1066         u8 reserved0;
1067         __le16 qm_pq_id /* Updated QM PQ ID */;
1068         __le32 reserved1[1];
1069 };
1070
1071
1072 /*
1073  * Enum flag for what type of dcb data to update
1074  */
1075 enum dcb_dscp_update_mode {
1076 /* use when no change should be done to DCB data */
1077         DONT_UPDATE_DCB_DSCP,
1078         UPDATE_DCB /* use to update only L2 (vlan) priority */,
1079         UPDATE_DSCP /* use to update only IP DSCP */,
1080         UPDATE_DCB_DSCP /* update vlan pri and DSCP */,
1081         MAX_DCB_DSCP_UPDATE_FLAG
1082 };
1083
1084
1085 struct eth_mstorm_per_pf_stat {
1086         struct regpair gre_discard_pkts /* Dropped GRE RX packets */;
1087         struct regpair vxlan_discard_pkts /* Dropped VXLAN RX packets */;
1088         struct regpair geneve_discard_pkts /* Dropped GENEVE RX packets */;
1089         struct regpair lb_discard_pkts /* Dropped Tx switched packets */;
1090 };
1091
1092
1093 struct eth_mstorm_per_queue_stat {
1094 /* Number of packets discarded because TTL=0 (in IPv4) or hopLimit=0 (IPv6) */
1095         struct regpair ttl0_discard;
1096 /* Number of packets discarded because they are bigger than MTU */
1097         struct regpair packet_too_big_discard;
1098 /* Number of packets discarded due to lack of host buffers (BDs/SGEs/CQEs) */
1099         struct regpair no_buff_discard;
1100 /* Number of packets discarded because of no active Rx connection */
1101         struct regpair not_active_discard;
1102 /* number of coalesced packets in all TPA aggregations */
1103         struct regpair tpa_coalesced_pkts;
1104 /* total number of TPA aggregations */
1105         struct regpair tpa_coalesced_events;
1106 /* number of aggregations, which abnormally ended */
1107         struct regpair tpa_aborts_num;
1108 /* total TCP payload length in all TPA aggregations */
1109         struct regpair tpa_coalesced_bytes;
1110 };
1111
1112
1113 /*
1114  * Ethernet TX Per PF
1115  */
1116 struct eth_pstorm_per_pf_stat {
1117 /* number of total ucast bytes sent on loopback port without errors */
1118         struct regpair sent_lb_ucast_bytes;
1119 /* number of total mcast bytes sent on loopback port without errors */
1120         struct regpair sent_lb_mcast_bytes;
1121 /* number of total bcast bytes sent on loopback port without errors */
1122         struct regpair sent_lb_bcast_bytes;
1123 /* number of total ucast packets sent on loopback port without errors */
1124         struct regpair sent_lb_ucast_pkts;
1125 /* number of total mcast packets sent on loopback port without errors */
1126         struct regpair sent_lb_mcast_pkts;
1127 /* number of total bcast packets sent on loopback port without errors */
1128         struct regpair sent_lb_bcast_pkts;
1129         struct regpair sent_gre_bytes /* Sent GRE bytes */;
1130         struct regpair sent_vxlan_bytes /* Sent VXLAN bytes */;
1131         struct regpair sent_geneve_bytes /* Sent GENEVE bytes */;
1132         struct regpair sent_gre_pkts /* Sent GRE packets */;
1133         struct regpair sent_vxlan_pkts /* Sent VXLAN packets */;
1134         struct regpair sent_geneve_pkts /* Sent GENEVE packets */;
1135         struct regpair gre_drop_pkts /* Dropped GRE TX packets */;
1136         struct regpair vxlan_drop_pkts /* Dropped VXLAN TX packets */;
1137         struct regpair geneve_drop_pkts /* Dropped GENEVE TX packets */;
1138 };
1139
1140
1141 /*
1142  * Ethernet TX Per Queue Stats
1143  */
1144 struct eth_pstorm_per_queue_stat {
1145 /* number of total bytes sent without errors */
1146         struct regpair sent_ucast_bytes;
1147 /* number of total bytes sent without errors */
1148         struct regpair sent_mcast_bytes;
1149 /* number of total bytes sent without errors */
1150         struct regpair sent_bcast_bytes;
1151 /* number of total packets sent without errors */
1152         struct regpair sent_ucast_pkts;
1153 /* number of total packets sent without errors */
1154         struct regpair sent_mcast_pkts;
1155 /* number of total packets sent without errors */
1156         struct regpair sent_bcast_pkts;
1157 /* number of total packets dropped due to errors */
1158         struct regpair error_drop_pkts;
1159 };
1160
1161
1162 /*
1163  * ETH Rx producers data
1164  */
1165 struct eth_rx_rate_limit {
1166 /* Rate Limit Multiplier - (Storm Clock (MHz) * 8 / Desired Bandwidth (MB/s)) */
1167         __le16 mult;
1168 /* Constant term to add (or subtract from number of cycles) */
1169         __le16 cnst;
1170         u8 add_sub_cnst /* Add (1) or subtract (0) constant term */;
1171         u8 reserved0;
1172         __le16 reserved1;
1173 };
1174
1175
1176 struct eth_ustorm_per_pf_stat {
1177 /* number of total ucast bytes received on loopback port without errors */
1178         struct regpair rcv_lb_ucast_bytes;
1179 /* number of total mcast bytes received on loopback port without errors */
1180         struct regpair rcv_lb_mcast_bytes;
1181 /* number of total bcast bytes received on loopback port without errors */
1182         struct regpair rcv_lb_bcast_bytes;
1183 /* number of total ucast packets received on loopback port without errors */
1184         struct regpair rcv_lb_ucast_pkts;
1185 /* number of total mcast packets received on loopback port without errors */
1186         struct regpair rcv_lb_mcast_pkts;
1187 /* number of total bcast packets received on loopback port without errors */
1188         struct regpair rcv_lb_bcast_pkts;
1189         struct regpair rcv_gre_bytes /* Received GRE bytes */;
1190         struct regpair rcv_vxlan_bytes /* Received VXLAN bytes */;
1191         struct regpair rcv_geneve_bytes /* Received GENEVE bytes */;
1192         struct regpair rcv_gre_pkts /* Received GRE packets */;
1193         struct regpair rcv_vxlan_pkts /* Received VXLAN packets */;
1194         struct regpair rcv_geneve_pkts /* Received GENEVE packets */;
1195 };
1196
1197
1198 struct eth_ustorm_per_queue_stat {
1199         struct regpair rcv_ucast_bytes;
1200         struct regpair rcv_mcast_bytes;
1201         struct regpair rcv_bcast_bytes;
1202         struct regpair rcv_ucast_pkts;
1203         struct regpair rcv_mcast_pkts;
1204         struct regpair rcv_bcast_pkts;
1205 };
1206
1207
1208 /*
1209  * Event Ring VF-PF Channel data
1210  */
1211 struct vf_pf_channel_eqe_data {
1212         struct regpair msg_addr /* VF-PF message address */;
1213 };
1214
1215 /*
1216  * Event Ring malicious VF data
1217  */
1218 struct malicious_vf_eqe_data {
1219         u8 vf_id /* Malicious VF ID */;
1220         u8 err_id /* Malicious VF error (use enum malicious_vf_error_id) */;
1221         __le16 reserved[3];
1222 };
1223
1224 /*
1225  * Event Ring initial cleanup data
1226  */
1227 struct initial_cleanup_eqe_data {
1228         u8 vf_id /* VF ID */;
1229         u8 reserved[7];
1230 };
1231
1232 /*
1233  * Event Data Union
1234  */
1235 union event_ring_data {
1236         u8 bytes[8] /* Byte Array */;
1237         struct vf_pf_channel_eqe_data vf_pf_channel /* VF-PF Channel data */;
1238         struct iscsi_eqe_data iscsi_info /* Dedicated fields to iscsi data */;
1239 /* Dedicated fields to iscsi connect done results */
1240         struct iscsi_connect_done_results iscsi_conn_done_info;
1241         struct malicious_vf_eqe_data malicious_vf /* Malicious VF data */;
1242 /* VF Initial Cleanup data */
1243         struct initial_cleanup_eqe_data vf_init_cleanup;
1244 };
1245
1246
1247 /*
1248  * Event Ring Entry
1249  */
1250 struct event_ring_entry {
1251         u8 protocol_id /* Event Protocol ID (use enum protocol_type) */;
1252         u8 opcode /* Event Opcode */;
1253         __le16 reserved0 /* Reserved */;
1254         __le16 echo /* Echo value from ramrod data on the host */;
1255         u8 fw_return_code /* FW return code for SP ramrods */;
1256         u8 flags;
1257 /* 0: synchronous EQE - a completion of SP message. 1: asynchronous EQE */
1258 #define EVENT_RING_ENTRY_ASYNC_MASK      0x1
1259 #define EVENT_RING_ENTRY_ASYNC_SHIFT     0
1260 #define EVENT_RING_ENTRY_RESERVED1_MASK  0x7F
1261 #define EVENT_RING_ENTRY_RESERVED1_SHIFT 1
1262         union event_ring_data data;
1263 };
1264
1265 /*
1266  * Event Ring Next Page Address
1267  */
1268 struct event_ring_next_addr {
1269         struct regpair addr /* Next Page Address */;
1270         __le32 reserved[2] /* Reserved */;
1271 };
1272
1273 /*
1274  * Event Ring Element
1275  */
1276 union event_ring_element {
1277         struct event_ring_entry entry /* Event Ring Entry */;
1278 /* Event Ring Next Page Address */
1279         struct event_ring_next_addr next_addr;
1280 };
1281
1282
1283
1284 /*
1285  * Ports mode
1286  */
1287 enum fw_flow_ctrl_mode {
1288         flow_ctrl_pause,
1289         flow_ctrl_pfc,
1290         MAX_FW_FLOW_CTRL_MODE
1291 };
1292
1293
1294 /*
1295  * GFT profile type.
1296  */
1297 enum gft_profile_type {
1298 /* tunnel type, inner 4 tuple, IP type and L4 type match. */
1299         GFT_PROFILE_TYPE_4_TUPLE,
1300 /* tunnel type, inner L4 destination port, IP type and L4 type match. */
1301         GFT_PROFILE_TYPE_L4_DST_PORT,
1302 /* tunnel type, inner IP destination address and IP type match. */
1303         GFT_PROFILE_TYPE_IP_DST_ADDR,
1304 /* tunnel type, inner IP source address and IP type match. */
1305         GFT_PROFILE_TYPE_IP_SRC_ADDR,
1306         GFT_PROFILE_TYPE_TUNNEL_TYPE /* tunnel type and outer IP type match. */,
1307         MAX_GFT_PROFILE_TYPE
1308 };
1309
1310
1311 /*
1312  * Major and Minor hsi Versions
1313  */
1314 struct hsi_fp_ver_struct {
1315         u8 minor_ver_arr[2] /* Minor Version of hsi loading pf */;
1316         u8 major_ver_arr[2] /* Major Version of driver loading pf */;
1317 };
1318
1319
1320 /*
1321  * Integration Phase
1322  */
1323 enum integ_phase {
1324         INTEG_PHASE_BB_A0_LATEST = 3 /* BB A0 latest integration phase */,
1325         INTEG_PHASE_BB_B0_NO_MCP = 10 /* BB B0 without MCP */,
1326         INTEG_PHASE_BB_B0_WITH_MCP = 11 /* BB B0 with MCP */,
1327         MAX_INTEG_PHASE
1328 };
1329
1330
1331 /*
1332  * Ports mode
1333  */
1334 enum iwarp_ll2_tx_queues {
1335 /* LL2 queue for OOO packets sent in-order by the driver */
1336         IWARP_LL2_IN_ORDER_TX_QUEUE = 1,
1337 /* LL2 queue for unaligned packets sent aligned by the driver */
1338         IWARP_LL2_ALIGNED_TX_QUEUE,
1339 /* LL2 queue for unaligned packets sent aligned and was right-trimmed by the
1340  * driver
1341  */
1342         IWARP_LL2_ALIGNED_RIGHT_TRIMMED_TX_QUEUE,
1343         IWARP_LL2_ERROR /* Error indication */,
1344         MAX_IWARP_LL2_TX_QUEUES
1345 };
1346
1347
1348 /*
1349  * Malicious VF error ID
1350  */
1351 enum malicious_vf_error_id {
1352         MALICIOUS_VF_NO_ERROR /* Zero placeholder value */,
1353 /* Writing to VF/PF channel when it is not ready */
1354         VF_PF_CHANNEL_NOT_READY,
1355         VF_ZONE_MSG_NOT_VALID /* VF channel message is not valid */,
1356         VF_ZONE_FUNC_NOT_ENABLED /* Parent PF of VF channel is not active */,
1357 /* TX packet is shorter then reported on BDs or from minimal size */
1358         ETH_PACKET_TOO_SMALL,
1359 /* Tx packet with marked as insert VLAN when its illegal */
1360         ETH_ILLEGAL_VLAN_MODE,
1361         ETH_MTU_VIOLATION /* TX packet is greater then MTU */,
1362 /* TX packet has illegal inband tags marked */
1363         ETH_ILLEGAL_INBAND_TAGS,
1364 /* Vlan cant be added to inband tag */
1365         ETH_VLAN_INSERT_AND_INBAND_VLAN,
1366 /* indicated number of BDs for the packet is illegal */
1367         ETH_ILLEGAL_NBDS,
1368         ETH_FIRST_BD_WO_SOP /* 1st BD must have start_bd flag set */,
1369 /* There are not enough BDs for transmission of even one packet */
1370         ETH_INSUFFICIENT_BDS,
1371         ETH_ILLEGAL_LSO_HDR_NBDS /* Header NBDs value is illegal */,
1372         ETH_ILLEGAL_LSO_MSS /* LSO MSS value is more than allowed */,
1373 /* empty BD (which not contains control flags) is illegal  */
1374         ETH_ZERO_SIZE_BD,
1375         ETH_ILLEGAL_LSO_HDR_LEN /* LSO header size is above the limit  */,
1376 /* In LSO its expected that on the local BD ring there will be at least MSS
1377  * bytes of data
1378  */
1379         ETH_INSUFFICIENT_PAYLOAD,
1380         ETH_EDPM_OUT_OF_SYNC /* Valid BDs on local ring after EDPM L2 sync */,
1381 /* Tunneled packet with IPv6+Ext without a proper number of BDs */
1382         ETH_TUNN_IPV6_EXT_NBD_ERR,
1383         ETH_CONTROL_PACKET_VIOLATION /* VF sent control frame such as PFC */,
1384         ETH_ANTI_SPOOFING_ERR /* Anti-Spoofing verification failure */,
1385         MAX_MALICIOUS_VF_ERROR_ID
1386 };
1387
1388
1389
1390 /*
1391  * Mstorm non-triggering VF zone
1392  */
1393 struct mstorm_non_trigger_vf_zone {
1394 /* VF statistic bucket */
1395         struct eth_mstorm_per_queue_stat eth_queue_stat;
1396 /* VF RX queues producers */
1397         struct eth_rx_prod_data
1398                 eth_rx_queue_producers[ETH_MAX_NUM_RX_QUEUES_PER_VF_QUAD];
1399 };
1400
1401
1402 /*
1403  * Mstorm VF zone
1404  */
1405 struct mstorm_vf_zone {
1406 /* non-interrupt-triggering zone */
1407         struct mstorm_non_trigger_vf_zone non_trigger;
1408 };
1409
1410
1411 /*
1412  * vlan header including TPID and TCI fields
1413  */
1414 struct vlan_header {
1415         __le16 tpid /* Tag Protocol Identifier */;
1416         __le16 tci /* Tag Control Information */;
1417 };
1418
1419 /*
1420  * outer tag configurations
1421  */
1422 struct outer_tag_config_struct {
1423 /* Enables updating S-tag priority from inner tag or DCB. Should be 1 for Bette
1424  * Davis, UFP with Host Control mode, and UFP with DCB over base interface.
1425  * else - 0.
1426  */
1427         u8 enable_stag_pri_change;
1428 /* If inner_to_outer_pri_map is initialize then set pri_map_valid */
1429         u8 pri_map_valid;
1430         u8 reserved[2];
1431 /* In case mf_mode is MF_OVLAN, this field specifies the outer tag protocol
1432  * identifier and outer tag control information
1433  */
1434         struct vlan_header outer_tag;
1435 /* Map from inner to outer priority. Set pri_map_valid when init map */
1436         u8 inner_to_outer_pri_map[8];
1437 };
1438
1439
1440 /*
1441  * personality per PF
1442  */
1443 enum personality_type {
1444         BAD_PERSONALITY_TYP,
1445         PERSONALITY_ISCSI /* iSCSI and LL2 */,
1446         PERSONALITY_FCOE /* Fcoe and LL2 */,
1447         PERSONALITY_RDMA_AND_ETH /* Roce or Iwarp, Eth and LL2 */,
1448         PERSONALITY_RDMA /* Roce and LL2 */,
1449         PERSONALITY_CORE /* CORE(LL2) */,
1450         PERSONALITY_ETH /* Ethernet */,
1451         PERSONALITY_TOE /* Toe and LL2 */,
1452         MAX_PERSONALITY_TYPE
1453 };
1454
1455
1456 /*
1457  * tunnel configuration
1458  */
1459 struct pf_start_tunnel_config {
1460 /* Set VXLAN tunnel UDP destination port to vxlan_udp_port. If not set -
1461  * FW will use a default port
1462  */
1463         u8 set_vxlan_udp_port_flg;
1464 /* Set GENEVE tunnel UDP destination port to geneve_udp_port. If not set -
1465  * FW will use a default port
1466  */
1467         u8 set_geneve_udp_port_flg;
1468         u8 tunnel_clss_vxlan /* Rx classification scheme for VXLAN tunnel. */;
1469 /* Rx classification scheme for l2 GENEVE tunnel. */
1470         u8 tunnel_clss_l2geneve;
1471 /* Rx classification scheme for ip GENEVE tunnel. */
1472         u8 tunnel_clss_ipgeneve;
1473         u8 tunnel_clss_l2gre /* Rx classification scheme for l2 GRE tunnel. */;
1474         u8 tunnel_clss_ipgre /* Rx classification scheme for ip GRE tunnel. */;
1475         u8 reserved;
1476 /* VXLAN tunnel UDP destination port. Valid if set_vxlan_udp_port_flg=1 */
1477         __le16 vxlan_udp_port;
1478 /* GENEVE tunnel UDP destination port. Valid if set_geneve_udp_port_flg=1 */
1479         __le16 geneve_udp_port;
1480 };
1481
1482 /*
1483  * Ramrod data for PF start ramrod
1484  */
1485 struct pf_start_ramrod_data {
1486         struct regpair event_ring_pbl_addr /* Address of event ring PBL */;
1487 /* PBL address of consolidation queue */
1488         struct regpair consolid_q_pbl_addr;
1489 /* tunnel configuration. */
1490         struct pf_start_tunnel_config tunnel_config;
1491         __le16 event_ring_sb_id /* Status block ID */;
1492 /* All VfIds owned by Pf will be from baseVfId till baseVfId+numVfs */
1493         u8 base_vf_id;
1494         u8 num_vfs /* Amount of vfs owned by PF */;
1495         u8 event_ring_num_pages /* Number of PBL pages in event ring */;
1496         u8 event_ring_sb_index /* Status block index */;
1497         u8 path_id /* HW path ID (engine ID) */;
1498         u8 warning_as_error /* In FW asserts, treat warning as error */;
1499 /* If not set - throw a warning for each ramrod (for debug) */
1500         u8 dont_log_ramrods;
1501         u8 personality /* define what type of personality is new PF */;
1502 /* Log type mask. Each bit set enables a corresponding event type logging.
1503  * Event types are defined as ASSERT_LOG_TYPE_xxx
1504  */
1505         __le16 log_type_mask;
1506         u8 mf_mode /* Multi function mode */;
1507         u8 integ_phase /* Integration phase */;
1508 /* If set, inter-pf tx switching is allowed in Switch Independent func mode */
1509         u8 allow_npar_tx_switching;
1510         u8 reserved0;
1511 /* FP HSI version to be used by FW */
1512         struct hsi_fp_ver_struct hsi_fp_ver;
1513 /* Outer tag configurations */
1514         struct outer_tag_config_struct outer_tag_config;
1515 };
1516
1517
1518
1519 /*
1520  * Per protocol DCB data
1521  */
1522 struct protocol_dcb_data {
1523         u8 dcb_enable_flag /* Enable DCB */;
1524         u8 dscp_enable_flag /* Enable updating DSCP value */;
1525         u8 dcb_priority /* DCB priority */;
1526         u8 dcb_tc /* DCB TC */;
1527         u8 dscp_val /* DSCP value to write if dscp_enable_flag is set */;
1528 /* When DCB is enabled - if this flag is set, dont add VLAN 0 tag to untagged
1529  * frames
1530  */
1531         u8 dcb_dont_add_vlan0;
1532 };
1533
1534 /*
1535  * Update tunnel configuration
1536  */
1537 struct pf_update_tunnel_config {
1538 /* Update RX per PF tunnel classification scheme. */
1539         u8 update_rx_pf_clss;
1540 /* Update per PORT default tunnel RX classification scheme for traffic with
1541  * unknown unicast outer MAC in NPAR mode.
1542  */
1543         u8 update_rx_def_ucast_clss;
1544 /* Update per PORT default tunnel RX classification scheme for traffic with non
1545  * unicast outer MAC in NPAR mode.
1546  */
1547         u8 update_rx_def_non_ucast_clss;
1548 /* Update VXLAN tunnel UDP destination port. */
1549         u8 set_vxlan_udp_port_flg;
1550 /* Update GENEVE tunnel UDP destination port. */
1551         u8 set_geneve_udp_port_flg;
1552         u8 tunnel_clss_vxlan /* Classification scheme for VXLAN tunnel. */;
1553 /* Classification scheme for l2 GENEVE tunnel. */
1554         u8 tunnel_clss_l2geneve;
1555 /* Classification scheme for ip GENEVE tunnel. */
1556         u8 tunnel_clss_ipgeneve;
1557         u8 tunnel_clss_l2gre /* Classification scheme for l2 GRE tunnel. */;
1558         u8 tunnel_clss_ipgre /* Classification scheme for ip GRE tunnel. */;
1559         __le16 vxlan_udp_port /* VXLAN tunnel UDP destination port. */;
1560         __le16 geneve_udp_port /* GENEVE tunnel UDP destination port. */;
1561         __le16 reserved;
1562 };
1563
1564 /*
1565  * Data for port update ramrod
1566  */
1567 struct pf_update_ramrod_data {
1568 /* Update Eth DCB  data indication (use enum dcb_dscp_update_mode) */
1569         u8 update_eth_dcb_data_mode;
1570 /* Update FCOE DCB  data indication (use enum dcb_dscp_update_mode) */
1571         u8 update_fcoe_dcb_data_mode;
1572 /* Update iSCSI DCB  data indication (use enum dcb_dscp_update_mode) */
1573         u8 update_iscsi_dcb_data_mode;
1574         u8 update_roce_dcb_data_mode /* Update ROCE DCB  data indication */;
1575 /* Update RROCE (RoceV2) DCB  data indication */
1576         u8 update_rroce_dcb_data_mode;
1577         u8 update_iwarp_dcb_data_mode /* Update IWARP DCB  data indication */;
1578         u8 update_mf_vlan_flag /* Update MF outer vlan Id */;
1579 /* Update Enable STAG Priority Change indication */
1580         u8 update_enable_stag_pri_change;
1581         struct protocol_dcb_data eth_dcb_data /* core eth related fields */;
1582         struct protocol_dcb_data fcoe_dcb_data /* core fcoe related fields */;
1583 /* core iscsi related fields */
1584         struct protocol_dcb_data iscsi_dcb_data;
1585         struct protocol_dcb_data roce_dcb_data /* core roce related fields */;
1586 /* core roce related fields */
1587         struct protocol_dcb_data rroce_dcb_data;
1588 /* core iwarp related fields */
1589         struct protocol_dcb_data iwarp_dcb_data;
1590         __le16 mf_vlan /* new outer vlan id value */;
1591 /* enables updating S-tag priority from inner tag or DCB. Should be 1 for Bette
1592  * Davis, UFP with Host Control mode, and UFP with DCB over base interface.
1593  * else - 0
1594  */
1595         u8 enable_stag_pri_change;
1596         u8 reserved;
1597 /* tunnel configuration. */
1598         struct pf_update_tunnel_config tunnel_config;
1599 };
1600
1601
1602
1603 /*
1604  * Ports mode
1605  */
1606 enum ports_mode {
1607         ENGX2_PORTX1 /* 2 engines x 1 port */,
1608         ENGX2_PORTX2 /* 2 engines x 2 ports */,
1609         ENGX1_PORTX1 /* 1 engine  x 1 port */,
1610         ENGX1_PORTX2 /* 1 engine  x 2 ports */,
1611         ENGX1_PORTX4 /* 1 engine  x 4 ports */,
1612         MAX_PORTS_MODE
1613 };
1614
1615
1616
1617 /*
1618  * use to index in hsi_fp_[major|minor]_ver_arr per protocol
1619  */
1620 enum protocol_version_array_key {
1621         ETH_VER_KEY = 0,
1622         ROCE_VER_KEY,
1623         MAX_PROTOCOL_VERSION_ARRAY_KEY
1624 };
1625
1626
1627
1628 /*
1629  * RDMA TX Stats
1630  */
1631 struct rdma_sent_stats {
1632         struct regpair sent_bytes /* number of total RDMA bytes sent */;
1633         struct regpair sent_pkts /* number of total RDMA packets sent */;
1634 };
1635
1636 /*
1637  * Pstorm non-triggering VF zone
1638  */
1639 struct pstorm_non_trigger_vf_zone {
1640 /* VF statistic bucket */
1641         struct eth_pstorm_per_queue_stat eth_queue_stat;
1642         struct rdma_sent_stats rdma_stats /* RoCE sent statistics */;
1643 };
1644
1645
1646 /*
1647  * Pstorm VF zone
1648  */
1649 struct pstorm_vf_zone {
1650 /* non-interrupt-triggering zone */
1651         struct pstorm_non_trigger_vf_zone non_trigger;
1652         struct regpair reserved[7] /* vf_zone size mus be power of 2 */;
1653 };
1654
1655
1656 /*
1657  * Ramrod Header of SPQE
1658  */
1659 struct ramrod_header {
1660         __le32 cid /* Slowpath Connection CID */;
1661         u8 cmd_id /* Ramrod Cmd (Per Protocol Type) */;
1662         u8 protocol_id /* Ramrod Protocol ID */;
1663         __le16 echo /* Ramrod echo */;
1664 };
1665
1666
1667 /*
1668  * RDMA RX Stats
1669  */
1670 struct rdma_rcv_stats {
1671         struct regpair rcv_bytes /* number of total RDMA bytes received */;
1672         struct regpair rcv_pkts /* number of total RDMA packets received */;
1673 };
1674
1675
1676
1677 /*
1678  * Data for update QCN/DCQCN RL ramrod
1679  */
1680 struct rl_update_ramrod_data {
1681         u8 qcn_update_param_flg /* Update QCN global params: timeout. */;
1682 /* Update DCQCN global params: timeout, g, k. */
1683         u8 dcqcn_update_param_flg;
1684         u8 rl_init_flg /* Init RL parameters, when RL disabled. */;
1685         u8 rl_start_flg /* Start RL in IDLE state. Set rate to maximum. */;
1686         u8 rl_stop_flg /* Stop RL. */;
1687         u8 rl_id_first /* ID of first or single RL, that will be updated. */;
1688 /* ID of last RL, that will be updated. If clear, single RL will updated. */
1689         u8 rl_id_last;
1690         u8 rl_dc_qcn_flg /* If set, RL will used for DCQCN. */;
1691         __le32 rl_bc_rate /* Byte Counter Limit. */;
1692         __le16 rl_max_rate /* Maximum rate in 1.6 Mbps resolution. */;
1693         __le16 rl_r_ai /* Active increase rate. */;
1694         __le16 rl_r_hai /* Hyper active increase rate. */;
1695         __le16 dcqcn_g /* DCQCN Alpha update gain in 1/64K resolution . */;
1696         __le32 dcqcn_k_us /* DCQCN Alpha update interval. */;
1697         __le32 dcqcn_timeuot_us /* DCQCN timeout. */;
1698         __le32 qcn_timeuot_us /* QCN timeout. */;
1699         __le32 reserved[2];
1700 };
1701
1702
1703 /*
1704  * Slowpath Element (SPQE)
1705  */
1706 struct slow_path_element {
1707         struct ramrod_header hdr /* Ramrod Header */;
1708         struct regpair data_ptr /* Pointer to the Ramrod Data on the Host */;
1709 };
1710
1711
1712 /*
1713  * Tstorm non-triggering VF zone
1714  */
1715 struct tstorm_non_trigger_vf_zone {
1716         struct rdma_rcv_stats rdma_stats /* RoCE received statistics */;
1717 };
1718
1719
1720 struct tstorm_per_port_stat {
1721 /* packet is dropped because it was truncated in NIG */
1722         struct regpair trunc_error_discard;
1723 /* packet is dropped because of Ethernet FCS error */
1724         struct regpair mac_error_discard;
1725 /* packet is dropped because classification was unsuccessful */
1726         struct regpair mftag_filter_discard;
1727 /* packet was passed to Ethernet and dropped because of no mac filter match */
1728         struct regpair eth_mac_filter_discard;
1729 /* packet passed to Light L2 and dropped because Light L2 is not configured for
1730  * this PF
1731  */
1732         struct regpair ll2_mac_filter_discard;
1733 /* packet passed to Light L2 and dropped because Light L2 is not configured for
1734  * this PF
1735  */
1736         struct regpair ll2_conn_disabled_discard;
1737 /* packet is an ISCSI irregular packet */
1738         struct regpair iscsi_irregular_pkt;
1739 /* packet is an FCOE irregular packet */
1740         struct regpair fcoe_irregular_pkt;
1741 /* packet is an ROCE irregular packet */
1742         struct regpair roce_irregular_pkt;
1743 /* packet is an IWARP irregular packet */
1744         struct regpair iwarp_irregular_pkt;
1745 /* packet is an ETH irregular packet */
1746         struct regpair eth_irregular_pkt;
1747 /* packet is an TOE irregular packet */
1748         struct regpair toe_irregular_pkt;
1749 /* packet is an PREROCE irregular packet */
1750         struct regpair preroce_irregular_pkt;
1751         struct regpair eth_gre_tunn_filter_discard /* GRE dropped packets */;
1752 /* VXLAN dropped packets */
1753         struct regpair eth_vxlan_tunn_filter_discard;
1754 /* GENEVE dropped packets */
1755         struct regpair eth_geneve_tunn_filter_discard;
1756         struct regpair eth_gft_drop_pkt /* GFT dropped packets */;
1757 };
1758
1759
1760 /*
1761  * Tstorm VF zone
1762  */
1763 struct tstorm_vf_zone {
1764 /* non-interrupt-triggering zone */
1765         struct tstorm_non_trigger_vf_zone non_trigger;
1766 };
1767
1768
1769 /*
1770  * Tunnel classification scheme
1771  */
1772 enum tunnel_clss {
1773 /* Use MAC and VLAN from first L2 header for vport classification. */
1774         TUNNEL_CLSS_MAC_VLAN = 0,
1775 /* Use MAC from first L2 header and VNI from tunnel header for vport
1776  * classification
1777  */
1778         TUNNEL_CLSS_MAC_VNI,
1779 /* Use MAC and VLAN from last L2 header for vport classification */
1780         TUNNEL_CLSS_INNER_MAC_VLAN,
1781 /* Use MAC from last L2 header and VNI from tunnel header for vport
1782  * classification
1783  */
1784         TUNNEL_CLSS_INNER_MAC_VNI,
1785 /* Use MAC and VLAN from last L2 header for vport classification. If no exact
1786  * match, use MAC and VLAN from first L2 header for classification.
1787  */
1788         TUNNEL_CLSS_MAC_VLAN_DUAL_STAGE,
1789         MAX_TUNNEL_CLSS
1790 };
1791
1792
1793
1794 /*
1795  * Ustorm non-triggering VF zone
1796  */
1797 struct ustorm_non_trigger_vf_zone {
1798 /* VF statistic bucket */
1799         struct eth_ustorm_per_queue_stat eth_queue_stat;
1800         struct regpair vf_pf_msg_addr /* VF-PF message address */;
1801 };
1802
1803
1804 /*
1805  * Ustorm triggering VF zone
1806  */
1807 struct ustorm_trigger_vf_zone {
1808         u8 vf_pf_msg_valid /* VF-PF message valid flag */;
1809         u8 reserved[7];
1810 };
1811
1812
1813 /*
1814  * Ustorm VF zone
1815  */
1816 struct ustorm_vf_zone {
1817 /* non-interrupt-triggering zone */
1818         struct ustorm_non_trigger_vf_zone non_trigger;
1819         struct ustorm_trigger_vf_zone trigger /* interrupt triggering zone */;
1820 };
1821
1822
1823 /*
1824  * VF-PF channel data
1825  */
1826 struct vf_pf_channel_data {
1827 /* 0: VF-PF Channel NOT ready. Waiting for ack from PF driver. 1: VF-PF Channel
1828  * is ready for a new transaction.
1829  */
1830         __le32 ready;
1831 /* 0: VF-PF Channel is invalid because of malicious VF. 1: VF-PF Channel is
1832  * valid.
1833  */
1834         u8 valid;
1835         u8 reserved0;
1836         __le16 reserved1;
1837 };
1838
1839
1840 /*
1841  * Ramrod data for VF start ramrod
1842  */
1843 struct vf_start_ramrod_data {
1844         u8 vf_id /* VF ID */;
1845 /* If set, initial cleanup ack will be sent to parent PF SP event queue */
1846         u8 enable_flr_ack;
1847         __le16 opaque_fid /* VF opaque FID */;
1848         u8 personality /* define what type of personality is new VF */;
1849         u8 reserved[7];
1850 /* FP HSI version to be used by FW */
1851         struct hsi_fp_ver_struct hsi_fp_ver;
1852 };
1853
1854
1855 /*
1856  * Ramrod data for VF start ramrod
1857  */
1858 struct vf_stop_ramrod_data {
1859         u8 vf_id /* VF ID */;
1860         u8 reserved0;
1861         __le16 reserved1;
1862         __le32 reserved2;
1863 };
1864
1865
1866 /*
1867  * VF zone size mode.
1868  */
1869 enum vf_zone_size_mode {
1870 /* Default VF zone size. Up to 192 VF supported. */
1871         VF_ZONE_SIZE_MODE_DEFAULT,
1872 /* Doubled VF zone size. Up to 96 VF supported. */
1873         VF_ZONE_SIZE_MODE_DOUBLE,
1874 /* Quad VF zone size. Up to 48 VF supported. */
1875         VF_ZONE_SIZE_MODE_QUAD,
1876         MAX_VF_ZONE_SIZE_MODE
1877 };
1878
1879
1880
1881
1882
1883 /*
1884  * Attentions status block
1885  */
1886 struct atten_status_block {
1887         __le32 atten_bits;
1888         __le32 atten_ack;
1889         __le16 reserved0;
1890         __le16 sb_index /* status block running index */;
1891         __le32 reserved1;
1892 };
1893
1894
1895 /*
1896  * DMAE command
1897  */
1898 struct dmae_cmd {
1899         __le32 opcode;
1900 /* DMA Source. 0 - PCIe, 1 - GRC (use enum dmae_cmd_src_enum) */
1901 #define DMAE_CMD_SRC_MASK              0x1
1902 #define DMAE_CMD_SRC_SHIFT             0
1903 /* DMA destination. 0 - None, 1 - PCIe, 2 - GRC, 3 - None
1904  * (use enum dmae_cmd_dst_enum)
1905  */
1906 #define DMAE_CMD_DST_MASK              0x3
1907 #define DMAE_CMD_DST_SHIFT             1
1908 /* Completion destination. 0 - PCie, 1 - GRC (use enum dmae_cmd_c_dst_enum) */
1909 #define DMAE_CMD_C_DST_MASK            0x1
1910 #define DMAE_CMD_C_DST_SHIFT           3
1911 /* Reset the CRC result (do not use the previous result as the seed) */
1912 #define DMAE_CMD_CRC_RESET_MASK        0x1
1913 #define DMAE_CMD_CRC_RESET_SHIFT       4
1914 /* Reset the source address in the next go to the same source address of the
1915  * previous go
1916  */
1917 #define DMAE_CMD_SRC_ADDR_RESET_MASK   0x1
1918 #define DMAE_CMD_SRC_ADDR_RESET_SHIFT  5
1919 /* Reset the destination address in the next go to the same destination address
1920  * of the previous go
1921  */
1922 #define DMAE_CMD_DST_ADDR_RESET_MASK   0x1
1923 #define DMAE_CMD_DST_ADDR_RESET_SHIFT  6
1924 /* 0   completion function is the same as src function, 1 - 0 completion
1925  * function is the same as dst function (use enum dmae_cmd_comp_func_enum)
1926  */
1927 #define DMAE_CMD_COMP_FUNC_MASK        0x1
1928 #define DMAE_CMD_COMP_FUNC_SHIFT       7
1929 /* 0 - Do not write a completion word, 1 - Write a completion word
1930  * (use enum dmae_cmd_comp_word_en_enum)
1931  */
1932 #define DMAE_CMD_COMP_WORD_EN_MASK     0x1
1933 #define DMAE_CMD_COMP_WORD_EN_SHIFT    8
1934 /* 0 - Do not write a CRC word, 1 - Write a CRC word
1935  * (use enum dmae_cmd_comp_crc_en_enum)
1936  */
1937 #define DMAE_CMD_COMP_CRC_EN_MASK      0x1
1938 #define DMAE_CMD_COMP_CRC_EN_SHIFT     9
1939 /* The CRC word should be taken from the DMAE address space from address 9+X,
1940  * where X is the value in these bits.
1941  */
1942 #define DMAE_CMD_COMP_CRC_OFFSET_MASK  0x7
1943 #define DMAE_CMD_COMP_CRC_OFFSET_SHIFT 10
1944 #define DMAE_CMD_RESERVED1_MASK        0x1
1945 #define DMAE_CMD_RESERVED1_SHIFT       13
1946 #define DMAE_CMD_ENDIANITY_MODE_MASK   0x3
1947 #define DMAE_CMD_ENDIANITY_MODE_SHIFT  14
1948 /* The field specifies how the completion word is affected by PCIe read error. 0
1949  * Send a regular completion, 1 - Send a completion with an error indication,
1950  * 2 do not send a completion (use enum dmae_cmd_error_handling_enum)
1951  */
1952 #define DMAE_CMD_ERR_HANDLING_MASK     0x3
1953 #define DMAE_CMD_ERR_HANDLING_SHIFT    16
1954 /* The port ID to be placed on the  RF FID  field of the GRC bus. this field is
1955  * used both when GRC is the destination and when it is the source of the DMAE
1956  * transaction.
1957  */
1958 #define DMAE_CMD_PORT_ID_MASK          0x3
1959 #define DMAE_CMD_PORT_ID_SHIFT         18
1960 /* Source PCI function number [3:0] */
1961 #define DMAE_CMD_SRC_PF_ID_MASK        0xF
1962 #define DMAE_CMD_SRC_PF_ID_SHIFT       20
1963 /* Destination PCI function number [3:0] */
1964 #define DMAE_CMD_DST_PF_ID_MASK        0xF
1965 #define DMAE_CMD_DST_PF_ID_SHIFT       24
1966 #define DMAE_CMD_SRC_VF_ID_VALID_MASK  0x1 /* Source VFID valid */
1967 #define DMAE_CMD_SRC_VF_ID_VALID_SHIFT 28
1968 #define DMAE_CMD_DST_VF_ID_VALID_MASK  0x1 /* Destination VFID valid */
1969 #define DMAE_CMD_DST_VF_ID_VALID_SHIFT 29
1970 #define DMAE_CMD_RESERVED2_MASK        0x3
1971 #define DMAE_CMD_RESERVED2_SHIFT       30
1972 /* PCIe source address low in bytes or GRC source address in DW */
1973         __le32 src_addr_lo;
1974 /* PCIe source address high in bytes or reserved (if source is GRC) */
1975         __le32 src_addr_hi;
1976 /* PCIe destination address low in bytes or GRC destination address in DW */
1977         __le32 dst_addr_lo;
1978 /* PCIe destination address high in bytes or reserved (if destination is GRC) */
1979         __le32 dst_addr_hi;
1980         __le16 length_dw /* Length in DW */;
1981         __le16 opcode_b;
1982 #define DMAE_CMD_SRC_VF_ID_MASK        0xFF /* Source VF id */
1983 #define DMAE_CMD_SRC_VF_ID_SHIFT       0
1984 #define DMAE_CMD_DST_VF_ID_MASK        0xFF /* Destination VF id */
1985 #define DMAE_CMD_DST_VF_ID_SHIFT       8
1986 /* PCIe completion address low in bytes or GRC completion address in DW */
1987         __le32 comp_addr_lo;
1988 /* PCIe completion address high in bytes or reserved (if completion address is
1989  * GRC)
1990  */
1991         __le32 comp_addr_hi;
1992         __le32 comp_val /* Value to write to completion address */;
1993         __le32 crc32 /* crc16 result */;
1994         __le32 crc_32_c /* crc32_c result */;
1995         __le16 crc16 /* crc16 result */;
1996         __le16 crc16_c /* crc16_c result */;
1997         __le16 crc10 /* crc_t10 result */;
1998         __le16 reserved;
1999         __le16 xsum16 /* checksum16 result  */;
2000         __le16 xsum8 /* checksum8 result  */;
2001 };
2002
2003
2004 enum dmae_cmd_comp_crc_en_enum {
2005         dmae_cmd_comp_crc_disabled /* Do not write a CRC word */,
2006         dmae_cmd_comp_crc_enabled /* Write a CRC word */,
2007         MAX_DMAE_CMD_COMP_CRC_EN_ENUM
2008 };
2009
2010
2011 enum dmae_cmd_comp_func_enum {
2012 /* completion word and/or CRC will be sent to SRC-PCI function/SRC VFID */
2013         dmae_cmd_comp_func_to_src,
2014 /* completion word and/or CRC will be sent to DST-PCI function/DST VFID */
2015         dmae_cmd_comp_func_to_dst,
2016         MAX_DMAE_CMD_COMP_FUNC_ENUM
2017 };
2018
2019
2020 enum dmae_cmd_comp_word_en_enum {
2021         dmae_cmd_comp_word_disabled /* Do not write a completion word */,
2022         dmae_cmd_comp_word_enabled /* Write the completion word */,
2023         MAX_DMAE_CMD_COMP_WORD_EN_ENUM
2024 };
2025
2026
2027 enum dmae_cmd_c_dst_enum {
2028         dmae_cmd_c_dst_pcie,
2029         dmae_cmd_c_dst_grc,
2030         MAX_DMAE_CMD_C_DST_ENUM
2031 };
2032
2033
2034 enum dmae_cmd_dst_enum {
2035         dmae_cmd_dst_none_0,
2036         dmae_cmd_dst_pcie,
2037         dmae_cmd_dst_grc,
2038         dmae_cmd_dst_none_3,
2039         MAX_DMAE_CMD_DST_ENUM
2040 };
2041
2042
2043 enum dmae_cmd_error_handling_enum {
2044 /* Send a regular completion (with no error indication) */
2045         dmae_cmd_error_handling_send_regular_comp,
2046 /* Send a completion with an error indication (i.e. set bit 31 of the completion
2047  * word)
2048  */
2049         dmae_cmd_error_handling_send_comp_with_err,
2050         dmae_cmd_error_handling_dont_send_comp /* Do not send a completion */,
2051         MAX_DMAE_CMD_ERROR_HANDLING_ENUM
2052 };
2053
2054
2055 enum dmae_cmd_src_enum {
2056         dmae_cmd_src_pcie /* The source is the PCIe */,
2057         dmae_cmd_src_grc /* The source is the GRC */,
2058         MAX_DMAE_CMD_SRC_ENUM
2059 };
2060
2061
2062 struct e4_mstorm_core_conn_ag_ctx {
2063         u8 byte0 /* cdu_validation */;
2064         u8 byte1 /* state */;
2065         u8 flags0;
2066 #define E4_MSTORM_CORE_CONN_AG_CTX_BIT0_MASK     0x1 /* exist_in_qm0 */
2067 #define E4_MSTORM_CORE_CONN_AG_CTX_BIT0_SHIFT    0
2068 #define E4_MSTORM_CORE_CONN_AG_CTX_BIT1_MASK     0x1 /* exist_in_qm1 */
2069 #define E4_MSTORM_CORE_CONN_AG_CTX_BIT1_SHIFT    1
2070 #define E4_MSTORM_CORE_CONN_AG_CTX_CF0_MASK      0x3 /* cf0 */
2071 #define E4_MSTORM_CORE_CONN_AG_CTX_CF0_SHIFT     2
2072 #define E4_MSTORM_CORE_CONN_AG_CTX_CF1_MASK      0x3 /* cf1 */
2073 #define E4_MSTORM_CORE_CONN_AG_CTX_CF1_SHIFT     4
2074 #define E4_MSTORM_CORE_CONN_AG_CTX_CF2_MASK      0x3 /* cf2 */
2075 #define E4_MSTORM_CORE_CONN_AG_CTX_CF2_SHIFT     6
2076         u8 flags1;
2077 #define E4_MSTORM_CORE_CONN_AG_CTX_CF0EN_MASK    0x1 /* cf0en */
2078 #define E4_MSTORM_CORE_CONN_AG_CTX_CF0EN_SHIFT   0
2079 #define E4_MSTORM_CORE_CONN_AG_CTX_CF1EN_MASK    0x1 /* cf1en */
2080 #define E4_MSTORM_CORE_CONN_AG_CTX_CF1EN_SHIFT   1
2081 #define E4_MSTORM_CORE_CONN_AG_CTX_CF2EN_MASK    0x1 /* cf2en */
2082 #define E4_MSTORM_CORE_CONN_AG_CTX_CF2EN_SHIFT   2
2083 #define E4_MSTORM_CORE_CONN_AG_CTX_RULE0EN_MASK  0x1 /* rule0en */
2084 #define E4_MSTORM_CORE_CONN_AG_CTX_RULE0EN_SHIFT 3
2085 #define E4_MSTORM_CORE_CONN_AG_CTX_RULE1EN_MASK  0x1 /* rule1en */
2086 #define E4_MSTORM_CORE_CONN_AG_CTX_RULE1EN_SHIFT 4
2087 #define E4_MSTORM_CORE_CONN_AG_CTX_RULE2EN_MASK  0x1 /* rule2en */
2088 #define E4_MSTORM_CORE_CONN_AG_CTX_RULE2EN_SHIFT 5
2089 #define E4_MSTORM_CORE_CONN_AG_CTX_RULE3EN_MASK  0x1 /* rule3en */
2090 #define E4_MSTORM_CORE_CONN_AG_CTX_RULE3EN_SHIFT 6
2091 #define E4_MSTORM_CORE_CONN_AG_CTX_RULE4EN_MASK  0x1 /* rule4en */
2092 #define E4_MSTORM_CORE_CONN_AG_CTX_RULE4EN_SHIFT 7
2093         __le16 word0 /* word0 */;
2094         __le16 word1 /* word1 */;
2095         __le32 reg0 /* reg0 */;
2096         __le32 reg1 /* reg1 */;
2097 };
2098
2099
2100
2101
2102
2103 struct e4_ystorm_core_conn_ag_ctx {
2104         u8 byte0 /* cdu_validation */;
2105         u8 byte1 /* state */;
2106         u8 flags0;
2107 #define E4_YSTORM_CORE_CONN_AG_CTX_BIT0_MASK     0x1 /* exist_in_qm0 */
2108 #define E4_YSTORM_CORE_CONN_AG_CTX_BIT0_SHIFT    0
2109 #define E4_YSTORM_CORE_CONN_AG_CTX_BIT1_MASK     0x1 /* exist_in_qm1 */
2110 #define E4_YSTORM_CORE_CONN_AG_CTX_BIT1_SHIFT    1
2111 #define E4_YSTORM_CORE_CONN_AG_CTX_CF0_MASK      0x3 /* cf0 */
2112 #define E4_YSTORM_CORE_CONN_AG_CTX_CF0_SHIFT     2
2113 #define E4_YSTORM_CORE_CONN_AG_CTX_CF1_MASK      0x3 /* cf1 */
2114 #define E4_YSTORM_CORE_CONN_AG_CTX_CF1_SHIFT     4
2115 #define E4_YSTORM_CORE_CONN_AG_CTX_CF2_MASK      0x3 /* cf2 */
2116 #define E4_YSTORM_CORE_CONN_AG_CTX_CF2_SHIFT     6
2117         u8 flags1;
2118 #define E4_YSTORM_CORE_CONN_AG_CTX_CF0EN_MASK    0x1 /* cf0en */
2119 #define E4_YSTORM_CORE_CONN_AG_CTX_CF0EN_SHIFT   0
2120 #define E4_YSTORM_CORE_CONN_AG_CTX_CF1EN_MASK    0x1 /* cf1en */
2121 #define E4_YSTORM_CORE_CONN_AG_CTX_CF1EN_SHIFT   1
2122 #define E4_YSTORM_CORE_CONN_AG_CTX_CF2EN_MASK    0x1 /* cf2en */
2123 #define E4_YSTORM_CORE_CONN_AG_CTX_CF2EN_SHIFT   2
2124 #define E4_YSTORM_CORE_CONN_AG_CTX_RULE0EN_MASK  0x1 /* rule0en */
2125 #define E4_YSTORM_CORE_CONN_AG_CTX_RULE0EN_SHIFT 3
2126 #define E4_YSTORM_CORE_CONN_AG_CTX_RULE1EN_MASK  0x1 /* rule1en */
2127 #define E4_YSTORM_CORE_CONN_AG_CTX_RULE1EN_SHIFT 4
2128 #define E4_YSTORM_CORE_CONN_AG_CTX_RULE2EN_MASK  0x1 /* rule2en */
2129 #define E4_YSTORM_CORE_CONN_AG_CTX_RULE2EN_SHIFT 5
2130 #define E4_YSTORM_CORE_CONN_AG_CTX_RULE3EN_MASK  0x1 /* rule3en */
2131 #define E4_YSTORM_CORE_CONN_AG_CTX_RULE3EN_SHIFT 6
2132 #define E4_YSTORM_CORE_CONN_AG_CTX_RULE4EN_MASK  0x1 /* rule4en */
2133 #define E4_YSTORM_CORE_CONN_AG_CTX_RULE4EN_SHIFT 7
2134         u8 byte2 /* byte2 */;
2135         u8 byte3 /* byte3 */;
2136         __le16 word0 /* word0 */;
2137         __le32 reg0 /* reg0 */;
2138         __le32 reg1 /* reg1 */;
2139         __le16 word1 /* word1 */;
2140         __le16 word2 /* word2 */;
2141         __le16 word3 /* word3 */;
2142         __le16 word4 /* word4 */;
2143         __le32 reg2 /* reg2 */;
2144         __le32 reg3 /* reg3 */;
2145 };
2146
2147
2148 struct fw_asserts_ram_section {
2149 /* The offset of the section in the RAM in RAM lines (64-bit units) */
2150         __le16 section_ram_line_offset;
2151 /* The size of the section in RAM lines (64-bit units) */
2152         __le16 section_ram_line_size;
2153 /* The offset of the asserts list within the section in dwords */
2154         u8 list_dword_offset;
2155 /* The size of an assert list element in dwords */
2156         u8 list_element_dword_size;
2157         u8 list_num_elements /* The number of elements in the asserts list */;
2158 /* The offset of the next list index field within the section in dwords */
2159         u8 list_next_index_dword_offset;
2160 };
2161
2162
2163 struct fw_ver_num {
2164         u8 major /* Firmware major version number */;
2165         u8 minor /* Firmware minor version number */;
2166         u8 rev /* Firmware revision version number */;
2167         u8 eng /* Firmware engineering version number (for bootleg versions) */;
2168 };
2169
2170 struct fw_ver_info {
2171         __le16 tools_ver /* Tools version number */;
2172         u8 image_id /* FW image ID (e.g. main, l2b, kuku) */;
2173         u8 reserved1;
2174         struct fw_ver_num num /* FW version number */;
2175         __le32 timestamp /* FW Timestamp in unix time  (sec. since 1970) */;
2176         __le32 reserved2;
2177 };
2178
2179 struct fw_info {
2180         struct fw_ver_info ver /* FW version information */;
2181 /* Info regarding the FW asserts section in the Storm RAM */
2182         struct fw_asserts_ram_section fw_asserts_section;
2183 };
2184
2185
2186 struct fw_info_location {
2187         __le32 grc_addr /* GRC address where the fw_info struct is located. */;
2188 /* Size of the fw_info structure (thats located at the grc_addr). */
2189         __le32 size;
2190 };
2191
2192
2193
2194
2195 /*
2196  * IGU cleanup command
2197  */
2198 struct igu_cleanup {
2199         __le32 sb_id_and_flags;
2200 #define IGU_CLEANUP_RESERVED0_MASK     0x7FFFFFF
2201 #define IGU_CLEANUP_RESERVED0_SHIFT    0
2202 /* cleanup clear - 0, set - 1 */
2203 #define IGU_CLEANUP_CLEANUP_SET_MASK   0x1
2204 #define IGU_CLEANUP_CLEANUP_SET_SHIFT  27
2205 #define IGU_CLEANUP_CLEANUP_TYPE_MASK  0x7
2206 #define IGU_CLEANUP_CLEANUP_TYPE_SHIFT 28
2207 /* must always be set (use enum command_type_bit) */
2208 #define IGU_CLEANUP_COMMAND_TYPE_MASK  0x1
2209 #define IGU_CLEANUP_COMMAND_TYPE_SHIFT 31
2210         __le32 reserved1;
2211 };
2212
2213
2214 /*
2215  * IGU firmware driver command
2216  */
2217 union igu_command {
2218         struct igu_prod_cons_update prod_cons_update;
2219         struct igu_cleanup cleanup;
2220 };
2221
2222
2223 /*
2224  * IGU firmware driver command
2225  */
2226 struct igu_command_reg_ctrl {
2227         __le16 opaque_fid;
2228         __le16 igu_command_reg_ctrl_fields;
2229 #define IGU_COMMAND_REG_CTRL_PXP_BAR_ADDR_MASK  0xFFF
2230 #define IGU_COMMAND_REG_CTRL_PXP_BAR_ADDR_SHIFT 0
2231 #define IGU_COMMAND_REG_CTRL_RESERVED_MASK      0x7
2232 #define IGU_COMMAND_REG_CTRL_RESERVED_SHIFT     12
2233 /* command typ: 0 - read, 1 - write */
2234 #define IGU_COMMAND_REG_CTRL_COMMAND_TYPE_MASK  0x1
2235 #define IGU_COMMAND_REG_CTRL_COMMAND_TYPE_SHIFT 15
2236 };
2237
2238
2239 /*
2240  * IGU mapping line structure
2241  */
2242 struct igu_mapping_line {
2243         __le32 igu_mapping_line_fields;
2244 #define IGU_MAPPING_LINE_VALID_MASK            0x1
2245 #define IGU_MAPPING_LINE_VALID_SHIFT           0
2246 #define IGU_MAPPING_LINE_VECTOR_NUMBER_MASK    0xFF
2247 #define IGU_MAPPING_LINE_VECTOR_NUMBER_SHIFT   1
2248 /* In BB: VF-0-120, PF-0-7; In K2: VF-0-191, PF-0-15 */
2249 #define IGU_MAPPING_LINE_FUNCTION_NUMBER_MASK  0xFF
2250 #define IGU_MAPPING_LINE_FUNCTION_NUMBER_SHIFT 9
2251 #define IGU_MAPPING_LINE_PF_VALID_MASK         0x1 /* PF-1, VF-0 */
2252 #define IGU_MAPPING_LINE_PF_VALID_SHIFT        17
2253 #define IGU_MAPPING_LINE_IPS_GROUP_MASK        0x3F
2254 #define IGU_MAPPING_LINE_IPS_GROUP_SHIFT       18
2255 #define IGU_MAPPING_LINE_RESERVED_MASK         0xFF
2256 #define IGU_MAPPING_LINE_RESERVED_SHIFT        24
2257 };
2258
2259
2260 /*
2261  * IGU MSIX line structure
2262  */
2263 struct igu_msix_vector {
2264         struct regpair address;
2265         __le32 data;
2266         __le32 msix_vector_fields;
2267 #define IGU_MSIX_VECTOR_MASK_BIT_MASK      0x1
2268 #define IGU_MSIX_VECTOR_MASK_BIT_SHIFT     0
2269 #define IGU_MSIX_VECTOR_RESERVED0_MASK     0x7FFF
2270 #define IGU_MSIX_VECTOR_RESERVED0_SHIFT    1
2271 #define IGU_MSIX_VECTOR_STEERING_TAG_MASK  0xFF
2272 #define IGU_MSIX_VECTOR_STEERING_TAG_SHIFT 16
2273 #define IGU_MSIX_VECTOR_RESERVED1_MASK     0xFF
2274 #define IGU_MSIX_VECTOR_RESERVED1_SHIFT    24
2275 };
2276
2277
2278 /*
2279  * per encapsulation type enabling flags
2280  */
2281 struct prs_reg_encapsulation_type_en {
2282         u8 flags;
2283 /* Enable bit for Ethernet-over-GRE (L2 GRE) encapsulation. */
2284 #define PRS_REG_ENCAPSULATION_TYPE_EN_ETH_OVER_GRE_ENABLE_MASK     0x1
2285 #define PRS_REG_ENCAPSULATION_TYPE_EN_ETH_OVER_GRE_ENABLE_SHIFT    0
2286 /* Enable bit for IP-over-GRE (IP GRE) encapsulation. */
2287 #define PRS_REG_ENCAPSULATION_TYPE_EN_IP_OVER_GRE_ENABLE_MASK      0x1
2288 #define PRS_REG_ENCAPSULATION_TYPE_EN_IP_OVER_GRE_ENABLE_SHIFT     1
2289 /* Enable bit for VXLAN encapsulation. */
2290 #define PRS_REG_ENCAPSULATION_TYPE_EN_VXLAN_ENABLE_MASK            0x1
2291 #define PRS_REG_ENCAPSULATION_TYPE_EN_VXLAN_ENABLE_SHIFT           2
2292 /* Enable bit for T-Tag encapsulation. */
2293 #define PRS_REG_ENCAPSULATION_TYPE_EN_T_TAG_ENABLE_MASK            0x1
2294 #define PRS_REG_ENCAPSULATION_TYPE_EN_T_TAG_ENABLE_SHIFT           3
2295 /* Enable bit for Ethernet-over-GENEVE (L2 GENEVE) encapsulation. */
2296 #define PRS_REG_ENCAPSULATION_TYPE_EN_ETH_OVER_GENEVE_ENABLE_MASK  0x1
2297 #define PRS_REG_ENCAPSULATION_TYPE_EN_ETH_OVER_GENEVE_ENABLE_SHIFT 4
2298 /* Enable bit for IP-over-GENEVE (IP GENEVE) encapsulation. */
2299 #define PRS_REG_ENCAPSULATION_TYPE_EN_IP_OVER_GENEVE_ENABLE_MASK   0x1
2300 #define PRS_REG_ENCAPSULATION_TYPE_EN_IP_OVER_GENEVE_ENABLE_SHIFT  5
2301 #define PRS_REG_ENCAPSULATION_TYPE_EN_RESERVED_MASK                0x3
2302 #define PRS_REG_ENCAPSULATION_TYPE_EN_RESERVED_SHIFT               6
2303 };
2304
2305
2306 enum pxp_tph_st_hint {
2307         TPH_ST_HINT_BIDIR /* Read/Write access by Host and Device */,
2308         TPH_ST_HINT_REQUESTER /* Read/Write access by Device */,
2309 /* Device Write and Host Read, or Host Write and Device Read */
2310         TPH_ST_HINT_TARGET,
2311 /* Device Write and Host Read, or Host Write and Device Read - with temporal
2312  * reuse
2313  */
2314         TPH_ST_HINT_TARGET_PRIO,
2315         MAX_PXP_TPH_ST_HINT
2316 };
2317
2318
2319 /*
2320  * QM hardware structure of enable bypass credit mask
2321  */
2322 struct qm_rf_bypass_mask {
2323         u8 flags;
2324 #define QM_RF_BYPASS_MASK_LINEVOQ_MASK    0x1
2325 #define QM_RF_BYPASS_MASK_LINEVOQ_SHIFT   0
2326 #define QM_RF_BYPASS_MASK_RESERVED0_MASK  0x1
2327 #define QM_RF_BYPASS_MASK_RESERVED0_SHIFT 1
2328 #define QM_RF_BYPASS_MASK_PFWFQ_MASK      0x1
2329 #define QM_RF_BYPASS_MASK_PFWFQ_SHIFT     2
2330 #define QM_RF_BYPASS_MASK_VPWFQ_MASK      0x1
2331 #define QM_RF_BYPASS_MASK_VPWFQ_SHIFT     3
2332 #define QM_RF_BYPASS_MASK_PFRL_MASK       0x1
2333 #define QM_RF_BYPASS_MASK_PFRL_SHIFT      4
2334 #define QM_RF_BYPASS_MASK_VPQCNRL_MASK    0x1
2335 #define QM_RF_BYPASS_MASK_VPQCNRL_SHIFT   5
2336 #define QM_RF_BYPASS_MASK_FWPAUSE_MASK    0x1
2337 #define QM_RF_BYPASS_MASK_FWPAUSE_SHIFT   6
2338 #define QM_RF_BYPASS_MASK_RESERVED1_MASK  0x1
2339 #define QM_RF_BYPASS_MASK_RESERVED1_SHIFT 7
2340 };
2341
2342
2343 /*
2344  * QM hardware structure of opportunistic credit mask
2345  */
2346 struct qm_rf_opportunistic_mask {
2347         __le16 flags;
2348 #define QM_RF_OPPORTUNISTIC_MASK_LINEVOQ_MASK     0x1
2349 #define QM_RF_OPPORTUNISTIC_MASK_LINEVOQ_SHIFT    0
2350 #define QM_RF_OPPORTUNISTIC_MASK_BYTEVOQ_MASK     0x1
2351 #define QM_RF_OPPORTUNISTIC_MASK_BYTEVOQ_SHIFT    1
2352 #define QM_RF_OPPORTUNISTIC_MASK_PFWFQ_MASK       0x1
2353 #define QM_RF_OPPORTUNISTIC_MASK_PFWFQ_SHIFT      2
2354 #define QM_RF_OPPORTUNISTIC_MASK_VPWFQ_MASK       0x1
2355 #define QM_RF_OPPORTUNISTIC_MASK_VPWFQ_SHIFT      3
2356 #define QM_RF_OPPORTUNISTIC_MASK_PFRL_MASK        0x1
2357 #define QM_RF_OPPORTUNISTIC_MASK_PFRL_SHIFT       4
2358 #define QM_RF_OPPORTUNISTIC_MASK_VPQCNRL_MASK     0x1
2359 #define QM_RF_OPPORTUNISTIC_MASK_VPQCNRL_SHIFT    5
2360 #define QM_RF_OPPORTUNISTIC_MASK_FWPAUSE_MASK     0x1
2361 #define QM_RF_OPPORTUNISTIC_MASK_FWPAUSE_SHIFT    6
2362 #define QM_RF_OPPORTUNISTIC_MASK_RESERVED0_MASK   0x1
2363 #define QM_RF_OPPORTUNISTIC_MASK_RESERVED0_SHIFT  7
2364 #define QM_RF_OPPORTUNISTIC_MASK_QUEUEEMPTY_MASK  0x1
2365 #define QM_RF_OPPORTUNISTIC_MASK_QUEUEEMPTY_SHIFT 8
2366 #define QM_RF_OPPORTUNISTIC_MASK_RESERVED1_MASK   0x7F
2367 #define QM_RF_OPPORTUNISTIC_MASK_RESERVED1_SHIFT  9
2368 };
2369
2370
2371 /*
2372  * QM hardware structure of QM map memory
2373  */
2374 struct qm_rf_pq_map_e4 {
2375         __le32 reg;
2376 #define QM_RF_PQ_MAP_E4_PQ_VALID_MASK          0x1 /* PQ active */
2377 #define QM_RF_PQ_MAP_E4_PQ_VALID_SHIFT         0
2378 #define QM_RF_PQ_MAP_E4_RL_ID_MASK             0xFF /* RL ID */
2379 #define QM_RF_PQ_MAP_E4_RL_ID_SHIFT            1
2380 /* the first PQ associated with the VPORT and VOQ of this PQ */
2381 #define QM_RF_PQ_MAP_E4_VP_PQ_ID_MASK          0x1FF
2382 #define QM_RF_PQ_MAP_E4_VP_PQ_ID_SHIFT         9
2383 #define QM_RF_PQ_MAP_E4_VOQ_MASK               0x1F /* VOQ */
2384 #define QM_RF_PQ_MAP_E4_VOQ_SHIFT              18
2385 #define QM_RF_PQ_MAP_E4_WRR_WEIGHT_GROUP_MASK  0x3 /* WRR weight */
2386 #define QM_RF_PQ_MAP_E4_WRR_WEIGHT_GROUP_SHIFT 23
2387 #define QM_RF_PQ_MAP_E4_RL_VALID_MASK          0x1 /* RL active */
2388 #define QM_RF_PQ_MAP_E4_RL_VALID_SHIFT         25
2389 #define QM_RF_PQ_MAP_E4_RESERVED_MASK          0x3F
2390 #define QM_RF_PQ_MAP_E4_RESERVED_SHIFT         26
2391 };
2392
2393
2394 /*
2395  * Completion params for aggregated interrupt completion
2396  */
2397 struct sdm_agg_int_comp_params {
2398         __le16 params;
2399 /* the number of aggregated interrupt, 0-31 */
2400 #define SDM_AGG_INT_COMP_PARAMS_AGG_INT_INDEX_MASK      0x3F
2401 #define SDM_AGG_INT_COMP_PARAMS_AGG_INT_INDEX_SHIFT     0
2402 /* 1 - set a bit in aggregated vector, 0 - dont set */
2403 #define SDM_AGG_INT_COMP_PARAMS_AGG_VECTOR_ENABLE_MASK  0x1
2404 #define SDM_AGG_INT_COMP_PARAMS_AGG_VECTOR_ENABLE_SHIFT 6
2405 /* Number of bit in the aggregated vector, 0-279 (TBD) */
2406 #define SDM_AGG_INT_COMP_PARAMS_AGG_VECTOR_BIT_MASK     0x1FF
2407 #define SDM_AGG_INT_COMP_PARAMS_AGG_VECTOR_BIT_SHIFT    7
2408 };
2409
2410
2411 /*
2412  * SDM operation gen command (generate aggregative interrupt)
2413  */
2414 struct sdm_op_gen {
2415         __le32 command;
2416 /* completion parameters 0-15 */
2417 #define SDM_OP_GEN_COMP_PARAM_MASK  0xFFFF
2418 #define SDM_OP_GEN_COMP_PARAM_SHIFT 0
2419 #define SDM_OP_GEN_COMP_TYPE_MASK   0xF /* completion type 16-19 */
2420 #define SDM_OP_GEN_COMP_TYPE_SHIFT  16
2421 #define SDM_OP_GEN_RESERVED_MASK    0xFFF /* reserved 20-31 */
2422 #define SDM_OP_GEN_RESERVED_SHIFT   20
2423 };
2424
2425 struct ystorm_core_conn_ag_ctx {
2426         u8 byte0 /* cdu_validation */;
2427         u8 byte1 /* state */;
2428         u8 flags0;
2429 #define YSTORM_CORE_CONN_AG_CTX_BIT0_MASK     0x1 /* exist_in_qm0 */
2430 #define YSTORM_CORE_CONN_AG_CTX_BIT0_SHIFT    0
2431 #define YSTORM_CORE_CONN_AG_CTX_BIT1_MASK     0x1 /* exist_in_qm1 */
2432 #define YSTORM_CORE_CONN_AG_CTX_BIT1_SHIFT    1
2433 #define YSTORM_CORE_CONN_AG_CTX_CF0_MASK      0x3 /* cf0 */
2434 #define YSTORM_CORE_CONN_AG_CTX_CF0_SHIFT     2
2435 #define YSTORM_CORE_CONN_AG_CTX_CF1_MASK      0x3 /* cf1 */
2436 #define YSTORM_CORE_CONN_AG_CTX_CF1_SHIFT     4
2437 #define YSTORM_CORE_CONN_AG_CTX_CF2_MASK      0x3 /* cf2 */
2438 #define YSTORM_CORE_CONN_AG_CTX_CF2_SHIFT     6
2439         u8 flags1;
2440 #define YSTORM_CORE_CONN_AG_CTX_CF0EN_MASK    0x1 /* cf0en */
2441 #define YSTORM_CORE_CONN_AG_CTX_CF0EN_SHIFT   0
2442 #define YSTORM_CORE_CONN_AG_CTX_CF1EN_MASK    0x1 /* cf1en */
2443 #define YSTORM_CORE_CONN_AG_CTX_CF1EN_SHIFT   1
2444 #define YSTORM_CORE_CONN_AG_CTX_CF2EN_MASK    0x1 /* cf2en */
2445 #define YSTORM_CORE_CONN_AG_CTX_CF2EN_SHIFT   2
2446 #define YSTORM_CORE_CONN_AG_CTX_RULE0EN_MASK  0x1 /* rule0en */
2447 #define YSTORM_CORE_CONN_AG_CTX_RULE0EN_SHIFT 3
2448 #define YSTORM_CORE_CONN_AG_CTX_RULE1EN_MASK  0x1 /* rule1en */
2449 #define YSTORM_CORE_CONN_AG_CTX_RULE1EN_SHIFT 4
2450 #define YSTORM_CORE_CONN_AG_CTX_RULE2EN_MASK  0x1 /* rule2en */
2451 #define YSTORM_CORE_CONN_AG_CTX_RULE2EN_SHIFT 5
2452 #define YSTORM_CORE_CONN_AG_CTX_RULE3EN_MASK  0x1 /* rule3en */
2453 #define YSTORM_CORE_CONN_AG_CTX_RULE3EN_SHIFT 6
2454 #define YSTORM_CORE_CONN_AG_CTX_RULE4EN_MASK  0x1 /* rule4en */
2455 #define YSTORM_CORE_CONN_AG_CTX_RULE4EN_SHIFT 7
2456         u8 byte2 /* byte2 */;
2457         u8 byte3 /* byte3 */;
2458         __le16 word0 /* word0 */;
2459         __le32 reg0 /* reg0 */;
2460         __le32 reg1 /* reg1 */;
2461         __le16 word1 /* word1 */;
2462         __le16 word2 /* word2 */;
2463         __le16 word3 /* word3 */;
2464         __le16 word4 /* word4 */;
2465         __le32 reg2 /* reg2 */;
2466         __le32 reg3 /* reg3 */;
2467 };
2468
2469 #endif /* __ECORE_HSI_COMMON__ */