xref: /illumos-gate/usr/src/uts/sun4v/sys/vsw_hio.h (revision 2983dda76a6d296fdb560c88114fe41caad1b84f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_VSW_HIO_H
28 #define	_VSW_HIO_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /* kstats for hybrid io resources */
35 typedef struct vsw_hio_kstats {
36 	kstat_named_t	hio_capable;		/* is hybrid io capable */
37 	kstat_named_t	hio_num_shares;		/* # of hybrid io shares */
38 
39 	struct {
40 		kstat_named_t	assigned;	/* to which mac */
41 		kstat_named_t	state;		/* share state */
42 	} share[1];
43 	/* space for other shares here */
44 } vsw_hio_kstats_t;
45 
46 typedef struct vsw_share {
47 	uint32_t	vs_state;	/* State of this share */
48 	uint32_t	vs_index;	/* Index in the shares array */
49 	struct vsw	*vs_vswp;	/* Back pointer to vswp */
50 	uint8_t		vs_req_id;	/* DDS request ID */
51 
52 	/* Cached info */
53 	vsw_port_t	*vs_portp;	/* Corresponding port */
54 	uint64_t	vs_ldcid;	/* LDC to which the share is assigned */
55 	uint64_t	vs_macaddr;	/* Associated MAC addr */
56 	uint64_t	vs_cookie;	/* Share Cookie from alloc_share */
57 
58 } vsw_share_t;
59 
60 #define	VSW_SHARE_FREE		0x0
61 #define	VSW_SHARE_ASSIGNED	0x1
62 #define	VSW_SHARE_DDS_SENT	0x2
63 #define	VSW_SHARE_DDS_ACKD	0x4
64 
65 /* Hybrid related info */
66 typedef struct vsw_hio {
67 	uint32_t		vh_num_shares;	/* Number of shares available */
68 	vsw_share_t		*vh_shares;	/* Array of Shares */
69 	uint32_t		vh_kstat_size;	/* size for the whole kstats */
70 	vsw_hio_kstats_t	*vh_kstatsp;	/* stats for vsw hio */
71 	kstat_t			*vh_ksp;	/* kstats */
72 } vsw_hio_t;
73 
74 
75 #ifdef	__cplusplus
76 }
77 #endif
78 
79 #endif	/* _VSW_HIO_H */
80