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