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