1 /*
2  * Copyright (c) 2007 Mellanox Technologies. All rights reserved.
3  *
4  * This software is available to you under a choice of one of two
5  * licenses.  You may choose to be licensed under the terms of the GNU
6  * General Public License (GPL) Version 2, available from the file
7  * COPYING in the main directory of this source tree, or the
8  * OpenIB.org BSD license below:
9  *
10  *     Redistribution and use in source and binary forms, with or
11  *     without modification, are permitted provided that the following
12  *     conditions are met:
13  *
14  *      - Redistributions of source code must retain the above
15  *        copyright notice, this list of conditions and the following
16  *        disclaimer.
17  *
18  *      - Redistributions in binary form must reproduce the above
19  *        copyright notice, this list of conditions and the following
20  *        disclaimer in the documentation and/or other materials
21  *        provided with the distribution.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30  * SOFTWARE.
31  *
32  */
33 
34 #ifndef _MLX4_EN_PORT_H_
35 #define _MLX4_EN_PORT_H_
36 
37 
38 #define SET_PORT_GEN_ALL_VALID	0x7
39 #define SET_PORT_PROMISC_SHIFT	31
40 #define SET_PORT_MC_PROMISC_SHIFT	30
41 
42 #define MLX4_EN_NUM_TC		8
43 
44 #define VLAN_FLTR_SIZE	128
45 struct mlx4_set_vlan_fltr_mbox {
46 	__be32 entry[VLAN_FLTR_SIZE];
47 };
48 
49 
50 enum {
51 	MLX4_MCAST_CONFIG       = 0,
52 	MLX4_MCAST_DISABLE      = 1,
53 	MLX4_MCAST_ENABLE       = 2,
54 };
55 
56 enum {
57 	MLX4_EN_1G_SPEED	= 0x02,
58 	MLX4_EN_10G_SPEED_XFI	= 0x01,
59 	MLX4_EN_10G_SPEED_XAUI	= 0x00,
60 	MLX4_EN_40G_SPEED	= 0x40,
61 	MLX4_EN_OTHER_SPEED	= 0x0f,
62 };
63 
64 struct mlx4_en_query_port_context {
65 	u8 link_up;
66 #define MLX4_EN_LINK_UP_MASK	0x80
67 	u8 reserved;
68 	__be16 mtu;
69 	u8 reserved2;
70 	u8 link_speed;
71 #define MLX4_EN_SPEED_MASK	0x43
72 	u16 reserved3[5];
73 	__be64 mac;
74 	u8 transceiver;
75 };
76 
77 
78 struct mlx4_en_stat_out_mbox {
79 	/* Received frames with a length of 64 octets */
80 	__be64 R64_prio_0;
81 	__be64 R64_prio_1;
82 	__be64 R64_prio_2;
83 	__be64 R64_prio_3;
84 	__be64 R64_prio_4;
85 	__be64 R64_prio_5;
86 	__be64 R64_prio_6;
87 	__be64 R64_prio_7;
88 	__be64 R64_novlan;
89 	/* Received frames with a length of 127 octets */
90 	__be64 R127_prio_0;
91 	__be64 R127_prio_1;
92 	__be64 R127_prio_2;
93 	__be64 R127_prio_3;
94 	__be64 R127_prio_4;
95 	__be64 R127_prio_5;
96 	__be64 R127_prio_6;
97 	__be64 R127_prio_7;
98 	__be64 R127_novlan;
99 	/* Received frames with a length of 255 octets */
100 	__be64 R255_prio_0;
101 	__be64 R255_prio_1;
102 	__be64 R255_prio_2;
103 	__be64 R255_prio_3;
104 	__be64 R255_prio_4;
105 	__be64 R255_prio_5;
106 	__be64 R255_prio_6;
107 	__be64 R255_prio_7;
108 	__be64 R255_novlan;
109 	/* Received frames with a length of 511 octets */
110 	__be64 R511_prio_0;
111 	__be64 R511_prio_1;
112 	__be64 R511_prio_2;
113 	__be64 R511_prio_3;
114 	__be64 R511_prio_4;
115 	__be64 R511_prio_5;
116 	__be64 R511_prio_6;
117 	__be64 R511_prio_7;
118 	__be64 R511_novlan;
119 	/* Received frames with a length of 1023 octets */
120 	__be64 R1023_prio_0;
121 	__be64 R1023_prio_1;
122 	__be64 R1023_prio_2;
123 	__be64 R1023_prio_3;
124 	__be64 R1023_prio_4;
125 	__be64 R1023_prio_5;
126 	__be64 R1023_prio_6;
127 	__be64 R1023_prio_7;
128 	__be64 R1023_novlan;
129 	/* Received frames with a length of 1518 octets */
130 	__be64 R1518_prio_0;
131 	__be64 R1518_prio_1;
132 	__be64 R1518_prio_2;
133 	__be64 R1518_prio_3;
134 	__be64 R1518_prio_4;
135 	__be64 R1518_prio_5;
136 	__be64 R1518_prio_6;
137 	__be64 R1518_prio_7;
138 	__be64 R1518_novlan;
139 	/* Received frames with a length of 1522 octets */
140 	__be64 R1522_prio_0;
141 	__be64 R1522_prio_1;
142 	__be64 R1522_prio_2;
143 	__be64 R1522_prio_3;
144 	__be64 R1522_prio_4;
145 	__be64 R1522_prio_5;
146 	__be64 R1522_prio_6;
147 	__be64 R1522_prio_7;
148 	__be64 R1522_novlan;
149 	/* Received frames with a length of 1548 octets */
150 	__be64 R1548_prio_0;
151 	__be64 R1548_prio_1;
152 	__be64 R1548_prio_2;
153 	__be64 R1548_prio_3;
154 	__be64 R1548_prio_4;
155 	__be64 R1548_prio_5;
156 	__be64 R1548_prio_6;
157 	__be64 R1548_prio_7;
158 	__be64 R1548_novlan;
159 	/* Received frames with a length of 1548 < octets < MTU */
160 	__be64 R2MTU_prio_0;
161 	__be64 R2MTU_prio_1;
162 	__be64 R2MTU_prio_2;
163 	__be64 R2MTU_prio_3;
164 	__be64 R2MTU_prio_4;
165 	__be64 R2MTU_prio_5;
166 	__be64 R2MTU_prio_6;
167 	__be64 R2MTU_prio_7;
168 	__be64 R2MTU_novlan;
169 	/* Received frames with a length of MTU< octets and good CRC */
170 	__be64 RGIANT_prio_0;
171 	__be64 RGIANT_prio_1;
172 	__be64 RGIANT_prio_2;
173 	__be64 RGIANT_prio_3;
174 	__be64 RGIANT_prio_4;
175 	__be64 RGIANT_prio_5;
176 	__be64 RGIANT_prio_6;
177 	__be64 RGIANT_prio_7;
178 	__be64 RGIANT_novlan;
179 	/* Received broadcast frames with good CRC */
180 	__be64 RBCAST_prio_0;
181 	__be64 RBCAST_prio_1;
182 	__be64 RBCAST_prio_2;
183 	__be64 RBCAST_prio_3;
184 	__be64 RBCAST_prio_4;
185 	__be64 RBCAST_prio_5;
186 	__be64 RBCAST_prio_6;
187 	__be64 RBCAST_prio_7;
188 	__be64 RBCAST_novlan;
189 	/* Received multicast frames with good CRC */
190 	__be64 MCAST_prio_0;
191 	__be64 MCAST_prio_1;
192 	__be64 MCAST_prio_2;
193 	__be64 MCAST_prio_3;
194 	__be64 MCAST_prio_4;
195 	__be64 MCAST_prio_5;
196 	__be64 MCAST_prio_6;
197 	__be64 MCAST_prio_7;
198 	__be64 MCAST_novlan;
199 	/* Received unicast not short or GIANT frames with good CRC */
200 	__be64 RTOTG_prio_0;
201 	__be64 RTOTG_prio_1;
202 	__be64 RTOTG_prio_2;
203 	__be64 RTOTG_prio_3;
204 	__be64 RTOTG_prio_4;
205 	__be64 RTOTG_prio_5;
206 	__be64 RTOTG_prio_6;
207 	__be64 RTOTG_prio_7;
208 	__be64 RTOTG_novlan;
209 
210 	/* Count of total octets of received frames, includes framing characters */
211 	__be64 RTTLOCT_prio_0;
212 	/* Count of total octets of received frames, not including framing
213 	   characters */
214 	__be64 RTTLOCT_NOFRM_prio_0;
215 	/* Count of Total number of octets received
216 	   (only for frames without errors) */
217 	__be64 ROCT_prio_0;
218 
219 	__be64 RTTLOCT_prio_1;
220 	__be64 RTTLOCT_NOFRM_prio_1;
221 	__be64 ROCT_prio_1;
222 
223 	__be64 RTTLOCT_prio_2;
224 	__be64 RTTLOCT_NOFRM_prio_2;
225 	__be64 ROCT_prio_2;
226 
227 	__be64 RTTLOCT_prio_3;
228 	__be64 RTTLOCT_NOFRM_prio_3;
229 	__be64 ROCT_prio_3;
230 
231 	__be64 RTTLOCT_prio_4;
232 	__be64 RTTLOCT_NOFRM_prio_4;
233 	__be64 ROCT_prio_4;
234 
235 	__be64 RTTLOCT_prio_5;
236 	__be64 RTTLOCT_NOFRM_prio_5;
237 	__be64 ROCT_prio_5;
238 
239 	__be64 RTTLOCT_prio_6;
240 	__be64 RTTLOCT_NOFRM_prio_6;
241 	__be64 ROCT_prio_6;
242 
243 	__be64 RTTLOCT_prio_7;
244 	__be64 RTTLOCT_NOFRM_prio_7;
245 	__be64 ROCT_prio_7;
246 
247 	__be64 RTTLOCT_novlan;
248 	__be64 RTTLOCT_NOFRM_novlan;
249 	__be64 ROCT_novlan;
250 
251 	/* Count of Total received frames including bad frames */
252 	__be64 RTOT_prio_0;
253 	/* Count of  Total number of received frames with 802.1Q encapsulation */
254 	__be64 R1Q_prio_0;
255 	__be64 reserved1;
256 
257 	__be64 RTOT_prio_1;
258 	__be64 R1Q_prio_1;
259 	__be64 reserved2;
260 
261 	__be64 RTOT_prio_2;
262 	__be64 R1Q_prio_2;
263 	__be64 reserved3;
264 
265 	__be64 RTOT_prio_3;
266 	__be64 R1Q_prio_3;
267 	__be64 reserved4;
268 
269 	__be64 RTOT_prio_4;
270 	__be64 R1Q_prio_4;
271 	__be64 reserved5;
272 
273 	__be64 RTOT_prio_5;
274 	__be64 R1Q_prio_5;
275 	__be64 reserved6;
276 
277 	__be64 RTOT_prio_6;
278 	__be64 R1Q_prio_6;
279 	__be64 reserved7;
280 
281 	__be64 RTOT_prio_7;
282 	__be64 R1Q_prio_7;
283 	__be64 reserved8;
284 
285 	__be64 RTOT_novlan;
286 	__be64 R1Q_novlan;
287 	__be64 reserved9;
288 
289 	/* Total number of Successfully Received Control Frames */
290 	__be64 RCNTL;
291 	__be64 reserved10;
292 	__be64 reserved11;
293 	__be64 reserved12;
294 	/* Count of received frames with a length/type field  value between 46
295 	   (42 for VLANtagged frames) and 1500 (also 1500 for VLAN-tagged frames),
296 	   inclusive */
297 	__be64 RInRangeLengthErr;
298 	/* Count of received frames with length/type field between 1501 and 1535
299 	   decimal, inclusive */
300 	__be64 ROutRangeLengthErr;
301 	/* Count of received frames that are longer than max allowed size for
302 	   802.3 frames (1518/1522) */
303 	__be64 RFrmTooLong;
304 	/* Count frames received with PCS error */
305 	__be64 PCS;
306 
307 	/* Transmit frames with a length of 64 octets */
308 	__be64 T64_prio_0;
309 	__be64 T64_prio_1;
310 	__be64 T64_prio_2;
311 	__be64 T64_prio_3;
312 	__be64 T64_prio_4;
313 	__be64 T64_prio_5;
314 	__be64 T64_prio_6;
315 	__be64 T64_prio_7;
316 	__be64 T64_novlan;
317 	__be64 T64_loopbk;
318 	/* Transmit frames with a length of 65 to 127 octets. */
319 	__be64 T127_prio_0;
320 	__be64 T127_prio_1;
321 	__be64 T127_prio_2;
322 	__be64 T127_prio_3;
323 	__be64 T127_prio_4;
324 	__be64 T127_prio_5;
325 	__be64 T127_prio_6;
326 	__be64 T127_prio_7;
327 	__be64 T127_novlan;
328 	__be64 T127_loopbk;
329 	/* Transmit frames with a length of 128 to 255 octets */
330 	__be64 T255_prio_0;
331 	__be64 T255_prio_1;
332 	__be64 T255_prio_2;
333 	__be64 T255_prio_3;
334 	__be64 T255_prio_4;
335 	__be64 T255_prio_5;
336 	__be64 T255_prio_6;
337 	__be64 T255_prio_7;
338 	__be64 T255_novlan;
339 	__be64 T255_loopbk;
340 	/* Transmit frames with a length of 256 to 511 octets */
341 	__be64 T511_prio_0;
342 	__be64 T511_prio_1;
343 	__be64 T511_prio_2;
344 	__be64 T511_prio_3;
345 	__be64 T511_prio_4;
346 	__be64 T511_prio_5;
347 	__be64 T511_prio_6;
348 	__be64 T511_prio_7;
349 	__be64 T511_novlan;
350 	__be64 T511_loopbk;
351 	/* Transmit frames with a length of 512 to 1023 octets */
352 	__be64 T1023_prio_0;
353 	__be64 T1023_prio_1;
354 	__be64 T1023_prio_2;
355 	__be64 T1023_prio_3;
356 	__be64 T1023_prio_4;
357 	__be64 T1023_prio_5;
358 	__be64 T1023_prio_6;
359 	__be64 T1023_prio_7;
360 	__be64 T1023_novlan;
361 	__be64 T1023_loopbk;
362 	/* Transmit frames with a length of 1024 to 1518 octets */
363 	__be64 T1518_prio_0;
364 	__be64 T1518_prio_1;
365 	__be64 T1518_prio_2;
366 	__be64 T1518_prio_3;
367 	__be64 T1518_prio_4;
368 	__be64 T1518_prio_5;
369 	__be64 T1518_prio_6;
370 	__be64 T1518_prio_7;
371 	__be64 T1518_novlan;
372 	__be64 T1518_loopbk;
373 	/* Counts transmit frames with a length of 1519 to 1522 bytes */
374 	__be64 T1522_prio_0;
375 	__be64 T1522_prio_1;
376 	__be64 T1522_prio_2;
377 	__be64 T1522_prio_3;
378 	__be64 T1522_prio_4;
379 	__be64 T1522_prio_5;
380 	__be64 T1522_prio_6;
381 	__be64 T1522_prio_7;
382 	__be64 T1522_novlan;
383 	__be64 T1522_loopbk;
384 	/* Transmit frames with a length of 1523 to 1548 octets */
385 	__be64 T1548_prio_0;
386 	__be64 T1548_prio_1;
387 	__be64 T1548_prio_2;
388 	__be64 T1548_prio_3;
389 	__be64 T1548_prio_4;
390 	__be64 T1548_prio_5;
391 	__be64 T1548_prio_6;
392 	__be64 T1548_prio_7;
393 	__be64 T1548_novlan;
394 	__be64 T1548_loopbk;
395 	/* Counts transmit frames with a length of 1549 to MTU bytes */
396 	__be64 T2MTU_prio_0;
397 	__be64 T2MTU_prio_1;
398 	__be64 T2MTU_prio_2;
399 	__be64 T2MTU_prio_3;
400 	__be64 T2MTU_prio_4;
401 	__be64 T2MTU_prio_5;
402 	__be64 T2MTU_prio_6;
403 	__be64 T2MTU_prio_7;
404 	__be64 T2MTU_novlan;
405 	__be64 T2MTU_loopbk;
406 	/* Transmit frames with a length greater than MTU octets and a good CRC. */
407 	__be64 TGIANT_prio_0;
408 	__be64 TGIANT_prio_1;
409 	__be64 TGIANT_prio_2;
410 	__be64 TGIANT_prio_3;
411 	__be64 TGIANT_prio_4;
412 	__be64 TGIANT_prio_5;
413 	__be64 TGIANT_prio_6;
414 	__be64 TGIANT_prio_7;
415 	__be64 TGIANT_novlan;
416 	__be64 TGIANT_loopbk;
417 	/* Transmit broadcast frames with a good CRC */
418 	__be64 TBCAST_prio_0;
419 	__be64 TBCAST_prio_1;
420 	__be64 TBCAST_prio_2;
421 	__be64 TBCAST_prio_3;
422 	__be64 TBCAST_prio_4;
423 	__be64 TBCAST_prio_5;
424 	__be64 TBCAST_prio_6;
425 	__be64 TBCAST_prio_7;
426 	__be64 TBCAST_novlan;
427 	__be64 TBCAST_loopbk;
428 	/* Transmit multicast frames with a good CRC */
429 	__be64 TMCAST_prio_0;
430 	__be64 TMCAST_prio_1;
431 	__be64 TMCAST_prio_2;
432 	__be64 TMCAST_prio_3;
433 	__be64 TMCAST_prio_4;
434 	__be64 TMCAST_prio_5;
435 	__be64 TMCAST_prio_6;
436 	__be64 TMCAST_prio_7;
437 	__be64 TMCAST_novlan;
438 	__be64 TMCAST_loopbk;
439 	/* Transmit good frames that are neither broadcast nor multicast */
440 	__be64 TTOTG_prio_0;
441 	__be64 TTOTG_prio_1;
442 	__be64 TTOTG_prio_2;
443 	__be64 TTOTG_prio_3;
444 	__be64 TTOTG_prio_4;
445 	__be64 TTOTG_prio_5;
446 	__be64 TTOTG_prio_6;
447 	__be64 TTOTG_prio_7;
448 	__be64 TTOTG_novlan;
449 	__be64 TTOTG_loopbk;
450 
451 	/* total octets of transmitted frames, including framing characters */
452 	__be64 TTTLOCT_prio_0;
453 	/* total octets of transmitted frames, not including framing characters */
454 	__be64 TTTLOCT_NOFRM_prio_0;
455 	/* ifOutOctets */
456 	__be64 TOCT_prio_0;
457 
458 	__be64 TTTLOCT_prio_1;
459 	__be64 TTTLOCT_NOFRM_prio_1;
460 	__be64 TOCT_prio_1;
461 
462 	__be64 TTTLOCT_prio_2;
463 	__be64 TTTLOCT_NOFRM_prio_2;
464 	__be64 TOCT_prio_2;
465 
466 	__be64 TTTLOCT_prio_3;
467 	__be64 TTTLOCT_NOFRM_prio_3;
468 	__be64 TOCT_prio_3;
469 
470 	__be64 TTTLOCT_prio_4;
471 	__be64 TTTLOCT_NOFRM_prio_4;
472 	__be64 TOCT_prio_4;
473 
474 	__be64 TTTLOCT_prio_5;
475 	__be64 TTTLOCT_NOFRM_prio_5;
476 	__be64 TOCT_prio_5;
477 
478 	__be64 TTTLOCT_prio_6;
479 	__be64 TTTLOCT_NOFRM_prio_6;
480 	__be64 TOCT_prio_6;
481 
482 	__be64 TTTLOCT_prio_7;
483 	__be64 TTTLOCT_NOFRM_prio_7;
484 	__be64 TOCT_prio_7;
485 
486 	__be64 TTTLOCT_novlan;
487 	__be64 TTTLOCT_NOFRM_novlan;
488 	__be64 TOCT_novlan;
489 
490 	__be64 TTTLOCT_loopbk;
491 	__be64 TTTLOCT_NOFRM_loopbk;
492 	__be64 TOCT_loopbk;
493 
494 	/* Total frames transmitted with a good CRC that are not aborted  */
495 	__be64 TTOT_prio_0;
496 	/* Total number of frames transmitted with 802.1Q encapsulation */
497 	__be64 T1Q_prio_0;
498 	__be64 reserved13;
499 
500 	__be64 TTOT_prio_1;
501 	__be64 T1Q_prio_1;
502 	__be64 reserved14;
503 
504 	__be64 TTOT_prio_2;
505 	__be64 T1Q_prio_2;
506 	__be64 reserved15;
507 
508 	__be64 TTOT_prio_3;
509 	__be64 T1Q_prio_3;
510 	__be64 reserved16;
511 
512 	__be64 TTOT_prio_4;
513 	__be64 T1Q_prio_4;
514 	__be64 reserved17;
515 
516 	__be64 TTOT_prio_5;
517 	__be64 T1Q_prio_5;
518 	__be64 reserved18;
519 
520 	__be64 TTOT_prio_6;
521 	__be64 T1Q_prio_6;
522 	__be64 reserved19;
523 
524 	__be64 TTOT_prio_7;
525 	__be64 T1Q_prio_7;
526 	__be64 reserved20;
527 
528 	__be64 TTOT_novlan;
529 	__be64 T1Q_novlan;
530 	__be64 reserved21;
531 
532 	__be64 TTOT_loopbk;
533 	__be64 T1Q_loopbk;
534 	__be64 reserved22;
535 
536 	/* Received frames with a length greater than MTU octets and a bad CRC */
537 	__be32 RJBBR;
538 	/* Received frames with a bad CRC that are not runts, jabbers,
539 	   or alignment errors */
540 	__be32 RCRC;
541 	/* Received frames with SFD with a length of less than 64 octets and a
542 	   bad CRC */
543 	__be32 RRUNT;
544 	/* Received frames with a length less than 64 octets and a good CRC */
545 	__be32 RSHORT;
546 	/* Total Number of Received Packets Dropped */
547 	__be32 RDROP;
548 	/* Drop due to overflow  */
549 	__be32 RdropOvflw;
550 	/* Drop due to overflow */
551 	__be32 RdropLength;
552 	/* Total of good frames. Does not include frames received with
553 	   frame-too-long, FCS, or length errors */
554 	__be32 RTOTFRMS;
555 	/* Total dropped Xmited packets */
556 	__be32 TDROP;
557 };
558 
559 
560 #endif
561