xref: /illumos-gate/usr/src/uts/sun4v/sys/vsw_hio.h (revision 257873cfc1dd3337766407f80397db60a56f2f5a)
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 	/* physdev's share related info */
59 	mac_share_handle_t	vs_shdl;	/* HIO share handle */
60 	mac_group_info_t	vs_rxginfo;	/* RX group info */
61 	uint64_t		vs_gnum;	/* RX group number */
62 } vsw_share_t;
63 
64 #define	VSW_SHARE_FREE		0x0
65 #define	VSW_SHARE_ASSIGNED	0x1
66 #define	VSW_SHARE_DDS_SENT	0x2
67 #define	VSW_SHARE_DDS_ACKD	0x4
68 
69 /* Hybrid related info */
70 typedef struct vsw_hio {
71 	mac_capab_rings_t	vh_rcapab;	/* Rings capability data */
72 	mac_capab_share_t	vh_scapab;	/* Share capability data */
73 	vsw_share_t		*vh_shares;	/* Array of Shares */
74 	uint32_t		vh_num_shares;	/* Number of shares available */
75 
76 	uint32_t		vh_kstat_size;	/* size for the whole kstats */
77 	vsw_hio_kstats_t	*vh_kstatsp;	/* stats for vsw hio */
78 	kstat_t			*vh_ksp;	/* kstats */
79 } vsw_hio_t;
80 
81 
82 #ifdef	__cplusplus
83 }
84 #endif
85 
86 #endif	/* _VSW_HIO_H */
87