xref: /onnv-gate/usr/src/uts/common/io/chxge/com/gmac.h (revision 3833:45d8d0ee8613)
1*3833Sxw161283 /*
2*3833Sxw161283  * CDDL HEADER START
3*3833Sxw161283  *
4*3833Sxw161283  * The contents of this file are subject to the terms of the
5*3833Sxw161283  * Common Development and Distribution License (the "License").
6*3833Sxw161283  * You may not use this file except in compliance with the License.
7*3833Sxw161283  *
8*3833Sxw161283  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*3833Sxw161283  * or http://www.opensolaris.org/os/licensing.
10*3833Sxw161283  * See the License for the specific language governing permissions
11*3833Sxw161283  * and limitations under the License.
12*3833Sxw161283  *
13*3833Sxw161283  * When distributing Covered Code, include this CDDL HEADER in each
14*3833Sxw161283  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*3833Sxw161283  * If applicable, add the following below this CDDL HEADER, with the
16*3833Sxw161283  * fields enclosed by brackets "[]" replaced with your own identifying
17*3833Sxw161283  * information: Portions Copyright [yyyy] [name of copyright owner]
18*3833Sxw161283  *
19*3833Sxw161283  * CDDL HEADER END
20*3833Sxw161283  */
21*3833Sxw161283 
22*3833Sxw161283 /*
23*3833Sxw161283  * Copyright (C) 2003-2005 Chelsio Communications.  All rights reserved.
24*3833Sxw161283  */
25*3833Sxw161283 
26*3833Sxw161283 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* gmac.h */
27*3833Sxw161283 
28*3833Sxw161283 #ifndef CHELSIO_GMAC_H
29*3833Sxw161283 #define CHELSIO_GMAC_H
30*3833Sxw161283 
31*3833Sxw161283 #include "common.h"
32*3833Sxw161283 
33*3833Sxw161283 enum { MAC_STATS_UPDATE_FAST, MAC_STATS_UPDATE_FULL };
34*3833Sxw161283 enum { MAC_DIRECTION_RX = 1, MAC_DIRECTION_TX = 2 };
35*3833Sxw161283 
36*3833Sxw161283 struct cmac_statistics {
37*3833Sxw161283 	/* Transmit */
38*3833Sxw161283 	u64 TxOctetsOK;
39*3833Sxw161283 	u64 TxOctetsBad;
40*3833Sxw161283 	u64 TxUnicastFramesOK;
41*3833Sxw161283 	u64 TxMulticastFramesOK;
42*3833Sxw161283 	u64 TxBroadcastFramesOK;
43*3833Sxw161283 	u64 TxPauseFrames;
44*3833Sxw161283 	u64 TxFramesWithDeferredXmissions;
45*3833Sxw161283 	u64 TxLateCollisions;
46*3833Sxw161283 	u64 TxTotalCollisions;
47*3833Sxw161283 	u64 TxFramesAbortedDueToXSCollisions;
48*3833Sxw161283 	u64 TxUnderrun;
49*3833Sxw161283 	u64 TxLengthErrors;
50*3833Sxw161283 	u64 TxInternalMACXmitError;
51*3833Sxw161283 	u64 TxFramesWithExcessiveDeferral;
52*3833Sxw161283 	u64 TxFCSErrors;
53*3833Sxw161283 	u64 TxJumboFramesOK;
54*3833Sxw161283 	u64 TxJumboOctetsOK;
55*3833Sxw161283 
56*3833Sxw161283 	/* Receive */
57*3833Sxw161283 	u64 RxOctetsOK;
58*3833Sxw161283 	u64 RxOctetsBad;
59*3833Sxw161283 	u64 RxUnicastFramesOK;
60*3833Sxw161283 	u64 RxMulticastFramesOK;
61*3833Sxw161283 	u64 RxBroadcastFramesOK;
62*3833Sxw161283 	u64 RxPauseFrames;
63*3833Sxw161283 	u64 RxFCSErrors;
64*3833Sxw161283 	u64 RxAlignErrors;
65*3833Sxw161283 	u64 RxSymbolErrors;
66*3833Sxw161283 	u64 RxDataErrors;
67*3833Sxw161283 	u64 RxSequenceErrors;
68*3833Sxw161283 	u64 RxRuntErrors;
69*3833Sxw161283 	u64 RxJabberErrors;
70*3833Sxw161283 	u64 RxInternalMACRcvError;
71*3833Sxw161283 	u64 RxInRangeLengthErrors;
72*3833Sxw161283 	u64 RxOutOfRangeLengthField;
73*3833Sxw161283 	u64 RxFrameTooLongErrors;
74*3833Sxw161283 	u64 RxJumboFramesOK;
75*3833Sxw161283 	u64 RxJumboOctetsOK;
76*3833Sxw161283 };
77*3833Sxw161283 
78*3833Sxw161283 struct cmac_ops {
79*3833Sxw161283 	void (*destroy)(struct cmac *);
80*3833Sxw161283 	int (*reset)(struct cmac *);
81*3833Sxw161283 	int (*interrupt_enable)(struct cmac *);
82*3833Sxw161283 	int (*interrupt_disable)(struct cmac *);
83*3833Sxw161283 	int (*interrupt_clear)(struct cmac *);
84*3833Sxw161283 	int (*interrupt_handler)(struct cmac *);
85*3833Sxw161283 
86*3833Sxw161283 	int (*enable)(struct cmac *, int);
87*3833Sxw161283 	int (*disable)(struct cmac *, int);
88*3833Sxw161283 
89*3833Sxw161283 	int (*loopback_enable)(struct cmac *);
90*3833Sxw161283 	int (*loopback_disable)(struct cmac *);
91*3833Sxw161283 
92*3833Sxw161283 	int (*set_mtu)(struct cmac *, int mtu);
93*3833Sxw161283 	int (*set_rx_mode)(struct cmac *, struct t1_rx_mode *rm);
94*3833Sxw161283 
95*3833Sxw161283 	int (*set_speed_duplex_fc)(struct cmac *, int speed, int duplex, int fc);
96*3833Sxw161283 	int (*get_speed_duplex_fc)(struct cmac *, int *speed, int *duplex,
97*3833Sxw161283 				   int *fc);
98*3833Sxw161283 
99*3833Sxw161283 	const struct cmac_statistics *(*statistics_update)(struct cmac *, int);
100*3833Sxw161283 
101*3833Sxw161283 	int (*macaddress_get)(struct cmac *, u8 mac_addr[6]);
102*3833Sxw161283 	int (*macaddress_set)(struct cmac *, u8 mac_addr[6]);
103*3833Sxw161283 };
104*3833Sxw161283 
105*3833Sxw161283 typedef struct _cmac_instance cmac_instance;
106*3833Sxw161283 
107*3833Sxw161283 struct cmac {
108*3833Sxw161283 	struct cmac_statistics stats;
109*3833Sxw161283 	adapter_t *adapter;
110*3833Sxw161283 	struct cmac_ops *ops;
111*3833Sxw161283 	cmac_instance *instance;
112*3833Sxw161283 };
113*3833Sxw161283 
114*3833Sxw161283 struct gmac {
115*3833Sxw161283 	unsigned int stats_update_period;
116*3833Sxw161283 	struct cmac *(*create)(adapter_t *adapter, int index);
117*3833Sxw161283 	int (*reset)(adapter_t *);
118*3833Sxw161283 };
119*3833Sxw161283 
120*3833Sxw161283 extern struct gmac t1_pm3393_ops;
121*3833Sxw161283 extern struct gmac t1_chelsio_mac_ops;
122*3833Sxw161283 extern struct gmac t1_vsc7321_ops;
123*3833Sxw161283 extern struct gmac t1_vsc7326_ops;
124*3833Sxw161283 extern struct gmac t1_ixf1010_ops;
125*3833Sxw161283 extern struct gmac t1_dummy_mac_ops;
126*3833Sxw161283 #endif
127