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