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