xref: /onnv-gate/usr/src/uts/common/io/xge/drv/xgell.h (revision 11878:ac93462db6d7)
11256Syl150051 /*
21256Syl150051  * CDDL HEADER START
31256Syl150051  *
41256Syl150051  * The contents of this file are subject to the terms of the
51256Syl150051  * Common Development and Distribution License (the "License").
61256Syl150051  * You may not use this file except in compliance with the License.
71256Syl150051  *
81256Syl150051  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91256Syl150051  * or http://www.opensolaris.org/os/licensing.
101256Syl150051  * See the License for the specific language governing permissions
111256Syl150051  * and limitations under the License.
121256Syl150051  *
131256Syl150051  * When distributing Covered Code, include this CDDL HEADER in each
141256Syl150051  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151256Syl150051  * If applicable, add the following below this CDDL HEADER, with the
161256Syl150051  * fields enclosed by brackets "[]" replaced with your own identifying
171256Syl150051  * information: Portions Copyright [yyyy] [name of copyright owner]
181256Syl150051  *
191256Syl150051  * CDDL HEADER END
201256Syl150051  */
211256Syl150051 
221256Syl150051 /*
23*11878SVenu.Iyer@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
241256Syl150051  * Use is subject to license terms.
251256Syl150051  */
261256Syl150051 
271256Syl150051 /*
281256Syl150051  *  Copyright (c) 2002-2005 Neterion, Inc.
291256Syl150051  *  All right Reserved.
301256Syl150051  *
311256Syl150051  *  FileName :    xgell.h
321256Syl150051  *
331256Syl150051  *  Description:  Link Layer driver declaration
341256Syl150051  *
351256Syl150051  */
361256Syl150051 
371256Syl150051 #ifndef _SYS_XGELL_H
381256Syl150051 #define	_SYS_XGELL_H
391256Syl150051 
401256Syl150051 #include <sys/types.h>
411256Syl150051 #include <sys/errno.h>
421256Syl150051 #include <sys/param.h>
431256Syl150051 #include <sys/stropts.h>
441256Syl150051 #include <sys/stream.h>
451256Syl150051 #include <sys/strsubr.h>
461256Syl150051 #include <sys/kmem.h>
471256Syl150051 #include <sys/conf.h>
481256Syl150051 #include <sys/devops.h>
491256Syl150051 #include <sys/ksynch.h>
501256Syl150051 #include <sys/stat.h>
511256Syl150051 #include <sys/modctl.h>
521256Syl150051 #include <sys/debug.h>
531256Syl150051 #include <sys/pci.h>
541256Syl150051 #include <sys/ethernet.h>
551256Syl150051 #include <sys/vlan.h>
561256Syl150051 #include <sys/dlpi.h>
571256Syl150051 #include <sys/taskq.h>
581256Syl150051 #include <sys/cyclic.h>
591256Syl150051 
601256Syl150051 #include <sys/pattr.h>
611256Syl150051 #include <sys/strsun.h>
621256Syl150051 
638275SEric Cheng #include <sys/mac_provider.h>
642311Sseb #include <sys/mac_ether.h>
651256Syl150051 
661256Syl150051 #ifdef __cplusplus
671256Syl150051 extern "C" {
681256Syl150051 #endif
691256Syl150051 
707656SSherry.Moore@Sun.COM #define	XGELL_DESC		"Xframe I/II 10Gb Ethernet"
711256Syl150051 #define	XGELL_IFNAME		"xge"
721256Syl150051 
731256Syl150051 #include <xgehal.h>
741256Syl150051 
753115Syl150051 /*
766937Sxw161283  * The definition of XGELL_RX_BUFFER_RECYCLE_CACHE is an experimental value.
776937Sxw161283  * With this value, the lock contention between xgell_rx_buffer_recycle()
786937Sxw161283  * and xgell_rx_1b_compl() is reduced to great extent. And multiple rx rings
796937Sxw161283  * alleviate the lock contention further since each rx ring has its own mutex.
806937Sxw161283  */
816937Sxw161283 #define	XGELL_RX_BUFFER_RECYCLE_CACHE	XGE_HAL_RING_RXDS_PER_BLOCK(1) * 2
826937Sxw161283 #define	MSG_SIZE	64
836937Sxw161283 
846937Sxw161283 /*
853115Syl150051  * These default values can be overridden by vaules in xge.conf.
863115Syl150051  * In xge.conf user has to specify actual (not percentages) values.
873115Syl150051  */
883115Syl150051 #define	XGELL_RX_BUFFER_TOTAL		XGE_HAL_RING_RXDS_PER_BLOCK(1) * 6
893115Syl150051 #define	XGELL_RX_BUFFER_POST_HIWAT	XGE_HAL_RING_RXDS_PER_BLOCK(1) * 5
901256Syl150051 
918275SEric Cheng /*
928275SEric Cheng  * Multiple rings configuration
938275SEric Cheng  */
948275SEric Cheng #define	XGELL_RX_RING_MAIN			0
958275SEric Cheng #define	XGELL_TX_RING_MAIN			0
961256Syl150051 
978275SEric Cheng #define	XGELL_RX_RING_NUM_MIN			1
988275SEric Cheng #define	XGELL_TX_RING_NUM_MIN			1
998275SEric Cheng #define	XGELL_RX_RING_NUM_MAX			8
1008275SEric Cheng #define	XGELL_TX_RING_NUM_MAX			1 /* TODO */
1018275SEric Cheng #define	XGELL_RX_RING_NUM_DEFAULT		XGELL_RX_RING_NUM_MAX
1028275SEric Cheng #define	XGELL_TX_RING_NUM_DEFAULT		XGELL_TX_RING_NUM_MAX
1038275SEric Cheng 
1048275SEric Cheng #define	XGELL_MINTR_NUM_MIN			1
1058275SEric Cheng #define	XGELL_MINTR_NUM_MAX			\
1068275SEric Cheng 	(XGELL_RX_RING_NUM_MAX + XGELL_TX_RING_NUM_MAX + 1)
1078275SEric Cheng #define	XGELL_MINTR_NUM_DEFAULT			XGELL_MINTR_NUM_MAX
1081256Syl150051 
1098275SEric Cheng #define	XGELL_CONF_GROUP_POLICY_BASIC		0
1108275SEric Cheng #define	XGELL_CONF_GROUP_POLICY_VIRT		1
1118275SEric Cheng #define	XGELL_CONF_GROUP_POLICY_PERF		2
1128275SEric Cheng #if 0
1138275SEric Cheng #if defined(__sparc)
1148275SEric Cheng #define	XGELL_CONF_GROUP_POLICY_DEFAULT		XGELL_CONF_GROUP_POLICY_PERF
1158275SEric Cheng #else
1168275SEric Cheng #define	XGELL_CONF_GROUP_POLICY_DEFAULT		XGELL_CONF_GROUP_POLICY_VIRT
1178275SEric Cheng #endif
1183115Syl150051 #else
1198275SEric Cheng /*
1208275SEric Cheng  * The _PERF configuration enable a fat group of all rx rings, as approachs
1218275SEric Cheng  * better fanout performance of the primary interface.
1228275SEric Cheng  */
1238275SEric Cheng #define	XGELL_CONF_GROUP_POLICY_DEFAULT		XGELL_CONF_GROUP_POLICY_PERF
1248275SEric Cheng #endif
1258275SEric Cheng 
1268275SEric Cheng #define	XGELL_TX_LEVEL_LOW	8
1278275SEric Cheng #define	XGELL_TX_LEVEL_HIGH	32
1288275SEric Cheng #define	XGELL_TX_LEVEL_CHECK	3
1298275SEric Cheng #define	XGELL_MAX_RING_DEFAULT	8
1308275SEric Cheng #define	XGELL_MAX_FIFO_DEFAULT	1
1318275SEric Cheng 
1328275SEric Cheng /* Control driver to copy or DMA inbound/outbound packets */
1338275SEric Cheng #if defined(__sparc)
1348275SEric Cheng #define	XGELL_RX_DMA_LOWAT			256
1358275SEric Cheng #define	XGELL_TX_DMA_LOWAT			512
1368275SEric Cheng #else
1378275SEric Cheng #define	XGELL_RX_DMA_LOWAT			256
1388275SEric Cheng #define	XGELL_TX_DMA_LOWAT			128
1393115Syl150051 #endif
1403115Syl150051 
1413115Syl150051 /*
1423115Syl150051  * Try to collapse up to XGELL_RX_PKT_BURST packets into single mblk
1433115Syl150051  * sequence before mac_rx() is called.
1443115Syl150051  */
1458275SEric Cheng #define	XGELL_RX_PKT_BURST			32
1463115Syl150051 
1471256Syl150051 /* About 1s */
1488275SEric Cheng #define	XGE_DEV_POLL_TICKS			drv_usectohz(1000000)
1491256Syl150051 
1503115Syl150051 #define	XGELL_LSO_MAXLEN			65535
1513115Syl150051 #define	XGELL_CONF_ENABLE_BY_DEFAULT		1
1523115Syl150051 #define	XGELL_CONF_DISABLE_BY_DEFAULT		0
1533115Syl150051 
1543115Syl150051 /* LRO configuration */
1556937Sxw161283 #define	XGE_HAL_DEFAULT_LRO_SG_SIZE		2 /* <=2 LRO fix not required */
1563115Syl150051 #define	XGE_HAL_DEFAULT_LRO_FRM_LEN		65535
1573115Syl150051 
1581256Syl150051 /*
1596937Sxw161283  * Default values for tunables used in HAL. Please refer to xgehal-config.h
1606937Sxw161283  * for more details.
1611256Syl150051  */
1621256Syl150051 #define	XGE_HAL_DEFAULT_USE_HARDCODE		-1
1631256Syl150051 
1646937Sxw161283 /* Bimodal adaptive schema defaults - ENABLED */
1653115Syl150051 #define	XGE_HAL_DEFAULT_BIMODAL_INTERRUPTS	-1
1663115Syl150051 #define	XGE_HAL_DEFAULT_BIMODAL_TIMER_LO_US	24
1673115Syl150051 #define	XGE_HAL_DEFAULT_BIMODAL_TIMER_HI_US	256
1683115Syl150051 
1696937Sxw161283 /* Interrupt moderation/utilization defaults */
1703115Syl150051 #define	XGE_HAL_DEFAULT_TX_URANGE_A		5
1713115Syl150051 #define	XGE_HAL_DEFAULT_TX_URANGE_B		15
1723115Syl150051 #define	XGE_HAL_DEFAULT_TX_URANGE_C		30
1733115Syl150051 #define	XGE_HAL_DEFAULT_TX_UFC_A		15
1743115Syl150051 #define	XGE_HAL_DEFAULT_TX_UFC_B		30
1753115Syl150051 #define	XGE_HAL_DEFAULT_TX_UFC_C		45
1763115Syl150051 #define	XGE_HAL_DEFAULT_TX_UFC_D		60
1771256Syl150051 #define	XGE_HAL_DEFAULT_TX_TIMER_CI_EN		1
1781256Syl150051 #define	XGE_HAL_DEFAULT_TX_TIMER_AC_EN		1
1793115Syl150051 #define	XGE_HAL_DEFAULT_TX_TIMER_VAL		10000
1803115Syl150051 #define	XGE_HAL_DEFAULT_INDICATE_MAX_PKTS_B	512 /* bimodal */
1813115Syl150051 #define	XGE_HAL_DEFAULT_INDICATE_MAX_PKTS_N	256 /* normal UFC */
1823115Syl150051 #define	XGE_HAL_DEFAULT_RX_URANGE_A		10
1833115Syl150051 #define	XGE_HAL_DEFAULT_RX_URANGE_B		30
1843115Syl150051 #define	XGE_HAL_DEFAULT_RX_URANGE_C		50
1851256Syl150051 #define	XGE_HAL_DEFAULT_RX_UFC_A		1
1863115Syl150051 #define	XGE_HAL_DEFAULT_RX_UFC_B_J		2
1873115Syl150051 #define	XGE_HAL_DEFAULT_RX_UFC_B_N		8
1883115Syl150051 #define	XGE_HAL_DEFAULT_RX_UFC_C_J		4
1893115Syl150051 #define	XGE_HAL_DEFAULT_RX_UFC_C_N		16
1903115Syl150051 #define	XGE_HAL_DEFAULT_RX_UFC_D		32
1911256Syl150051 #define	XGE_HAL_DEFAULT_RX_TIMER_AC_EN		1
1923115Syl150051 #define	XGE_HAL_DEFAULT_RX_TIMER_VAL		384
1931256Syl150051 
1948275SEric Cheng #define	XGE_HAL_DEFAULT_FIFO_QUEUE_LENGTH_A	1024
1951256Syl150051 #define	XGE_HAL_DEFAULT_FIFO_QUEUE_LENGTH_J	2048
1961256Syl150051 #define	XGE_HAL_DEFAULT_FIFO_QUEUE_LENGTH_N	4096
1971256Syl150051 #define	XGE_HAL_DEFAULT_FIFO_QUEUE_INTR		0
1981256Syl150051 #define	XGE_HAL_DEFAULT_FIFO_RESERVE_THRESHOLD	0
1991256Syl150051 #define	XGE_HAL_DEFAULT_FIFO_MEMBLOCK_SIZE	PAGESIZE
2001256Syl150051 
2013115Syl150051 /*
2026937Sxw161283  * This will force HAL to allocate extra copied buffer per TXDL which
2033115Syl150051  * size calculated by formula:
2043115Syl150051  *
2053115Syl150051  *      (ALIGNMENT_SIZE * ALIGNED_FRAGS)
2063115Syl150051  */
2073115Syl150051 #define	XGE_HAL_DEFAULT_FIFO_ALIGNMENT_SIZE	4096
2081256Syl150051 #define	XGE_HAL_DEFAULT_FIFO_MAX_ALIGNED_FRAGS	1
2098275SEric Cheng #if defined(__sparc)
2108275SEric Cheng #define	XGE_HAL_DEFAULT_FIFO_FRAGS		64
2118275SEric Cheng #else
2123115Syl150051 #define	XGE_HAL_DEFAULT_FIFO_FRAGS		128
2131256Syl150051 #endif
2143115Syl150051 #define	XGE_HAL_DEFAULT_FIFO_FRAGS_THRESHOLD	18
2151256Syl150051 
2168275SEric Cheng #define	XGE_HAL_DEFAULT_RING_QUEUE_BLOCKS	2
2171256Syl150051 #define	XGE_HAL_RING_QUEUE_BUFFER_MODE_DEFAULT	1
2183115Syl150051 #define	XGE_HAL_DEFAULT_BACKOFF_INTERVAL_US	64
2191256Syl150051 #define	XGE_HAL_DEFAULT_RING_PRIORITY		0
2201256Syl150051 #define	XGE_HAL_DEFAULT_RING_MEMBLOCK_SIZE	PAGESIZE
2211256Syl150051 
2221256Syl150051 #define	XGE_HAL_DEFAULT_RING_NUM		8
2231256Syl150051 #define	XGE_HAL_DEFAULT_TMAC_UTIL_PERIOD	5
2241256Syl150051 #define	XGE_HAL_DEFAULT_RMAC_UTIL_PERIOD	5
2251256Syl150051 #define	XGE_HAL_DEFAULT_RMAC_HIGH_PTIME		65535
2261256Syl150051 #define	XGE_HAL_DEFAULT_MC_PAUSE_THRESHOLD_Q0Q3	187
2271256Syl150051 #define	XGE_HAL_DEFAULT_MC_PAUSE_THRESHOLD_Q4Q7	187
2283115Syl150051 #define	XGE_HAL_DEFAULT_RMAC_PAUSE_GEN_EN	1
2293115Syl150051 #define	XGE_HAL_DEFAULT_RMAC_PAUSE_GEN_DIS	0
2303115Syl150051 #define	XGE_HAL_DEFAULT_RMAC_PAUSE_RCV_EN	1
2313115Syl150051 #define	XGE_HAL_DEFAULT_RMAC_PAUSE_RCV_DIS	0
2321256Syl150051 #define	XGE_HAL_DEFAULT_INITIAL_MTU		XGE_HAL_DEFAULT_MTU /* 1500 */
2333115Syl150051 #define	XGE_HAL_DEFAULT_ISR_POLLING_CNT		0
2341256Syl150051 #define	XGE_HAL_DEFAULT_LATENCY_TIMER		255
2356937Sxw161283 #define	XGE_HAL_DEFAULT_SHARED_SPLITS		0
2366937Sxw161283 #define	XGE_HAL_DEFAULT_STATS_REFRESH_TIME	1
2376937Sxw161283 
2386937Sxw161283 #if defined(__sparc)
2398275SEric Cheng #define	XGE_HAL_DEFAULT_MMRB_COUNT		XGE_HAL_MAX_MMRB_COUNT
2408275SEric Cheng #define	XGE_HAL_DEFAULT_SPLIT_TRANSACTION	XGE_HAL_EIGHT_SPLIT_TRANSACTION
2416937Sxw161283 #else
2421256Syl150051 #define	XGE_HAL_DEFAULT_MMRB_COUNT		1 /* 1k */
2438275SEric Cheng #define	XGE_HAL_DEFAULT_SPLIT_TRANSACTION	XGE_HAL_TWO_SPLIT_TRANSACTION
2446937Sxw161283 #endif
2451256Syl150051 
2461256Syl150051 /*
2478275SEric Cheng  * Default the size of buffers allocated for ndd interface functions
2481256Syl150051  */
2496937Sxw161283 #define	XGELL_STATS_BUFSIZE			8192
2501256Syl150051 #define	XGELL_PCICONF_BUFSIZE			2048
2511256Syl150051 #define	XGELL_ABOUT_BUFSIZE			512
2521256Syl150051 #define	XGELL_IOCTL_BUFSIZE			64
2536937Sxw161283 #define	XGELL_DEVCONF_BUFSIZE			8192
2541256Syl150051 
2551256Syl150051 /*
2568275SEric Cheng  * Multiple mac address definitions
2571256Syl150051  *
2588275SEric Cheng  * We'll use whole MAC Addresses Configuration Memory for unicast addresses,
2598275SEric Cheng  * since current multicast implementation in HAL is by enabling promise mode.
2601256Syl150051  */
2618275SEric Cheng #define	XGE_RX_MULTI_MAC_ADDRESSES_MAX		8 /* per ring group */
2621256Syl150051 
2631256Syl150051 typedef struct {
2643115Syl150051 	int rx_pkt_burst;
2651256Syl150051 	int rx_buffer_total;
2661256Syl150051 	int rx_buffer_post_hiwat;
2673115Syl150051 	int rx_dma_lowat;
2683115Syl150051 	int tx_dma_lowat;
2698275SEric Cheng 	int lso_enable;
2706937Sxw161283 	int msix_enable;
2718275SEric Cheng 	int grouping;
2721256Syl150051 } xgell_config_t;
2731256Syl150051 
2748275SEric Cheng typedef struct xgell_multi_mac xgell_multi_mac_t;
2758275SEric Cheng typedef struct xgell_rx_ring xgell_rx_ring_t;
2768275SEric Cheng typedef struct xgell_tx_ring xgell_tx_ring_t;
2778275SEric Cheng typedef struct xgelldev xgelldev_t;
2786937Sxw161283 
2791256Syl150051 typedef struct xgell_rx_buffer_t {
2808275SEric Cheng 	struct xgell_rx_buffer_t *next;
2818275SEric Cheng 	void			*vaddr;
2828275SEric Cheng 	dma_addr_t		dma_addr;
2838275SEric Cheng 	ddi_dma_handle_t	dma_handle;
2848275SEric Cheng 	ddi_acc_handle_t	dma_acch;
2858275SEric Cheng 	xgell_rx_ring_t		*ring;
2868275SEric Cheng 	frtn_t			frtn;
2871256Syl150051 } xgell_rx_buffer_t;
2881256Syl150051 
2898275SEric Cheng /* Buffer pool for one rx ring */
2901256Syl150051 typedef struct xgell_rx_buffer_pool_t {
2911256Syl150051 	uint_t			total;		/* total buffers */
2921256Syl150051 	uint_t			size;		/* buffer size */
2931256Syl150051 	xgell_rx_buffer_t	*head;		/* header pointer */
2941256Syl150051 	uint_t			free;		/* free buffers */
2951256Syl150051 	uint_t			post;		/* posted buffers */
2961256Syl150051 	uint_t			post_hiwat;	/* hiwat to stop post */
2971256Syl150051 	spinlock_t		pool_lock;	/* buffer pool lock */
2988275SEric Cheng 	boolean_t		live;		/* pool status */
2996937Sxw161283 	xgell_rx_buffer_t	*recycle_head;	/* recycle list's head */
3006937Sxw161283 	xgell_rx_buffer_t	*recycle_tail;	/* recycle list's tail */
3016937Sxw161283 	uint_t			recycle;	/* # of rx buffers recycled */
3026937Sxw161283 	spinlock_t		recycle_lock;	/* buffer recycle lock */
3031256Syl150051 } xgell_rx_buffer_pool_t;
3041256Syl150051 
3058275SEric Cheng struct xgell_multi_mac {
3068275SEric Cheng 	int			naddr;		/* total supported addresses */
3078275SEric Cheng 	int			naddrfree;	/* free addresses slots */
3088275SEric Cheng 	ether_addr_t		mac_addr[XGE_RX_MULTI_MAC_ADDRESSES_MAX];
3098275SEric Cheng 	boolean_t		mac_addr_set[XGE_RX_MULTI_MAC_ADDRESSES_MAX];
3106937Sxw161283 };
3116937Sxw161283 
3128275SEric Cheng typedef uint_t (*intr_func_t)(caddr_t, caddr_t);
3138275SEric Cheng 
3148275SEric Cheng typedef struct xgell_intr {
3158275SEric Cheng 	uint_t			index;
3168275SEric Cheng 	ddi_intr_handle_t	*handle;	/* DDI interrupt handle */
3178275SEric Cheng 	intr_func_t		*function;	/* interrupt function */
3188275SEric Cheng 	caddr_t			arg;		/* interrupt source */
3198275SEric Cheng } xgell_intr_t;
3208275SEric Cheng 
3218275SEric Cheng struct xgell_rx_ring {
3228275SEric Cheng 	int			index;
3238275SEric Cheng 	boolean_t		live;		/* ring active status */
3248275SEric Cheng 	xge_hal_channel_h	channelh;	/* hardware channel */
3258275SEric Cheng 	xgelldev_t		*lldev;		/* driver device */
3268275SEric Cheng 	mac_ring_handle_t	ring_handle;	/* call back ring handle */
3278275SEric Cheng 	mac_group_handle_t	group_handle;	/* call back group handle */
3288275SEric Cheng 	uint64_t		ring_gen_num;
3298275SEric Cheng 
3308275SEric Cheng 	xgell_multi_mac_t	mmac;		/* per group multiple addrs */
3318275SEric Cheng 	xgell_rx_buffer_pool_t	bf_pool;	/* per ring buffer pool */
332*11878SVenu.Iyer@Sun.COM 	uint64_t		rx_pkts;	/* total received packets */
333*11878SVenu.Iyer@Sun.COM 	uint64_t		rx_bytes;	/* total received bytes */
3348275SEric Cheng 	int			poll_bytes;	/* bytes to be polled up */
3358275SEric Cheng 	int			polled_bytes;	/* total polled bytes */
3368275SEric Cheng 	mblk_t			*poll_mp;	/* polled messages */
3378275SEric Cheng 
3388275SEric Cheng 	spinlock_t		ring_lock;	/* per ring lock */
3398275SEric Cheng };
3408275SEric Cheng 
3418275SEric Cheng struct xgell_tx_ring {
3428275SEric Cheng 	int			index;
3438275SEric Cheng 	boolean_t		live;		/* ring active status */
3448275SEric Cheng 	xge_hal_channel_h	channelh;	/* hardware channel */
3458275SEric Cheng 	xgelldev_t		*lldev;		/* driver device */
3468275SEric Cheng 	mac_ring_handle_t	ring_handle;	/* call back ring handle */
347*11878SVenu.Iyer@Sun.COM 	uint64_t		tx_pkts;	/* packets sent */
348*11878SVenu.Iyer@Sun.COM 	uint64_t		tx_bytes;	/* bytes sent though the ring */
3498275SEric Cheng 
3508275SEric Cheng 	boolean_t		need_resched;
3516937Sxw161283 };
3521256Syl150051 
3532311Sseb struct xgelldev {
3548275SEric Cheng 	volatile int		is_initialized;
3558275SEric Cheng 	volatile int		in_reset;
3568275SEric Cheng 	kmutex_t		genlock;
3572311Sseb 	mac_handle_t		mh;
3581256Syl150051 	int			instance;
3591256Syl150051 	dev_info_t		*dev_info;
3601256Syl150051 	xge_hal_device_h	devh;
3618275SEric Cheng 	caddr_t			ndp;
3628275SEric Cheng 	timeout_id_t		timeout_id;
3638275SEric Cheng 
3648275SEric Cheng 	int			init_rx_rings;
3658275SEric Cheng 	int			init_tx_rings;
3668275SEric Cheng 	int			init_rx_groups;
3678275SEric Cheng 
3688275SEric Cheng 	int			live_rx_rings;
3698275SEric Cheng 	int			live_tx_rings;
3708275SEric Cheng 	xgell_rx_ring_t		rx_ring[XGELL_RX_RING_NUM_DEFAULT];
3718275SEric Cheng 	xgell_tx_ring_t		tx_ring[XGELL_TX_RING_NUM_DEFAULT];
3728275SEric Cheng 
3733115Syl150051 	int			tx_copied_max;
3748275SEric Cheng 
3758275SEric Cheng 	xgell_intr_t		intrs[XGELL_MINTR_NUM_DEFAULT];
3768275SEric Cheng 
3776937Sxw161283 	ddi_intr_handle_t	*intr_table;
3786937Sxw161283 	uint_t			intr_table_size;
3796937Sxw161283 	int			intr_type;
3806937Sxw161283 	int			intr_cnt;
3816937Sxw161283 	uint_t			intr_pri;
3826937Sxw161283 	int			intr_cap;
3838275SEric Cheng 
3848275SEric Cheng 	xgell_config_t		config;
3852311Sseb };
3861256Syl150051 
3871256Syl150051 typedef struct {
3881256Syl150051 	mblk_t			*mblk;
3891256Syl150051 	ddi_dma_handle_t	dma_handles[XGE_HAL_DEFAULT_FIFO_FRAGS];
3901256Syl150051 	int			handle_cnt;
3911256Syl150051 } xgell_txd_priv_t;
3921256Syl150051 
3931256Syl150051 typedef struct {
3941256Syl150051 	xgell_rx_buffer_t	*rx_buffer;
3951256Syl150051 } xgell_rxd_priv_t;
3961256Syl150051 
3971256Syl150051 int xgell_device_alloc(xge_hal_device_h devh, dev_info_t *dev_info,
3981256Syl150051     xgelldev_t **lldev_out);
3991256Syl150051 
4001256Syl150051 void xgell_device_free(xgelldev_t *lldev);
4011256Syl150051 
4021256Syl150051 int xgell_device_register(xgelldev_t *lldev, xgell_config_t *config);
4031256Syl150051 
4041256Syl150051 int xgell_device_unregister(xgelldev_t *lldev);
4051256Syl150051 
4061256Syl150051 void xgell_callback_link_up(void *userdata);
4071256Syl150051 
4081256Syl150051 void xgell_callback_link_down(void *userdata);
4091256Syl150051 
4101256Syl150051 int xgell_onerr_reset(xgelldev_t *lldev);
4111256Syl150051 
4121256Syl150051 void xge_device_poll_now(void *data);
4131256Syl150051 
4146937Sxw161283 int xge_add_intrs(xgelldev_t *lldev);
4156937Sxw161283 
4166937Sxw161283 int xge_enable_intrs(xgelldev_t *lldev);
4176937Sxw161283 
4186937Sxw161283 void xge_disable_intrs(xgelldev_t *lldev);
4196937Sxw161283 
4206937Sxw161283 void xge_rem_intrs(xgelldev_t *lldev);
4216937Sxw161283 
422*11878SVenu.Iyer@Sun.COM int xgell_rx_ring_stat(mac_ring_driver_t rh, uint_t stat, uint64_t *val);
4236937Sxw161283 
424*11878SVenu.Iyer@Sun.COM int xgell_tx_ring_stat(mac_ring_driver_t rh, uint_t stat, uint64_t *val);
4256937Sxw161283 
4261256Syl150051 #ifdef __cplusplus
4271256Syl150051 }
4281256Syl150051 #endif
4291256Syl150051 
4301256Syl150051 #endif /* _SYS_XGELL_H */
431