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