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