annotate usr/src/uts/sun4v/sys/vdc.h @ 10971:2663784ac9bb

backout 6726533: causes 6898072
author jmcp <James.McPherson@Sun.COM>
date Thu, 05 Nov 2009 15:54:24 -0800
parents c6175c150216
children 4bcbed8266fd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
1 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
2 * CDDL HEADER START
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
3 *
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
4 * The contents of this file are subject to the terms of the
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
5 * Common Development and Distribution License (the "License").
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
6 * You may not use this file except in compliance with the License.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
7 *
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
9 * or http://www.opensolaris.org/os/licensing.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
10 * See the License for the specific language governing permissions
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
11 * and limitations under the License.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
12 *
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
13 * When distributing Covered Code, include this CDDL HEADER in each
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
15 * If applicable, add the following below this CDDL HEADER, with the
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
16 * fields enclosed by brackets "[]" replaced with your own identifying
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
17 * information: Portions Copyright [yyyy] [name of copyright owner]
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
18 *
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
19 * CDDL HEADER END
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
20 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
21
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
22 /*
9889
68d0fe4c716e PSARC 2008/769 Multiple disk sector size support.
yu, larry liu - Sun Microsystems - Beijing China <Larry.Liu@Sun.COM>
parents: 7563
diff changeset
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
24 * Use is subject to license terms.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
25 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
26
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
27 #ifndef _VDC_H
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
28 #define _VDC_H
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
29
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
30 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
31 * Virtual disk client implementation definitions
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
32 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
33
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
34 #include <sys/sysmacros.h>
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
35 #include <sys/note.h>
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
36
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
37 #include <sys/ldc.h>
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
38 #include <sys/vio_mailbox.h>
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
39 #include <sys/vdsk_mailbox.h>
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
40 #include <sys/vdsk_common.h>
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
41
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
42 #ifdef __cplusplus
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
43 extern "C" {
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
44 #endif
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
45
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
46 #define VDC_DRIVER_NAME "vdc"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
47
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
48 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
49 * Bit-field values to indicate if parts of the vdc driver are initialised.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
50 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
51 #define VDC_SOFT_STATE 0x0001
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
52 #define VDC_LOCKS 0x0002
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
53 #define VDC_MINOR 0x0004
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
54 #define VDC_THREAD 0x0008
6480
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
55 #define VDC_DRING_INIT 0x0010 /* The DRing was created */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
56 #define VDC_DRING_BOUND 0x0020 /* The DRing was bound to an LDC channel */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
57 #define VDC_DRING_LOCAL 0x0040 /* The local private DRing was allocated */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
58 #define VDC_DRING_ENTRY 0x0080 /* At least one DRing entry was initialised */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
59 #define VDC_DRING (VDC_DRING_INIT | VDC_DRING_BOUND | \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
60 VDC_DRING_LOCAL | VDC_DRING_ENTRY)
6480
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
61 #define VDC_HANDSHAKE 0x0100 /* Indicates if a handshake is in progress */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
62 #define VDC_HANDSHAKE_STOP 0x0200 /* stop further handshakes */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
63
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
64 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
65 * Definitions of MD nodes/properties.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
66 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
67 #define VDC_MD_CHAN_NAME "channel-endpoint"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
68 #define VDC_MD_VDEV_NAME "virtual-device"
4848
eee1ef6f0e3e FWARC 2007/363 VIO vDisk MD node updates
achartre
parents: 3078
diff changeset
69 #define VDC_MD_PORT_NAME "virtual-device-port"
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
70 #define VDC_MD_DISK_NAME "disk"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
71 #define VDC_MD_CFG_HDL "cfg-handle"
4848
eee1ef6f0e3e FWARC 2007/363 VIO vDisk MD node updates
achartre
parents: 3078
diff changeset
72 #define VDC_MD_TIMEOUT "vdc-timeout"
eee1ef6f0e3e FWARC 2007/363 VIO vDisk MD node updates
achartre
parents: 3078
diff changeset
73 #define VDC_MD_ID "id"
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
74
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
75 /*
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
76 * Definition of actions to be carried out when processing the sequence ID
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
77 * of a message received from the vDisk server. The function verifying the
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
78 * sequence number checks the 'seq_num_xxx' fields in the soft state and
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
79 * returns whether the message should be processed (VDC_SEQ_NUM_TODO) or
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
80 * whether it was it was previously processed (VDC_SEQ_NUM_SKIP).
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
81 */
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
82 #define VDC_SEQ_NUM_INVALID -1 /* Error */
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
83 #define VDC_SEQ_NUM_SKIP 0 /* Request already processed */
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
84 #define VDC_SEQ_NUM_TODO 1 /* Request needs processing */
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
85
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
86 /*
3078
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
87 * Macros to get UNIT and PART number
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
88 */
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
89 #define VDCUNIT_SHIFT 3
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
90 #define VDCPART_MASK 7
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
91
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
92 #define VDCUNIT(dev) (getminor((dev)) >> VDCUNIT_SHIFT)
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
93 #define VDCPART(dev) (getminor((dev)) & VDCPART_MASK)
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
94
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
95 /*
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
96 * Scheme to store the instance number and the slice number in the minor number.
3078
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
97 * (NOTE: Uses the same format and definitions as the sd(7D) driver)
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
98 */
3078
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
99 #define VD_MAKE_DEV(instance, minor) ((instance << VDCUNIT_SHIFT) | minor)
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
100
9889
68d0fe4c716e PSARC 2008/769 Multiple disk sector size support.
yu, larry liu - Sun Microsystems - Beijing China <Larry.Liu@Sun.COM>
parents: 7563
diff changeset
101 #define VDC_EFI_DEV_SET(dev, vdsk, ioctl) \
68d0fe4c716e PSARC 2008/769 Multiple disk sector size support.
yu, larry liu - Sun Microsystems - Beijing China <Larry.Liu@Sun.COM>
parents: 7563
diff changeset
102 VDSK_EFI_DEV_SET(dev, vdsk, ioctl, \
68d0fe4c716e PSARC 2008/769 Multiple disk sector size support.
yu, larry liu - Sun Microsystems - Beijing China <Larry.Liu@Sun.COM>
parents: 7563
diff changeset
103 (vdsk)->vdisk_bsize, (vdsk)->vdisk_size)
68d0fe4c716e PSARC 2008/769 Multiple disk sector size support.
yu, larry liu - Sun Microsystems - Beijing China <Larry.Liu@Sun.COM>
parents: 7563
diff changeset
104
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
105 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
106 * variables controlling how long to wait before timing out and how many
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
107 * retries to attempt before giving up when communicating with vds.
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
108 *
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
109 * These values need to be sufficiently large so that a guest can survive
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
110 * the reboot of the service domain.
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
111 */
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
112 #define VDC_RETRIES 10
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
113
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
114 #define VDC_USEC_TIMEOUT_MIN (30 * MICROSEC) /* 30 sec */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
115
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
116 /*
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
117 * This macro returns the number of Hz that the vdc driver should wait before
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
118 * a timeout is triggered. The 'timeout' parameter specifiecs the wait
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
119 * time in Hz. The 'mul' parameter allows for a multiplier to be
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
120 * specified allowing for a backoff to be implemented (e.g. using the
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
121 * retry number as a multiplier) where the wait time will get longer if
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
122 * there is no response on the previous retry.
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
123 */
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
124 #define VD_GET_TIMEOUT_HZ(timeout, mul) \
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
125 (ddi_get_lbolt() + ((timeout) * MAX(1, (mul))))
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
126
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
127 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
128 * Macros to manipulate Descriptor Ring variables in the soft state
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
129 * structure.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
130 */
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
131 #define VDC_GET_NEXT_REQ_ID(vdc) ((vdc)->req_id++)
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
132
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
133 #define VDC_GET_DRING_ENTRY_PTR(vdc, idx) \
5365
e9a7403eebeb FWARC 2007/602 VIO vDisk Protocol Updates
lm66018
parents: 4963
diff changeset
134 (vd_dring_entry_t *)(uintptr_t)((vdc)->dring_mem_info.vaddr + \
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
135 (idx * (vdc)->dring_entry_size))
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
136
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
137 #define VDC_MARK_DRING_ENTRY_FREE(vdc, idx) \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
138 { \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
139 vd_dring_entry_t *dep = NULL; \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
140 ASSERT(vdc != NULL); \
5365
e9a7403eebeb FWARC 2007/602 VIO vDisk Protocol Updates
lm66018
parents: 4963
diff changeset
141 ASSERT(idx < vdc->dring_len); \
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
142 ASSERT(vdc->dring_mem_info.vaddr != NULL); \
5365
e9a7403eebeb FWARC 2007/602 VIO vDisk Protocol Updates
lm66018
parents: 4963
diff changeset
143 dep = (vd_dring_entry_t *)(uintptr_t) \
e9a7403eebeb FWARC 2007/602 VIO vDisk Protocol Updates
lm66018
parents: 4963
diff changeset
144 (vdc->dring_mem_info.vaddr + \
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
145 (idx * vdc->dring_entry_size)); \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
146 ASSERT(dep != NULL); \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
147 dep->hdr.dstate = VIO_DESC_FREE; \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
148 }
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
149
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
150 /* Initialise the Session ID and Sequence Num in the DRing msg */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
151 #define VDC_INIT_DRING_DATA_MSG_IDS(dmsg, vdc) \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
152 ASSERT(vdc != NULL); \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
153 dmsg.tag.vio_sid = vdc->session_id; \
2032
b9ba1b330453 6422255 vdc could handle handshake restarts better
lm66018
parents: 1991
diff changeset
154 dmsg.seq_num = vdc->seq_num;
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
155
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
156 /*
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
157 * The states that the read thread can be in.
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
158 */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
159 typedef enum vdc_rd_state {
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
160 VDC_READ_IDLE, /* idling - conn is not up */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
161 VDC_READ_WAITING, /* waiting for data */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
162 VDC_READ_PENDING, /* pending data avail for read */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
163 VDC_READ_RESET /* channel was reset - stop reads */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
164 } vdc_rd_state_t;
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
165
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
166 /*
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
167 * The states that the vdc-vds connection can be in.
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
168 */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
169 typedef enum vdc_state {
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
170 VDC_STATE_INIT, /* device is initialized */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
171 VDC_STATE_INIT_WAITING, /* waiting for ldc connection */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
172 VDC_STATE_NEGOTIATE, /* doing handshake negotiation */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
173 VDC_STATE_HANDLE_PENDING, /* handle requests in backup dring */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
174 VDC_STATE_RUNNING, /* running and accepting requests */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
175 VDC_STATE_DETACH, /* detaching */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
176 VDC_STATE_RESETTING /* resetting connection with vds */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
177 } vdc_state_t;
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
178
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
179 /*
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
180 * The states that the vdc instance can be in.
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
181 */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
182 typedef enum vdc_lc_state {
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
183 VDC_LC_ATTACHING, /* driver is attaching */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
184 VDC_LC_ONLINE, /* driver is attached and online */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
185 VDC_LC_DETACHING /* driver is detaching */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
186 } vdc_lc_state_t;
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
187
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
188 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
189 * Local Descriptor Ring entry
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
190 *
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
191 * vdc creates a Local (private) descriptor ring the same size as the
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
192 * public descriptor ring it exports to vds.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
193 */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
194
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
195 typedef enum {
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
196 VIO_read_dir, /* read data from server */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
197 VIO_write_dir, /* write data to server */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
198 VIO_both_dir /* transfer both in and out in same buffer */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
199 } vio_desc_direction_t;
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
200
10971
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
201 typedef enum {
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
202 CB_STRATEGY, /* non-blocking strategy call */
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
203 CB_SYNC /* synchronous operation */
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
204 } vio_cb_type_t;
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
205
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
206 typedef struct vdc_local_desc {
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
207 boolean_t is_free; /* local state - inuse or not */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
208
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
209 int operation; /* VD_OP_xxx to be performed */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
210 caddr_t addr; /* addr passed in by consumer */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
211 int slice;
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
212 diskaddr_t offset; /* disk offset */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
213 size_t nbytes;
10971
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
214 vio_cb_type_t cb_type; /* operation type blk/nonblk */
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
215 void *cb_arg; /* buf passed to strategy() */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
216 vio_desc_direction_t dir; /* direction of transfer */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
217
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
218 caddr_t align_addr; /* used if addr non-aligned */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
219 ldc_mem_handle_t desc_mhdl; /* Mem handle of buf */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
220 vd_dring_entry_t *dep; /* public Dring Entry Pointer */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
221
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
222 } vdc_local_desc_t;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
223
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
224 /*
10971
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
225 * I/O queue used by failfast
5658
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
226 */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
227 typedef struct vdc_io {
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
228 struct vdc_io *vio_next; /* next pending I/O in the queue */
10971
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
229 struct buf *vio_buf; /* buf for CB_STRATEGY I/O */
5658
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
230 clock_t vio_qtime; /* time the I/O was queued */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
231 } vdc_io_t;
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
232
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
233 /*
6480
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
234 * Per vDisk server channel states
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
235 */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
236 #define VDC_LDC_INIT 0x0001
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
237 #define VDC_LDC_CB 0x0002
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
238 #define VDC_LDC_OPEN 0x0004
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
239 #define VDC_LDC (VDC_LDC_INIT | VDC_LDC_CB | VDC_LDC_OPEN)
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
240
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
241 /*
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
242 * vDisk server information
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
243 */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
244 typedef struct vdc_server {
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
245 struct vdc_server *next; /* Next server */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
246 struct vdc *vdcp; /* Ptr to vdc struct */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
247 uint64_t id; /* Server port id */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
248 uint64_t state; /* Server state */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
249 uint64_t ldc_id; /* Server LDC id */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
250 ldc_handle_t ldc_handle; /* Server LDC handle */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
251 ldc_status_t ldc_state; /* Server LDC state */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
252 uint64_t ctimeout; /* conn tmout (secs) */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
253 } vdc_server_t;
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
254
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
255 /*
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
256 * vdc soft state structure
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
257 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
258 typedef struct vdc {
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
259
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
260 kmutex_t lock; /* protects next 2 sections of vars */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
261 kcondvar_t running_cv; /* signal when upper layers can send */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
262 kcondvar_t initwait_cv; /* signal when ldc conn is up */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
263 kcondvar_t dring_free_cv; /* signal when desc is avail */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
264 kcondvar_t membind_cv; /* signal when mem can be bound */
10971
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
265 boolean_t self_reset;
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
266
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
267 int initialized; /* keeps track of what's init'ed */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
268 vdc_lc_state_t lifecycle; /* Current state of the vdc instance */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
269
2032
b9ba1b330453 6422255 vdc could handle handshake restarts better
lm66018
parents: 1991
diff changeset
270 int hshake_cnt; /* number of failed handshakes */
4963
ce6338ba4a73 6531913 vds can lose access to vdisks built from files located on the root fs
achartre
parents: 4848
diff changeset
271 uint8_t open[OTYPCNT]; /* mask of opened slices */
ce6338ba4a73 6531913 vds can lose access to vdisks built from files located on the root fs
achartre
parents: 4848
diff changeset
272 uint8_t open_excl; /* mask of exclusively opened slices */
ce6338ba4a73 6531913 vds can lose access to vdisks built from files located on the root fs
achartre
parents: 4848
diff changeset
273 ulong_t open_lyr[V_NUMPAR]; /* number of layered opens */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
274 int dkio_flush_pending; /* # outstanding DKIO flushes */
4963
ce6338ba4a73 6531913 vds can lose access to vdisks built from files located on the root fs
achartre
parents: 4848
diff changeset
275 int validate_pending; /* # outstanding validate request */
ce6338ba4a73 6531913 vds can lose access to vdisks built from files located on the root fs
achartre
parents: 4848
diff changeset
276 vd_disk_label_t vdisk_label; /* label type of device/disk imported */
7563
84ec90ffc3f7 PSARC/2008/336 Extended VTOC
Prasad Singamsetty <Prasad.Singamsetty@Sun.COM>
parents: 6623
diff changeset
277 struct extvtoc *vtoc; /* structure to store VTOC data */
4963
ce6338ba4a73 6531913 vds can lose access to vdisks built from files located on the root fs
achartre
parents: 4848
diff changeset
278 struct dk_geom *geom; /* structure to store geometry data */
5874
4c514db6bfb0 6528974 Usage of DKIOCGETEFI has changed and impacts vdisks using zfs volumes
achartre
parents: 5658
diff changeset
279 vd_slice_t slice[V_NUMPAR]; /* logical partitions */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
280
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
281 kthread_t *msg_proc_thr; /* main msg processing thread */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
282
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
283 kmutex_t read_lock; /* lock to protect read */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
284 kcondvar_t read_cv; /* cv to wait for READ events */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
285 vdc_rd_state_t read_state; /* current read state */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
286
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
287 uint32_t sync_op_cnt; /* num of active sync operations */
10971
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
288 boolean_t sync_op_pending; /* sync operation is pending */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
289 boolean_t sync_op_blocked; /* blocked waiting to do sync op */
10971
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
290 uint32_t sync_op_status; /* status of sync operation */
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
291 kcondvar_t sync_pending_cv; /* cv wait for sync op to finish */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
292 kcondvar_t sync_blocked_cv; /* cv wait for other syncs to finish */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
293
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
294 uint64_t session_id; /* common ID sent with all messages */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
295 uint64_t seq_num; /* most recent sequence num generated */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
296 uint64_t seq_num_reply; /* Last seq num ACK/NACK'ed by vds */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
297 uint64_t req_id; /* Most recent Request ID generated */
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
298 uint64_t req_id_proc; /* Last request ID processed by vdc */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
299 vdc_state_t state; /* Current disk client-server state */
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
300
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
301 dev_info_t *dip; /* device info pointer */
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
302 int instance; /* driver instance number */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
303
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
304 vio_ver_t ver; /* version number agreed with server */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
305 vd_disk_type_t vdisk_type; /* type of device/disk being imported */
5365
e9a7403eebeb FWARC 2007/602 VIO vDisk Protocol Updates
lm66018
parents: 4963
diff changeset
306 uint32_t vdisk_media; /* physical media type of vDisk */
2531
65c5d20aa275 6419154 libpcp pcp_init routine should accept service names
narayan
parents: 2410
diff changeset
307 uint64_t vdisk_size; /* device size in blocks */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
308 uint64_t max_xfer_sz; /* maximum block size of a descriptor */
9889
68d0fe4c716e PSARC 2008/769 Multiple disk sector size support.
yu, larry liu - Sun Microsystems - Beijing China <Larry.Liu@Sun.COM>
parents: 7563
diff changeset
309 uint64_t vdisk_bsize; /* blk size for the virtual disk */
68d0fe4c716e PSARC 2008/769 Multiple disk sector size support.
yu, larry liu - Sun Microsystems - Beijing China <Larry.Liu@Sun.COM>
parents: 7563
diff changeset
310 uint32_t vio_bmask; /* mask to check vio blk alignment */
68d0fe4c716e PSARC 2008/769 Multiple disk sector size support.
yu, larry liu - Sun Microsystems - Beijing China <Larry.Liu@Sun.COM>
parents: 7563
diff changeset
311 int vio_bshift; /* shift for vio blk conversion */
5365
e9a7403eebeb FWARC 2007/602 VIO vDisk Protocol Updates
lm66018
parents: 4963
diff changeset
312 uint64_t operations; /* bitmask of ops. server supports */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
313 struct dk_cinfo *cinfo; /* structure to store DKIOCINFO data */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
314 struct dk_minfo *minfo; /* structure for DKIOCGMEDIAINFO data */
2531
65c5d20aa275 6419154 libpcp pcp_init routine should accept service names
narayan
parents: 2410
diff changeset
315 ddi_devid_t devid; /* device id */
4848
eee1ef6f0e3e FWARC 2007/363 VIO vDisk MD node updates
achartre
parents: 3078
diff changeset
316 boolean_t ctimeout_reached; /* connection timeout has expired */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
317
5658
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
318 /*
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
319 * The ownership fields are protected by the lock mutex. The
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
320 * ownership_lock mutex is used to serialize ownership operations;
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
321 * it should be acquired before the lock mutex.
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
322 */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
323 kmutex_t ownership_lock; /* serialize ownership ops */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
324 int ownership; /* ownership status flags */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
325 kthread_t *ownership_thread; /* ownership thread */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
326 kcondvar_t ownership_cv; /* cv for ownership update */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
327
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
328 /*
10971
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
329 * The failfast fields are protected by the lock mutex.
5658
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
330 */
10971
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
331 kthread_t *failfast_thread; /* failfast thread */
5658
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
332 clock_t failfast_interval; /* interval in microsecs */
10971
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
333 kcondvar_t failfast_cv; /* cv for failfast update */
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
334 kcondvar_t failfast_io_cv; /* cv wait for I/O to finish */
2663784ac9bb backout 6726533: causes 6898072
jmcp <James.McPherson@Sun.COM>
parents: 10812
diff changeset
335 vdc_io_t *failfast_io_queue; /* failfast io queue */
5658
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
336
6099
b338715e1b52 6503157 guest domain I/O statistics need to be made available to iostat(1M)
lm66018
parents: 5874
diff changeset
337 /*
b338715e1b52 6503157 guest domain I/O statistics need to be made available to iostat(1M)
lm66018
parents: 5874
diff changeset
338 * kstats used to store I/O statistics consumed by iostat(1M).
b338715e1b52 6503157 guest domain I/O statistics need to be made available to iostat(1M)
lm66018
parents: 5874
diff changeset
339 * These are protected by the lock mutex.
b338715e1b52 6503157 guest domain I/O statistics need to be made available to iostat(1M)
lm66018
parents: 5874
diff changeset
340 */
b338715e1b52 6503157 guest domain I/O statistics need to be made available to iostat(1M)
lm66018
parents: 5874
diff changeset
341 kstat_t *io_stats;
b338715e1b52 6503157 guest domain I/O statistics need to be made available to iostat(1M)
lm66018
parents: 5874
diff changeset
342 kstat_t *err_stats;
b338715e1b52 6503157 guest domain I/O statistics need to be made available to iostat(1M)
lm66018
parents: 5874
diff changeset
343
6480
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
344 ldc_dring_handle_t dring_hdl; /* dring handle */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
345 ldc_mem_info_t dring_mem_info; /* dring information */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
346 uint_t dring_curr_idx; /* current index */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
347 uint32_t dring_len; /* dring length */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
348 uint32_t dring_max_cookies; /* dring max cookies */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
349 uint32_t dring_cookie_count; /* num cookies */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
350 uint32_t dring_entry_size; /* descriptor size */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
351 ldc_mem_cookie_t *dring_cookie; /* dring cookies */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
352 uint64_t dring_ident; /* dring ident */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
353
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
354 uint64_t threads_pending; /* num of threads */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
355
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
356 vdc_local_desc_t *local_dring; /* local dring */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
357 vdc_local_desc_t *local_dring_backup; /* local dring backup */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
358 int local_dring_backup_tail; /* backup dring tail */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
359 int local_dring_backup_len; /* backup dring len */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
360
6480
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
361 int num_servers; /* no. of servers */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
362 vdc_server_t *server_list; /* vdisk server list */
d50f51fd3502 6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents: 6099
diff changeset
363 vdc_server_t *curr_server; /* curr vdisk server */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
364 } vdc_t;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
365
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
366 /*
5658
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
367 * Ownership status flags
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
368 */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
369 #define VDC_OWNERSHIP_NONE 0x00 /* no ownership wanted */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
370 #define VDC_OWNERSHIP_WANTED 0x01 /* ownership is wanted */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
371 #define VDC_OWNERSHIP_GRANTED 0x02 /* ownership has been granted */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
372 #define VDC_OWNERSHIP_RESET 0x04 /* ownership has been reset */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
373
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
374 /*
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
375 * Reservation conflict panic message
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
376 */
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
377 #define VDC_RESV_CONFLICT_FMT_STR "Reservation Conflict\nDisk: "
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
378 #define VDC_RESV_CONFLICT_FMT_LEN (sizeof (VDC_RESV_CONFLICT_FMT_STR))
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
379
73d21dd02285 FWARC 2007/672 VIO vDisk Protocol Updates
achartre
parents: 5365
diff changeset
380 /*
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
381 * Debugging macros
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
382 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
383 #ifdef DEBUG
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
384 extern int vdc_msglevel;
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
385 extern uint64_t vdc_matchinst;
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
386
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
387 #define DMSG(_vdc, err_level, format, ...) \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
388 do { \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
389 if (vdc_msglevel > err_level && \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
390 (vdc_matchinst & (1ull << (_vdc)->instance))) \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
391 cmn_err(CE_CONT, "?[%d,t@%p] %s: "format, \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
392 (_vdc)->instance, (void *)curthread, \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
393 __func__, __VA_ARGS__); \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
394 _NOTE(CONSTANTCONDITION) \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
395 } while (0);
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
396
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
397 #define DMSGX(err_level, format, ...) \
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
398 do { \
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
399 if (vdc_msglevel > err_level) \
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
400 cmn_err(CE_CONT, "?%s: "format, __func__, __VA_ARGS__);\
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
401 _NOTE(CONSTANTCONDITION) \
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
402 } while (0);
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
403
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
404 #define VDC_DUMP_DRING_MSG(dmsgp) \
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
405 DMSGX(0, "sq:%lu start:%d end:%d ident:%lu\n", \
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
406 dmsgp->seq_num, dmsgp->start_idx, \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
407 dmsgp->end_idx, dmsgp->dring_ident);
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
408
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
409 #else /* !DEBUG */
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
410 #define DMSG(err_level, ...)
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
411 #define DMSGX(err_level, format, ...)
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
412 #define VDC_DUMP_DRING_MSG(dmsgp)
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
413
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
414 #endif /* !DEBUG */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
415
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
416 #ifdef __cplusplus
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
417 }
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
418 #endif
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
419
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
420 #endif /* _VDC_H */