xref: /onnv-gate/usr/src/uts/sun4v/sys/vsw_hio.h (revision 8275:7c223a798022)
16495Sspeer /*
26495Sspeer  * CDDL HEADER START
36495Sspeer  *
46495Sspeer  * The contents of this file are subject to the terms of the
56495Sspeer  * Common Development and Distribution License (the "License").
66495Sspeer  * You may not use this file except in compliance with the License.
76495Sspeer  *
86495Sspeer  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96495Sspeer  * or http://www.opensolaris.org/os/licensing.
106495Sspeer  * See the License for the specific language governing permissions
116495Sspeer  * and limitations under the License.
126495Sspeer  *
136495Sspeer  * When distributing Covered Code, include this CDDL HEADER in each
146495Sspeer  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156495Sspeer  * If applicable, add the following below this CDDL HEADER, with the
166495Sspeer  * fields enclosed by brackets "[]" replaced with your own identifying
176495Sspeer  * information: Portions Copyright [yyyy] [name of copyright owner]
186495Sspeer  *
196495Sspeer  * CDDL HEADER END
206495Sspeer  */
216495Sspeer 
226495Sspeer /*
236495Sspeer  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
246495Sspeer  * Use is subject to license terms.
256495Sspeer  */
266495Sspeer 
276495Sspeer #ifndef	_VSW_HIO_H
286495Sspeer #define	_VSW_HIO_H
296495Sspeer 
306495Sspeer #ifdef	__cplusplus
316495Sspeer extern "C" {
326495Sspeer #endif
336495Sspeer 
348160SWentao.Yang@Sun.COM /* kstats for hybrid io resources */
358160SWentao.Yang@Sun.COM typedef struct vsw_hio_kstats {
368160SWentao.Yang@Sun.COM 	kstat_named_t	hio_capable;		/* is hybrid io capable */
378160SWentao.Yang@Sun.COM 	kstat_named_t	hio_num_shares;		/* # of hybrid io shares */
388160SWentao.Yang@Sun.COM 
398160SWentao.Yang@Sun.COM 	struct {
408160SWentao.Yang@Sun.COM 		kstat_named_t	assigned;	/* to which mac */
418160SWentao.Yang@Sun.COM 		kstat_named_t	state;		/* share state */
428160SWentao.Yang@Sun.COM 	} share[1];
438160SWentao.Yang@Sun.COM 	/* space for other shares here */
448160SWentao.Yang@Sun.COM } vsw_hio_kstats_t;
458160SWentao.Yang@Sun.COM 
466495Sspeer typedef struct vsw_share {
476495Sspeer 	uint32_t	vs_state;	/* State of this share */
486495Sspeer 	uint32_t	vs_index;	/* Index in the shares array */
496495Sspeer 	struct vsw	*vs_vswp;	/* Back pointer to vswp */
506495Sspeer 	uint8_t		vs_req_id;	/* DDS request ID */
516495Sspeer 
526495Sspeer 	/* Cached info */
536495Sspeer 	vsw_port_t	*vs_portp;	/* Corresponding port */
546495Sspeer 	uint64_t	vs_ldcid;	/* LDC to which the share is assigned */
556495Sspeer 	uint64_t	vs_macaddr;	/* Associated MAC addr */
566495Sspeer 	uint64_t	vs_cookie;	/* Share Cookie from alloc_share */
576495Sspeer 
586495Sspeer } vsw_share_t;
596495Sspeer 
606495Sspeer #define	VSW_SHARE_FREE		0x0
616495Sspeer #define	VSW_SHARE_ASSIGNED	0x1
626495Sspeer #define	VSW_SHARE_DDS_SENT	0x2
636495Sspeer #define	VSW_SHARE_DDS_ACKD	0x4
646495Sspeer 
656495Sspeer /* Hybrid related info */
666495Sspeer typedef struct vsw_hio {
67*8275SEric Cheng 	uint32_t		vh_num_shares;	/* Number of shares available */
686495Sspeer 	vsw_share_t		*vh_shares;	/* Array of Shares */
698160SWentao.Yang@Sun.COM 	uint32_t		vh_kstat_size;	/* size for the whole kstats */
708160SWentao.Yang@Sun.COM 	vsw_hio_kstats_t	*vh_kstatsp;	/* stats for vsw hio */
718160SWentao.Yang@Sun.COM 	kstat_t			*vh_ksp;	/* kstats */
726495Sspeer } vsw_hio_t;
736495Sspeer 
746495Sspeer 
756495Sspeer #ifdef	__cplusplus
766495Sspeer }
776495Sspeer #endif
786495Sspeer 
796495Sspeer #endif	/* _VSW_HIO_H */
80