xref: /onnv-gate/usr/src/uts/common/sys/nxge/nxge.h (revision 5572:7ca08041cf00)
13859Sml29623 /*
23859Sml29623  * CDDL HEADER START
33859Sml29623  *
43859Sml29623  * The contents of this file are subject to the terms of the
53859Sml29623  * Common Development and Distribution License (the "License").
63859Sml29623  * You may not use this file except in compliance with the License.
73859Sml29623  *
83859Sml29623  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93859Sml29623  * or http://www.opensolaris.org/os/licensing.
103859Sml29623  * See the License for the specific language governing permissions
113859Sml29623  * and limitations under the License.
123859Sml29623  *
133859Sml29623  * When distributing Covered Code, include this CDDL HEADER in each
143859Sml29623  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153859Sml29623  * If applicable, add the following below this CDDL HEADER, with the
163859Sml29623  * fields enclosed by brackets "[]" replaced with your own identifying
173859Sml29623  * information: Portions Copyright [yyyy] [name of copyright owner]
183859Sml29623  *
193859Sml29623  * CDDL HEADER END
203859Sml29623  */
213859Sml29623 /*
223859Sml29623  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
233859Sml29623  * Use is subject to license terms.
243859Sml29623  */
253859Sml29623 
263859Sml29623 #ifndef	_SYS_NXGE_NXGE_H
273859Sml29623 #define	_SYS_NXGE_NXGE_H
283859Sml29623 
293859Sml29623 #pragma ident	"%Z%%M%	%I%	%E% SMI"
303859Sml29623 
313859Sml29623 #ifdef	__cplusplus
323859Sml29623 extern "C" {
333859Sml29623 #endif
343859Sml29623 
353859Sml29623 #if defined(_KERNEL) || defined(COSIM)
363859Sml29623 #include <nxge_mac.h>
373859Sml29623 #include <nxge_ipp.h>
383859Sml29623 #include <nxge_fflp.h>
393859Sml29623 #endif
403859Sml29623 
413859Sml29623 /*
423859Sml29623  * NXGE diagnostics IOCTLS.
433859Sml29623  */
443859Sml29623 #define	NXGE_IOC		((((('N' << 8) + 'X') << 8) + 'G') << 8)
453859Sml29623 
463859Sml29623 #define	NXGE_GET64		(NXGE_IOC|1)
473859Sml29623 #define	NXGE_PUT64		(NXGE_IOC|2)
483859Sml29623 #define	NXGE_GET_TX_RING_SZ	(NXGE_IOC|3)
493859Sml29623 #define	NXGE_GET_TX_DESC	(NXGE_IOC|4)
503859Sml29623 #define	NXGE_GLOBAL_RESET	(NXGE_IOC|5)
513859Sml29623 #define	NXGE_TX_SIDE_RESET	(NXGE_IOC|6)
523859Sml29623 #define	NXGE_RX_SIDE_RESET	(NXGE_IOC|7)
533859Sml29623 #define	NXGE_RESET_MAC		(NXGE_IOC|8)
543859Sml29623 
553859Sml29623 #define	NXGE_GET_MII		(NXGE_IOC|11)
563859Sml29623 #define	NXGE_PUT_MII		(NXGE_IOC|12)
573859Sml29623 #define	NXGE_RTRACE		(NXGE_IOC|13)
583859Sml29623 #define	NXGE_RTRACE_TEST	(NXGE_IOC|20)
593859Sml29623 #define	NXGE_TX_REGS_DUMP	(NXGE_IOC|21)
603859Sml29623 #define	NXGE_RX_REGS_DUMP	(NXGE_IOC|22)
613859Sml29623 #define	NXGE_INT_REGS_DUMP	(NXGE_IOC|23)
623859Sml29623 #define	NXGE_VIR_REGS_DUMP	(NXGE_IOC|24)
633859Sml29623 #define	NXGE_VIR_INT_REGS_DUMP	(NXGE_IOC|25)
643859Sml29623 #define	NXGE_RDUMP		(NXGE_IOC|26)
653859Sml29623 #define	NXGE_RDC_GRPS_DUMP	(NXGE_IOC|27)
663859Sml29623 #define	NXGE_PIO_TEST		(NXGE_IOC|28)
673859Sml29623 
683859Sml29623 #define	NXGE_GET_TCAM		(NXGE_IOC|29)
693859Sml29623 #define	NXGE_PUT_TCAM		(NXGE_IOC|30)
703859Sml29623 #define	NXGE_INJECT_ERR		(NXGE_IOC|40)
713859Sml29623 
723859Sml29623 #if (defined(SOLARIS) && defined(_KERNEL)) || defined(COSIM)
733859Sml29623 #define	NXGE_OK			0
743859Sml29623 #define	NXGE_ERROR		0x40000000
753859Sml29623 #define	NXGE_DDI_FAILED		0x20000000
763859Sml29623 #define	NXGE_GET_PORT_NUM(n)	n
773859Sml29623 
783859Sml29623 /*
793859Sml29623  * Definitions for module_info.
803859Sml29623  */
813859Sml29623 #define	NXGE_IDNUM		(0)			/* module ID number */
823859Sml29623 #define	NXGE_DRIVER_NAME	"nxge"			/* module name */
833859Sml29623 
843859Sml29623 #define	NXGE_MINPSZ		(0)			/* min packet size */
853859Sml29623 #define	NXGE_MAXPSZ		(ETHERMTU)		/* max packet size */
863859Sml29623 #define	NXGE_HIWAT		(2048 * NXGE_MAXPSZ)	/* hi-water mark */
873859Sml29623 #define	NXGE_LOWAT		(1)			/* lo-water mark */
883859Sml29623 #define	NXGE_HIWAT_MAX		(192000 * NXGE_MAXPSZ)
893859Sml29623 #define	NXGE_HIWAT_MIN		(2 * NXGE_MAXPSZ)
903859Sml29623 #define	NXGE_LOWAT_MAX		(192000 * NXGE_MAXPSZ)
913859Sml29623 #define	NXGE_LOWAT_MIN		(1)
923859Sml29623 
933859Sml29623 #ifndef	D_HOTPLUG
943859Sml29623 #define	D_HOTPLUG		0x00
953859Sml29623 #endif
963859Sml29623 
973859Sml29623 #define	INIT_BUCKET_SIZE	16	/* Initial Hash Bucket Size */
983859Sml29623 
993859Sml29623 #define	NXGE_CHECK_TIMER	(5000)
1003859Sml29623 
1013859Sml29623 typedef enum {
1023859Sml29623 	param_instance,
1033859Sml29623 	param_main_instance,
1043859Sml29623 	param_function_number,
1053859Sml29623 	param_partition_id,
1063859Sml29623 	param_read_write_mode,
1074185Sspeer 	param_fw_version,
1084977Sraghus 	param_port_mode,
1093859Sml29623 	param_niu_cfg_type,
1103859Sml29623 	param_tx_quick_cfg,
1113859Sml29623 	param_rx_quick_cfg,
1123859Sml29623 	param_master_cfg_enable,
1133859Sml29623 	param_master_cfg_value,
1143859Sml29623 
1153859Sml29623 	param_autoneg,
1163859Sml29623 	param_anar_10gfdx,
1173859Sml29623 	param_anar_10ghdx,
1183859Sml29623 	param_anar_1000fdx,
1193859Sml29623 	param_anar_1000hdx,
1203859Sml29623 	param_anar_100T4,
1213859Sml29623 	param_anar_100fdx,
1223859Sml29623 	param_anar_100hdx,
1233859Sml29623 	param_anar_10fdx,
1243859Sml29623 	param_anar_10hdx,
1253859Sml29623 
1263859Sml29623 	param_anar_asmpause,
1273859Sml29623 	param_anar_pause,
1283859Sml29623 	param_use_int_xcvr,
1293859Sml29623 	param_enable_ipg0,
1303859Sml29623 	param_ipg0,
1313859Sml29623 	param_ipg1,
1323859Sml29623 	param_ipg2,
1333859Sml29623 	param_accept_jumbo,
1343859Sml29623 	param_txdma_weight,
1353859Sml29623 	param_txdma_channels_begin,
1363859Sml29623 
1373859Sml29623 	param_txdma_channels,
1383859Sml29623 	param_txdma_info,
1393859Sml29623 	param_rxdma_channels_begin,
1403859Sml29623 	param_rxdma_channels,
1413859Sml29623 	param_rxdma_drr_weight,
1423859Sml29623 	param_rxdma_full_header,
1433859Sml29623 	param_rxdma_info,
1443859Sml29623 	param_rxdma_rbr_size,
1453859Sml29623 	param_rxdma_rcr_size,
1463859Sml29623 	param_default_port_rdc,
1473859Sml29623 	param_rxdma_intr_time,
1483859Sml29623 	param_rxdma_intr_pkts,
1493859Sml29623 
1503859Sml29623 	param_rdc_grps_start,
1513859Sml29623 	param_rx_rdc_grps,
1523859Sml29623 	param_default_grp0_rdc,
1533859Sml29623 	param_default_grp1_rdc,
1543859Sml29623 	param_default_grp2_rdc,
1553859Sml29623 	param_default_grp3_rdc,
1563859Sml29623 	param_default_grp4_rdc,
1573859Sml29623 	param_default_grp5_rdc,
1583859Sml29623 	param_default_grp6_rdc,
1593859Sml29623 	param_default_grp7_rdc,
1603859Sml29623 
1613859Sml29623 	param_info_rdc_groups,
1623859Sml29623 	param_start_ldg,
1633859Sml29623 	param_max_ldg,
1643859Sml29623 	param_mac_2rdc_grp,
1653859Sml29623 	param_vlan_2rdc_grp,
1663859Sml29623 	param_fcram_part_cfg,
1673859Sml29623 	param_fcram_access_ratio,
1683859Sml29623 	param_tcam_access_ratio,
1693859Sml29623 	param_tcam_enable,
1703859Sml29623 	param_hash_lookup_enable,
1713859Sml29623 	param_llc_snap_enable,
1723859Sml29623 
1733859Sml29623 	param_h1_init_value,
1743859Sml29623 	param_h2_init_value,
1753859Sml29623 	param_class_cfg_ether_usr1,
1763859Sml29623 	param_class_cfg_ether_usr2,
1773859Sml29623 	param_class_cfg_ip_usr4,
1783859Sml29623 	param_class_cfg_ip_usr5,
1793859Sml29623 	param_class_cfg_ip_usr6,
1803859Sml29623 	param_class_cfg_ip_usr7,
1813859Sml29623 	param_class_opt_ip_usr4,
1823859Sml29623 	param_class_opt_ip_usr5,
1833859Sml29623 	param_class_opt_ip_usr6,
1843859Sml29623 	param_class_opt_ip_usr7,
1853859Sml29623 	param_class_opt_ipv4_tcp,
1863859Sml29623 	param_class_opt_ipv4_udp,
1873859Sml29623 	param_class_opt_ipv4_ah,
1883859Sml29623 	param_class_opt_ipv4_sctp,
1893859Sml29623 	param_class_opt_ipv6_tcp,
1903859Sml29623 	param_class_opt_ipv6_udp,
1913859Sml29623 	param_class_opt_ipv6_ah,
1923859Sml29623 	param_class_opt_ipv6_sctp,
1933859Sml29623 	param_nxge_debug_flag,
1943859Sml29623 	param_npi_debug_flag,
1953859Sml29623 	param_dump_rdc,
1963859Sml29623 	param_dump_tdc,
1973859Sml29623 	param_dump_mac_regs,
1983859Sml29623 	param_dump_ipp_regs,
1993859Sml29623 	param_dump_fflp_regs,
2003859Sml29623 	param_dump_vlan_table,
2013859Sml29623 	param_dump_rdc_table,
2023859Sml29623 	param_dump_ptrs,
2033859Sml29623 	param_end
2043859Sml29623 } nxge_param_index_t;
2053859Sml29623 
2063859Sml29623 
2073859Sml29623 /*
2083859Sml29623  * Named Dispatch Parameter Management Structure
2093859Sml29623  */
2103859Sml29623 typedef	int (*nxge_ndgetf_t)(p_nxge_t, queue_t *, MBLKP, caddr_t, cred_t *);
2113859Sml29623 typedef	int (*nxge_ndsetf_t)(p_nxge_t, queue_t *,
2123859Sml29623 	    MBLKP, char *, caddr_t, cred_t *);
2133859Sml29623 
2143859Sml29623 #define	NXGE_PARAM_READ			0x00000001ULL
2153859Sml29623 #define	NXGE_PARAM_WRITE		0x00000002ULL
2163859Sml29623 #define	NXGE_PARAM_SHARED		0x00000004ULL
2173859Sml29623 #define	NXGE_PARAM_PRIV			0x00000008ULL
2183859Sml29623 #define	NXGE_PARAM_RW			NXGE_PARAM_READ | NXGE_PARAM_WRITE
2193859Sml29623 #define	NXGE_PARAM_RWS			NXGE_PARAM_RW | NXGE_PARAM_SHARED
2203859Sml29623 #define	NXGE_PARAM_RWP			NXGE_PARAM_RW | NXGE_PARAM_PRIV
2213859Sml29623 
2223859Sml29623 #define	NXGE_PARAM_RXDMA		0x00000010ULL
2233859Sml29623 #define	NXGE_PARAM_TXDMA		0x00000020ULL
2243859Sml29623 #define	NXGE_PARAM_CLASS_GEN	0x00000040ULL
2253859Sml29623 #define	NXGE_PARAM_MAC			0x00000080ULL
2263859Sml29623 #define	NXGE_PARAM_CLASS_BIN	NXGE_PARAM_CLASS_GEN | NXGE_PARAM_BASE_BIN
2273859Sml29623 #define	NXGE_PARAM_CLASS_HEX	NXGE_PARAM_CLASS_GEN | NXGE_PARAM_BASE_HEX
2283859Sml29623 #define	NXGE_PARAM_CLASS		NXGE_PARAM_CLASS_HEX
2293859Sml29623 
2303859Sml29623 #define	NXGE_PARAM_CMPLX		0x00010000ULL
2313859Sml29623 #define	NXGE_PARAM_NDD_WR_OK		0x00020000ULL
2323859Sml29623 #define	NXGE_PARAM_INIT_ONLY		0x00040000ULL
2333859Sml29623 #define	NXGE_PARAM_INIT_CONFIG		0x00080000ULL
2343859Sml29623 
2353859Sml29623 #define	NXGE_PARAM_READ_PROP		0x00100000ULL
2363859Sml29623 #define	NXGE_PARAM_PROP_ARR32		0x00200000ULL
2373859Sml29623 #define	NXGE_PARAM_PROP_ARR64		0x00400000ULL
2383859Sml29623 #define	NXGE_PARAM_PROP_STR		0x00800000ULL
2393859Sml29623 
2403859Sml29623 #define	NXGE_PARAM_BASE_DEC		0x00000000ULL
2413859Sml29623 #define	NXGE_PARAM_BASE_BIN		0x10000000ULL
2423859Sml29623 #define	NXGE_PARAM_BASE_HEX		0x20000000ULL
2433859Sml29623 #define	NXGE_PARAM_BASE_STR		0x40000000ULL
2443859Sml29623 #define	NXGE_PARAM_DONT_SHOW		0x80000000ULL
2453859Sml29623 
2463859Sml29623 #define	NXGE_PARAM_ARRAY_CNT_MASK	0x0000ffff00000000ULL
2473859Sml29623 #define	NXGE_PARAM_ARRAY_CNT_SHIFT	32ULL
2483859Sml29623 #define	NXGE_PARAM_ARRAY_ALLOC_MASK	0xffff000000000000ULL
2493859Sml29623 #define	NXGE_PARAM_ARRAY_ALLOC_SHIFT	48ULL
2503859Sml29623 
2513859Sml29623 typedef struct _nxge_param_t {
2523859Sml29623 	int (*getf)();
2533859Sml29623 	int (*setf)();   /* null for read only */
2543859Sml29623 	uint64_t type;  /* R/W/ Common/Port/ .... */
2553859Sml29623 	uint64_t minimum;
2563859Sml29623 	uint64_t maximum;
2573859Sml29623 	uint64_t value;	/* for array params, pointer to value array */
2583859Sml29623 	uint64_t old_value; /* for array params, pointer to old_value array */
2593859Sml29623 	char   *fcode_name;
2603859Sml29623 	char   *name;
2613859Sml29623 } nxge_param_t, *p_nxge_param_t;
2623859Sml29623 
2633859Sml29623 
2643859Sml29623 
2653859Sml29623 typedef enum {
2663859Sml29623 	nxge_lb_normal,
2673859Sml29623 	nxge_lb_ext10g,
2683859Sml29623 	nxge_lb_ext1000,
2693859Sml29623 	nxge_lb_ext100,
2703859Sml29623 	nxge_lb_ext10,
2713859Sml29623 	nxge_lb_phy10g,
2723859Sml29623 	nxge_lb_phy1000,
2733859Sml29623 	nxge_lb_phy,
2743859Sml29623 	nxge_lb_serdes10g,
2753859Sml29623 	nxge_lb_serdes1000,
2763859Sml29623 	nxge_lb_serdes,
2773859Sml29623 	nxge_lb_mac10g,
2783859Sml29623 	nxge_lb_mac1000,
2793859Sml29623 	nxge_lb_mac
2803859Sml29623 } nxge_lb_t;
2813859Sml29623 
2823859Sml29623 enum nxge_mac_state {
2833859Sml29623 	NXGE_MAC_STOPPED = 0,
2843859Sml29623 	NXGE_MAC_STARTED
2853859Sml29623 };
2863859Sml29623 
2873859Sml29623 /*
2883859Sml29623  * Private DLPI full dlsap address format.
2893859Sml29623  */
2903859Sml29623 typedef struct _nxge_dladdr_t {
2913859Sml29623 	ether_addr_st dl_phys;
2923859Sml29623 	uint16_t dl_sap;
2933859Sml29623 } nxge_dladdr_t, *p_nxge_dladdr_t;
2943859Sml29623 
2953859Sml29623 typedef struct _mc_addr_t {
2963859Sml29623 	ether_addr_st multcast_addr;
2973859Sml29623 	uint_t mc_addr_cnt;
2983859Sml29623 } mc_addr_t, *p_mc_addr_t;
2993859Sml29623 
3003859Sml29623 typedef struct _mc_bucket_t {
3013859Sml29623 	p_mc_addr_t addr_list;
3023859Sml29623 	uint_t list_size;
3033859Sml29623 } mc_bucket_t, *p_mc_bucket_t;
3043859Sml29623 
3053859Sml29623 typedef struct _mc_table_t {
3063859Sml29623 	p_mc_bucket_t bucket_list;
3073859Sml29623 	uint_t buckets_used;
3083859Sml29623 } mc_table_t, *p_mc_table_t;
3093859Sml29623 
3103859Sml29623 typedef struct _filter_t {
3113859Sml29623 	uint32_t all_phys_cnt;
3123859Sml29623 	uint32_t all_multicast_cnt;
3133859Sml29623 	uint32_t all_sap_cnt;
3143859Sml29623 } filter_t, *p_filter_t;
3153859Sml29623 
3163859Sml29623 #if defined(_KERNEL) || defined(COSIM)
3173859Sml29623 
3183859Sml29623 
3193859Sml29623 typedef struct _nxge_port_stats_t {
3203859Sml29623 	/*
3213859Sml29623 	 *  Overall structure size
3223859Sml29623 	 */
3233859Sml29623 	size_t			stats_size;
3243859Sml29623 
3253859Sml29623 	/*
3263859Sml29623 	 * Link Input/Output stats
3273859Sml29623 	 */
3283859Sml29623 	uint64_t		ipackets;
3293859Sml29623 	uint64_t		ierrors;
3303859Sml29623 	uint64_t		opackets;
3313859Sml29623 	uint64_t		oerrors;
3323859Sml29623 	uint64_t		collisions;
3333859Sml29623 
3343859Sml29623 	/*
3353859Sml29623 	 * MIB II variables
3363859Sml29623 	 */
3373859Sml29623 	uint64_t		rbytes;    /* # bytes received */
3383859Sml29623 	uint64_t		obytes;    /* # bytes transmitted */
3393859Sml29623 	uint32_t		multircv;  /* # multicast packets received */
3403859Sml29623 	uint32_t		multixmt;  /* # multicast packets for xmit */
3413859Sml29623 	uint32_t		brdcstrcv; /* # broadcast packets received */
3423859Sml29623 	uint32_t		brdcstxmt; /* # broadcast packets for xmit */
3433859Sml29623 	uint32_t		norcvbuf;  /* # rcv packets discarded */
3443859Sml29623 	uint32_t		noxmtbuf;  /* # xmit packets discarded */
3453859Sml29623 
3463859Sml29623 	/*
3473859Sml29623 	 * Lets the user know the MTU currently in use by
3483859Sml29623 	 * the physical MAC port.
3493859Sml29623 	 */
3503859Sml29623 	nxge_lb_t		lb_mode;
3513859Sml29623 	uint32_t		qos_mode;
3523859Sml29623 	uint32_t		trunk_mode;
3533859Sml29623 	uint32_t		poll_mode;
3543859Sml29623 
3553859Sml29623 	/*
3563859Sml29623 	 * Tx Statistics.
3573859Sml29623 	 */
3583859Sml29623 	uint32_t		tx_inits;
3593859Sml29623 	uint32_t		tx_starts;
3603859Sml29623 	uint32_t		tx_nocanput;
3613859Sml29623 	uint32_t		tx_msgdup_fail;
3623859Sml29623 	uint32_t		tx_allocb_fail;
3633859Sml29623 	uint32_t		tx_no_desc;
3643859Sml29623 	uint32_t		tx_dma_bind_fail;
3653859Sml29623 	uint32_t		tx_uflo;
3663859Sml29623 	uint32_t		tx_hdr_pkts;
3673859Sml29623 	uint32_t		tx_ddi_pkts;
3683859Sml29623 	uint32_t		tx_dvma_pkts;
3693859Sml29623 
3703859Sml29623 	uint32_t		tx_max_pend;
3713859Sml29623 
3723859Sml29623 	/*
3733859Sml29623 	 * Rx Statistics.
3743859Sml29623 	 */
3753859Sml29623 	uint32_t		rx_inits;
3763859Sml29623 	uint32_t		rx_hdr_pkts;
3773859Sml29623 	uint32_t		rx_mtu_pkts;
3783859Sml29623 	uint32_t		rx_split_pkts;
3793859Sml29623 	uint32_t		rx_no_buf;
3803859Sml29623 	uint32_t		rx_no_comp_wb;
3813859Sml29623 	uint32_t		rx_ov_flow;
3823859Sml29623 	uint32_t		rx_len_mm;
3833859Sml29623 	uint32_t		rx_tag_err;
3843859Sml29623 	uint32_t		rx_nocanput;
3853859Sml29623 	uint32_t		rx_msgdup_fail;
3863859Sml29623 	uint32_t		rx_allocb_fail;
3873859Sml29623 
3883859Sml29623 	/*
3893859Sml29623 	 * Receive buffer management statistics.
3903859Sml29623 	 */
3913859Sml29623 	uint32_t		rx_new_pages;
3923859Sml29623 	uint32_t		rx_new_hdr_pgs;
3933859Sml29623 	uint32_t		rx_new_mtu_pgs;
3943859Sml29623 	uint32_t		rx_new_nxt_pgs;
3953859Sml29623 	uint32_t		rx_reused_pgs;
3963859Sml29623 	uint32_t		rx_hdr_drops;
3973859Sml29623 	uint32_t		rx_mtu_drops;
3983859Sml29623 	uint32_t		rx_nxt_drops;
3993859Sml29623 
4003859Sml29623 	/*
4013859Sml29623 	 * Receive flow statistics
4023859Sml29623 	 */
4033859Sml29623 	uint32_t		rx_rel_flow;
4043859Sml29623 	uint32_t		rx_rel_bit;
4053859Sml29623 
4063859Sml29623 	uint32_t		rx_pkts_dropped;
4073859Sml29623 
4083859Sml29623 	/*
4093859Sml29623 	 * PCI-E Bus Statistics.
4103859Sml29623 	 */
4113859Sml29623 	uint32_t		pci_bus_speed;
4123859Sml29623 	uint32_t		pci_err;
4133859Sml29623 	uint32_t		pci_rta_err;
4143859Sml29623 	uint32_t		pci_rma_err;
4153859Sml29623 	uint32_t		pci_parity_err;
4163859Sml29623 	uint32_t		pci_bad_ack_err;
4173859Sml29623 	uint32_t		pci_drto_err;
4183859Sml29623 	uint32_t		pci_dmawz_err;
4193859Sml29623 	uint32_t		pci_dmarz_err;
4203859Sml29623 
4213859Sml29623 	uint32_t		rx_taskq_waits;
4223859Sml29623 
4233859Sml29623 	uint32_t		tx_jumbo_pkts;
4243859Sml29623 
4253859Sml29623 	/*
4263859Sml29623 	 * Some statistics added to support bringup, these
4273859Sml29623 	 * should be removed.
4283859Sml29623 	 */
4293859Sml29623 	uint32_t		user_defined;
4303859Sml29623 } nxge_port_stats_t, *p_nxge_port_stats_t;
4313859Sml29623 
4323859Sml29623 
4333859Sml29623 typedef struct _nxge_stats_t {
4343859Sml29623 	/*
4353859Sml29623 	 *  Overall structure size
4363859Sml29623 	 */
4373859Sml29623 	size_t			stats_size;
4383859Sml29623 
4393859Sml29623 	kstat_t			*ksp;
4403859Sml29623 	kstat_t			*rdc_ksp[NXGE_MAX_RDCS];
4413859Sml29623 	kstat_t			*tdc_ksp[NXGE_MAX_TDCS];
4423859Sml29623 	kstat_t			*rdc_sys_ksp;
4433859Sml29623 	kstat_t			*fflp_ksp[1];
4443859Sml29623 	kstat_t			*ipp_ksp;
4453859Sml29623 	kstat_t			*txc_ksp;
4463859Sml29623 	kstat_t			*mac_ksp;
4473859Sml29623 	kstat_t			*zcp_ksp;
4483859Sml29623 	kstat_t			*port_ksp;
4493859Sml29623 	kstat_t			*mmac_ksp;
4503859Sml29623 
4513859Sml29623 	nxge_mac_stats_t	mac_stats;	/* Common MAC Statistics */
4523859Sml29623 	nxge_xmac_stats_t	xmac_stats;	/* XMAC Statistics */
4533859Sml29623 	nxge_bmac_stats_t	bmac_stats;	/* BMAC Statistics */
4543859Sml29623 
4553859Sml29623 	nxge_rx_ring_stats_t	rx_stats;	/* per port RX stats */
4563859Sml29623 	nxge_ipp_stats_t	ipp_stats;	/* per port IPP stats */
4573859Sml29623 	nxge_zcp_stats_t	zcp_stats;	/* per port IPP stats */
4583859Sml29623 	nxge_rx_ring_stats_t	rdc_stats[NXGE_MAX_RDCS]; /* per rdc stats */
4593859Sml29623 	nxge_rdc_sys_stats_t	rdc_sys_stats;	/* per port RDC stats */
4603859Sml29623 
4613859Sml29623 	nxge_tx_ring_stats_t	tx_stats;	/* per port TX stats */
4623859Sml29623 	nxge_txc_stats_t	txc_stats;	/* per port TX stats */
4633859Sml29623 	nxge_tx_ring_stats_t	tdc_stats[NXGE_MAX_TDCS]; /* per tdc stats */
4643859Sml29623 	nxge_fflp_stats_t	fflp_stats;	/* fflp stats */
4653859Sml29623 	nxge_port_stats_t	port_stats;	/* fflp stats */
4663859Sml29623 	nxge_mmac_stats_t	mmac_stats;	/* Multi mac. stats */
4673859Sml29623 
4683859Sml29623 } nxge_stats_t, *p_nxge_stats_t;
4693859Sml29623 
4703859Sml29623 
4713859Sml29623 
4723859Sml29623 typedef struct _nxge_intr_t {
4733859Sml29623 	boolean_t		intr_registered; /* interrupts are registered */
4743859Sml29623 	boolean_t		intr_enabled; 	/* interrupts are enabled */
4753859Sml29623 	boolean_t		niu_msi_enable;	/* debug or configurable? */
4763859Sml29623 	uint8_t			nldevs;		/* # of logical devices */
4773859Sml29623 	int			intr_types;	/* interrupt types supported */
4783859Sml29623 	int			intr_type;	/* interrupt type to add */
4793859Sml29623 	int			max_int_cnt;	/* max MSIX/INT HW supports */
4803859Sml29623 	int			start_inum;	/* start inum (in sequence?) */
4813859Sml29623 	int			msi_intx_cnt;	/* # msi/intx ints returned */
4823859Sml29623 	int			intr_added;	/* # ints actually needed */
4833859Sml29623 	int			intr_cap;	/* interrupt capabilities */
4843859Sml29623 	size_t			intr_size;	/* size of array to allocate */
4853859Sml29623 	ddi_intr_handle_t 	*htable;	/* For array of interrupts */
4863859Sml29623 	/* Add interrupt number for each interrupt vector */
4873859Sml29623 	int			pri;
4883859Sml29623 } nxge_intr_t, *p_nxge_intr_t;
4893859Sml29623 
4903859Sml29623 typedef struct _nxge_ldgv_t {
4913859Sml29623 	uint8_t			ndma_ldvs;
4923859Sml29623 	uint8_t			nldvs;
4933859Sml29623 	uint8_t			start_ldg;
4943859Sml29623 	uint8_t			start_ldg_tx;
4953859Sml29623 	uint8_t			start_ldg_rx;
4963859Sml29623 	uint8_t			maxldgs;
4973859Sml29623 	uint8_t			maxldvs;
4983859Sml29623 	uint8_t			ldg_intrs;
4993859Sml29623 	boolean_t		own_sys_err;
5003859Sml29623 	boolean_t		own_max_ldv;
5013859Sml29623 	uint32_t		tmres;
5023859Sml29623 	p_nxge_ldg_t		ldgp;
5033859Sml29623 	p_nxge_ldv_t		ldvp;
5043859Sml29623 	p_nxge_ldv_t		ldvp_syserr;
5053859Sml29623 } nxge_ldgv_t, *p_nxge_ldgv_t;
5063859Sml29623 
5073859Sml29623 /*
5083859Sml29623  * Neptune Device instance state information.
5093859Sml29623  *
5103859Sml29623  * Each instance is dynamically allocated on first attach.
5113859Sml29623  */
5123859Sml29623 struct _nxge_t {
5133859Sml29623 	dev_info_t		*dip;		/* device instance */
5143859Sml29623 	dev_info_t		*p_dip;		/* Parent's device instance */
5153859Sml29623 	int			instance;	/* instance number */
5163859Sml29623 	int			function_num;	/* device function number */
5173859Sml29623 	int			nports;		/* # of ports on this device */
5183859Sml29623 	int			board_ver;	/* Board Version */
5193859Sml29623 	int			partition_id;	/* partition ID */
5203859Sml29623 	int			use_partition;	/* partition is enabled */
5213859Sml29623 	uint32_t		drv_state;	/* driver state bit flags */
5223859Sml29623 	uint64_t		nxge_debug_level; /* driver state bit flags */
5233859Sml29623 	kmutex_t		genlock[1];
5243859Sml29623 	enum nxge_mac_state	nxge_mac_state;
5253859Sml29623 	ddi_softintr_t		resched_id;	/* reschedule callback	*/
5263859Sml29623 	boolean_t		resched_needed;
5273859Sml29623 	boolean_t		resched_running;
5283859Sml29623 
5293859Sml29623 	p_dev_regs_t		dev_regs;
5303859Sml29623 	npi_handle_t		npi_handle;
5313859Sml29623 	npi_handle_t		npi_pci_handle;
5323859Sml29623 	npi_handle_t		npi_reg_handle;
5333859Sml29623 	npi_handle_t		npi_msi_handle;
5343859Sml29623 	npi_handle_t		npi_vreg_handle;
5353859Sml29623 	npi_handle_t		npi_v2reg_handle;
5363859Sml29623 
5374732Sdavemq 	nxge_xcvr_table_t	xcvr;
538*5572Ssbehera 	boolean_t		hot_swappable_phy;
539*5572Ssbehera 	boolean_t		phy_absent;
540*5572Ssbehera 	uint32_t		xcvr_addr;
541*5572Ssbehera 	uint16_t		chip_id;
5423859Sml29623 	nxge_mac_t		mac;
5433859Sml29623 	nxge_ipp_t		ipp;
5443859Sml29623 	nxge_txc_t		txc;
5453859Sml29623 	nxge_classify_t		classifier;
5463859Sml29623 
5473859Sml29623 	mac_handle_t		mach;	/* mac module handle */
5483859Sml29623 	p_nxge_stats_t		statsp;
5493859Sml29623 	uint32_t		param_count;
5503859Sml29623 	p_nxge_param_t		param_arr;
5513859Sml29623 	nxge_hw_list_t		*nxge_hw_p; 	/* pointer to per Neptune */
5523859Sml29623 	niu_type_t		niu_type;
5534977Sraghus 	platform_type_t		platform_type;
5543859Sml29623 	boolean_t		os_addr_mode32;	/* set to 1 for 32 bit mode */
5553859Sml29623 	uint8_t			nrdc;
5563859Sml29623 	uint8_t			def_rdc;
5573859Sml29623 	uint8_t			rdc[NXGE_MAX_RDCS];
5583859Sml29623 	uint8_t			ntdc;
5593859Sml29623 	uint8_t			tdc[NXGE_MAX_TDCS];
5603859Sml29623 
5613859Sml29623 	nxge_intr_t		nxge_intr_type;
5623859Sml29623 	nxge_dma_pt_cfg_t 	pt_config;
5633859Sml29623 	nxge_class_pt_cfg_t 	class_config;
5643859Sml29623 
5653859Sml29623 	/* Logical device and group data structures. */
5663859Sml29623 	p_nxge_ldgv_t		ldgvp;
5673859Sml29623 
5684185Sspeer 	npi_vpd_info_t		vpd_info;
5693859Sml29623 	caddr_t			param_list;	/* Parameter list */
5703859Sml29623 
5713859Sml29623 	ether_addr_st		factaddr;	/* factory mac address	    */
5723859Sml29623 	ether_addr_st		ouraddr;	/* individual address	    */
5733859Sml29623 	kmutex_t		ouraddr_lock;	/* lock to protect to uradd */
5743859Sml29623 
5753859Sml29623 	ddi_iblock_cookie_t	interrupt_cookie;
5763859Sml29623 
5773859Sml29623 	/*
5783859Sml29623 	 * Blocks of memory may be pre-allocated by the
5793859Sml29623 	 * partition manager or the driver. They may include
5803859Sml29623 	 * blocks for configuration and buffers. The idea is
5813859Sml29623 	 * to preallocate big blocks of contiguous areas in
5823859Sml29623 	 * system memory (i.e. with IOMMU). These blocks then
5833859Sml29623 	 * will be broken up to a fixed number of blocks with
5843859Sml29623 	 * each block having the same block size (4K, 8K, 16K or
5853859Sml29623 	 * 32K) in the case of buffer blocks. For systems that
5863859Sml29623 	 * do not support DVMA, more than one big block will be
5873859Sml29623 	 * allocated.
5883859Sml29623 	 */
5893859Sml29623 	uint32_t		rx_default_block_size;
5903859Sml29623 	nxge_rx_block_size_t	rx_bksize_code;
5913859Sml29623 
5923859Sml29623 	p_nxge_dma_pool_t	rx_buf_pool_p;
5933859Sml29623 	p_nxge_dma_pool_t	rx_cntl_pool_p;
5943859Sml29623 
5953859Sml29623 	p_nxge_dma_pool_t	tx_buf_pool_p;
5963859Sml29623 	p_nxge_dma_pool_t	tx_cntl_pool_p;
5973859Sml29623 
5983859Sml29623 	/* Receive buffer block ring and completion ring. */
5993859Sml29623 	p_rx_rbr_rings_t 	rx_rbr_rings;
6003859Sml29623 	p_rx_rcr_rings_t 	rx_rcr_rings;
6013859Sml29623 	p_rx_mbox_areas_t 	rx_mbox_areas_p;
6023859Sml29623 
6033859Sml29623 	p_rx_tx_params_t	rx_params;
6043859Sml29623 	uint32_t		start_rdc;
6053859Sml29623 	uint32_t		max_rdcs;
6063859Sml29623 	uint32_t		rdc_mask;
6073859Sml29623 
6083859Sml29623 	/* Transmit descriptors rings */
6093859Sml29623 	p_tx_rings_t 		tx_rings;
6103859Sml29623 	p_tx_mbox_areas_t	tx_mbox_areas_p;
6113859Sml29623 
6123859Sml29623 	uint32_t		start_tdc;
6133859Sml29623 	uint32_t		max_tdcs;
6143859Sml29623 	uint32_t		tdc_mask;
6153859Sml29623 
6163859Sml29623 	p_rx_tx_params_t	tx_params;
6173859Sml29623 
6183859Sml29623 	ddi_dma_handle_t 	dmasparehandle;
6193859Sml29623 
6203859Sml29623 	ulong_t 		sys_page_sz;
6213859Sml29623 	ulong_t 		sys_page_mask;
6223859Sml29623 	int 			suspended;
6233859Sml29623 
6243859Sml29623 	mii_bmsr_t 		bmsr;		/* xcvr status at last poll. */
6253859Sml29623 	mii_bmsr_t 		soft_bmsr;	/* xcvr status kept by SW. */
6263859Sml29623 
6273859Sml29623 	kmutex_t 		mif_lock;	/* Lock to protect the list. */
6283859Sml29623 
6293859Sml29623 	void 			(*mii_read)();
6303859Sml29623 	void 			(*mii_write)();
6313859Sml29623 	void 			(*mii_poll)();
6323859Sml29623 	filter_t 		filter;		/* Current instance filter */
6333859Sml29623 	p_hash_filter_t 	hash_filter;	/* Multicast hash filter. */
6343859Sml29623 	krwlock_t		filter_lock;	/* Lock to protect filters. */
6353859Sml29623 
6363859Sml29623 	ulong_t 		sys_burst_sz;
6373859Sml29623 
6383859Sml29623 	uint8_t 		cache_line;
6393859Sml29623 
6403859Sml29623 	timeout_id_t 		nxge_link_poll_timerid;
6413859Sml29623 	timeout_id_t 		nxge_timerid;
6423859Sml29623 
6433859Sml29623 	uint_t 			need_periodic_reclaim;
6443859Sml29623 	timeout_id_t 		reclaim_timer;
6453859Sml29623 
6463859Sml29623 	uint8_t 		msg_min;
6473859Sml29623 	uint8_t 		crc_size;
6483859Sml29623 
6493859Sml29623 	boolean_t 		hard_props_read;
6503859Sml29623 
6513859Sml29623 	boolean_t 		nxge_htraffic;
6523859Sml29623 	uint32_t 		nxge_ncpus;
6533859Sml29623 	uint32_t 		nxge_cpumask;
6543859Sml29623 	uint16_t 		intr_timeout;
6553859Sml29623 	uint16_t 		intr_threshold;
6563859Sml29623 	uchar_t 		nxge_rxmode;
6573859Sml29623 	uint32_t 		active_threads;
6583859Sml29623 
6593859Sml29623 	rtrace_t		rtrace;
6603859Sml29623 	int			fm_capabilities; /* FMA capabilities */
6613859Sml29623 
6623859Sml29623 	uint32_t 		nxge_port_rbr_size;
6633859Sml29623 	uint32_t 		nxge_port_rcr_size;
6643859Sml29623 	uint32_t 		nxge_port_tx_ring_size;
6653859Sml29623 	nxge_mmac_t		nxge_mmac_info;
6663859Sml29623 #if	defined(sun4v)
6673859Sml29623 	boolean_t		niu_hsvc_available;
6683859Sml29623 	hsvc_info_t		niu_hsvc;
6693859Sml29623 	uint64_t		niu_min_ver;
6703859Sml29623 #endif
6713859Sml29623 	boolean_t		link_notify;
6724693Stm144005 
6734693Stm144005 	kmutex_t		poll_lock;
6744693Stm144005 	kcondvar_t		poll_cv;
6754693Stm144005 	link_mon_enable_t	poll_state;
6764693Stm144005 #define	NXGE_MAGIC		0x3ab434e3
6774693Stm144005 	uint32_t		nxge_magic;
6783859Sml29623 };
6793859Sml29623 
6803859Sml29623 /*
6813859Sml29623  * Driver state flags.
6823859Sml29623  */
6833859Sml29623 #define	STATE_REGS_MAPPED	0x000000001	/* device registers mapped */
6843859Sml29623 #define	STATE_KSTATS_SETUP	0x000000002	/* kstats allocated	*/
6853859Sml29623 #define	STATE_NODE_CREATED	0x000000004	/* device node created	*/
6863859Sml29623 #define	STATE_HW_CONFIG_CREATED	0x000000008	/* hardware properties	*/
6873859Sml29623 #define	STATE_HW_INITIALIZED	0x000000010	/* hardware initialized	*/
6883859Sml29623 #define	STATE_MDIO_LOCK_INIT	0x000000020	/* mdio lock initialized */
6893859Sml29623 #define	STATE_MII_LOCK_INIT	0x000000040	/* mii lock initialized */
6903859Sml29623 
6913859Sml29623 #define	STOP_POLL_THRESH 	9
6923859Sml29623 #define	START_POLL_THRESH	2
6933859Sml29623 
6943859Sml29623 typedef struct _nxge_port_kstat_t {
6953859Sml29623 	/*
6963859Sml29623 	 * Transciever state informations.
6973859Sml29623 	 */
6983859Sml29623 	kstat_named_t	xcvr_inits;
6993859Sml29623 	kstat_named_t	xcvr_inuse;
7003859Sml29623 	kstat_named_t	xcvr_addr;
7013859Sml29623 	kstat_named_t	xcvr_id;
7023859Sml29623 	kstat_named_t	cap_autoneg;
7033859Sml29623 	kstat_named_t	cap_10gfdx;
7043859Sml29623 	kstat_named_t	cap_10ghdx;
7053859Sml29623 	kstat_named_t	cap_1000fdx;
7063859Sml29623 	kstat_named_t	cap_1000hdx;
7073859Sml29623 	kstat_named_t	cap_100T4;
7083859Sml29623 	kstat_named_t	cap_100fdx;
7093859Sml29623 	kstat_named_t	cap_100hdx;
7103859Sml29623 	kstat_named_t	cap_10fdx;
7113859Sml29623 	kstat_named_t	cap_10hdx;
7123859Sml29623 	kstat_named_t	cap_asmpause;
7133859Sml29623 	kstat_named_t	cap_pause;
7143859Sml29623 
7153859Sml29623 	/*
7163859Sml29623 	 * Link partner capabilities.
7173859Sml29623 	 */
7183859Sml29623 	kstat_named_t	lp_cap_autoneg;
7193859Sml29623 	kstat_named_t	lp_cap_10gfdx;
7203859Sml29623 	kstat_named_t	lp_cap_10ghdx;
7213859Sml29623 	kstat_named_t	lp_cap_1000fdx;
7223859Sml29623 	kstat_named_t	lp_cap_1000hdx;
7233859Sml29623 	kstat_named_t	lp_cap_100T4;
7243859Sml29623 	kstat_named_t	lp_cap_100fdx;
7253859Sml29623 	kstat_named_t	lp_cap_100hdx;
7263859Sml29623 	kstat_named_t	lp_cap_10fdx;
7273859Sml29623 	kstat_named_t	lp_cap_10hdx;
7283859Sml29623 	kstat_named_t	lp_cap_asmpause;
7293859Sml29623 	kstat_named_t	lp_cap_pause;
7303859Sml29623 
7313859Sml29623 	/*
7323859Sml29623 	 * Shared link setup.
7333859Sml29623 	 */
7343859Sml29623 	kstat_named_t	link_T4;
7353859Sml29623 	kstat_named_t	link_speed;
7363859Sml29623 	kstat_named_t	link_duplex;
7373859Sml29623 	kstat_named_t	link_asmpause;
7383859Sml29623 	kstat_named_t	link_pause;
7393859Sml29623 	kstat_named_t	link_up;
7403859Sml29623 
7413859Sml29623 	/*
7423859Sml29623 	 * Lets the user know the MTU currently in use by
7433859Sml29623 	 * the physical MAC port.
7443859Sml29623 	 */
7453859Sml29623 	kstat_named_t	mac_mtu;
7463859Sml29623 	kstat_named_t	lb_mode;
7473859Sml29623 	kstat_named_t	qos_mode;
7483859Sml29623 	kstat_named_t	trunk_mode;
7493859Sml29623 
7503859Sml29623 	/*
7513859Sml29623 	 * Misc MAC statistics.
7523859Sml29623 	 */
7533859Sml29623 	kstat_named_t	ifspeed;
7543859Sml29623 	kstat_named_t	promisc;
7553859Sml29623 	kstat_named_t	rev_id;
7563859Sml29623 
7573859Sml29623 	/*
7583859Sml29623 	 * Some statistics added to support bringup, these
7593859Sml29623 	 * should be removed.
7603859Sml29623 	 */
7613859Sml29623 	kstat_named_t	user_defined;
7623859Sml29623 } nxge_port_kstat_t, *p_nxge_port_kstat_t;
7633859Sml29623 
7643859Sml29623 typedef struct _nxge_rdc_kstat {
7653859Sml29623 	/*
7663859Sml29623 	 * Receive DMA channel statistics.
7673859Sml29623 	 */
7683859Sml29623 	kstat_named_t	ipackets;
7693859Sml29623 	kstat_named_t	rbytes;
7703859Sml29623 	kstat_named_t	errors;
7713859Sml29623 	kstat_named_t	dcf_err;
7723859Sml29623 	kstat_named_t	rcr_ack_err;
7733859Sml29623 
7743859Sml29623 	kstat_named_t	dc_fifoflow_err;
7753859Sml29623 	kstat_named_t	rcr_sha_par_err;
7763859Sml29623 	kstat_named_t	rbr_pre_par_err;
7773859Sml29623 	kstat_named_t	wred_drop;
7783859Sml29623 	kstat_named_t	rbr_pre_emty;
7793859Sml29623 
7803859Sml29623 	kstat_named_t	rcr_shadow_full;
7813859Sml29623 	kstat_named_t	rbr_tmout;
7823859Sml29623 	kstat_named_t	rsp_cnt_err;
7833859Sml29623 	kstat_named_t	byte_en_bus;
7843859Sml29623 	kstat_named_t	rsp_dat_err;
7853859Sml29623 
7863859Sml29623 	kstat_named_t	compl_l2_err;
7873859Sml29623 	kstat_named_t	compl_l4_cksum_err;
7883859Sml29623 	kstat_named_t	compl_zcp_soft_err;
7893859Sml29623 	kstat_named_t	compl_fflp_soft_err;
7903859Sml29623 	kstat_named_t	config_err;
7913859Sml29623 
7923859Sml29623 	kstat_named_t	rcrincon;
7933859Sml29623 	kstat_named_t	rcrfull;
7943859Sml29623 	kstat_named_t	rbr_empty;
7953859Sml29623 	kstat_named_t	rbrfull;
7963859Sml29623 	kstat_named_t	rbrlogpage;
7973859Sml29623 
7983859Sml29623 	kstat_named_t	cfiglogpage;
7993859Sml29623 	kstat_named_t	port_drop_pkt;
8003859Sml29623 	kstat_named_t	rcr_to;
8013859Sml29623 	kstat_named_t	rcr_thresh;
8023859Sml29623 	kstat_named_t	rcr_mex;
8033859Sml29623 	kstat_named_t	id_mismatch;
8043859Sml29623 	kstat_named_t	zcp_eop_err;
8053859Sml29623 	kstat_named_t	ipp_eop_err;
8063859Sml29623 } nxge_rdc_kstat_t, *p_nxge_rdc_kstat_t;
8073859Sml29623 
8083859Sml29623 typedef struct _nxge_rdc_sys_kstat {
8093859Sml29623 	/*
8103859Sml29623 	 * Receive DMA system statistics.
8113859Sml29623 	 */
8123859Sml29623 	kstat_named_t	pre_par;
8133859Sml29623 	kstat_named_t	sha_par;
8143859Sml29623 	kstat_named_t	id_mismatch;
8153859Sml29623 	kstat_named_t	ipp_eop_err;
8163859Sml29623 	kstat_named_t	zcp_eop_err;
8173859Sml29623 } nxge_rdc_sys_kstat_t, *p_nxge_rdc_sys_kstat_t;
8183859Sml29623 
8193859Sml29623 typedef	struct _nxge_tdc_kstat {
8203859Sml29623 	/*
8213859Sml29623 	 * Transmit DMA channel statistics.
8223859Sml29623 	 */
8233859Sml29623 	kstat_named_t	opackets;
8243859Sml29623 	kstat_named_t	obytes;
8253859Sml29623 	kstat_named_t	oerrors;
8263859Sml29623 	kstat_named_t	tx_inits;
8273859Sml29623 	kstat_named_t	tx_no_buf;
8283859Sml29623 
8293859Sml29623 	kstat_named_t	mbox_err;
8303859Sml29623 	kstat_named_t	pkt_size_err;
8313859Sml29623 	kstat_named_t	tx_ring_oflow;
8323859Sml29623 	kstat_named_t	pref_buf_ecc_err;
8333859Sml29623 	kstat_named_t	nack_pref;
8343859Sml29623 	kstat_named_t	nack_pkt_rd;
8353859Sml29623 	kstat_named_t	conf_part_err;
8363859Sml29623 	kstat_named_t	pkt_prt_err;
8373859Sml29623 	kstat_named_t	reset_fail;
8383859Sml29623 /* used to in the common (per port) counter */
8393859Sml29623 
8403859Sml29623 	kstat_named_t	tx_starts;
8413859Sml29623 	kstat_named_t	tx_nocanput;
8423859Sml29623 	kstat_named_t	tx_msgdup_fail;
8433859Sml29623 	kstat_named_t	tx_allocb_fail;
8443859Sml29623 	kstat_named_t	tx_no_desc;
8453859Sml29623 	kstat_named_t	tx_dma_bind_fail;
8463859Sml29623 	kstat_named_t	tx_uflo;
8473859Sml29623 	kstat_named_t	tx_hdr_pkts;
8483859Sml29623 	kstat_named_t	tx_ddi_pkts;
8493859Sml29623 	kstat_named_t	tx_dvma_pkts;
8503859Sml29623 	kstat_named_t	tx_max_pend;
8513859Sml29623 } nxge_tdc_kstat_t, *p_nxge_tdc_kstat_t;
8523859Sml29623 
8533859Sml29623 typedef	struct _nxge_txc_kstat {
8543859Sml29623 	/*
8553859Sml29623 	 * Transmit port TXC block statistics.
8563859Sml29623 	 */
8573859Sml29623 	kstat_named_t	pkt_stuffed;
8583859Sml29623 	kstat_named_t	pkt_xmit;
8593859Sml29623 	kstat_named_t	ro_correct_err;
8603859Sml29623 	kstat_named_t	ro_uncorrect_err;
8613859Sml29623 	kstat_named_t	sf_correct_err;
8623859Sml29623 	kstat_named_t	sf_uncorrect_err;
8633859Sml29623 	kstat_named_t	address_failed;
8643859Sml29623 	kstat_named_t	dma_failed;
8653859Sml29623 	kstat_named_t	length_failed;
8663859Sml29623 	kstat_named_t	pkt_assy_dead;
8673859Sml29623 	kstat_named_t	reorder_err;
8683859Sml29623 } nxge_txc_kstat_t, *p_nxge_txc_kstat_t;
8693859Sml29623 
8703859Sml29623 typedef struct _nxge_ipp_kstat {
8713859Sml29623 	/*
8723859Sml29623 	 * Receive port IPP block statistics.
8733859Sml29623 	 */
8743859Sml29623 	kstat_named_t	eop_miss;
8753859Sml29623 	kstat_named_t	sop_miss;
8763859Sml29623 	kstat_named_t	dfifo_ue;
8773859Sml29623 	kstat_named_t	ecc_err_cnt;
8784439Sml29623 	kstat_named_t	pfifo_perr;
8793859Sml29623 	kstat_named_t	pfifo_over;
8803859Sml29623 	kstat_named_t	pfifo_und;
8813859Sml29623 	kstat_named_t	bad_cs_cnt;
8823859Sml29623 	kstat_named_t	pkt_dis_cnt;
8833859Sml29623 } nxge_ipp_kstat_t, *p_nxge_ipp_kstat_t;
8843859Sml29623 
8853859Sml29623 typedef	struct _nxge_zcp_kstat {
8863859Sml29623 	/*
8873859Sml29623 	 * ZCP statistics.
8883859Sml29623 	 */
8893859Sml29623 	kstat_named_t	errors;
8903859Sml29623 	kstat_named_t	inits;
8913859Sml29623 	kstat_named_t	rrfifo_underrun;
8923859Sml29623 	kstat_named_t	rrfifo_overrun;
8933859Sml29623 	kstat_named_t	rspfifo_uncorr_err;
8943859Sml29623 	kstat_named_t	buffer_overflow;
8953859Sml29623 	kstat_named_t	stat_tbl_perr;
8963859Sml29623 	kstat_named_t	dyn_tbl_perr;
8973859Sml29623 	kstat_named_t	buf_tbl_perr;
8983859Sml29623 	kstat_named_t	tt_program_err;
8993859Sml29623 	kstat_named_t	rsp_tt_index_err;
9003859Sml29623 	kstat_named_t	slv_tt_index_err;
9013859Sml29623 	kstat_named_t	zcp_tt_index_err;
9023859Sml29623 	kstat_named_t	access_fail;
9033859Sml29623 	kstat_named_t	cfifo_ecc;
9043859Sml29623 } nxge_zcp_kstat_t, *p_nxge_zcp_kstat_t;
9053859Sml29623 
9063859Sml29623 typedef	struct _nxge_mac_kstat {
9073859Sml29623 	/*
9083859Sml29623 	 * Transmit MAC statistics.
9093859Sml29623 	 */
9103859Sml29623 	kstat_named_t	tx_frame_cnt;
9113859Sml29623 	kstat_named_t	tx_underflow_err;
9123859Sml29623 	kstat_named_t	tx_overflow_err;
9133859Sml29623 	kstat_named_t	tx_maxpktsize_err;
9143859Sml29623 	kstat_named_t	tx_fifo_xfr_err;
9153859Sml29623 	kstat_named_t	tx_byte_cnt;
9163859Sml29623 
9173859Sml29623 	/*
9183859Sml29623 	 * Receive MAC statistics.
9193859Sml29623 	 */
9203859Sml29623 	kstat_named_t	rx_frame_cnt;
9213859Sml29623 	kstat_named_t	rx_underflow_err;
9223859Sml29623 	kstat_named_t	rx_overflow_err;
9233859Sml29623 	kstat_named_t	rx_len_err_cnt;
9243859Sml29623 	kstat_named_t	rx_crc_err_cnt;
9253859Sml29623 	kstat_named_t	rx_viol_err_cnt;
9263859Sml29623 	kstat_named_t	rx_byte_cnt;
9273859Sml29623 	kstat_named_t	rx_hist1_cnt;
9283859Sml29623 	kstat_named_t	rx_hist2_cnt;
9293859Sml29623 	kstat_named_t	rx_hist3_cnt;
9303859Sml29623 	kstat_named_t	rx_hist4_cnt;
9313859Sml29623 	kstat_named_t	rx_hist5_cnt;
9323859Sml29623 	kstat_named_t	rx_hist6_cnt;
9333859Sml29623 	kstat_named_t	rx_broadcast_cnt;
9343859Sml29623 	kstat_named_t	rx_mult_cnt;
9353859Sml29623 	kstat_named_t	rx_frag_cnt;
9363859Sml29623 	kstat_named_t	rx_frame_align_err_cnt;
9373859Sml29623 	kstat_named_t	rx_linkfault_err_cnt;
9383859Sml29623 	kstat_named_t	rx_local_fault_err_cnt;
9393859Sml29623 	kstat_named_t	rx_remote_fault_err_cnt;
9403859Sml29623 } nxge_mac_kstat_t, *p_nxge_mac_kstat_t;
9413859Sml29623 
9423859Sml29623 typedef	struct _nxge_xmac_kstat {
9433859Sml29623 	/*
9443859Sml29623 	 * XMAC statistics.
9453859Sml29623 	 */
9463859Sml29623 	kstat_named_t	tx_frame_cnt;
9473859Sml29623 	kstat_named_t	tx_underflow_err;
9483859Sml29623 	kstat_named_t	tx_maxpktsize_err;
9493859Sml29623 	kstat_named_t	tx_overflow_err;
9503859Sml29623 	kstat_named_t	tx_fifo_xfr_err;
9513859Sml29623 	kstat_named_t	tx_byte_cnt;
9523859Sml29623 	kstat_named_t	rx_frame_cnt;
9533859Sml29623 	kstat_named_t	rx_underflow_err;
9543859Sml29623 	kstat_named_t	rx_overflow_err;
9553859Sml29623 	kstat_named_t	rx_crc_err_cnt;
9563859Sml29623 	kstat_named_t	rx_len_err_cnt;
9573859Sml29623 	kstat_named_t	rx_viol_err_cnt;
9583859Sml29623 	kstat_named_t	rx_byte_cnt;
9593859Sml29623 	kstat_named_t	rx_hist1_cnt;
9603859Sml29623 	kstat_named_t	rx_hist2_cnt;
9613859Sml29623 	kstat_named_t	rx_hist3_cnt;
9623859Sml29623 	kstat_named_t	rx_hist4_cnt;
9633859Sml29623 	kstat_named_t	rx_hist5_cnt;
9643859Sml29623 	kstat_named_t	rx_hist6_cnt;
9653859Sml29623 	kstat_named_t	rx_hist7_cnt;
9663859Sml29623 	kstat_named_t	rx_broadcast_cnt;
9673859Sml29623 	kstat_named_t	rx_mult_cnt;
9683859Sml29623 	kstat_named_t	rx_frag_cnt;
9693859Sml29623 	kstat_named_t	rx_frame_align_err_cnt;
9703859Sml29623 	kstat_named_t	rx_linkfault_err_cnt;
9713859Sml29623 	kstat_named_t	rx_remote_fault_err_cnt;
9723859Sml29623 	kstat_named_t	rx_local_fault_err_cnt;
9733859Sml29623 	kstat_named_t	rx_pause_cnt;
9743859Sml29623 	kstat_named_t	xpcs_deskew_err_cnt;
9753859Sml29623 	kstat_named_t	xpcs_ln0_symbol_err_cnt;
9763859Sml29623 	kstat_named_t	xpcs_ln1_symbol_err_cnt;
9773859Sml29623 	kstat_named_t	xpcs_ln2_symbol_err_cnt;
9783859Sml29623 	kstat_named_t	xpcs_ln3_symbol_err_cnt;
9793859Sml29623 } nxge_xmac_kstat_t, *p_nxge_xmac_kstat_t;
9803859Sml29623 
9813859Sml29623 typedef	struct _nxge_bmac_kstat {
9823859Sml29623 	/*
9833859Sml29623 	 * BMAC statistics.
9843859Sml29623 	 */
9853859Sml29623 	kstat_named_t tx_frame_cnt;
9863859Sml29623 	kstat_named_t tx_underrun_err;
9873859Sml29623 	kstat_named_t tx_max_pkt_err;
9883859Sml29623 	kstat_named_t tx_byte_cnt;
9893859Sml29623 	kstat_named_t rx_frame_cnt;
9903859Sml29623 	kstat_named_t rx_byte_cnt;
9913859Sml29623 	kstat_named_t rx_overflow_err;
9923859Sml29623 	kstat_named_t rx_align_err_cnt;
9933859Sml29623 	kstat_named_t rx_crc_err_cnt;
9943859Sml29623 	kstat_named_t rx_len_err_cnt;
9953859Sml29623 	kstat_named_t rx_viol_err_cnt;
9963859Sml29623 	kstat_named_t rx_pause_cnt;
9973859Sml29623 	kstat_named_t tx_pause_state;
9983859Sml29623 	kstat_named_t tx_nopause_state;
9993859Sml29623 } nxge_bmac_kstat_t, *p_nxge_bmac_kstat_t;
10003859Sml29623 
10013859Sml29623 
10023859Sml29623 typedef struct _nxge_fflp_kstat {
10033859Sml29623 	/*
10043859Sml29623 	 * FFLP statistics.
10053859Sml29623 	 */
10063859Sml29623 
10073859Sml29623 	kstat_named_t	fflp_tcam_ecc_err;
10083859Sml29623 	kstat_named_t	fflp_tcam_perr;
10093859Sml29623 	kstat_named_t	fflp_vlan_perr;
10103859Sml29623 	kstat_named_t	fflp_hasht_lookup_err;
10113859Sml29623 	kstat_named_t	fflp_access_fail;
10123859Sml29623 	kstat_named_t	fflp_hasht_data_err[MAX_PARTITION];
10133859Sml29623 } nxge_fflp_kstat_t, *p_nxge_fflp_kstat_t;
10143859Sml29623 
10153859Sml29623 typedef struct _nxge_mmac_kstat {
10163859Sml29623 	kstat_named_t	mmac_max_addr_cnt;
10173859Sml29623 	kstat_named_t	mmac_avail_addr_cnt;
10183859Sml29623 	kstat_named_t	mmac_addr1;
10193859Sml29623 	kstat_named_t	mmac_addr2;
10203859Sml29623 	kstat_named_t	mmac_addr3;
10213859Sml29623 	kstat_named_t	mmac_addr4;
10223859Sml29623 	kstat_named_t	mmac_addr5;
10233859Sml29623 	kstat_named_t	mmac_addr6;
10243859Sml29623 	kstat_named_t	mmac_addr7;
10253859Sml29623 	kstat_named_t	mmac_addr8;
10263859Sml29623 	kstat_named_t	mmac_addr9;
10273859Sml29623 	kstat_named_t	mmac_addr10;
10283859Sml29623 	kstat_named_t	mmac_addr11;
10293859Sml29623 	kstat_named_t	mmac_addr12;
10303859Sml29623 	kstat_named_t	mmac_addr13;
10313859Sml29623 	kstat_named_t	mmac_addr14;
10323859Sml29623 	kstat_named_t	mmac_addr15;
10333859Sml29623 	kstat_named_t	mmac_addr16;
10343859Sml29623 } nxge_mmac_kstat_t, *p_nxge_mmac_kstat_t;
10353859Sml29623 
10363859Sml29623 #endif	/* _KERNEL */
10373859Sml29623 
10383859Sml29623 /*
10393859Sml29623  * Prototype definitions.
10403859Sml29623  */
10413859Sml29623 nxge_status_t nxge_init(p_nxge_t);
10423859Sml29623 void nxge_uninit(p_nxge_t);
10433859Sml29623 void nxge_get64(p_nxge_t, p_mblk_t);
10443859Sml29623 void nxge_put64(p_nxge_t, p_mblk_t);
10453859Sml29623 void nxge_pio_loop(p_nxge_t, p_mblk_t);
10463859Sml29623 
10473859Sml29623 #ifndef COSIM
10483859Sml29623 typedef	void	(*fptrv_t)();
10493859Sml29623 timeout_id_t nxge_start_timer(p_nxge_t, fptrv_t, int);
10503859Sml29623 void nxge_stop_timer(p_nxge_t, timeout_id_t);
10513859Sml29623 #endif
10523859Sml29623 #endif
10533859Sml29623 
10543859Sml29623 #ifdef	__cplusplus
10553859Sml29623 }
10563859Sml29623 #endif
10573859Sml29623 
10583859Sml29623 #endif	/* _SYS_NXGE_NXGE_H */
1059