xref: /onnv-gate/usr/src/uts/common/sys/nxge/nxge.h (revision 3859:19804e7fd496)
1*3859Sml29623 /*
2*3859Sml29623  * CDDL HEADER START
3*3859Sml29623  *
4*3859Sml29623  * The contents of this file are subject to the terms of the
5*3859Sml29623  * Common Development and Distribution License (the "License").
6*3859Sml29623  * You may not use this file except in compliance with the License.
7*3859Sml29623  *
8*3859Sml29623  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*3859Sml29623  * or http://www.opensolaris.org/os/licensing.
10*3859Sml29623  * See the License for the specific language governing permissions
11*3859Sml29623  * and limitations under the License.
12*3859Sml29623  *
13*3859Sml29623  * When distributing Covered Code, include this CDDL HEADER in each
14*3859Sml29623  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*3859Sml29623  * If applicable, add the following below this CDDL HEADER, with the
16*3859Sml29623  * fields enclosed by brackets "[]" replaced with your own identifying
17*3859Sml29623  * information: Portions Copyright [yyyy] [name of copyright owner]
18*3859Sml29623  *
19*3859Sml29623  * CDDL HEADER END
20*3859Sml29623  */
21*3859Sml29623 /*
22*3859Sml29623  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*3859Sml29623  * Use is subject to license terms.
24*3859Sml29623  */
25*3859Sml29623 
26*3859Sml29623 #ifndef	_SYS_NXGE_NXGE_H
27*3859Sml29623 #define	_SYS_NXGE_NXGE_H
28*3859Sml29623 
29*3859Sml29623 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*3859Sml29623 
31*3859Sml29623 #ifdef	__cplusplus
32*3859Sml29623 extern "C" {
33*3859Sml29623 #endif
34*3859Sml29623 
35*3859Sml29623 #if defined(_KERNEL) || defined(COSIM)
36*3859Sml29623 #include <nxge_mac.h>
37*3859Sml29623 #include <nxge_ipp.h>
38*3859Sml29623 #include <nxge_fflp.h>
39*3859Sml29623 #endif
40*3859Sml29623 
41*3859Sml29623 /*
42*3859Sml29623  * NXGE diagnostics IOCTLS.
43*3859Sml29623  */
44*3859Sml29623 #define	NXGE_IOC		((((('N' << 8) + 'X') << 8) + 'G') << 8)
45*3859Sml29623 
46*3859Sml29623 #define	NXGE_GET64		(NXGE_IOC|1)
47*3859Sml29623 #define	NXGE_PUT64		(NXGE_IOC|2)
48*3859Sml29623 #define	NXGE_GET_TX_RING_SZ	(NXGE_IOC|3)
49*3859Sml29623 #define	NXGE_GET_TX_DESC	(NXGE_IOC|4)
50*3859Sml29623 #define	NXGE_GLOBAL_RESET	(NXGE_IOC|5)
51*3859Sml29623 #define	NXGE_TX_SIDE_RESET	(NXGE_IOC|6)
52*3859Sml29623 #define	NXGE_RX_SIDE_RESET	(NXGE_IOC|7)
53*3859Sml29623 #define	NXGE_RESET_MAC		(NXGE_IOC|8)
54*3859Sml29623 
55*3859Sml29623 #define	NXGE_GET_MII		(NXGE_IOC|11)
56*3859Sml29623 #define	NXGE_PUT_MII		(NXGE_IOC|12)
57*3859Sml29623 #define	NXGE_RTRACE		(NXGE_IOC|13)
58*3859Sml29623 #define	NXGE_RTRACE_TEST	(NXGE_IOC|20)
59*3859Sml29623 #define	NXGE_TX_REGS_DUMP	(NXGE_IOC|21)
60*3859Sml29623 #define	NXGE_RX_REGS_DUMP	(NXGE_IOC|22)
61*3859Sml29623 #define	NXGE_INT_REGS_DUMP	(NXGE_IOC|23)
62*3859Sml29623 #define	NXGE_VIR_REGS_DUMP	(NXGE_IOC|24)
63*3859Sml29623 #define	NXGE_VIR_INT_REGS_DUMP	(NXGE_IOC|25)
64*3859Sml29623 #define	NXGE_RDUMP		(NXGE_IOC|26)
65*3859Sml29623 #define	NXGE_RDC_GRPS_DUMP	(NXGE_IOC|27)
66*3859Sml29623 #define	NXGE_PIO_TEST		(NXGE_IOC|28)
67*3859Sml29623 
68*3859Sml29623 #define	NXGE_GET_TCAM		(NXGE_IOC|29)
69*3859Sml29623 #define	NXGE_PUT_TCAM		(NXGE_IOC|30)
70*3859Sml29623 #define	NXGE_INJECT_ERR		(NXGE_IOC|40)
71*3859Sml29623 
72*3859Sml29623 #if (defined(SOLARIS) && defined(_KERNEL)) || defined(COSIM)
73*3859Sml29623 #define	NXGE_OK			0
74*3859Sml29623 #define	NXGE_ERROR		0x40000000
75*3859Sml29623 #define	NXGE_DDI_FAILED		0x20000000
76*3859Sml29623 #define	NXGE_GET_PORT_NUM(n)	n
77*3859Sml29623 
78*3859Sml29623 /*
79*3859Sml29623  * Definitions for module_info.
80*3859Sml29623  */
81*3859Sml29623 #define	NXGE_IDNUM		(0)			/* module ID number */
82*3859Sml29623 #define	NXGE_DRIVER_NAME	"nxge"			/* module name */
83*3859Sml29623 
84*3859Sml29623 #define	NXGE_MINPSZ		(0)			/* min packet size */
85*3859Sml29623 #define	NXGE_MAXPSZ		(ETHERMTU)		/* max packet size */
86*3859Sml29623 #define	NXGE_HIWAT		(2048 * NXGE_MAXPSZ)	/* hi-water mark */
87*3859Sml29623 #define	NXGE_LOWAT		(1)			/* lo-water mark */
88*3859Sml29623 #define	NXGE_HIWAT_MAX		(192000 * NXGE_MAXPSZ)
89*3859Sml29623 #define	NXGE_HIWAT_MIN		(2 * NXGE_MAXPSZ)
90*3859Sml29623 #define	NXGE_LOWAT_MAX		(192000 * NXGE_MAXPSZ)
91*3859Sml29623 #define	NXGE_LOWAT_MIN		(1)
92*3859Sml29623 
93*3859Sml29623 #ifndef	D_HOTPLUG
94*3859Sml29623 #define	D_HOTPLUG		0x00
95*3859Sml29623 #endif
96*3859Sml29623 
97*3859Sml29623 #define	INIT_BUCKET_SIZE	16	/* Initial Hash Bucket Size */
98*3859Sml29623 
99*3859Sml29623 #define	NXGE_CHECK_TIMER	(5000)
100*3859Sml29623 
101*3859Sml29623 typedef enum {
102*3859Sml29623 	param_instance,
103*3859Sml29623 	param_main_instance,
104*3859Sml29623 	param_function_number,
105*3859Sml29623 	param_partition_id,
106*3859Sml29623 	param_read_write_mode,
107*3859Sml29623 	param_niu_cfg_type,
108*3859Sml29623 	param_tx_quick_cfg,
109*3859Sml29623 	param_rx_quick_cfg,
110*3859Sml29623 	param_master_cfg_enable,
111*3859Sml29623 	param_master_cfg_value,
112*3859Sml29623 
113*3859Sml29623 	param_autoneg,
114*3859Sml29623 	param_anar_10gfdx,
115*3859Sml29623 	param_anar_10ghdx,
116*3859Sml29623 	param_anar_1000fdx,
117*3859Sml29623 	param_anar_1000hdx,
118*3859Sml29623 	param_anar_100T4,
119*3859Sml29623 	param_anar_100fdx,
120*3859Sml29623 	param_anar_100hdx,
121*3859Sml29623 	param_anar_10fdx,
122*3859Sml29623 	param_anar_10hdx,
123*3859Sml29623 
124*3859Sml29623 	param_anar_asmpause,
125*3859Sml29623 	param_anar_pause,
126*3859Sml29623 	param_use_int_xcvr,
127*3859Sml29623 	param_enable_ipg0,
128*3859Sml29623 	param_ipg0,
129*3859Sml29623 	param_ipg1,
130*3859Sml29623 	param_ipg2,
131*3859Sml29623 	param_accept_jumbo,
132*3859Sml29623 	param_txdma_weight,
133*3859Sml29623 	param_txdma_channels_begin,
134*3859Sml29623 
135*3859Sml29623 	param_txdma_channels,
136*3859Sml29623 	param_txdma_info,
137*3859Sml29623 	param_rxdma_channels_begin,
138*3859Sml29623 	param_rxdma_channels,
139*3859Sml29623 	param_rxdma_drr_weight,
140*3859Sml29623 	param_rxdma_full_header,
141*3859Sml29623 	param_rxdma_info,
142*3859Sml29623 	param_rxdma_rbr_size,
143*3859Sml29623 	param_rxdma_rcr_size,
144*3859Sml29623 	param_default_port_rdc,
145*3859Sml29623 	param_rxdma_intr_time,
146*3859Sml29623 	param_rxdma_intr_pkts,
147*3859Sml29623 
148*3859Sml29623 	param_rdc_grps_start,
149*3859Sml29623 	param_rx_rdc_grps,
150*3859Sml29623 	param_default_grp0_rdc,
151*3859Sml29623 	param_default_grp1_rdc,
152*3859Sml29623 	param_default_grp2_rdc,
153*3859Sml29623 	param_default_grp3_rdc,
154*3859Sml29623 	param_default_grp4_rdc,
155*3859Sml29623 	param_default_grp5_rdc,
156*3859Sml29623 	param_default_grp6_rdc,
157*3859Sml29623 	param_default_grp7_rdc,
158*3859Sml29623 
159*3859Sml29623 	param_info_rdc_groups,
160*3859Sml29623 	param_start_ldg,
161*3859Sml29623 	param_max_ldg,
162*3859Sml29623 	param_mac_2rdc_grp,
163*3859Sml29623 	param_vlan_2rdc_grp,
164*3859Sml29623 	param_fcram_part_cfg,
165*3859Sml29623 	param_fcram_access_ratio,
166*3859Sml29623 	param_tcam_access_ratio,
167*3859Sml29623 	param_tcam_enable,
168*3859Sml29623 	param_hash_lookup_enable,
169*3859Sml29623 	param_llc_snap_enable,
170*3859Sml29623 
171*3859Sml29623 	param_h1_init_value,
172*3859Sml29623 	param_h2_init_value,
173*3859Sml29623 	param_class_cfg_ether_usr1,
174*3859Sml29623 	param_class_cfg_ether_usr2,
175*3859Sml29623 	param_class_cfg_ip_usr4,
176*3859Sml29623 	param_class_cfg_ip_usr5,
177*3859Sml29623 	param_class_cfg_ip_usr6,
178*3859Sml29623 	param_class_cfg_ip_usr7,
179*3859Sml29623 	param_class_opt_ip_usr4,
180*3859Sml29623 	param_class_opt_ip_usr5,
181*3859Sml29623 	param_class_opt_ip_usr6,
182*3859Sml29623 	param_class_opt_ip_usr7,
183*3859Sml29623 	param_class_opt_ipv4_tcp,
184*3859Sml29623 	param_class_opt_ipv4_udp,
185*3859Sml29623 	param_class_opt_ipv4_ah,
186*3859Sml29623 	param_class_opt_ipv4_sctp,
187*3859Sml29623 	param_class_opt_ipv6_tcp,
188*3859Sml29623 	param_class_opt_ipv6_udp,
189*3859Sml29623 	param_class_opt_ipv6_ah,
190*3859Sml29623 	param_class_opt_ipv6_sctp,
191*3859Sml29623 	param_nxge_debug_flag,
192*3859Sml29623 	param_npi_debug_flag,
193*3859Sml29623 	param_dump_rdc,
194*3859Sml29623 	param_dump_tdc,
195*3859Sml29623 	param_dump_mac_regs,
196*3859Sml29623 	param_dump_ipp_regs,
197*3859Sml29623 	param_dump_fflp_regs,
198*3859Sml29623 	param_dump_vlan_table,
199*3859Sml29623 	param_dump_rdc_table,
200*3859Sml29623 	param_dump_ptrs,
201*3859Sml29623 	param_end
202*3859Sml29623 } nxge_param_index_t;
203*3859Sml29623 
204*3859Sml29623 
205*3859Sml29623 /*
206*3859Sml29623  * Named Dispatch Parameter Management Structure
207*3859Sml29623  */
208*3859Sml29623 typedef	int (*nxge_ndgetf_t)(p_nxge_t, queue_t *, MBLKP, caddr_t, cred_t *);
209*3859Sml29623 typedef	int (*nxge_ndsetf_t)(p_nxge_t, queue_t *,
210*3859Sml29623 	    MBLKP, char *, caddr_t, cred_t *);
211*3859Sml29623 
212*3859Sml29623 #define	NXGE_PARAM_READ			0x00000001ULL
213*3859Sml29623 #define	NXGE_PARAM_WRITE		0x00000002ULL
214*3859Sml29623 #define	NXGE_PARAM_SHARED		0x00000004ULL
215*3859Sml29623 #define	NXGE_PARAM_PRIV			0x00000008ULL
216*3859Sml29623 #define	NXGE_PARAM_RW			NXGE_PARAM_READ | NXGE_PARAM_WRITE
217*3859Sml29623 #define	NXGE_PARAM_RWS			NXGE_PARAM_RW | NXGE_PARAM_SHARED
218*3859Sml29623 #define	NXGE_PARAM_RWP			NXGE_PARAM_RW | NXGE_PARAM_PRIV
219*3859Sml29623 
220*3859Sml29623 #define	NXGE_PARAM_RXDMA		0x00000010ULL
221*3859Sml29623 #define	NXGE_PARAM_TXDMA		0x00000020ULL
222*3859Sml29623 #define	NXGE_PARAM_CLASS_GEN	0x00000040ULL
223*3859Sml29623 #define	NXGE_PARAM_MAC			0x00000080ULL
224*3859Sml29623 #define	NXGE_PARAM_CLASS_BIN	NXGE_PARAM_CLASS_GEN | NXGE_PARAM_BASE_BIN
225*3859Sml29623 #define	NXGE_PARAM_CLASS_HEX	NXGE_PARAM_CLASS_GEN | NXGE_PARAM_BASE_HEX
226*3859Sml29623 #define	NXGE_PARAM_CLASS		NXGE_PARAM_CLASS_HEX
227*3859Sml29623 
228*3859Sml29623 #define	NXGE_PARAM_CMPLX		0x00010000ULL
229*3859Sml29623 #define	NXGE_PARAM_NDD_WR_OK		0x00020000ULL
230*3859Sml29623 #define	NXGE_PARAM_INIT_ONLY		0x00040000ULL
231*3859Sml29623 #define	NXGE_PARAM_INIT_CONFIG		0x00080000ULL
232*3859Sml29623 
233*3859Sml29623 #define	NXGE_PARAM_READ_PROP		0x00100000ULL
234*3859Sml29623 #define	NXGE_PARAM_PROP_ARR32		0x00200000ULL
235*3859Sml29623 #define	NXGE_PARAM_PROP_ARR64		0x00400000ULL
236*3859Sml29623 #define	NXGE_PARAM_PROP_STR		0x00800000ULL
237*3859Sml29623 
238*3859Sml29623 #define	NXGE_PARAM_BASE_DEC		0x00000000ULL
239*3859Sml29623 #define	NXGE_PARAM_BASE_BIN		0x10000000ULL
240*3859Sml29623 #define	NXGE_PARAM_BASE_HEX		0x20000000ULL
241*3859Sml29623 #define	NXGE_PARAM_BASE_STR		0x40000000ULL
242*3859Sml29623 #define	NXGE_PARAM_DONT_SHOW		0x80000000ULL
243*3859Sml29623 
244*3859Sml29623 #define	NXGE_PARAM_ARRAY_CNT_MASK	0x0000ffff00000000ULL
245*3859Sml29623 #define	NXGE_PARAM_ARRAY_CNT_SHIFT	32ULL
246*3859Sml29623 #define	NXGE_PARAM_ARRAY_ALLOC_MASK	0xffff000000000000ULL
247*3859Sml29623 #define	NXGE_PARAM_ARRAY_ALLOC_SHIFT	48ULL
248*3859Sml29623 
249*3859Sml29623 typedef struct _nxge_param_t {
250*3859Sml29623 	int (*getf)();
251*3859Sml29623 	int (*setf)();   /* null for read only */
252*3859Sml29623 	uint64_t type;  /* R/W/ Common/Port/ .... */
253*3859Sml29623 	uint64_t minimum;
254*3859Sml29623 	uint64_t maximum;
255*3859Sml29623 	uint64_t value;	/* for array params, pointer to value array */
256*3859Sml29623 	uint64_t old_value; /* for array params, pointer to old_value array */
257*3859Sml29623 	char   *fcode_name;
258*3859Sml29623 	char   *name;
259*3859Sml29623 } nxge_param_t, *p_nxge_param_t;
260*3859Sml29623 
261*3859Sml29623 
262*3859Sml29623 
263*3859Sml29623 typedef enum {
264*3859Sml29623 	nxge_lb_normal,
265*3859Sml29623 	nxge_lb_ext10g,
266*3859Sml29623 	nxge_lb_ext1000,
267*3859Sml29623 	nxge_lb_ext100,
268*3859Sml29623 	nxge_lb_ext10,
269*3859Sml29623 	nxge_lb_phy10g,
270*3859Sml29623 	nxge_lb_phy1000,
271*3859Sml29623 	nxge_lb_phy,
272*3859Sml29623 	nxge_lb_serdes10g,
273*3859Sml29623 	nxge_lb_serdes1000,
274*3859Sml29623 	nxge_lb_serdes,
275*3859Sml29623 	nxge_lb_mac10g,
276*3859Sml29623 	nxge_lb_mac1000,
277*3859Sml29623 	nxge_lb_mac
278*3859Sml29623 } nxge_lb_t;
279*3859Sml29623 
280*3859Sml29623 enum nxge_mac_state {
281*3859Sml29623 	NXGE_MAC_STOPPED = 0,
282*3859Sml29623 	NXGE_MAC_STARTED
283*3859Sml29623 };
284*3859Sml29623 
285*3859Sml29623 /*
286*3859Sml29623  * Private DLPI full dlsap address format.
287*3859Sml29623  */
288*3859Sml29623 typedef struct _nxge_dladdr_t {
289*3859Sml29623 	ether_addr_st dl_phys;
290*3859Sml29623 	uint16_t dl_sap;
291*3859Sml29623 } nxge_dladdr_t, *p_nxge_dladdr_t;
292*3859Sml29623 
293*3859Sml29623 typedef struct _mc_addr_t {
294*3859Sml29623 	ether_addr_st multcast_addr;
295*3859Sml29623 	uint_t mc_addr_cnt;
296*3859Sml29623 } mc_addr_t, *p_mc_addr_t;
297*3859Sml29623 
298*3859Sml29623 typedef struct _mc_bucket_t {
299*3859Sml29623 	p_mc_addr_t addr_list;
300*3859Sml29623 	uint_t list_size;
301*3859Sml29623 } mc_bucket_t, *p_mc_bucket_t;
302*3859Sml29623 
303*3859Sml29623 typedef struct _mc_table_t {
304*3859Sml29623 	p_mc_bucket_t bucket_list;
305*3859Sml29623 	uint_t buckets_used;
306*3859Sml29623 } mc_table_t, *p_mc_table_t;
307*3859Sml29623 
308*3859Sml29623 typedef struct _filter_t {
309*3859Sml29623 	uint32_t all_phys_cnt;
310*3859Sml29623 	uint32_t all_multicast_cnt;
311*3859Sml29623 	uint32_t all_sap_cnt;
312*3859Sml29623 } filter_t, *p_filter_t;
313*3859Sml29623 
314*3859Sml29623 #if defined(_KERNEL) || defined(COSIM)
315*3859Sml29623 
316*3859Sml29623 
317*3859Sml29623 typedef struct _nxge_port_stats_t {
318*3859Sml29623 	/*
319*3859Sml29623 	 *  Overall structure size
320*3859Sml29623 	 */
321*3859Sml29623 	size_t			stats_size;
322*3859Sml29623 
323*3859Sml29623 	/*
324*3859Sml29623 	 * Link Input/Output stats
325*3859Sml29623 	 */
326*3859Sml29623 	uint64_t		ipackets;
327*3859Sml29623 	uint64_t		ierrors;
328*3859Sml29623 	uint64_t		opackets;
329*3859Sml29623 	uint64_t		oerrors;
330*3859Sml29623 	uint64_t		collisions;
331*3859Sml29623 
332*3859Sml29623 	/*
333*3859Sml29623 	 * MIB II variables
334*3859Sml29623 	 */
335*3859Sml29623 	uint64_t		rbytes;    /* # bytes received */
336*3859Sml29623 	uint64_t		obytes;    /* # bytes transmitted */
337*3859Sml29623 	uint32_t		multircv;  /* # multicast packets received */
338*3859Sml29623 	uint32_t		multixmt;  /* # multicast packets for xmit */
339*3859Sml29623 	uint32_t		brdcstrcv; /* # broadcast packets received */
340*3859Sml29623 	uint32_t		brdcstxmt; /* # broadcast packets for xmit */
341*3859Sml29623 	uint32_t		norcvbuf;  /* # rcv packets discarded */
342*3859Sml29623 	uint32_t		noxmtbuf;  /* # xmit packets discarded */
343*3859Sml29623 
344*3859Sml29623 	/*
345*3859Sml29623 	 * Lets the user know the MTU currently in use by
346*3859Sml29623 	 * the physical MAC port.
347*3859Sml29623 	 */
348*3859Sml29623 	nxge_lb_t		lb_mode;
349*3859Sml29623 	uint32_t		qos_mode;
350*3859Sml29623 	uint32_t		trunk_mode;
351*3859Sml29623 	uint32_t		poll_mode;
352*3859Sml29623 
353*3859Sml29623 	/*
354*3859Sml29623 	 * Tx Statistics.
355*3859Sml29623 	 */
356*3859Sml29623 	uint32_t		tx_inits;
357*3859Sml29623 	uint32_t		tx_starts;
358*3859Sml29623 	uint32_t		tx_nocanput;
359*3859Sml29623 	uint32_t		tx_msgdup_fail;
360*3859Sml29623 	uint32_t		tx_allocb_fail;
361*3859Sml29623 	uint32_t		tx_no_desc;
362*3859Sml29623 	uint32_t		tx_dma_bind_fail;
363*3859Sml29623 	uint32_t		tx_uflo;
364*3859Sml29623 	uint32_t		tx_hdr_pkts;
365*3859Sml29623 	uint32_t		tx_ddi_pkts;
366*3859Sml29623 	uint32_t		tx_dvma_pkts;
367*3859Sml29623 
368*3859Sml29623 	uint32_t		tx_max_pend;
369*3859Sml29623 
370*3859Sml29623 	/*
371*3859Sml29623 	 * Rx Statistics.
372*3859Sml29623 	 */
373*3859Sml29623 	uint32_t		rx_inits;
374*3859Sml29623 	uint32_t		rx_hdr_pkts;
375*3859Sml29623 	uint32_t		rx_mtu_pkts;
376*3859Sml29623 	uint32_t		rx_split_pkts;
377*3859Sml29623 	uint32_t		rx_no_buf;
378*3859Sml29623 	uint32_t		rx_no_comp_wb;
379*3859Sml29623 	uint32_t		rx_ov_flow;
380*3859Sml29623 	uint32_t		rx_len_mm;
381*3859Sml29623 	uint32_t		rx_tag_err;
382*3859Sml29623 	uint32_t		rx_nocanput;
383*3859Sml29623 	uint32_t		rx_msgdup_fail;
384*3859Sml29623 	uint32_t		rx_allocb_fail;
385*3859Sml29623 
386*3859Sml29623 	/*
387*3859Sml29623 	 * Receive buffer management statistics.
388*3859Sml29623 	 */
389*3859Sml29623 	uint32_t		rx_new_pages;
390*3859Sml29623 	uint32_t		rx_new_hdr_pgs;
391*3859Sml29623 	uint32_t		rx_new_mtu_pgs;
392*3859Sml29623 	uint32_t		rx_new_nxt_pgs;
393*3859Sml29623 	uint32_t		rx_reused_pgs;
394*3859Sml29623 	uint32_t		rx_hdr_drops;
395*3859Sml29623 	uint32_t		rx_mtu_drops;
396*3859Sml29623 	uint32_t		rx_nxt_drops;
397*3859Sml29623 
398*3859Sml29623 	/*
399*3859Sml29623 	 * Receive flow statistics
400*3859Sml29623 	 */
401*3859Sml29623 	uint32_t		rx_rel_flow;
402*3859Sml29623 	uint32_t		rx_rel_bit;
403*3859Sml29623 
404*3859Sml29623 	uint32_t		rx_pkts_dropped;
405*3859Sml29623 
406*3859Sml29623 	/*
407*3859Sml29623 	 * PCI-E Bus Statistics.
408*3859Sml29623 	 */
409*3859Sml29623 	uint32_t		pci_bus_speed;
410*3859Sml29623 	uint32_t		pci_err;
411*3859Sml29623 	uint32_t		pci_rta_err;
412*3859Sml29623 	uint32_t		pci_rma_err;
413*3859Sml29623 	uint32_t		pci_parity_err;
414*3859Sml29623 	uint32_t		pci_bad_ack_err;
415*3859Sml29623 	uint32_t		pci_drto_err;
416*3859Sml29623 	uint32_t		pci_dmawz_err;
417*3859Sml29623 	uint32_t		pci_dmarz_err;
418*3859Sml29623 
419*3859Sml29623 	uint32_t		rx_taskq_waits;
420*3859Sml29623 
421*3859Sml29623 	uint32_t		tx_jumbo_pkts;
422*3859Sml29623 
423*3859Sml29623 	/*
424*3859Sml29623 	 * Some statistics added to support bringup, these
425*3859Sml29623 	 * should be removed.
426*3859Sml29623 	 */
427*3859Sml29623 	uint32_t		user_defined;
428*3859Sml29623 } nxge_port_stats_t, *p_nxge_port_stats_t;
429*3859Sml29623 
430*3859Sml29623 
431*3859Sml29623 typedef struct _nxge_stats_t {
432*3859Sml29623 	/*
433*3859Sml29623 	 *  Overall structure size
434*3859Sml29623 	 */
435*3859Sml29623 	size_t			stats_size;
436*3859Sml29623 
437*3859Sml29623 	kstat_t			*ksp;
438*3859Sml29623 	kstat_t			*rdc_ksp[NXGE_MAX_RDCS];
439*3859Sml29623 	kstat_t			*tdc_ksp[NXGE_MAX_TDCS];
440*3859Sml29623 	kstat_t			*rdc_sys_ksp;
441*3859Sml29623 	kstat_t			*fflp_ksp[1];
442*3859Sml29623 	kstat_t			*ipp_ksp;
443*3859Sml29623 	kstat_t			*txc_ksp;
444*3859Sml29623 	kstat_t			*mac_ksp;
445*3859Sml29623 	kstat_t			*zcp_ksp;
446*3859Sml29623 	kstat_t			*port_ksp;
447*3859Sml29623 	kstat_t			*mmac_ksp;
448*3859Sml29623 
449*3859Sml29623 	nxge_mac_stats_t	mac_stats;	/* Common MAC Statistics */
450*3859Sml29623 	nxge_xmac_stats_t	xmac_stats;	/* XMAC Statistics */
451*3859Sml29623 	nxge_bmac_stats_t	bmac_stats;	/* BMAC Statistics */
452*3859Sml29623 
453*3859Sml29623 	nxge_rx_ring_stats_t	rx_stats;	/* per port RX stats */
454*3859Sml29623 	nxge_ipp_stats_t	ipp_stats;	/* per port IPP stats */
455*3859Sml29623 	nxge_zcp_stats_t	zcp_stats;	/* per port IPP stats */
456*3859Sml29623 	nxge_rx_ring_stats_t	rdc_stats[NXGE_MAX_RDCS]; /* per rdc stats */
457*3859Sml29623 	nxge_rdc_sys_stats_t	rdc_sys_stats;	/* per port RDC stats */
458*3859Sml29623 
459*3859Sml29623 	nxge_tx_ring_stats_t	tx_stats;	/* per port TX stats */
460*3859Sml29623 	nxge_txc_stats_t	txc_stats;	/* per port TX stats */
461*3859Sml29623 	nxge_tx_ring_stats_t	tdc_stats[NXGE_MAX_TDCS]; /* per tdc stats */
462*3859Sml29623 	nxge_fflp_stats_t	fflp_stats;	/* fflp stats */
463*3859Sml29623 	nxge_port_stats_t	port_stats;	/* fflp stats */
464*3859Sml29623 	nxge_mmac_stats_t	mmac_stats;	/* Multi mac. stats */
465*3859Sml29623 
466*3859Sml29623 } nxge_stats_t, *p_nxge_stats_t;
467*3859Sml29623 
468*3859Sml29623 
469*3859Sml29623 
470*3859Sml29623 typedef struct _nxge_intr_t {
471*3859Sml29623 	boolean_t		intr_registered; /* interrupts are registered */
472*3859Sml29623 	boolean_t		intr_enabled; 	/* interrupts are enabled */
473*3859Sml29623 	boolean_t		niu_msi_enable;	/* debug or configurable? */
474*3859Sml29623 	uint8_t			nldevs;		/* # of logical devices */
475*3859Sml29623 	int			intr_types;	/* interrupt types supported */
476*3859Sml29623 	int			intr_type;	/* interrupt type to add */
477*3859Sml29623 	int			max_int_cnt;	/* max MSIX/INT HW supports */
478*3859Sml29623 	int			start_inum;	/* start inum (in sequence?) */
479*3859Sml29623 	int			msi_intx_cnt;	/* # msi/intx ints returned */
480*3859Sml29623 	int			intr_added;	/* # ints actually needed */
481*3859Sml29623 	int			intr_cap;	/* interrupt capabilities */
482*3859Sml29623 	size_t			intr_size;	/* size of array to allocate */
483*3859Sml29623 	ddi_intr_handle_t 	*htable;	/* For array of interrupts */
484*3859Sml29623 	/* Add interrupt number for each interrupt vector */
485*3859Sml29623 	int			pri;
486*3859Sml29623 } nxge_intr_t, *p_nxge_intr_t;
487*3859Sml29623 
488*3859Sml29623 typedef struct _nxge_ldgv_t {
489*3859Sml29623 	uint8_t			ndma_ldvs;
490*3859Sml29623 	uint8_t			nldvs;
491*3859Sml29623 	uint8_t			start_ldg;
492*3859Sml29623 	uint8_t			start_ldg_tx;
493*3859Sml29623 	uint8_t			start_ldg_rx;
494*3859Sml29623 	uint8_t			maxldgs;
495*3859Sml29623 	uint8_t			maxldvs;
496*3859Sml29623 	uint8_t			ldg_intrs;
497*3859Sml29623 	boolean_t		own_sys_err;
498*3859Sml29623 	boolean_t		own_max_ldv;
499*3859Sml29623 	uint32_t		tmres;
500*3859Sml29623 	p_nxge_ldg_t		ldgp;
501*3859Sml29623 	p_nxge_ldv_t		ldvp;
502*3859Sml29623 	p_nxge_ldv_t		ldvp_syserr;
503*3859Sml29623 } nxge_ldgv_t, *p_nxge_ldgv_t;
504*3859Sml29623 
505*3859Sml29623 /*
506*3859Sml29623  * Neptune Device instance state information.
507*3859Sml29623  *
508*3859Sml29623  * Each instance is dynamically allocated on first attach.
509*3859Sml29623  */
510*3859Sml29623 struct _nxge_t {
511*3859Sml29623 	dev_info_t		*dip;		/* device instance */
512*3859Sml29623 	dev_info_t		*p_dip;		/* Parent's device instance */
513*3859Sml29623 	int			instance;	/* instance number */
514*3859Sml29623 	int			function_num;	/* device function number */
515*3859Sml29623 	int			nports;		/* # of ports on this device */
516*3859Sml29623 	int			board_ver;	/* Board Version */
517*3859Sml29623 	int			partition_id;	/* partition ID */
518*3859Sml29623 	int			use_partition;	/* partition is enabled */
519*3859Sml29623 	uint32_t		drv_state;	/* driver state bit flags */
520*3859Sml29623 	uint64_t		nxge_debug_level; /* driver state bit flags */
521*3859Sml29623 	kmutex_t		genlock[1];
522*3859Sml29623 	enum nxge_mac_state	nxge_mac_state;
523*3859Sml29623 	ddi_softintr_t		resched_id;	/* reschedule callback	*/
524*3859Sml29623 	boolean_t		resched_needed;
525*3859Sml29623 	boolean_t		resched_running;
526*3859Sml29623 
527*3859Sml29623 	p_dev_regs_t		dev_regs;
528*3859Sml29623 	npi_handle_t		npi_handle;
529*3859Sml29623 	npi_handle_t		npi_pci_handle;
530*3859Sml29623 	npi_handle_t		npi_reg_handle;
531*3859Sml29623 	npi_handle_t		npi_msi_handle;
532*3859Sml29623 	npi_handle_t		npi_vreg_handle;
533*3859Sml29623 	npi_handle_t		npi_v2reg_handle;
534*3859Sml29623 
535*3859Sml29623 	nxge_mac_t		mac;
536*3859Sml29623 	nxge_ipp_t		ipp;
537*3859Sml29623 	nxge_txc_t		txc;
538*3859Sml29623 	nxge_classify_t		classifier;
539*3859Sml29623 
540*3859Sml29623 	mac_handle_t		mach;	/* mac module handle */
541*3859Sml29623 	p_nxge_stats_t		statsp;
542*3859Sml29623 	uint32_t		param_count;
543*3859Sml29623 	p_nxge_param_t		param_arr;
544*3859Sml29623 	nxge_hw_list_t		*nxge_hw_p; 	/* pointer to per Neptune */
545*3859Sml29623 	niu_type_t		niu_type;
546*3859Sml29623 	boolean_t		os_addr_mode32;	/* set to 1 for 32 bit mode */
547*3859Sml29623 	uint8_t			nrdc;
548*3859Sml29623 	uint8_t			def_rdc;
549*3859Sml29623 	uint8_t			rdc[NXGE_MAX_RDCS];
550*3859Sml29623 	uint8_t			ntdc;
551*3859Sml29623 	uint8_t			tdc[NXGE_MAX_TDCS];
552*3859Sml29623 
553*3859Sml29623 	nxge_intr_t		nxge_intr_type;
554*3859Sml29623 	nxge_dma_pt_cfg_t 	pt_config;
555*3859Sml29623 	nxge_class_pt_cfg_t 	class_config;
556*3859Sml29623 
557*3859Sml29623 	/* Logical device and group data structures. */
558*3859Sml29623 	p_nxge_ldgv_t		ldgvp;
559*3859Sml29623 
560*3859Sml29623 	caddr_t			param_list;	/* Parameter list */
561*3859Sml29623 
562*3859Sml29623 	ether_addr_st		factaddr;	/* factory mac address	    */
563*3859Sml29623 	ether_addr_st		ouraddr;	/* individual address	    */
564*3859Sml29623 	kmutex_t		ouraddr_lock;	/* lock to protect to uradd */
565*3859Sml29623 
566*3859Sml29623 	ddi_iblock_cookie_t	interrupt_cookie;
567*3859Sml29623 
568*3859Sml29623 	/*
569*3859Sml29623 	 * Blocks of memory may be pre-allocated by the
570*3859Sml29623 	 * partition manager or the driver. They may include
571*3859Sml29623 	 * blocks for configuration and buffers. The idea is
572*3859Sml29623 	 * to preallocate big blocks of contiguous areas in
573*3859Sml29623 	 * system memory (i.e. with IOMMU). These blocks then
574*3859Sml29623 	 * will be broken up to a fixed number of blocks with
575*3859Sml29623 	 * each block having the same block size (4K, 8K, 16K or
576*3859Sml29623 	 * 32K) in the case of buffer blocks. For systems that
577*3859Sml29623 	 * do not support DVMA, more than one big block will be
578*3859Sml29623 	 * allocated.
579*3859Sml29623 	 */
580*3859Sml29623 	uint32_t		rx_default_block_size;
581*3859Sml29623 	nxge_rx_block_size_t	rx_bksize_code;
582*3859Sml29623 
583*3859Sml29623 	p_nxge_dma_pool_t	rx_buf_pool_p;
584*3859Sml29623 	p_nxge_dma_pool_t	rx_cntl_pool_p;
585*3859Sml29623 
586*3859Sml29623 	p_nxge_dma_pool_t	tx_buf_pool_p;
587*3859Sml29623 	p_nxge_dma_pool_t	tx_cntl_pool_p;
588*3859Sml29623 
589*3859Sml29623 	/* Receive buffer block ring and completion ring. */
590*3859Sml29623 	p_rx_rbr_rings_t 	rx_rbr_rings;
591*3859Sml29623 	p_rx_rcr_rings_t 	rx_rcr_rings;
592*3859Sml29623 	p_rx_mbox_areas_t 	rx_mbox_areas_p;
593*3859Sml29623 
594*3859Sml29623 	p_rx_tx_params_t	rx_params;
595*3859Sml29623 	uint32_t		start_rdc;
596*3859Sml29623 	uint32_t		max_rdcs;
597*3859Sml29623 	uint32_t		rdc_mask;
598*3859Sml29623 
599*3859Sml29623 	/* Transmit descriptors rings */
600*3859Sml29623 	p_tx_rings_t 		tx_rings;
601*3859Sml29623 	p_tx_mbox_areas_t	tx_mbox_areas_p;
602*3859Sml29623 
603*3859Sml29623 	uint32_t		start_tdc;
604*3859Sml29623 	uint32_t		max_tdcs;
605*3859Sml29623 	uint32_t		tdc_mask;
606*3859Sml29623 
607*3859Sml29623 	p_rx_tx_params_t	tx_params;
608*3859Sml29623 
609*3859Sml29623 	ddi_dma_handle_t 	dmasparehandle;
610*3859Sml29623 
611*3859Sml29623 	ulong_t 		sys_page_sz;
612*3859Sml29623 	ulong_t 		sys_page_mask;
613*3859Sml29623 	int 			suspended;
614*3859Sml29623 
615*3859Sml29623 	mii_bmsr_t 		bmsr;		/* xcvr status at last poll. */
616*3859Sml29623 	mii_bmsr_t 		soft_bmsr;	/* xcvr status kept by SW. */
617*3859Sml29623 
618*3859Sml29623 	kmutex_t 		mif_lock;	/* Lock to protect the list. */
619*3859Sml29623 
620*3859Sml29623 	void 			(*mii_read)();
621*3859Sml29623 	void 			(*mii_write)();
622*3859Sml29623 	void 			(*mii_poll)();
623*3859Sml29623 	filter_t 		filter;		/* Current instance filter */
624*3859Sml29623 	p_hash_filter_t 	hash_filter;	/* Multicast hash filter. */
625*3859Sml29623 	krwlock_t		filter_lock;	/* Lock to protect filters. */
626*3859Sml29623 
627*3859Sml29623 	ulong_t 		sys_burst_sz;
628*3859Sml29623 
629*3859Sml29623 	uint8_t 		cache_line;
630*3859Sml29623 
631*3859Sml29623 	timeout_id_t 		nxge_link_poll_timerid;
632*3859Sml29623 	timeout_id_t 		nxge_timerid;
633*3859Sml29623 
634*3859Sml29623 	uint_t 			need_periodic_reclaim;
635*3859Sml29623 	timeout_id_t 		reclaim_timer;
636*3859Sml29623 
637*3859Sml29623 	uint8_t 		msg_min;
638*3859Sml29623 	uint8_t 		crc_size;
639*3859Sml29623 
640*3859Sml29623 	boolean_t 		hard_props_read;
641*3859Sml29623 
642*3859Sml29623 	boolean_t 		nxge_htraffic;
643*3859Sml29623 	uint32_t 		nxge_ncpus;
644*3859Sml29623 	uint32_t 		nxge_cpumask;
645*3859Sml29623 	uint16_t 		intr_timeout;
646*3859Sml29623 	uint16_t 		intr_threshold;
647*3859Sml29623 	uchar_t 		nxge_rxmode;
648*3859Sml29623 	uint32_t 		active_threads;
649*3859Sml29623 
650*3859Sml29623 	rtrace_t		rtrace;
651*3859Sml29623 	int			fm_capabilities; /* FMA capabilities */
652*3859Sml29623 
653*3859Sml29623 	uint32_t 		nxge_port_rbr_size;
654*3859Sml29623 	uint32_t 		nxge_port_rcr_size;
655*3859Sml29623 	uint32_t 		nxge_port_tx_ring_size;
656*3859Sml29623 	nxge_mmac_t		nxge_mmac_info;
657*3859Sml29623 #if	defined(sun4v)
658*3859Sml29623 	boolean_t		niu_hsvc_available;
659*3859Sml29623 	hsvc_info_t		niu_hsvc;
660*3859Sml29623 	uint64_t		niu_min_ver;
661*3859Sml29623 #endif
662*3859Sml29623 	boolean_t		link_notify;
663*3859Sml29623 };
664*3859Sml29623 
665*3859Sml29623 /*
666*3859Sml29623  * Driver state flags.
667*3859Sml29623  */
668*3859Sml29623 #define	STATE_REGS_MAPPED	0x000000001	/* device registers mapped */
669*3859Sml29623 #define	STATE_KSTATS_SETUP	0x000000002	/* kstats allocated	*/
670*3859Sml29623 #define	STATE_NODE_CREATED	0x000000004	/* device node created	*/
671*3859Sml29623 #define	STATE_HW_CONFIG_CREATED	0x000000008	/* hardware properties	*/
672*3859Sml29623 #define	STATE_HW_INITIALIZED	0x000000010	/* hardware initialized	*/
673*3859Sml29623 #define	STATE_MDIO_LOCK_INIT	0x000000020	/* mdio lock initialized */
674*3859Sml29623 #define	STATE_MII_LOCK_INIT	0x000000040	/* mii lock initialized */
675*3859Sml29623 
676*3859Sml29623 #define	STOP_POLL_THRESH 	9
677*3859Sml29623 #define	START_POLL_THRESH	2
678*3859Sml29623 
679*3859Sml29623 typedef struct _nxge_port_kstat_t {
680*3859Sml29623 	/*
681*3859Sml29623 	 * Transciever state informations.
682*3859Sml29623 	 */
683*3859Sml29623 	kstat_named_t	xcvr_inits;
684*3859Sml29623 	kstat_named_t	xcvr_inuse;
685*3859Sml29623 	kstat_named_t	xcvr_addr;
686*3859Sml29623 	kstat_named_t	xcvr_id;
687*3859Sml29623 	kstat_named_t	cap_autoneg;
688*3859Sml29623 	kstat_named_t	cap_10gfdx;
689*3859Sml29623 	kstat_named_t	cap_10ghdx;
690*3859Sml29623 	kstat_named_t	cap_1000fdx;
691*3859Sml29623 	kstat_named_t	cap_1000hdx;
692*3859Sml29623 	kstat_named_t	cap_100T4;
693*3859Sml29623 	kstat_named_t	cap_100fdx;
694*3859Sml29623 	kstat_named_t	cap_100hdx;
695*3859Sml29623 	kstat_named_t	cap_10fdx;
696*3859Sml29623 	kstat_named_t	cap_10hdx;
697*3859Sml29623 	kstat_named_t	cap_asmpause;
698*3859Sml29623 	kstat_named_t	cap_pause;
699*3859Sml29623 
700*3859Sml29623 	/*
701*3859Sml29623 	 * Link partner capabilities.
702*3859Sml29623 	 */
703*3859Sml29623 	kstat_named_t	lp_cap_autoneg;
704*3859Sml29623 	kstat_named_t	lp_cap_10gfdx;
705*3859Sml29623 	kstat_named_t	lp_cap_10ghdx;
706*3859Sml29623 	kstat_named_t	lp_cap_1000fdx;
707*3859Sml29623 	kstat_named_t	lp_cap_1000hdx;
708*3859Sml29623 	kstat_named_t	lp_cap_100T4;
709*3859Sml29623 	kstat_named_t	lp_cap_100fdx;
710*3859Sml29623 	kstat_named_t	lp_cap_100hdx;
711*3859Sml29623 	kstat_named_t	lp_cap_10fdx;
712*3859Sml29623 	kstat_named_t	lp_cap_10hdx;
713*3859Sml29623 	kstat_named_t	lp_cap_asmpause;
714*3859Sml29623 	kstat_named_t	lp_cap_pause;
715*3859Sml29623 
716*3859Sml29623 	/*
717*3859Sml29623 	 * Shared link setup.
718*3859Sml29623 	 */
719*3859Sml29623 	kstat_named_t	link_T4;
720*3859Sml29623 	kstat_named_t	link_speed;
721*3859Sml29623 	kstat_named_t	link_duplex;
722*3859Sml29623 	kstat_named_t	link_asmpause;
723*3859Sml29623 	kstat_named_t	link_pause;
724*3859Sml29623 	kstat_named_t	link_up;
725*3859Sml29623 
726*3859Sml29623 	/*
727*3859Sml29623 	 * Lets the user know the MTU currently in use by
728*3859Sml29623 	 * the physical MAC port.
729*3859Sml29623 	 */
730*3859Sml29623 	kstat_named_t	mac_mtu;
731*3859Sml29623 	kstat_named_t	lb_mode;
732*3859Sml29623 	kstat_named_t	qos_mode;
733*3859Sml29623 	kstat_named_t	trunk_mode;
734*3859Sml29623 
735*3859Sml29623 	/*
736*3859Sml29623 	 * Misc MAC statistics.
737*3859Sml29623 	 */
738*3859Sml29623 	kstat_named_t	ifspeed;
739*3859Sml29623 	kstat_named_t	promisc;
740*3859Sml29623 	kstat_named_t	rev_id;
741*3859Sml29623 
742*3859Sml29623 	/*
743*3859Sml29623 	 * Some statistics added to support bringup, these
744*3859Sml29623 	 * should be removed.
745*3859Sml29623 	 */
746*3859Sml29623 	kstat_named_t	user_defined;
747*3859Sml29623 } nxge_port_kstat_t, *p_nxge_port_kstat_t;
748*3859Sml29623 
749*3859Sml29623 typedef struct _nxge_rdc_kstat {
750*3859Sml29623 	/*
751*3859Sml29623 	 * Receive DMA channel statistics.
752*3859Sml29623 	 */
753*3859Sml29623 	kstat_named_t	ipackets;
754*3859Sml29623 	kstat_named_t	rbytes;
755*3859Sml29623 	kstat_named_t	errors;
756*3859Sml29623 	kstat_named_t	dcf_err;
757*3859Sml29623 	kstat_named_t	rcr_ack_err;
758*3859Sml29623 
759*3859Sml29623 	kstat_named_t	dc_fifoflow_err;
760*3859Sml29623 	kstat_named_t	rcr_sha_par_err;
761*3859Sml29623 	kstat_named_t	rbr_pre_par_err;
762*3859Sml29623 	kstat_named_t	wred_drop;
763*3859Sml29623 	kstat_named_t	rbr_pre_emty;
764*3859Sml29623 
765*3859Sml29623 	kstat_named_t	rcr_shadow_full;
766*3859Sml29623 	kstat_named_t	rbr_tmout;
767*3859Sml29623 	kstat_named_t	rsp_cnt_err;
768*3859Sml29623 	kstat_named_t	byte_en_bus;
769*3859Sml29623 	kstat_named_t	rsp_dat_err;
770*3859Sml29623 
771*3859Sml29623 	kstat_named_t	compl_l2_err;
772*3859Sml29623 	kstat_named_t	compl_l4_cksum_err;
773*3859Sml29623 	kstat_named_t	compl_zcp_soft_err;
774*3859Sml29623 	kstat_named_t	compl_fflp_soft_err;
775*3859Sml29623 	kstat_named_t	config_err;
776*3859Sml29623 
777*3859Sml29623 	kstat_named_t	rcrincon;
778*3859Sml29623 	kstat_named_t	rcrfull;
779*3859Sml29623 	kstat_named_t	rbr_empty;
780*3859Sml29623 	kstat_named_t	rbrfull;
781*3859Sml29623 	kstat_named_t	rbrlogpage;
782*3859Sml29623 
783*3859Sml29623 	kstat_named_t	cfiglogpage;
784*3859Sml29623 	kstat_named_t	port_drop_pkt;
785*3859Sml29623 	kstat_named_t	rcr_to;
786*3859Sml29623 	kstat_named_t	rcr_thresh;
787*3859Sml29623 	kstat_named_t	rcr_mex;
788*3859Sml29623 	kstat_named_t	id_mismatch;
789*3859Sml29623 	kstat_named_t	zcp_eop_err;
790*3859Sml29623 	kstat_named_t	ipp_eop_err;
791*3859Sml29623 } nxge_rdc_kstat_t, *p_nxge_rdc_kstat_t;
792*3859Sml29623 
793*3859Sml29623 typedef struct _nxge_rdc_sys_kstat {
794*3859Sml29623 	/*
795*3859Sml29623 	 * Receive DMA system statistics.
796*3859Sml29623 	 */
797*3859Sml29623 	kstat_named_t	pre_par;
798*3859Sml29623 	kstat_named_t	sha_par;
799*3859Sml29623 	kstat_named_t	id_mismatch;
800*3859Sml29623 	kstat_named_t	ipp_eop_err;
801*3859Sml29623 	kstat_named_t	zcp_eop_err;
802*3859Sml29623 } nxge_rdc_sys_kstat_t, *p_nxge_rdc_sys_kstat_t;
803*3859Sml29623 
804*3859Sml29623 typedef	struct _nxge_tdc_kstat {
805*3859Sml29623 	/*
806*3859Sml29623 	 * Transmit DMA channel statistics.
807*3859Sml29623 	 */
808*3859Sml29623 	kstat_named_t	opackets;
809*3859Sml29623 	kstat_named_t	obytes;
810*3859Sml29623 	kstat_named_t	oerrors;
811*3859Sml29623 	kstat_named_t	tx_inits;
812*3859Sml29623 	kstat_named_t	tx_no_buf;
813*3859Sml29623 
814*3859Sml29623 	kstat_named_t	mbox_err;
815*3859Sml29623 	kstat_named_t	pkt_size_err;
816*3859Sml29623 	kstat_named_t	tx_ring_oflow;
817*3859Sml29623 	kstat_named_t	pref_buf_ecc_err;
818*3859Sml29623 	kstat_named_t	nack_pref;
819*3859Sml29623 	kstat_named_t	nack_pkt_rd;
820*3859Sml29623 	kstat_named_t	conf_part_err;
821*3859Sml29623 	kstat_named_t	pkt_prt_err;
822*3859Sml29623 	kstat_named_t	reset_fail;
823*3859Sml29623 /* used to in the common (per port) counter */
824*3859Sml29623 
825*3859Sml29623 	kstat_named_t	tx_starts;
826*3859Sml29623 	kstat_named_t	tx_nocanput;
827*3859Sml29623 	kstat_named_t	tx_msgdup_fail;
828*3859Sml29623 	kstat_named_t	tx_allocb_fail;
829*3859Sml29623 	kstat_named_t	tx_no_desc;
830*3859Sml29623 	kstat_named_t	tx_dma_bind_fail;
831*3859Sml29623 	kstat_named_t	tx_uflo;
832*3859Sml29623 	kstat_named_t	tx_hdr_pkts;
833*3859Sml29623 	kstat_named_t	tx_ddi_pkts;
834*3859Sml29623 	kstat_named_t	tx_dvma_pkts;
835*3859Sml29623 	kstat_named_t	tx_max_pend;
836*3859Sml29623 } nxge_tdc_kstat_t, *p_nxge_tdc_kstat_t;
837*3859Sml29623 
838*3859Sml29623 typedef	struct _nxge_txc_kstat {
839*3859Sml29623 	/*
840*3859Sml29623 	 * Transmit port TXC block statistics.
841*3859Sml29623 	 */
842*3859Sml29623 	kstat_named_t	pkt_stuffed;
843*3859Sml29623 	kstat_named_t	pkt_xmit;
844*3859Sml29623 	kstat_named_t	ro_correct_err;
845*3859Sml29623 	kstat_named_t	ro_uncorrect_err;
846*3859Sml29623 	kstat_named_t	sf_correct_err;
847*3859Sml29623 	kstat_named_t	sf_uncorrect_err;
848*3859Sml29623 	kstat_named_t	address_failed;
849*3859Sml29623 	kstat_named_t	dma_failed;
850*3859Sml29623 	kstat_named_t	length_failed;
851*3859Sml29623 	kstat_named_t	pkt_assy_dead;
852*3859Sml29623 	kstat_named_t	reorder_err;
853*3859Sml29623 } nxge_txc_kstat_t, *p_nxge_txc_kstat_t;
854*3859Sml29623 
855*3859Sml29623 typedef struct _nxge_ipp_kstat {
856*3859Sml29623 	/*
857*3859Sml29623 	 * Receive port IPP block statistics.
858*3859Sml29623 	 */
859*3859Sml29623 	kstat_named_t	eop_miss;
860*3859Sml29623 	kstat_named_t	sop_miss;
861*3859Sml29623 	kstat_named_t	dfifo_ue;
862*3859Sml29623 	kstat_named_t	ecc_err_cnt;
863*3859Sml29623 	kstat_named_t	dfifo_perr;
864*3859Sml29623 	kstat_named_t	pfifo_over;
865*3859Sml29623 	kstat_named_t	pfifo_und;
866*3859Sml29623 	kstat_named_t	bad_cs_cnt;
867*3859Sml29623 	kstat_named_t	pkt_dis_cnt;
868*3859Sml29623 	kstat_named_t	cs_fail;
869*3859Sml29623 } nxge_ipp_kstat_t, *p_nxge_ipp_kstat_t;
870*3859Sml29623 
871*3859Sml29623 typedef	struct _nxge_zcp_kstat {
872*3859Sml29623 	/*
873*3859Sml29623 	 * ZCP statistics.
874*3859Sml29623 	 */
875*3859Sml29623 	kstat_named_t	errors;
876*3859Sml29623 	kstat_named_t	inits;
877*3859Sml29623 	kstat_named_t	rrfifo_underrun;
878*3859Sml29623 	kstat_named_t	rrfifo_overrun;
879*3859Sml29623 	kstat_named_t	rspfifo_uncorr_err;
880*3859Sml29623 	kstat_named_t	buffer_overflow;
881*3859Sml29623 	kstat_named_t	stat_tbl_perr;
882*3859Sml29623 	kstat_named_t	dyn_tbl_perr;
883*3859Sml29623 	kstat_named_t	buf_tbl_perr;
884*3859Sml29623 	kstat_named_t	tt_program_err;
885*3859Sml29623 	kstat_named_t	rsp_tt_index_err;
886*3859Sml29623 	kstat_named_t	slv_tt_index_err;
887*3859Sml29623 	kstat_named_t	zcp_tt_index_err;
888*3859Sml29623 	kstat_named_t	access_fail;
889*3859Sml29623 	kstat_named_t	cfifo_ecc;
890*3859Sml29623 } nxge_zcp_kstat_t, *p_nxge_zcp_kstat_t;
891*3859Sml29623 
892*3859Sml29623 typedef	struct _nxge_mac_kstat {
893*3859Sml29623 	/*
894*3859Sml29623 	 * Transmit MAC statistics.
895*3859Sml29623 	 */
896*3859Sml29623 	kstat_named_t	tx_frame_cnt;
897*3859Sml29623 	kstat_named_t	tx_underflow_err;
898*3859Sml29623 	kstat_named_t	tx_overflow_err;
899*3859Sml29623 	kstat_named_t	tx_maxpktsize_err;
900*3859Sml29623 	kstat_named_t	tx_fifo_xfr_err;
901*3859Sml29623 	kstat_named_t	tx_byte_cnt;
902*3859Sml29623 
903*3859Sml29623 	/*
904*3859Sml29623 	 * Receive MAC statistics.
905*3859Sml29623 	 */
906*3859Sml29623 	kstat_named_t	rx_frame_cnt;
907*3859Sml29623 	kstat_named_t	rx_underflow_err;
908*3859Sml29623 	kstat_named_t	rx_overflow_err;
909*3859Sml29623 	kstat_named_t	rx_len_err_cnt;
910*3859Sml29623 	kstat_named_t	rx_crc_err_cnt;
911*3859Sml29623 	kstat_named_t	rx_viol_err_cnt;
912*3859Sml29623 	kstat_named_t	rx_byte_cnt;
913*3859Sml29623 	kstat_named_t	rx_hist1_cnt;
914*3859Sml29623 	kstat_named_t	rx_hist2_cnt;
915*3859Sml29623 	kstat_named_t	rx_hist3_cnt;
916*3859Sml29623 	kstat_named_t	rx_hist4_cnt;
917*3859Sml29623 	kstat_named_t	rx_hist5_cnt;
918*3859Sml29623 	kstat_named_t	rx_hist6_cnt;
919*3859Sml29623 	kstat_named_t	rx_broadcast_cnt;
920*3859Sml29623 	kstat_named_t	rx_mult_cnt;
921*3859Sml29623 	kstat_named_t	rx_frag_cnt;
922*3859Sml29623 	kstat_named_t	rx_frame_align_err_cnt;
923*3859Sml29623 	kstat_named_t	rx_linkfault_err_cnt;
924*3859Sml29623 	kstat_named_t	rx_local_fault_err_cnt;
925*3859Sml29623 	kstat_named_t	rx_remote_fault_err_cnt;
926*3859Sml29623 } nxge_mac_kstat_t, *p_nxge_mac_kstat_t;
927*3859Sml29623 
928*3859Sml29623 typedef	struct _nxge_xmac_kstat {
929*3859Sml29623 	/*
930*3859Sml29623 	 * XMAC statistics.
931*3859Sml29623 	 */
932*3859Sml29623 	kstat_named_t	tx_frame_cnt;
933*3859Sml29623 	kstat_named_t	tx_underflow_err;
934*3859Sml29623 	kstat_named_t	tx_maxpktsize_err;
935*3859Sml29623 	kstat_named_t	tx_overflow_err;
936*3859Sml29623 	kstat_named_t	tx_fifo_xfr_err;
937*3859Sml29623 	kstat_named_t	tx_byte_cnt;
938*3859Sml29623 	kstat_named_t	rx_frame_cnt;
939*3859Sml29623 	kstat_named_t	rx_underflow_err;
940*3859Sml29623 	kstat_named_t	rx_overflow_err;
941*3859Sml29623 	kstat_named_t	rx_crc_err_cnt;
942*3859Sml29623 	kstat_named_t	rx_len_err_cnt;
943*3859Sml29623 	kstat_named_t	rx_viol_err_cnt;
944*3859Sml29623 	kstat_named_t	rx_byte_cnt;
945*3859Sml29623 	kstat_named_t	rx_hist1_cnt;
946*3859Sml29623 	kstat_named_t	rx_hist2_cnt;
947*3859Sml29623 	kstat_named_t	rx_hist3_cnt;
948*3859Sml29623 	kstat_named_t	rx_hist4_cnt;
949*3859Sml29623 	kstat_named_t	rx_hist5_cnt;
950*3859Sml29623 	kstat_named_t	rx_hist6_cnt;
951*3859Sml29623 	kstat_named_t	rx_hist7_cnt;
952*3859Sml29623 	kstat_named_t	rx_broadcast_cnt;
953*3859Sml29623 	kstat_named_t	rx_mult_cnt;
954*3859Sml29623 	kstat_named_t	rx_frag_cnt;
955*3859Sml29623 	kstat_named_t	rx_frame_align_err_cnt;
956*3859Sml29623 	kstat_named_t	rx_linkfault_err_cnt;
957*3859Sml29623 	kstat_named_t	rx_remote_fault_err_cnt;
958*3859Sml29623 	kstat_named_t	rx_local_fault_err_cnt;
959*3859Sml29623 	kstat_named_t	rx_pause_cnt;
960*3859Sml29623 	kstat_named_t	xpcs_deskew_err_cnt;
961*3859Sml29623 	kstat_named_t	xpcs_ln0_symbol_err_cnt;
962*3859Sml29623 	kstat_named_t	xpcs_ln1_symbol_err_cnt;
963*3859Sml29623 	kstat_named_t	xpcs_ln2_symbol_err_cnt;
964*3859Sml29623 	kstat_named_t	xpcs_ln3_symbol_err_cnt;
965*3859Sml29623 } nxge_xmac_kstat_t, *p_nxge_xmac_kstat_t;
966*3859Sml29623 
967*3859Sml29623 typedef	struct _nxge_bmac_kstat {
968*3859Sml29623 	/*
969*3859Sml29623 	 * BMAC statistics.
970*3859Sml29623 	 */
971*3859Sml29623 	kstat_named_t tx_frame_cnt;
972*3859Sml29623 	kstat_named_t tx_underrun_err;
973*3859Sml29623 	kstat_named_t tx_max_pkt_err;
974*3859Sml29623 	kstat_named_t tx_byte_cnt;
975*3859Sml29623 	kstat_named_t rx_frame_cnt;
976*3859Sml29623 	kstat_named_t rx_byte_cnt;
977*3859Sml29623 	kstat_named_t rx_overflow_err;
978*3859Sml29623 	kstat_named_t rx_align_err_cnt;
979*3859Sml29623 	kstat_named_t rx_crc_err_cnt;
980*3859Sml29623 	kstat_named_t rx_len_err_cnt;
981*3859Sml29623 	kstat_named_t rx_viol_err_cnt;
982*3859Sml29623 	kstat_named_t rx_pause_cnt;
983*3859Sml29623 	kstat_named_t tx_pause_state;
984*3859Sml29623 	kstat_named_t tx_nopause_state;
985*3859Sml29623 } nxge_bmac_kstat_t, *p_nxge_bmac_kstat_t;
986*3859Sml29623 
987*3859Sml29623 
988*3859Sml29623 typedef struct _nxge_fflp_kstat {
989*3859Sml29623 	/*
990*3859Sml29623 	 * FFLP statistics.
991*3859Sml29623 	 */
992*3859Sml29623 
993*3859Sml29623 	kstat_named_t	fflp_tcam_ecc_err;
994*3859Sml29623 	kstat_named_t	fflp_tcam_perr;
995*3859Sml29623 	kstat_named_t	fflp_vlan_perr;
996*3859Sml29623 	kstat_named_t	fflp_hasht_lookup_err;
997*3859Sml29623 	kstat_named_t	fflp_access_fail;
998*3859Sml29623 	kstat_named_t	fflp_hasht_data_err[MAX_PARTITION];
999*3859Sml29623 } nxge_fflp_kstat_t, *p_nxge_fflp_kstat_t;
1000*3859Sml29623 
1001*3859Sml29623 typedef struct _nxge_mmac_kstat {
1002*3859Sml29623 	kstat_named_t	mmac_max_addr_cnt;
1003*3859Sml29623 	kstat_named_t	mmac_avail_addr_cnt;
1004*3859Sml29623 	kstat_named_t	mmac_addr1;
1005*3859Sml29623 	kstat_named_t	mmac_addr2;
1006*3859Sml29623 	kstat_named_t	mmac_addr3;
1007*3859Sml29623 	kstat_named_t	mmac_addr4;
1008*3859Sml29623 	kstat_named_t	mmac_addr5;
1009*3859Sml29623 	kstat_named_t	mmac_addr6;
1010*3859Sml29623 	kstat_named_t	mmac_addr7;
1011*3859Sml29623 	kstat_named_t	mmac_addr8;
1012*3859Sml29623 	kstat_named_t	mmac_addr9;
1013*3859Sml29623 	kstat_named_t	mmac_addr10;
1014*3859Sml29623 	kstat_named_t	mmac_addr11;
1015*3859Sml29623 	kstat_named_t	mmac_addr12;
1016*3859Sml29623 	kstat_named_t	mmac_addr13;
1017*3859Sml29623 	kstat_named_t	mmac_addr14;
1018*3859Sml29623 	kstat_named_t	mmac_addr15;
1019*3859Sml29623 	kstat_named_t	mmac_addr16;
1020*3859Sml29623 } nxge_mmac_kstat_t, *p_nxge_mmac_kstat_t;
1021*3859Sml29623 
1022*3859Sml29623 #endif	/* _KERNEL */
1023*3859Sml29623 
1024*3859Sml29623 /*
1025*3859Sml29623  * Prototype definitions.
1026*3859Sml29623  */
1027*3859Sml29623 nxge_status_t nxge_init(p_nxge_t);
1028*3859Sml29623 void nxge_uninit(p_nxge_t);
1029*3859Sml29623 void nxge_get64(p_nxge_t, p_mblk_t);
1030*3859Sml29623 void nxge_put64(p_nxge_t, p_mblk_t);
1031*3859Sml29623 void nxge_pio_loop(p_nxge_t, p_mblk_t);
1032*3859Sml29623 
1033*3859Sml29623 #ifndef COSIM
1034*3859Sml29623 typedef	void	(*fptrv_t)();
1035*3859Sml29623 timeout_id_t nxge_start_timer(p_nxge_t, fptrv_t, int);
1036*3859Sml29623 void nxge_stop_timer(p_nxge_t, timeout_id_t);
1037*3859Sml29623 #endif
1038*3859Sml29623 #endif
1039*3859Sml29623 
1040*3859Sml29623 #ifdef	__cplusplus
1041*3859Sml29623 }
1042*3859Sml29623 #endif
1043*3859Sml29623 
1044*3859Sml29623 #endif	/* _SYS_NXGE_NXGE_H */
1045