xref: /titanic_41/usr/src/uts/sun4v/sys/vsw_hio.h (revision da14cebe459d3275048785f25bd869cb09b5307f)
1678453a8Sspeer /*
2678453a8Sspeer  * CDDL HEADER START
3678453a8Sspeer  *
4678453a8Sspeer  * The contents of this file are subject to the terms of the
5678453a8Sspeer  * Common Development and Distribution License (the "License").
6678453a8Sspeer  * You may not use this file except in compliance with the License.
7678453a8Sspeer  *
8678453a8Sspeer  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9678453a8Sspeer  * or http://www.opensolaris.org/os/licensing.
10678453a8Sspeer  * See the License for the specific language governing permissions
11678453a8Sspeer  * and limitations under the License.
12678453a8Sspeer  *
13678453a8Sspeer  * When distributing Covered Code, include this CDDL HEADER in each
14678453a8Sspeer  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15678453a8Sspeer  * If applicable, add the following below this CDDL HEADER, with the
16678453a8Sspeer  * fields enclosed by brackets "[]" replaced with your own identifying
17678453a8Sspeer  * information: Portions Copyright [yyyy] [name of copyright owner]
18678453a8Sspeer  *
19678453a8Sspeer  * CDDL HEADER END
20678453a8Sspeer  */
21678453a8Sspeer 
22678453a8Sspeer /*
23678453a8Sspeer  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24678453a8Sspeer  * Use is subject to license terms.
25678453a8Sspeer  */
26678453a8Sspeer 
27678453a8Sspeer #ifndef	_VSW_HIO_H
28678453a8Sspeer #define	_VSW_HIO_H
29678453a8Sspeer 
30678453a8Sspeer #ifdef	__cplusplus
31678453a8Sspeer extern "C" {
32678453a8Sspeer #endif
33678453a8Sspeer 
346ab6cb20SWENTAO YANG /* kstats for hybrid io resources */
356ab6cb20SWENTAO YANG typedef struct vsw_hio_kstats {
366ab6cb20SWENTAO YANG 	kstat_named_t	hio_capable;		/* is hybrid io capable */
376ab6cb20SWENTAO YANG 	kstat_named_t	hio_num_shares;		/* # of hybrid io shares */
386ab6cb20SWENTAO YANG 
396ab6cb20SWENTAO YANG 	struct {
406ab6cb20SWENTAO YANG 		kstat_named_t	assigned;	/* to which mac */
416ab6cb20SWENTAO YANG 		kstat_named_t	state;		/* share state */
426ab6cb20SWENTAO YANG 	} share[1];
436ab6cb20SWENTAO YANG 	/* space for other shares here */
446ab6cb20SWENTAO YANG } vsw_hio_kstats_t;
456ab6cb20SWENTAO YANG 
46678453a8Sspeer typedef struct vsw_share {
47678453a8Sspeer 	uint32_t	vs_state;	/* State of this share */
48678453a8Sspeer 	uint32_t	vs_index;	/* Index in the shares array */
49678453a8Sspeer 	struct vsw	*vs_vswp;	/* Back pointer to vswp */
50678453a8Sspeer 	uint8_t		vs_req_id;	/* DDS request ID */
51678453a8Sspeer 
52678453a8Sspeer 	/* Cached info */
53678453a8Sspeer 	vsw_port_t	*vs_portp;	/* Corresponding port */
54678453a8Sspeer 	uint64_t	vs_ldcid;	/* LDC to which the share is assigned */
55678453a8Sspeer 	uint64_t	vs_macaddr;	/* Associated MAC addr */
56678453a8Sspeer 	uint64_t	vs_cookie;	/* Share Cookie from alloc_share */
57678453a8Sspeer 
58678453a8Sspeer } vsw_share_t;
59678453a8Sspeer 
60678453a8Sspeer #define	VSW_SHARE_FREE		0x0
61678453a8Sspeer #define	VSW_SHARE_ASSIGNED	0x1
62678453a8Sspeer #define	VSW_SHARE_DDS_SENT	0x2
63678453a8Sspeer #define	VSW_SHARE_DDS_ACKD	0x4
64678453a8Sspeer 
65678453a8Sspeer /* Hybrid related info */
66678453a8Sspeer typedef struct vsw_hio {
67678453a8Sspeer 	uint32_t		vh_num_shares;	/* Number of shares available */
68*da14cebeSEric Cheng 	vsw_share_t		*vh_shares;	/* Array of Shares */
696ab6cb20SWENTAO YANG 	uint32_t		vh_kstat_size;	/* size for the whole kstats */
706ab6cb20SWENTAO YANG 	vsw_hio_kstats_t	*vh_kstatsp;	/* stats for vsw hio */
716ab6cb20SWENTAO YANG 	kstat_t			*vh_ksp;	/* kstats */
72678453a8Sspeer } vsw_hio_t;
73678453a8Sspeer 
74678453a8Sspeer 
75678453a8Sspeer #ifdef	__cplusplus
76678453a8Sspeer }
77678453a8Sspeer #endif
78678453a8Sspeer 
79678453a8Sspeer #endif	/* _VSW_HIO_H */
80