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