xref: /onnv-gate/usr/src/uts/common/sys/nxge/nxge_common.h (revision 5759:e97b4d0cce4a)
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 /*
22*5759Smisaki  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
233859Sml29623  * Use is subject to license terms.
243859Sml29623  */
253859Sml29623 
263859Sml29623 #ifndef	_SYS_NXGE_NXGE_COMMON_H
273859Sml29623 #define	_SYS_NXGE_NXGE_COMMON_H
283859Sml29623 
293859Sml29623 #pragma ident	"%Z%%M%	%I%	%E% SMI"
303859Sml29623 
313859Sml29623 #ifdef	__cplusplus
323859Sml29623 extern "C" {
333859Sml29623 #endif
343859Sml29623 
353859Sml29623 #define	NXGE_DMA_START			B_TRUE
363859Sml29623 #define	NXGE_DMA_STOP			B_FALSE
373859Sml29623 
383859Sml29623 /*
393859Sml29623  * Default DMA configurations.
403859Sml29623  */
413859Sml29623 #define	NXGE_RDMA_PER_NIU_PORT		(NXGE_MAX_RDCS/NXGE_PORTS_NIU)
423859Sml29623 #define	NXGE_TDMA_PER_NIU_PORT		(NXGE_MAX_TDCS_NIU/NXGE_PORTS_NIU)
433859Sml29623 #define	NXGE_RDMA_PER_NEP_PORT		(NXGE_MAX_RDCS/NXGE_PORTS_NEPTUNE)
443859Sml29623 #define	NXGE_TDMA_PER_NEP_PORT		(NXGE_MAX_TDCS/NXGE_PORTS_NEPTUNE)
453859Sml29623 #define	NXGE_RDCGRP_PER_NIU_PORT	(NXGE_MAX_RDC_GROUPS/NXGE_PORTS_NIU)
463859Sml29623 #define	NXGE_RDCGRP_PER_NEP_PORT	(NXGE_MAX_RDC_GROUPS/NXGE_PORTS_NEPTUNE)
473859Sml29623 
483859Sml29623 #define	NXGE_TIMER_RESO			2
493859Sml29623 
503859Sml29623 #define	NXGE_TIMER_LDG			2
513859Sml29623 
523859Sml29623 /*
533859Sml29623  * Receive and Transmit DMA definitions
543859Sml29623  */
553859Sml29623 #if	defined(sun4v) && defined(NIU_LP_WORKAROUND)
563859Sml29623 /*
573859Sml29623  * N2/NIU: Maximum descriptors if we need to call
583859Sml29623  *	   Hypervisor to set up the logical pages
593859Sml29623  *	   and the driver must use contiguous memory.
603859Sml29623  */
613859Sml29623 #define	NXGE_NIU_MAX_ENTRY		(1 << 9) /* 512 */
623859Sml29623 #define	NXGE_NIU_CONTIG_RBR_MAX		(NXGE_NIU_MAX_ENTRY)
633859Sml29623 #define	NXGE_NIU_CONTIG_RCR_MAX		(NXGE_NIU_MAX_ENTRY)
643859Sml29623 #define	NXGE_NIU_CONTIG_TX_MAX		(NXGE_NIU_MAX_ENTRY)
653859Sml29623 #endif
663859Sml29623 
673859Sml29623 #ifdef	_DMA_USES_VIRTADDR
683859Sml29623 #ifdef	NIU_PA_WORKAROUND
693859Sml29623 #define	NXGE_DMA_BLOCK		(16 * 64 * 4)
703859Sml29623 #else
713859Sml29623 #define	NXGE_DMA_BLOCK		1
723859Sml29623 #endif
733859Sml29623 #else
743859Sml29623 #define	NXGE_DMA_BLOCK		(64 * 64)
753859Sml29623 #endif
763859Sml29623 
773859Sml29623 #define	NXGE_RBR_RBB_MIN	(128)
783859Sml29623 #define	NXGE_RBR_RBB_MAX	(64 * 128 -1)
793859Sml29623 
803859Sml29623 #if	defined(sun4v) && defined(NIU_LP_WORKAROUND)
813859Sml29623 #define	NXGE_RBR_RBB_DEFAULT	512
823859Sml29623 #define	NXGE_RBR_SPARE		0
833859Sml29623 #else
84*5759Smisaki #if	defined(__i386)
85*5759Smisaki #define	NXGE_RBR_RBB_DEFAULT	256
86*5759Smisaki #else
873859Sml29623 #define	NXGE_RBR_RBB_DEFAULT	(64 * 16) /* x86 hello */
88*5759Smisaki #endif
893859Sml29623 #define	NXGE_RBR_SPARE		0
903859Sml29623 #endif
913859Sml29623 
923859Sml29623 
933859Sml29623 #define	NXGE_RCR_MIN		(NXGE_RBR_RBB_MIN * 2)
943859Sml29623 
953859Sml29623 #if	defined(sun4v) && defined(NIU_LP_WORKAROUND)
963859Sml29623 #define	NXGE_RCR_MAX		(NXGE_NIU_CONTIG_RCR_MAX)
973859Sml29623 #define	NXGE_RCR_DEFAULT	(512)
983859Sml29623 #define	NXGE_TX_RING_DEFAULT	(512)
993859Sml29623 #else
1003859Sml29623 #ifndef	NIU_PA_WORKAROUND
1013859Sml29623 #define	NXGE_RCR_MAX		(65355) /* MAX hardware supported */
1023859Sml29623 #if defined(_BIG_ENDIAN)
1033859Sml29623 #define	NXGE_RCR_DEFAULT	(NXGE_RBR_RBB_DEFAULT * 8)
1043859Sml29623 #else
1053859Sml29623 #ifdef USE_RX_BIG_BUF
1063859Sml29623 #define	NXGE_RCR_DEFAULT	(NXGE_RBR_RBB_DEFAULT * 8)
1073859Sml29623 #else
1083859Sml29623 #define	NXGE_RCR_DEFAULT	(NXGE_RBR_RBB_DEFAULT * 4)
1093859Sml29623 #endif
1103859Sml29623 #endif
111*5759Smisaki #if	defined(__i386)
112*5759Smisaki #define	NXGE_TX_RING_DEFAULT	(256)
113*5759Smisaki #else
1143859Sml29623 #define	NXGE_TX_RING_DEFAULT	(1024)
115*5759Smisaki #endif
1163859Sml29623 #define	NXGE_TX_RING_MAX	(64 * 128 - 1)
1173859Sml29623 #else
118*5759Smisaki #if	defined(__i386)
119*5759Smisaki #define	NXGE_RCR_DEFAULT	(256)
120*5759Smisaki #define	NXGE_TX_RING_DEFAULT	(256)
121*5759Smisaki #else
1223859Sml29623 #define	NXGE_RCR_DEFAULT	(512)
1233859Sml29623 #define	NXGE_TX_RING_DEFAULT	(512)
124*5759Smisaki #endif
1253859Sml29623 #define	NXGE_RCR_MAX		(1024)
1263859Sml29623 #define	NXGE_TX_RING_MAX	(1024)
1273859Sml29623 #endif
1283859Sml29623 #endif
1293859Sml29623 
1303859Sml29623 #define	NXGE_TX_RECLAIM 	32
1313859Sml29623 
1323859Sml29623 /* per receive DMA channel configuration data structure */
1333859Sml29623 typedef struct  nxge_rdc_cfg {
1343859Sml29623 	uint32_t	flag;		/* 0: not configured, 1: configured */
1353859Sml29623 	struct nxge_hw_list *nxge_hw_p;
1363859Sml29623 	uint32_t	partition_id;
1373859Sml29623 	uint32_t	port;		/* function number */
1383859Sml29623 	uint32_t	rx_group_id;
1393859Sml29623 
1403859Sml29623 	/* Partitioning, DMC function zero. */
1413859Sml29623 	uint32_t	rx_log_page_vld_page0;	/* TRUE or FALSE */
1423859Sml29623 	uint32_t	rx_log_page_vld_page1;	/* TRUE or FALSE */
1433859Sml29623 	uint64_t	rx_log_mask1;
1443859Sml29623 	uint64_t	rx_log_value1;
1453859Sml29623 	uint64_t	rx_log_mask2;
1463859Sml29623 	uint64_t	rx_log_value2;
1473859Sml29623 	uint64_t	rx_log_page_relo1;
1483859Sml29623 	uint64_t	rx_log_page_relo2;
1493859Sml29623 	uint64_t	rx_log_page_hdl;
1503859Sml29623 
1513859Sml29623 	/* WRED parameters, DMC function zero */
1523859Sml29623 	uint32_t	red_enable;
1533859Sml29623 
1543859Sml29623 	uint32_t	thre_syn;
1553859Sml29623 	uint32_t	win_syn;
1563859Sml29623 	uint32_t	threshold;
1573859Sml29623 	uint32_t	win_non_syn;
1583859Sml29623 
1593859Sml29623 	/* RXDMA configuration, DMC */
1603859Sml29623 	char		*rdc_mbaddr_p;	/* mailbox address */
1613859Sml29623 	uint32_t	min_flag;	/* TRUE for 18 bytes header */
1623859Sml29623 
1633859Sml29623 	/* Software Reserved Packet Buffer Offset, DMC */
1643859Sml29623 	uint32_t	sw_offset;
1653859Sml29623 
1663859Sml29623 	/* RBR Configuration A */
1673859Sml29623 	uint64_t	rbr_staddr;	/* starting address of RBR */
1683859Sml29623 	uint32_t	rbr_nblks;	/* # of RBR entries */
1693859Sml29623 	uint32_t	rbr_len;	/* # of RBR entries in 64B lines */
1703859Sml29623 
1713859Sml29623 	/* RBR Configuration B */
1723859Sml29623 	uint32_t	bksize;		/* Block size is fixed. */
1733859Sml29623 #define	RBR_BKSIZE_4K			0
1743859Sml29623 #define	RBR_BKSIZE_4K_BYTES		(4 * 1024)
1753859Sml29623 #define	RBR_BKSIZE_8K			1
1763859Sml29623 #define	RBR_BKSIZE_8K_BYTES		(8 * 1024)
1773859Sml29623 #define	RBR_BKSIZE_16K			2
1783859Sml29623 #define	RBR_BKSIZE_16K_BYTES		(16 * 1024)
1793859Sml29623 #define	RBR_BKSIZE_32K			3
1803859Sml29623 #define	RBR_BKSIZE_32K_BYTES		(32 * 1024)
1813859Sml29623 
1823859Sml29623 	uint32_t	bufsz2;
1833859Sml29623 #define	RBR_BUFSZ2_2K			0
1843859Sml29623 #define	RBR_BUFSZ2_2K_BYTES		(2 * 1024)
1853859Sml29623 #define	RBR_BUFSZ2_4K			1
1863859Sml29623 #define	RBR_BUFSZ2_4K_BYTES		(4 * 1024)
1873859Sml29623 #define	RBR_BUFSZ2_8K			2
1883859Sml29623 #define	RBR_BUFSZ2_8K_BYTES		(8 * 1024)
1893859Sml29623 #define	RBR_BUFSZ2_16K			3
1903859Sml29623 #define	RBR_BUFSZ2_16K_BYTES		(16 * 1024)
1913859Sml29623 
1923859Sml29623 	uint32_t	bufsz1;
1933859Sml29623 #define	RBR_BUFSZ1_1K			0
1943859Sml29623 #define	RBR_BUFSZ1_1K_BYTES		1024
1953859Sml29623 #define	RBR_BUFSZ1_2K			1
1963859Sml29623 #define	RBR_BUFSZ1_2K_BYTES		(2 * 1024)
1973859Sml29623 #define	RBR_BUFSZ1_4K			2
1983859Sml29623 #define	RBR_BUFSZ1_4K_BYTES		(4 * 1024)
1993859Sml29623 #define	RBR_BUFSZ1_8K			3
2003859Sml29623 #define	RBR_BUFSZ1_8K_BYTES		(8 * 1024)
2013859Sml29623 
2023859Sml29623 	uint32_t	bufsz0;
2033859Sml29623 #define	RBR_BUFSZ0_256B			0
2043859Sml29623 #define	RBR_BUFSZ0_256_BYTES		256
2053859Sml29623 #define	RBR_BUFSZ0_512B			1
2063859Sml29623 #define	RBR_BUFSZ0_512B_BYTES		512
2073859Sml29623 #define	RBR_BUFSZ0_1K			2
2083859Sml29623 #define	RBR_BUFSZ0_1K_BYTES		(1024)
2093859Sml29623 #define	RBR_BUFSZ0_2K			3
2103859Sml29623 #define	RBR_BUFSZ0_2K_BYTES		(2 * 1024)
2113859Sml29623 
2123859Sml29623 	/* Receive buffers added by the software */
2133859Sml29623 	uint32_t	bkadd;		/* maximum size is 1 million */
2143859Sml29623 
2153859Sml29623 	/* Receive Completion Ring Configuration A */
2163859Sml29623 	uint32_t	rcr_len;	/* # of 64B blocks, each RCR is 8B */
2173859Sml29623 	uint64_t	rcr_staddr;
2183859Sml29623 
2193859Sml29623 	/* Receive Completion Ring Configuration B */
2203859Sml29623 	uint32_t	pthres;		/* packet threshold */
2213859Sml29623 	uint32_t	entout;		/* enable timeout */
2223859Sml29623 	uint32_t	timeout;	/* timeout value */
2233859Sml29623 
2243859Sml29623 	/* Logical Device Group Number */
2253859Sml29623 	uint16_t	rx_ldg;
2263859Sml29623 	uint16_t	rx_ld_state_flags;
2273859Sml29623 
2283859Sml29623 	/* Receive DMA Channel Event Mask */
2293859Sml29623 	uint64_t	rx_dma_ent_mask;
2303859Sml29623 
2313859Sml29623 	/* 32 bit (set to 1) or 64 bit (set to 0) addressing mode */
2323859Sml29623 	uint32_t	rx_addr_md;
2333859Sml29623 } nxge_rdc_cfg_t, *p_nxge_rdc_cfg_t;
2343859Sml29623 
2353859Sml29623 /*
2363859Sml29623  * Per Transmit DMA Channel Configuration Data Structure (32 TDC)
2373859Sml29623  */
2383859Sml29623 typedef struct  nxge_tdc_cfg {
2393859Sml29623 	uint32_t	flag;		/* 0: not configured 1: configured */
2403859Sml29623 	struct nxge_hw_list *nxge_hw_p;
2413859Sml29623 	uint32_t	partition_id;
2423859Sml29623 	uint32_t	port; 		/* function number */
2433859Sml29623 	/* partitioning, DMC function zero (All 0s for non-partitioning) */
2443859Sml29623 	uint32_t	tx_log_page_vld_page0;	/* TRUE or FALSE */
2453859Sml29623 	uint32_t	tx_log_page_vld_page1;	/* TRUE or FALSE */
2463859Sml29623 	uint64_t	tx_log_mask1;
2473859Sml29623 	uint64_t	tx_log_value1;
2483859Sml29623 	uint64_t	tx_log_mask2;
2493859Sml29623 	uint64_t	tx_log_value2;
2503859Sml29623 	uint64_t	tx_log_page_relo1;
2513859Sml29623 	uint64_t	tx_log_page_relo2;
2523859Sml29623 	uint64_t	tx_log_page_hdl;
2533859Sml29623 
2543859Sml29623 	/* Transmit Ring Configuration */
2553859Sml29623 	uint64_t	tx_staddr;
2563859Sml29623 	uint64_t	tx_rng_len;	/* in 64 B Blocks */
2573859Sml29623 #define	TX_MAX_BUF_SIZE			4096
2583859Sml29623 
2593859Sml29623 	/* TXDMA configuration, DMC */
2603859Sml29623 	char		*tdc_mbaddr_p;	/* mailbox address */
2613859Sml29623 
2623859Sml29623 	/* Logical Device Group Number */
2633859Sml29623 	uint16_t	tx_ldg;
2643859Sml29623 	uint16_t	tx_ld_state_flags;
2653859Sml29623 
2663859Sml29623 	/* TXDMA event flags */
2673859Sml29623 	uint64_t	tx_event_mask;
2683859Sml29623 
2693859Sml29623 	/* Transmit threshold before reclamation */
2703859Sml29623 	uint32_t	tx_rng_threshold;
2713859Sml29623 #define	TX_RING_THRESHOLD		(TX_DEFAULT_MAX_GPS/4)
2723859Sml29623 #define	TX_RING_JUMBO_THRESHOLD		(TX_DEFAULT_JUMBO_MAX_GPS/4)
2733859Sml29623 
2743859Sml29623 	/* For reclaim: a wrap-around counter (packets transmitted) */
2753859Sml29623 	uint32_t	tx_pkt_cnt;
2763859Sml29623 	/* last packet with the mark bit set */
2773859Sml29623 	uint32_t	tx_lastmark;
2783859Sml29623 } nxge_tdc_cfg_t, *p_nxge_tdc_cfg_t;
2793859Sml29623 
2803859Sml29623 #define	RDC_TABLE_ENTRY_METHOD_SEQ	0
2813859Sml29623 #define	RDC_TABLE_ENTRY_METHOD_REP	1
2823859Sml29623 
2833859Sml29623 /* per receive DMA channel table group data structure */
2843859Sml29623 typedef struct nxge_rdc_grp {
2853859Sml29623 	uint32_t	flag;		/* 0:not configured 1: configured */
2863859Sml29623 	uint8_t	port;
2873859Sml29623 	uint8_t	partition_id;
2883859Sml29623 	uint8_t	rx_group_id;
2893859Sml29623 	uint8_t	start_rdc;	/* assume assigned in sequence	*/
2903859Sml29623 	uint8_t	max_rdcs;
2913859Sml29623 	uint8_t	def_rdc;
2923859Sml29623 	uint8_t		rdc[NXGE_MAX_RDCS];
2933859Sml29623 	uint16_t	config_method;
2943859Sml29623 } nxge_rdc_grp_t, *p_nxge_rdc_grp_t;
2953859Sml29623 
2963859Sml29623 /* Common RDC and TDC configuration of DMC */
2973859Sml29623 typedef struct _nxge_dma_common_cfg_t {
2983859Sml29623 	uint16_t	rdc_red_ran_init; /* RED initial seed value */
2993859Sml29623 
3003859Sml29623 	/* Transmit Ring */
3013859Sml29623 } nxge_dma_common_cfg_t, *p_nxge_dma_common_cfg_t;
3023859Sml29623 
3033859Sml29623 /*
3043859Sml29623  * VLAN and MAC table configurations:
3053859Sml29623  *  Each VLAN ID should belong to at most one RDC group.
3063859Sml29623  *  Each port could own multiple RDC groups.
3073859Sml29623  *  Each MAC should belong to one RDC group.
3083859Sml29623  */
3093859Sml29623 typedef struct nxge_mv_cfg {
3103859Sml29623 	uint8_t		flag;			/* 0:unconfigure 1:configured */
3113859Sml29623 	uint8_t		rdctbl;			/* RDC channel table group */
3123859Sml29623 	uint8_t		mpr_npr;		/* MAC and VLAN preference */
3133859Sml29623 	uint8_t		odd_parity;
3143859Sml29623 } nxge_mv_cfg_t, *p_nxge_mv_cfg_t;
3153859Sml29623 
3163859Sml29623 typedef struct nxge_param_map {
3173859Sml29623 #if defined(_BIG_ENDIAN)
3183859Sml29623 	uint32_t		rsrvd2:2;	/* [30:31] rsrvd */
3193859Sml29623 	uint32_t		remove:1;	/* [29] Remove */
3203859Sml29623 	uint32_t		pref:1;		/* [28] preference */
3213859Sml29623 	uint32_t		rsrv:4;		/* [27:24] preference */
3223859Sml29623 	uint32_t		map_to:8;	/* [23:16] map to resource */
3233859Sml29623 	uint32_t		param_id:16;	/* [15:0] Param ID */
3243859Sml29623 #else
3253859Sml29623 	uint32_t		param_id:16;	/* [15:0] Param ID */
3263859Sml29623 	uint32_t		map_to:8;	/* [23:16] map to resource */
3273859Sml29623 	uint32_t		rsrv:4;		/* [27:24] preference */
3283859Sml29623 	uint32_t		pref:1;		/* [28] preference */
3293859Sml29623 	uint32_t		remove:1;	/* [29] Remove */
3303859Sml29623 	uint32_t		rsrvd2:2;	/* [30:31] rsrvd */
3313859Sml29623 #endif
3323859Sml29623 } nxge_param_map_t, *p_nxge_param_map_t;
3333859Sml29623 
3343859Sml29623 typedef struct nxge_rcr_param {
3353859Sml29623 #if defined(_BIG_ENDIAN)
3363859Sml29623 	uint32_t		rsrvd2:2;	/* [30:31] rsrvd */
3373859Sml29623 	uint32_t		remove:1;	/* [29] Remove */
3383859Sml29623 	uint32_t		rsrv:5;		/* [28:24] preference */
3393859Sml29623 	uint32_t		rdc:8;		/* [23:16] rdc # */
3403859Sml29623 	uint32_t		cfg_val:16;	/* [15:0] interrupt parameter */
3413859Sml29623 #else
3423859Sml29623 	uint32_t		cfg_val:16;	/* [15:0] interrupt parameter */
3433859Sml29623 	uint32_t		rdc:8;		/* [23:16] rdc # */
3443859Sml29623 	uint32_t		rsrv:5;		/* [28:24] preference */
3453859Sml29623 	uint32_t		remove:1;	/* [29] Remove */
3463859Sml29623 	uint32_t		rsrvd2:2;	/* [30:31] rsrvd */
3473859Sml29623 #endif
3483859Sml29623 } nxge_rcr_param_t, *p_nxge_rcr_param_t;
3493859Sml29623 
3503859Sml29623 /* Needs to have entries in the ndd table */
3513859Sml29623 /*
3523859Sml29623  * Hardware properties created by fcode.
3533859Sml29623  * In order for those properties visible to the user
3543859Sml29623  * command ndd, we need to add the following properties
3553859Sml29623  * to the ndd defined parameter array and data structures.
3563859Sml29623  *
3573859Sml29623  * Use default static configuration for x86.
3583859Sml29623  */
3593859Sml29623 typedef struct nxge_hw_pt_cfg {
3603859Sml29623 	uint32_t	partition_id;	 /* partition Id		*/
3613859Sml29623 	uint32_t	read_write_mode; /* read write permission mode	*/
3623859Sml29623 	uint32_t	function_number; /* function number		*/
3633859Sml29623 	uint32_t	start_tdc;	 /* start TDC (0 - 31)		*/
3643859Sml29623 	uint32_t	max_tdcs;	 /* max TDC in sequence		*/
3653859Sml29623 	uint32_t	start_rdc;	 /* start RDC (0 - 31)		*/
3663859Sml29623 	uint32_t	max_rdcs;	 /* max rdc in sequence		*/
3673859Sml29623 	uint32_t	ninterrupts;	/* obp interrupts(mac/mif/syserr) */
3683859Sml29623 	uint32_t	mac_ldvid;
3693859Sml29623 	uint32_t	mif_ldvid;
3703859Sml29623 	uint32_t	ser_ldvid;
3713859Sml29623 	uint32_t	def_rdc;	 /* default RDC			*/
3723859Sml29623 	uint32_t	drr_wt;		 /* port DRR weight		*/
3733859Sml29623 	uint32_t	rx_full_header;	 /* select the header flag	*/
3743859Sml29623 	uint32_t	start_grpid;	 /* starting group ID		*/
3753859Sml29623 	uint32_t	max_grpids;	 /* max group ID		*/
3763859Sml29623 	uint32_t	start_rdc_grpid; /* starting RDC group ID	*/
3773859Sml29623 	uint32_t	max_rdc_grpids;	 /* max RDC group ID		*/
3783859Sml29623 	uint32_t	start_ldg;	 /* starting logical group # 	*/
3793859Sml29623 	uint32_t	max_ldgs;	 /* max logical device group	*/
3803859Sml29623 	uint32_t	max_ldvs;	 /* max logical devices		*/
3813859Sml29623 	uint32_t	start_mac_entry; /* where to put the first mac	*/
3823859Sml29623 	uint32_t	max_macs;	 /* the max mac entry allowed	*/
3833859Sml29623 	uint32_t	mac_pref;	 /* preference over VLAN	*/
3843859Sml29623 	uint32_t	def_mac_rxdma_grpid; /* default RDC group ID	*/
3853859Sml29623 	uint32_t	start_vlan;	 /* starting VLAN ID		*/
3863859Sml29623 	uint32_t	max_vlans;	 /* max VLAN ID			*/
3873859Sml29623 	uint32_t	vlan_pref;	 /* preference over MAC		*/
3883859Sml29623 	uint32_t	def_vlan_rxdma_grpid; /* default RDC group Id	*/
3893859Sml29623 
3903859Sml29623 	/* Expand if we have more hardware or default configurations    */
3913859Sml29623 	uint16_t	ldg[NXGE_INT_MAX_LDG];
3923859Sml29623 	uint16_t	ldg_chn_start;
3933859Sml29623 } nxge_hw_pt_cfg_t, *p_nxge_hw_pt_cfg_t;
3943859Sml29623 
3953859Sml29623 
3963859Sml29623 /* per port configuration */
3973859Sml29623 typedef struct nxge_dma_pt_cfg {
3983859Sml29623 	uint8_t		mac_port;	/* MAC port (function)		*/
3993859Sml29623 	nxge_hw_pt_cfg_t hw_config;	/* hardware configuration 	*/
4003859Sml29623 
4013859Sml29623 	uint32_t alloc_buf_size;
4023859Sml29623 	uint32_t rbr_size;
4033859Sml29623 	uint32_t rcr_size;
4043859Sml29623 
4053859Sml29623 	/*
4063859Sml29623 	 * Configuration for hardware initialization based on the
4073859Sml29623 	 * hardware properties or the default properties.
4083859Sml29623 	 */
4093859Sml29623 	uint32_t	tx_dma_map;	/* Transmit DMA channel bit map */
4103859Sml29623 
4113859Sml29623 	/* Receive DMA channel */
4123859Sml29623 	nxge_rdc_grp_t	rdc_grps[NXGE_MAX_RDC_GROUPS];
4133859Sml29623 
4143859Sml29623 	uint16_t	rcr_timeout[NXGE_MAX_RDCS];
4153859Sml29623 	uint16_t	rcr_threshold[NXGE_MAX_RDCS];
4163859Sml29623 	uint8_t	rcr_full_header;
4173859Sml29623 	uint16_t	rx_drr_weight;
4183859Sml29623 
4193859Sml29623 	/* Add more stuff later */
4203859Sml29623 } nxge_dma_pt_cfg_t, *p_nxge_dma_pt_cfg_t;
4213859Sml29623 
4223859Sml29623 /* classification configuration */
4233859Sml29623 typedef struct nxge_class_pt_cfg {
4243859Sml29623 
4253859Sml29623 	/* MAC table */
4263859Sml29623 	nxge_mv_cfg_t	mac_host_info[NXGE_MAX_MACS];
4273859Sml29623 
4283859Sml29623 	/* VLAN table */
4293859Sml29623 	nxge_mv_cfg_t	vlan_tbl[NXGE_MAX_VLANS];
4303859Sml29623 	/* class config value */
4313859Sml29623 	uint32_t	init_h1;
4323859Sml29623 	uint16_t	init_h2;
4333859Sml29623 	uint8_t mcast_rdcgrp;
4343859Sml29623 	uint8_t mac_rdcgrp;
4353859Sml29623 	uint32_t	class_cfg[TCAM_CLASS_MAX];
4363859Sml29623 } nxge_class_pt_cfg_t, *p_nxge_class_pt_cfg_t;
4373859Sml29623 
4383859Sml29623 /* per Neptune sharable resources among ports */
4393859Sml29623 typedef struct nxge_common {
4403859Sml29623 	uint32_t		partition_id;
4413859Sml29623 	boolean_t		mode32;
4423859Sml29623 	/* DMA Channels: RDC and TDC */
4433859Sml29623 	nxge_rdc_cfg_t		rdc_config[NXGE_MAX_RDCS];
4443859Sml29623 	nxge_tdc_cfg_t		tdc_config[NXGE_MAX_TDCS];
4453859Sml29623 	nxge_dma_common_cfg_t	dma_common_config;
4463859Sml29623 
4473859Sml29623 	uint32_t		timer_res;
4483859Sml29623 	boolean_t		ld_sys_error_set;
4493859Sml29623 	uint8_t			sys_error_owner;
4503859Sml29623 
4513859Sml29623 	/* Layer 2/3/4 */
4523859Sml29623 	uint16_t		class2_etype;
4533859Sml29623 	uint16_t		class3_etype;
4543859Sml29623 
4553859Sml29623 	/* FCRAM (hashing) */
4563859Sml29623 	uint32_t		hash1_initval;
4573859Sml29623 	uint32_t		hash2_initval;
4583859Sml29623 } nxge_common_t, *p_nxge_common_t;
4593859Sml29623 
4603859Sml29623 /*
4613859Sml29623  * Partition (logical domain) configuration per Neptune/NIU.
4623859Sml29623  */
4633859Sml29623 typedef struct nxge_part_cfg {
4643859Sml29623 	uint32_t	rdc_grpbits;	/* RDC group bit masks */
4653859Sml29623 	uint32_t	tdc_bitmap;	/* bounded TDC */
4663859Sml29623 	nxge_dma_pt_cfg_t pt_config[NXGE_MAX_PORTS];
4673859Sml29623 
4683859Sml29623 	/* Flow Classification Partition (flow partition select register) */
4693859Sml29623 	uint8_t		hash_lookup;	/* external lookup is available */
4703859Sml29623 	uint8_t		base_mask;	/* select bits in base_h1 to replace */
4713859Sml29623 					/* bits [19:15} in Hash 1. */
4723859Sml29623 	uint8_t		base_h1;	/* value to replace Hash 1 [19:15]. */
4733859Sml29623 
4743859Sml29623 	/* Add more here */
4753859Sml29623 	uint32_t	attributes;	/* permission and attribute bits */
4763859Sml29623 #define	FZC_SERVICE_ENTITY		0x01
4773859Sml29623 #define	FZC_READ_WRITE			0x02
4783859Sml29623 #define	FZC_READ_ONLY			0x04
4793859Sml29623 } nxge_part_cfg_t, *p_nxge_part_cfg_t;
4803859Sml29623 
4813859Sml29623 typedef struct nxge_hw_list {
4823859Sml29623 	struct nxge_hw_list 	*next;
4833859Sml29623 	nxge_os_mutex_t 	nxge_cfg_lock;
4843859Sml29623 	nxge_os_mutex_t 	nxge_tcam_lock;
4853859Sml29623 	nxge_os_mutex_t 	nxge_vlan_lock;
4863859Sml29623 	nxge_os_mutex_t 	nxge_mdio_lock;
4873859Sml29623 	nxge_os_mutex_t 	nxge_mii_lock;
4883859Sml29623 
4893859Sml29623 	nxge_dev_info_t		*parent_devp;
4903859Sml29623 	struct _nxge_t		*nxge_p[NXGE_MAX_PORTS];
4913859Sml29623 	uint32_t		ndevs;
4923859Sml29623 	uint32_t 		flags;
4933859Sml29623 	uint32_t 		magic;
4944732Sdavemq 	uint32_t		niu_type;
4954732Sdavemq 	uint32_t		platform_type;
4965572Ssbehera 	uint8_t			xcvr_addr[NXGE_MAX_PORTS];
4973859Sml29623 } nxge_hw_list_t, *p_nxge_hw_list_t;
4983859Sml29623 
4993859Sml29623 #ifdef	__cplusplus
5003859Sml29623 }
5013859Sml29623 #endif
5023859Sml29623 
5033859Sml29623 #endif	/* _SYS_NXGE_NXGE_COMMON_H */
504