xref: /illumos-gate/usr/src/uts/common/io/hxge/hxge.h (revision e5d97391)
13dec9fcdSqs /*
23dec9fcdSqs  * CDDL HEADER START
33dec9fcdSqs  *
43dec9fcdSqs  * The contents of this file are subject to the terms of the
53dec9fcdSqs  * Common Development and Distribution License (the "License").
63dec9fcdSqs  * You may not use this file except in compliance with the License.
73dec9fcdSqs  *
83dec9fcdSqs  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93dec9fcdSqs  * or http://www.opensolaris.org/os/licensing.
103dec9fcdSqs  * See the License for the specific language governing permissions
113dec9fcdSqs  * and limitations under the License.
123dec9fcdSqs  *
133dec9fcdSqs  * When distributing Covered Code, include this CDDL HEADER in each
143dec9fcdSqs  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153dec9fcdSqs  * If applicable, add the following below this CDDL HEADER, with the
163dec9fcdSqs  * fields enclosed by brackets "[]" replaced with your own identifying
173dec9fcdSqs  * information: Portions Copyright [yyyy] [name of copyright owner]
183dec9fcdSqs  *
193dec9fcdSqs  * CDDL HEADER END
203dec9fcdSqs  */
213dec9fcdSqs /*
223dec9fcdSqs  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
233dec9fcdSqs  * Use is subject to license terms.
243dec9fcdSqs  */
253dec9fcdSqs 
263dec9fcdSqs #ifndef	_SYS_HXGE_HXGE_H
273dec9fcdSqs #define	_SYS_HXGE_HXGE_H
283dec9fcdSqs 
293dec9fcdSqs #ifdef	__cplusplus
303dec9fcdSqs extern "C" {
313dec9fcdSqs #endif
323dec9fcdSqs 
333dec9fcdSqs #include <hxge_vmac.h>
343dec9fcdSqs #include <hxge_pfc.h>
353dec9fcdSqs #include <hxge_classify.h>
363dec9fcdSqs 
373dec9fcdSqs /*
383dec9fcdSqs  * HXGE diagnostics IOCTLS.
393dec9fcdSqs  */
403dec9fcdSqs #define	HXGE_IOC		((((('N' << 8) + 'X') << 8) + 'G') << 8)
413dec9fcdSqs 
423dec9fcdSqs #define	HXGE_GET64		(HXGE_IOC|1)
433dec9fcdSqs #define	HXGE_PUT64		(HXGE_IOC|2)
443dec9fcdSqs #define	HXGE_GET_TX_RING_SZ	(HXGE_IOC|3)
453dec9fcdSqs #define	HXGE_GET_TX_DESC	(HXGE_IOC|4)
463dec9fcdSqs #define	HXGE_GLOBAL_RESET	(HXGE_IOC|5)
473dec9fcdSqs #define	HXGE_TX_SIDE_RESET	(HXGE_IOC|6)
483dec9fcdSqs #define	HXGE_RX_SIDE_RESET	(HXGE_IOC|7)
493dec9fcdSqs #define	HXGE_RESET_MAC		(HXGE_IOC|8)
503dec9fcdSqs #define	HXGE_RTRACE		(HXGE_IOC|9)
513dec9fcdSqs #define	HXGE_GET_TCAM		(HXGE_IOC|10)
523dec9fcdSqs #define	HXGE_PUT_TCAM		(HXGE_IOC|11)
533dec9fcdSqs 
543dec9fcdSqs #define	HXGE_OK			0
553dec9fcdSqs #define	HXGE_ERROR		0x40000000
563dec9fcdSqs #define	HXGE_DDI_FAILED		0x20000000
573dec9fcdSqs 
583dec9fcdSqs /*
593dec9fcdSqs  * Definitions for module_info.
603dec9fcdSqs  */
613dec9fcdSqs #define	HXGE_DRIVER_NAME	"hxge"			/* module name */
623dec9fcdSqs #define	HXGE_CHECK_TIMER	(5000)
633dec9fcdSqs 
643dec9fcdSqs typedef enum {
653dec9fcdSqs 	param_instance,
663dec9fcdSqs 
673dec9fcdSqs 	param_accept_jumbo,
683dec9fcdSqs 	param_rxdma_rbr_size,
693dec9fcdSqs 	param_rxdma_rcr_size,
703dec9fcdSqs 	param_rxdma_intr_time,
713dec9fcdSqs 	param_rxdma_intr_pkts,
723dec9fcdSqs 	param_vlan_ids,
733dec9fcdSqs 	param_implicit_vlan_id,
743dec9fcdSqs 	param_tcam_enable,
753dec9fcdSqs 
763dec9fcdSqs 	param_hash_init_value,
773dec9fcdSqs 	param_class_cfg_ether_usr1,
783dec9fcdSqs 	param_class_cfg_ether_usr2,
793dec9fcdSqs 	param_class_opt_ipv4_tcp,
803dec9fcdSqs 	param_class_opt_ipv4_udp,
813dec9fcdSqs 	param_class_opt_ipv4_ah,
823dec9fcdSqs 	param_class_opt_ipv4_sctp,
833dec9fcdSqs 	param_class_opt_ipv6_tcp,
843dec9fcdSqs 	param_class_opt_ipv6_udp,
853dec9fcdSqs 	param_class_opt_ipv6_ah,
863dec9fcdSqs 	param_class_opt_ipv6_sctp,
873dec9fcdSqs 	param_hxge_debug_flag,
883dec9fcdSqs 	param_hpi_debug_flag,
893dec9fcdSqs 	param_dump_ptrs,
903dec9fcdSqs 	param_end
913dec9fcdSqs } hxge_param_index_t;
923dec9fcdSqs 
933dec9fcdSqs 
943dec9fcdSqs #define	HXGE_PARAM_READ			0x00000001ULL
953dec9fcdSqs #define	HXGE_PARAM_WRITE		0x00000002ULL
963dec9fcdSqs #define	HXGE_PARAM_SHARED		0x00000004ULL
973dec9fcdSqs #define	HXGE_PARAM_PRIV			0x00000008ULL
983dec9fcdSqs #define	HXGE_PARAM_RW			HXGE_PARAM_READ | HXGE_PARAM_WRITE
993dec9fcdSqs #define	HXGE_PARAM_RWS			HXGE_PARAM_RW | HXGE_PARAM_SHARED
1003dec9fcdSqs #define	HXGE_PARAM_RWP			HXGE_PARAM_RW | HXGE_PARAM_PRIV
1013dec9fcdSqs 
1023dec9fcdSqs #define	HXGE_PARAM_RXDMA		0x00000010ULL
1033dec9fcdSqs #define	HXGE_PARAM_TXDMA		0x00000020ULL
1043dec9fcdSqs #define	HXGE_PARAM_MAC			0x00000040ULL
1053dec9fcdSqs 
1063dec9fcdSqs #define	HXGE_PARAM_CMPLX		0x00010000ULL
1073dec9fcdSqs #define	HXGE_PARAM_NDD_WR_OK		0x00020000ULL
1083dec9fcdSqs #define	HXGE_PARAM_INIT_ONLY		0x00040000ULL
1093dec9fcdSqs #define	HXGE_PARAM_INIT_CONFIG		0x00080000ULL
1103dec9fcdSqs 
1113dec9fcdSqs #define	HXGE_PARAM_READ_PROP		0x00100000ULL
1123dec9fcdSqs #define	HXGE_PARAM_PROP_ARR32		0x00200000ULL
1133dec9fcdSqs #define	HXGE_PARAM_PROP_ARR64		0x00400000ULL
1143dec9fcdSqs #define	HXGE_PARAM_PROP_STR		0x00800000ULL
1153dec9fcdSqs 
1163dec9fcdSqs #define	HXGE_PARAM_DONT_SHOW		0x80000000ULL
1173dec9fcdSqs 
1183dec9fcdSqs #define	HXGE_PARAM_ARRAY_CNT_MASK	0x0000ffff00000000ULL
1193dec9fcdSqs #define	HXGE_PARAM_ARRAY_CNT_SHIFT	32ULL
1203dec9fcdSqs #define	HXGE_PARAM_ARRAY_ALLOC_MASK	0xffff000000000000ULL
1213dec9fcdSqs #define	HXGE_PARAM_ARRAY_ALLOC_SHIFT	48ULL
1223dec9fcdSqs 
1233dec9fcdSqs typedef struct _hxge_param_t {
1243dec9fcdSqs 	int (*getf)();
1253dec9fcdSqs 	int (*setf)();		/* null for read only */
1263dec9fcdSqs 	uint64_t type;		/* R/W/ Common/Port/ .... */
1273dec9fcdSqs 	uint64_t minimum;
1283dec9fcdSqs 	uint64_t maximum;
1293dec9fcdSqs 	uint64_t value;		/* for array params, pointer to value array */
1303dec9fcdSqs 	uint64_t old_value; /* for array params, pointer to old_value array */
1313dec9fcdSqs 	char   *fcode_name;
1323dec9fcdSqs 	char   *name;
1333dec9fcdSqs } hxge_param_t, *p_hxge_param_t;
1343dec9fcdSqs 
1353dec9fcdSqs 
1363dec9fcdSqs typedef enum {
1373dec9fcdSqs 	hxge_lb_normal,
1383dec9fcdSqs 	hxge_lb_mac10g
1393dec9fcdSqs } hxge_lb_t;
1403dec9fcdSqs 
1413dec9fcdSqs enum hxge_mac_state {
1423dec9fcdSqs 	HXGE_MAC_STOPPED = 0,
1433dec9fcdSqs 	HXGE_MAC_STARTED
1443dec9fcdSqs };
1453dec9fcdSqs 
1463dec9fcdSqs typedef struct _filter_t {
1473dec9fcdSqs 	uint32_t all_phys_cnt;
1483dec9fcdSqs 	uint32_t all_multicast_cnt;
1493dec9fcdSqs 	uint32_t all_sap_cnt;
1503dec9fcdSqs } filter_t, *p_filter_t;
1513dec9fcdSqs 
1523dec9fcdSqs typedef struct _hxge_port_stats_t {
1533dec9fcdSqs 	hxge_lb_t		lb_mode;
1543dec9fcdSqs 	uint32_t		poll_mode;
1553dec9fcdSqs } hxge_port_stats_t, *p_hxge_port_stats_t;
1563dec9fcdSqs 
1573dec9fcdSqs 
1583dec9fcdSqs typedef struct _hxge_peu_sys_stats {
1593dec9fcdSqs 	uint32_t	spc_acc_err;
1603dec9fcdSqs 	uint32_t	tdc_pioacc_err;
1613dec9fcdSqs 	uint32_t	rdc_pioacc_err;
1623dec9fcdSqs 	uint32_t	pfc_pioacc_err;
1633dec9fcdSqs 	uint32_t	vmac_pioacc_err;
1643dec9fcdSqs 	uint32_t	cpl_hdrq_parerr;
1653dec9fcdSqs 	uint32_t	cpl_dataq_parerr;
1663dec9fcdSqs 	uint32_t	retryram_xdlh_parerr;
1673dec9fcdSqs 	uint32_t	retrysotram_xdlh_parerr;
1683dec9fcdSqs 	uint32_t	p_hdrq_parerr;
1693dec9fcdSqs 	uint32_t	p_dataq_parerr;
1703dec9fcdSqs 	uint32_t	np_hdrq_parerr;
1713dec9fcdSqs 	uint32_t	np_dataq_parerr;
1723dec9fcdSqs 	uint32_t	eic_msix_parerr;
1733dec9fcdSqs 	uint32_t	hcr_parerr;
1743dec9fcdSqs } hxge_peu_sys_stats_t, *p_hxge_peu_sys_stats_t;
1753dec9fcdSqs 
1763dec9fcdSqs 
1773dec9fcdSqs typedef struct _hxge_stats_t {
1783dec9fcdSqs 	/*
1793dec9fcdSqs 	 *  Overall structure size
1803dec9fcdSqs 	 */
1813dec9fcdSqs 	size_t			stats_size;
1823dec9fcdSqs 
1833dec9fcdSqs 	kstat_t			*ksp;
1843dec9fcdSqs 	kstat_t			*rdc_ksp[HXGE_MAX_RDCS];
1853dec9fcdSqs 	kstat_t			*tdc_ksp[HXGE_MAX_TDCS];
1863dec9fcdSqs 	kstat_t			*rdc_sys_ksp;
1873dec9fcdSqs 	kstat_t			*tdc_sys_ksp;
1883dec9fcdSqs 	kstat_t			*pfc_ksp;
1893dec9fcdSqs 	kstat_t			*vmac_ksp;
1903dec9fcdSqs 	kstat_t			*port_ksp;
1913dec9fcdSqs 	kstat_t			*mmac_ksp;
1923dec9fcdSqs 	kstat_t			*peu_sys_ksp;
1933dec9fcdSqs 
1943dec9fcdSqs 	hxge_mac_stats_t	mac_stats;
1953dec9fcdSqs 	hxge_vmac_stats_t	vmac_stats;	/* VMAC Statistics */
1963dec9fcdSqs 
1973dec9fcdSqs 	hxge_rx_ring_stats_t	rdc_stats[HXGE_MAX_RDCS]; /* per rdc stats */
1983dec9fcdSqs 	hxge_rdc_sys_stats_t	rdc_sys_stats;	/* RDC system stats */
1993dec9fcdSqs 
2003dec9fcdSqs 	hxge_tx_ring_stats_t	tdc_stats[HXGE_MAX_TDCS]; /* per tdc stats */
2013dec9fcdSqs 	hxge_tdc_sys_stats_t	tdc_sys_stats;	/* TDC system stats */
2023dec9fcdSqs 
2033dec9fcdSqs 	hxge_pfc_stats_t	pfc_stats;	/* pfc stats */
2043dec9fcdSqs 	hxge_port_stats_t	port_stats;	/* port stats */
2053dec9fcdSqs 	hxge_mmac_stats_t	mmac_stats;	/* Multi mac. stats */
2063dec9fcdSqs 
2073dec9fcdSqs 	hxge_peu_sys_stats_t	peu_sys_stats;	/* PEU system stats */
2083dec9fcdSqs } hxge_stats_t, *p_hxge_stats_t;
2093dec9fcdSqs 
2103dec9fcdSqs typedef struct _hxge_intr_t {
2113dec9fcdSqs 	boolean_t		intr_registered; /* interrupts are registered */
2123dec9fcdSqs 	boolean_t		intr_enabled; 	/* interrupts are enabled */
2133dec9fcdSqs 	boolean_t		niu_msi_enable;	/* debug or configurable? */
2143dec9fcdSqs 	uint8_t			nldevs;		/* # of logical devices */
2153dec9fcdSqs 	int			intr_types;	/* interrupt types supported */
2163dec9fcdSqs 	int			intr_type;	/* interrupt type to add */
2173dec9fcdSqs 	int			msi_intx_cnt;	/* # msi/intx ints returned */
2183dec9fcdSqs 	int			intr_added;	/* # ints actually needed */
2193dec9fcdSqs 	int			intr_cap;	/* interrupt capabilities */
2203dec9fcdSqs 	size_t			intr_size;	/* size of array to allocate */
2213dec9fcdSqs 	ddi_intr_handle_t 	*htable;	/* For array of interrupts */
2223dec9fcdSqs 	/* Add interrupt number for each interrupt vector */
2233dec9fcdSqs 	int			pri;
2243dec9fcdSqs } hxge_intr_t, *p_hxge_intr_t;
2253dec9fcdSqs 
2263dec9fcdSqs typedef struct _hxge_ldgv_t {
2273dec9fcdSqs 	uint8_t			ndma_ldvs;
2283dec9fcdSqs 	uint8_t			nldvs;
2293dec9fcdSqs 	uint8_t			start_ldg;
2303dec9fcdSqs 	uint8_t			maxldgs;
2313dec9fcdSqs 	uint8_t			maxldvs;
2323dec9fcdSqs 	uint8_t			ldg_intrs;
2333dec9fcdSqs 	uint32_t		tmres;
2343dec9fcdSqs 	p_hxge_ldg_t		ldgp;
2353dec9fcdSqs 	p_hxge_ldv_t		ldvp;
2363dec9fcdSqs 	p_hxge_ldv_t		ldvp_syserr;
2373dec9fcdSqs } hxge_ldgv_t, *p_hxge_ldgv_t;
2383dec9fcdSqs 
239a512c5d1SQiyan Sun - Sun Microsystems - San Diego United States typedef struct _hxge_timeout {
240a512c5d1SQiyan Sun - Sun Microsystems - San Diego United States 	timeout_id_t	id;
241a512c5d1SQiyan Sun - Sun Microsystems - San Diego United States 	clock_t		ticks;
242a512c5d1SQiyan Sun - Sun Microsystems - San Diego United States 	kmutex_t	lock;
243a512c5d1SQiyan Sun - Sun Microsystems - San Diego United States 	uint32_t	link_status;
244*e5d97391SQiyan Sun - Sun Microsystems - San Diego United States 	boolean_t	report_link_status;
245a512c5d1SQiyan Sun - Sun Microsystems - San Diego United States } hxge_timeout;
246a512c5d1SQiyan Sun - Sun Microsystems - San Diego United States 
2473dec9fcdSqs /*
2483dec9fcdSqs  * Hydra Device instance state information.
2493dec9fcdSqs  * Each instance is dynamically allocated on first attach.
2503dec9fcdSqs  */
2513dec9fcdSqs struct _hxge_t {
2523dec9fcdSqs 	dev_info_t		*dip;		/* device instance */
2533dec9fcdSqs 	dev_info_t		*p_dip;		/* Parent's device instance */
2543dec9fcdSqs 	int			instance;	/* instance number */
2553dec9fcdSqs 	uint32_t		drv_state;	/* driver state bit flags */
2563dec9fcdSqs 	uint64_t		hxge_debug_level; /* driver state bit flags */
2573dec9fcdSqs 	kmutex_t		genlock[1];
2583dec9fcdSqs 	enum hxge_mac_state	hxge_mac_state;
2593dec9fcdSqs 	ddi_softintr_t		resched_id;	/* reschedule callback */
2603dec9fcdSqs 	boolean_t		resched_needed;
2613dec9fcdSqs 	boolean_t		resched_running;
2623dec9fcdSqs 
2633dec9fcdSqs 	p_dev_regs_t		dev_regs;
2643dec9fcdSqs 	hpi_handle_t		hpi_handle;
2653dec9fcdSqs 	hpi_handle_t		hpi_pci_handle;
2663dec9fcdSqs 	hpi_handle_t		hpi_reg_handle;
2673dec9fcdSqs 	hpi_handle_t		hpi_msi_handle;
2683dec9fcdSqs 
2693dec9fcdSqs 	hxge_vmac_t		vmac;
2703dec9fcdSqs 	hxge_classify_t		classifier;
2713dec9fcdSqs 
2723dec9fcdSqs 	mac_handle_t		mach;		/* mac module handle */
2733dec9fcdSqs 
2743dec9fcdSqs 	p_hxge_stats_t		statsp;
2753dec9fcdSqs 	uint32_t		param_count;
2763dec9fcdSqs 	p_hxge_param_t		param_arr;
2773dec9fcdSqs 	hxge_hw_list_t		*hxge_hw_p; 	/* pointer to per Hydra */
2783dec9fcdSqs 	uint8_t			nrdc;
2793dec9fcdSqs 	uint8_t			rdc[HXGE_MAX_RDCS];
2803dec9fcdSqs 	uint8_t			ntdc;
2813dec9fcdSqs 	uint8_t			tdc[HXGE_MAX_TDCS];
2823dec9fcdSqs 
2833dec9fcdSqs 	hxge_intr_t		hxge_intr_type;
2843dec9fcdSqs 	hxge_dma_pt_cfg_t 	pt_config;
2853dec9fcdSqs 	hxge_class_pt_cfg_t 	class_config;
2863dec9fcdSqs 
2873dec9fcdSqs 	/* Logical device and group data structures. */
2883dec9fcdSqs 	p_hxge_ldgv_t		ldgvp;
2893dec9fcdSqs 
2903dec9fcdSqs 	caddr_t			param_list;	/* Parameter list */
2913dec9fcdSqs 
2923dec9fcdSqs 	ether_addr_st		factaddr;	/* factory mac address	    */
2933dec9fcdSqs 	ether_addr_st		ouraddr;	/* individual address	    */
2943dec9fcdSqs 	kmutex_t		ouraddr_lock;	/* lock to protect to uradd */
2953dec9fcdSqs 
2963dec9fcdSqs 	ddi_iblock_cookie_t	interrupt_cookie;
2973dec9fcdSqs 
2983dec9fcdSqs 	/*
2993dec9fcdSqs 	 * Blocks of memory may be pre-allocated by the
3003dec9fcdSqs 	 * partition manager or the driver. They may include
3013dec9fcdSqs 	 * blocks for configuration and buffers. The idea is
3023dec9fcdSqs 	 * to preallocate big blocks of contiguous areas in
3033dec9fcdSqs 	 * system memory (i.e. with IOMMU). These blocks then
3043dec9fcdSqs 	 * will be broken up to a fixed number of blocks with
3053dec9fcdSqs 	 * each block having the same block size (4K, 8K, 16K or
3063dec9fcdSqs 	 * 32K) in the case of buffer blocks. For systems that
3073dec9fcdSqs 	 * do not support DVMA, more than one big block will be
3083dec9fcdSqs 	 * allocated.
3093dec9fcdSqs 	 */
3103dec9fcdSqs 	uint32_t		rx_default_block_size;
3113dec9fcdSqs 	hxge_rx_block_size_t	rx_bksize_code;
3123dec9fcdSqs 
3133dec9fcdSqs 	p_hxge_dma_pool_t	rx_buf_pool_p;
3148ad8db65SMichael Speer 	p_hxge_dma_pool_t	rx_rbr_cntl_pool_p;
3158ad8db65SMichael Speer 	p_hxge_dma_pool_t	rx_rcr_cntl_pool_p;
3168ad8db65SMichael Speer 	p_hxge_dma_pool_t	rx_mbox_cntl_pool_p;
3173dec9fcdSqs 
3183dec9fcdSqs 	p_hxge_dma_pool_t	tx_buf_pool_p;
3193dec9fcdSqs 	p_hxge_dma_pool_t	tx_cntl_pool_p;
3203dec9fcdSqs 
3213dec9fcdSqs 	/* Receive buffer block ring and completion ring. */
3223dec9fcdSqs 	p_rx_rbr_rings_t 	rx_rbr_rings;
3233dec9fcdSqs 	p_rx_rcr_rings_t 	rx_rcr_rings;
3243dec9fcdSqs 	p_rx_mbox_areas_t 	rx_mbox_areas_p;
3253dec9fcdSqs 
3263dec9fcdSqs 	uint32_t		start_rdc;
3273dec9fcdSqs 	uint32_t		max_rdcs;
3283dec9fcdSqs 
3293dec9fcdSqs 	/* Transmit descriptors rings */
3303dec9fcdSqs 	p_tx_rings_t 		tx_rings;
3313dec9fcdSqs 	p_tx_mbox_areas_t	tx_mbox_areas_p;
3323dec9fcdSqs 
3333dec9fcdSqs 	uint32_t		start_tdc;
3343dec9fcdSqs 	uint32_t		max_tdcs;
3353dec9fcdSqs 	uint32_t		tdc_mask;
3363dec9fcdSqs 
3373dec9fcdSqs 	ddi_dma_handle_t 	dmasparehandle;
3383dec9fcdSqs 
3393dec9fcdSqs 	ulong_t 		sys_page_sz;
3403dec9fcdSqs 	ulong_t 		sys_page_mask;
3413dec9fcdSqs 	int 			suspended;
3423dec9fcdSqs 
3433dec9fcdSqs 	filter_t 		filter;		/* Current instance filter */
3443dec9fcdSqs 	p_hash_filter_t 	hash_filter;	/* Multicast hash filter. */
3453dec9fcdSqs 	krwlock_t		filter_lock;	/* Lock to protect filters. */
3463dec9fcdSqs 
3473dec9fcdSqs 	ulong_t 		sys_burst_sz;
3483dec9fcdSqs 	timeout_id_t 		hxge_timerid;
3493dec9fcdSqs 	uint8_t 		msg_min;
3503dec9fcdSqs 
3513dec9fcdSqs 	uint16_t		intr_timeout;
3523dec9fcdSqs 	uint16_t		intr_threshold;
3533dec9fcdSqs 
3543dec9fcdSqs 	rtrace_t		rtrace;
3553dec9fcdSqs 	int			fm_capabilities; /* FMA capabilities */
3563dec9fcdSqs 
3573dec9fcdSqs 	uint32_t 		hxge_port_rbr_size;
3583dec9fcdSqs 	uint32_t 		hxge_port_rcr_size;
3593dec9fcdSqs 	uint32_t 		hxge_port_tx_ring_size;
3603dec9fcdSqs 	hxge_mmac_t		hxge_mmac_info;
361fe930412Sqs 
362fe930412Sqs 	kmutex_t		pio_lock;
363a512c5d1SQiyan Sun - Sun Microsystems - San Diego United States 	hxge_timeout		timeout;
3643dec9fcdSqs };
3653dec9fcdSqs 
3663dec9fcdSqs /*
3673dec9fcdSqs  * Driver state flags.
3683dec9fcdSqs  */
3693dec9fcdSqs #define	STATE_REGS_MAPPED	0x000000001	/* device registers mapped */
3703dec9fcdSqs #define	STATE_KSTATS_SETUP	0x000000002	/* kstats allocated	*/
3713dec9fcdSqs #define	STATE_NODE_CREATED	0x000000004	/* device node created	*/
3723dec9fcdSqs #define	STATE_HW_CONFIG_CREATED	0x000000008	/* hardware properties	*/
3733dec9fcdSqs #define	STATE_HW_INITIALIZED	0x000000010	/* hardware initialized	*/
3743dec9fcdSqs 
3753dec9fcdSqs typedef struct _hxge_port_kstat_t {
3763dec9fcdSqs 	/*
3773dec9fcdSqs 	 * Transciever state informations.
3783dec9fcdSqs 	 */
3793dec9fcdSqs 	kstat_named_t	cap_autoneg;
3803dec9fcdSqs 	kstat_named_t	cap_10gfdx;
3813dec9fcdSqs 
3823dec9fcdSqs 	/*
3833dec9fcdSqs 	 * Link partner capabilities.
3843dec9fcdSqs 	 */
3853dec9fcdSqs 	kstat_named_t	lp_cap_autoneg;
3863dec9fcdSqs 	kstat_named_t	lp_cap_10gfdx;
3873dec9fcdSqs 
3883dec9fcdSqs 	/*
3893dec9fcdSqs 	 * Shared link setup.
3903dec9fcdSqs 	 */
3913dec9fcdSqs 	kstat_named_t	link_speed;
3923dec9fcdSqs 	kstat_named_t	link_duplex;
3933dec9fcdSqs 	kstat_named_t	link_up;
3943dec9fcdSqs 
3953dec9fcdSqs 	/*
3963dec9fcdSqs 	 * Lets the user know the MTU currently in use by
3973dec9fcdSqs 	 * the physical MAC port.
3983dec9fcdSqs 	 */
3993dec9fcdSqs 	kstat_named_t	lb_mode;
4003dec9fcdSqs 
4013dec9fcdSqs 	kstat_named_t	tx_max_pend;
4023dec9fcdSqs 	kstat_named_t	rx_jumbo_pkts;
4033dec9fcdSqs 
4043dec9fcdSqs 	/*
4053dec9fcdSqs 	 * Misc MAC statistics.
4063dec9fcdSqs 	 */
4073dec9fcdSqs 	kstat_named_t	ifspeed;
4083dec9fcdSqs 	kstat_named_t	promisc;
4093dec9fcdSqs } hxge_port_kstat_t, *p_hxge_port_kstat_t;
4103dec9fcdSqs 
4113dec9fcdSqs typedef struct _hxge_rdc_kstat {
4123dec9fcdSqs 	/*
4133dec9fcdSqs 	 * Receive DMA channel statistics.
4143dec9fcdSqs 	 * This structure needs to be consistent with hxge_rdc_stat_index_t
4153dec9fcdSqs 	 * in hxge_kstat.c
4163dec9fcdSqs 	 */
4173dec9fcdSqs 	kstat_named_t	ipackets;
4183dec9fcdSqs 	kstat_named_t	rbytes;
4193dec9fcdSqs 	kstat_named_t	errors;
4203dec9fcdSqs 	kstat_named_t	jumbo_pkts;
4213dec9fcdSqs 
4223dec9fcdSqs 	kstat_named_t	rcr_unknown_err;
4233dec9fcdSqs 	kstat_named_t	rcr_sha_par_err;
4243dec9fcdSqs 	kstat_named_t	rbr_pre_par_err;
4253dec9fcdSqs 	kstat_named_t	rbr_pre_emty;
4263dec9fcdSqs 
4273dec9fcdSqs 	kstat_named_t	rcr_shadow_full;
4283dec9fcdSqs 	kstat_named_t	rbr_tmout;
4293dec9fcdSqs 	kstat_named_t	peu_resp_err;
4303dec9fcdSqs 
4313dec9fcdSqs 	kstat_named_t	ctrl_fifo_ecc_err;
4323dec9fcdSqs 	kstat_named_t	data_fifo_ecc_err;
4333dec9fcdSqs 
4343dec9fcdSqs 	kstat_named_t	rcrfull;
4353dec9fcdSqs 	kstat_named_t	rbr_empty;
4363dec9fcdSqs 	kstat_named_t	rbrfull;
4378ad8db65SMichael Speer 	kstat_named_t	rcr_invalids;	/* Account for invalid RCR entries. */
4383dec9fcdSqs 
4393dec9fcdSqs 	kstat_named_t	rcr_to;
4403dec9fcdSqs 	kstat_named_t	rcr_thresh;
4413dec9fcdSqs } hxge_rdc_kstat_t, *p_hxge_rdc_kstat_t;
4423dec9fcdSqs 
4433dec9fcdSqs typedef struct _hxge_rdc_sys_kstat {
4443dec9fcdSqs 	/*
4453dec9fcdSqs 	 * Receive DMA system statistics.
4463dec9fcdSqs 	 * This structure needs to be consistent with hxge_rdc_sys_stat_idx_t
4473dec9fcdSqs 	 * in hxge_kstat.c
4483dec9fcdSqs 	 */
4493dec9fcdSqs 	kstat_named_t	ctrl_fifo_sec;
4503dec9fcdSqs 	kstat_named_t	ctrl_fifo_ded;
4513dec9fcdSqs 	kstat_named_t	data_fifo_sec;
4523dec9fcdSqs 	kstat_named_t	data_fifo_ded;
4533dec9fcdSqs } hxge_rdc_sys_kstat_t, *p_hxge_rdc_sys_kstat_t;
4543dec9fcdSqs 
4553dec9fcdSqs typedef	struct _hxge_tdc_kstat {
4563dec9fcdSqs 	/*
4573dec9fcdSqs 	 * Transmit DMA channel statistics.
4583dec9fcdSqs 	 * This structure needs to be consistent with hxge_tdc_stats_index_t
4593dec9fcdSqs 	 * in hxge_kstat.c
4603dec9fcdSqs 	 */
4613dec9fcdSqs 	kstat_named_t	opackets;
4623dec9fcdSqs 	kstat_named_t	obytes;
4633dec9fcdSqs 	kstat_named_t	obytes_with_pad;
4643dec9fcdSqs 	kstat_named_t	oerrors;
4653dec9fcdSqs 	kstat_named_t	tx_inits;
4663dec9fcdSqs 	kstat_named_t	tx_no_buf;
4673dec9fcdSqs 
4683dec9fcdSqs 	kstat_named_t	peu_resp_err;
4693dec9fcdSqs 	kstat_named_t	pkt_size_err;
4703dec9fcdSqs 	kstat_named_t	tx_rng_oflow;
4713dec9fcdSqs 	kstat_named_t	pkt_size_hdr_err;
4723dec9fcdSqs 	kstat_named_t	runt_pkt_drop_err;
4733dec9fcdSqs 	kstat_named_t	pref_par_err;
4743dec9fcdSqs 	kstat_named_t	tdr_pref_cpl_to;
4753dec9fcdSqs 	kstat_named_t	pkt_cpl_to;
4763dec9fcdSqs 	kstat_named_t	invalid_sop;
4773dec9fcdSqs 	kstat_named_t	unexpected_sop;
4783dec9fcdSqs 
4793dec9fcdSqs 	kstat_named_t	count_hdr_size_err;
4803dec9fcdSqs 	kstat_named_t	count_runt;
4813dec9fcdSqs 	kstat_named_t	count_abort;
4823dec9fcdSqs 
4833dec9fcdSqs 	kstat_named_t	tx_starts;
4843dec9fcdSqs 	kstat_named_t	tx_no_desc;
4853dec9fcdSqs 	kstat_named_t	tx_dma_bind_fail;
4863dec9fcdSqs 	kstat_named_t	tx_hdr_pkts;
4873dec9fcdSqs 	kstat_named_t	tx_ddi_pkts;
4883dec9fcdSqs 	kstat_named_t	tx_jumbo_pkts;
4893dec9fcdSqs 	kstat_named_t	tx_max_pend;
4903dec9fcdSqs 	kstat_named_t	tx_marks;
4913dec9fcdSqs } hxge_tdc_kstat_t, *p_hxge_tdc_kstat_t;
4923dec9fcdSqs 
4933dec9fcdSqs typedef struct _hxge_tdc_sys_kstat {
4943dec9fcdSqs 	/*
4953dec9fcdSqs 	 * Transmit DMA system statistics.
4963dec9fcdSqs 	 * This structure needs to be consistent with hxge_tdc_sys_stat_idx_t
4973dec9fcdSqs 	 * in hxge_kstat.c
4983dec9fcdSqs 	 */
4993dec9fcdSqs 	kstat_named_t	reord_tbl_par_err;
5003dec9fcdSqs 	kstat_named_t	reord_buf_ded_err;
5013dec9fcdSqs 	kstat_named_t	reord_buf_sec_err;
5023dec9fcdSqs } hxge_tdc_sys_kstat_t, *p_hxge_tdc_sys_kstat_t;
5033dec9fcdSqs 
5043dec9fcdSqs typedef	struct _hxge_vmac_kstat {
5053dec9fcdSqs 	/*
5063dec9fcdSqs 	 * VMAC statistics.
5073dec9fcdSqs 	 * This structure needs to be consistent with hxge_vmac_stat_index_t
5083dec9fcdSqs 	 * in hxge_kstat.c
5093dec9fcdSqs 	 */
5103dec9fcdSqs 	kstat_named_t	tx_frame_cnt;
5113dec9fcdSqs 	kstat_named_t	tx_byte_cnt;
5123dec9fcdSqs 
5133dec9fcdSqs 	kstat_named_t	rx_frame_cnt;
5143dec9fcdSqs 	kstat_named_t	rx_byte_cnt;
5153dec9fcdSqs 	kstat_named_t	rx_drop_frame_cnt;
5163dec9fcdSqs 	kstat_named_t	rx_drop_byte_cnt;
5173dec9fcdSqs 	kstat_named_t	rx_crc_cnt;
5183dec9fcdSqs 	kstat_named_t	rx_pause_cnt;
5193dec9fcdSqs 	kstat_named_t	rx_bcast_fr_cnt;
5203dec9fcdSqs 	kstat_named_t	rx_mcast_fr_cnt;
5213dec9fcdSqs } hxge_vmac_kstat_t, *p_hxge_vmac_kstat_t;
5223dec9fcdSqs 
5233dec9fcdSqs typedef struct _hxge_pfc_kstat {
5243dec9fcdSqs 	/*
5253dec9fcdSqs 	 * This structure needs to be consistent with hxge_pfc_stat_index_t
5263dec9fcdSqs 	 * in hxge_kstat.c
5273dec9fcdSqs 	 */
5283dec9fcdSqs 	kstat_named_t	pfc_pkt_drop;
5293dec9fcdSqs 	kstat_named_t	pfc_tcam_parity_err;
5303dec9fcdSqs 	kstat_named_t	pfc_vlan_parity_err;
5313dec9fcdSqs 	kstat_named_t	pfc_bad_cs_count;
5323dec9fcdSqs 	kstat_named_t	pfc_drop_count;
5333dec9fcdSqs 	kstat_named_t	pfc_tcp_ctrl_drop;
5343dec9fcdSqs 	kstat_named_t	pfc_l2_addr_drop;
5353dec9fcdSqs 	kstat_named_t	pfc_class_code_drop;
5363dec9fcdSqs 	kstat_named_t	pfc_tcam_drop;
5373dec9fcdSqs 	kstat_named_t	pfc_vlan_drop;
5383dec9fcdSqs } hxge_pfc_kstat_t, *p_hxge_pfc_kstat_t;
5393dec9fcdSqs 
5403dec9fcdSqs typedef struct _hxge_mmac_kstat {
5413dec9fcdSqs 	/*
5423dec9fcdSqs 	 * This structure needs to be consistent with hxge_mmac_stat_index_t
5433dec9fcdSqs 	 * in hxge_kstat.c
5443dec9fcdSqs 	 */
5453dec9fcdSqs 	kstat_named_t	mmac_max_addr_cnt;
5463dec9fcdSqs 	kstat_named_t	mmac_avail_addr_cnt;
5473dec9fcdSqs 	kstat_named_t	mmac_addr1;
5483dec9fcdSqs 	kstat_named_t	mmac_addr2;
5493dec9fcdSqs 	kstat_named_t	mmac_addr3;
5503dec9fcdSqs 	kstat_named_t	mmac_addr4;
5513dec9fcdSqs 	kstat_named_t	mmac_addr5;
5523dec9fcdSqs 	kstat_named_t	mmac_addr6;
5533dec9fcdSqs 	kstat_named_t	mmac_addr7;
5543dec9fcdSqs 	kstat_named_t	mmac_addr8;
5553dec9fcdSqs 	kstat_named_t	mmac_addr9;
5563dec9fcdSqs 	kstat_named_t	mmac_addr10;
5573dec9fcdSqs 	kstat_named_t	mmac_addr11;
5583dec9fcdSqs 	kstat_named_t	mmac_addr12;
5593dec9fcdSqs 	kstat_named_t	mmac_addr13;
5603dec9fcdSqs 	kstat_named_t	mmac_addr14;
5613dec9fcdSqs 	kstat_named_t	mmac_addr15;
5623dec9fcdSqs 	kstat_named_t	mmac_addr16;
5633dec9fcdSqs } hxge_mmac_kstat_t, *p_hxge_mmac_kstat_t;
5643dec9fcdSqs 
5653dec9fcdSqs typedef struct _hxge_peu_sys_kstat {
5663dec9fcdSqs 	/*
5673dec9fcdSqs 	 * This structure needs to be consistent with hxge_peu_sys_stat_idx_t
5683dec9fcdSqs 	 * in hxge_kstat.c
5693dec9fcdSqs 	 */
5703dec9fcdSqs 	kstat_named_t	spc_acc_err;
5713dec9fcdSqs 	kstat_named_t	tdc_pioacc_err;
5723dec9fcdSqs 	kstat_named_t	rdc_pioacc_err;
5733dec9fcdSqs 	kstat_named_t	pfc_pioacc_err;
5743dec9fcdSqs 	kstat_named_t	vmac_pioacc_err;
5753dec9fcdSqs 	kstat_named_t	cpl_hdrq_parerr;
5763dec9fcdSqs 	kstat_named_t	cpl_dataq_parerr;
5773dec9fcdSqs 	kstat_named_t	retryram_xdlh_parerr;
5783dec9fcdSqs 	kstat_named_t	retrysotram_xdlh_parerr;
5793dec9fcdSqs 	kstat_named_t	p_hdrq_parerr;
5803dec9fcdSqs 	kstat_named_t	p_dataq_parerr;
5813dec9fcdSqs 	kstat_named_t	np_hdrq_parerr;
5823dec9fcdSqs 	kstat_named_t	np_dataq_parerr;
5833dec9fcdSqs 	kstat_named_t	eic_msix_parerr;
5843dec9fcdSqs 	kstat_named_t	hcr_parerr;
5853dec9fcdSqs } hxge_peu_sys_kstat_t, *p_hxge_peu_sys_kstat_t;
5863dec9fcdSqs 
5873dec9fcdSqs /*
5883dec9fcdSqs  * Prototype definitions.
5893dec9fcdSqs  */
5903dec9fcdSqs hxge_status_t hxge_init(p_hxge_t);
5913dec9fcdSqs void hxge_uninit(p_hxge_t);
5923dec9fcdSqs void hxge_get64(p_hxge_t hxgep, p_mblk_t mp);
5933dec9fcdSqs void hxge_put64(p_hxge_t hxgep, p_mblk_t mp);
5943dec9fcdSqs 
5953dec9fcdSqs typedef	void	(*fptrv_t)();
5963dec9fcdSqs timeout_id_t hxge_start_timer(p_hxge_t hxgep, fptrv_t func, int msec);
5973dec9fcdSqs void hxge_stop_timer(p_hxge_t hxgep, timeout_id_t timerid);
5983dec9fcdSqs 
5993dec9fcdSqs #ifdef	__cplusplus
6003dec9fcdSqs }
6013dec9fcdSqs #endif
6023dec9fcdSqs 
6033dec9fcdSqs #endif	/* _SYS_HXGE_HXGE_H */
604