Mercurial > illumos > illumos-gate
annotate usr/src/uts/sun4v/sys/vdc.h @ 14183:68927c785889 default tip
4099 SMF methods without absolute paths no longer work
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@nexenta.com>
author | Jerry Jelinek <jerry.jelinek@joyent.com> |
---|---|
date | Fri, 06 Sep 2013 09:20:56 -0700 |
parents | 647d64f09759 |
children |
rev | line source |
---|---|
1991 | 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 /* | |
12191
647d64f09759
6931950 vdisk does not timeout when backend does not exist
Alexandre Chartre <Alexandre.Chartre@oracle.com>
parents:
11975
diff
changeset
|
23 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. |
1991 | 24 */ |
25 | |
26 #ifndef _VDC_H | |
27 #define _VDC_H | |
28 | |
29 /* | |
30 * Virtual disk client implementation definitions | |
31 */ | |
32 | |
33 #include <sys/sysmacros.h> | |
34 #include <sys/note.h> | |
35 | |
36 #include <sys/ldc.h> | |
37 #include <sys/vio_mailbox.h> | |
38 #include <sys/vdsk_mailbox.h> | |
39 #include <sys/vdsk_common.h> | |
40 | |
41 #ifdef __cplusplus | |
42 extern "C" { | |
43 #endif | |
44 | |
45 #define VDC_DRIVER_NAME "vdc" | |
46 | |
47 /* | |
48 * Bit-field values to indicate if parts of the vdc driver are initialised. | |
49 */ | |
50 #define VDC_SOFT_STATE 0x0001 | |
51 #define VDC_LOCKS 0x0002 | |
52 #define VDC_MINOR 0x0004 | |
53 #define VDC_THREAD 0x0008 | |
6480
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
54 #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
|
55 #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
|
56 #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
|
57 #define VDC_DRING_ENTRY 0x0080 /* At least one DRing entry was initialised */ |
1991 | 58 #define VDC_DRING (VDC_DRING_INIT | VDC_DRING_BOUND | \ |
59 VDC_DRING_LOCAL | VDC_DRING_ENTRY) | |
6480
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
60 #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
|
61 #define VDC_HANDSHAKE_STOP 0x0200 /* stop further handshakes */ |
1991 | 62 |
63 /* | |
64 * Definitions of MD nodes/properties. | |
65 */ | |
66 #define VDC_MD_CHAN_NAME "channel-endpoint" | |
67 #define VDC_MD_VDEV_NAME "virtual-device" | |
4848 | 68 #define VDC_MD_PORT_NAME "virtual-device-port" |
1991 | 69 #define VDC_MD_DISK_NAME "disk" |
70 #define VDC_MD_CFG_HDL "cfg-handle" | |
4848 | 71 #define VDC_MD_TIMEOUT "vdc-timeout" |
72 #define VDC_MD_ID "id" | |
1991 | 73 |
74 /* | |
2410
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
75 * 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
|
76 * 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
|
77 * 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
|
78 * 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
|
79 * 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
|
80 */ |
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
81 #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
|
82 #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
|
83 #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
|
84 |
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
85 /* |
11975
831d27fe2446
6931722 vdisk using failfast or multipath can hang during heavy I/O
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
11004
diff
changeset
|
86 * DRing reserved entries. Entry 0 is reserved and only used for error |
831d27fe2446
6931722 vdisk using failfast or multipath can hang during heavy I/O
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
11004
diff
changeset
|
87 * checking. This is done so that error checking can be done even if the |
831d27fe2446
6931722 vdisk using failfast or multipath can hang during heavy I/O
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
11004
diff
changeset
|
88 * DRing is full. All other entries are available for regular I/Os. |
831d27fe2446
6931722 vdisk using failfast or multipath can hang during heavy I/O
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
11004
diff
changeset
|
89 */ |
831d27fe2446
6931722 vdisk using failfast or multipath can hang during heavy I/O
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
11004
diff
changeset
|
90 #define VDC_DRING_NUM_RESV 1 /* #reserved entries */ |
831d27fe2446
6931722 vdisk using failfast or multipath can hang during heavy I/O
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
11004
diff
changeset
|
91 #define VDC_DRING_FIRST_RESV 0 /* 1st reserved entry */ |
831d27fe2446
6931722 vdisk using failfast or multipath can hang during heavy I/O
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
11004
diff
changeset
|
92 #define VDC_DRING_FIRST_ENTRY \ |
831d27fe2446
6931722 vdisk using failfast or multipath can hang during heavy I/O
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
11004
diff
changeset
|
93 (VDC_DRING_FIRST_RESV + VDC_DRING_NUM_RESV) /* 1st non-resv entry */ |
831d27fe2446
6931722 vdisk using failfast or multipath can hang during heavy I/O
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
11004
diff
changeset
|
94 |
831d27fe2446
6931722 vdisk using failfast or multipath can hang during heavy I/O
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
11004
diff
changeset
|
95 /* |
11004
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
96 * Flags for virtual disk operations. |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
97 */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
98 #define VDC_OP_STATE_RUNNING 0x01 /* do operation in running state */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
99 #define VDC_OP_ERRCHK_BACKEND 0x02 /* check backend on error */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
100 #define VDC_OP_ERRCHK_CONFLICT 0x04 /* check resv conflict on error */ |
11975
831d27fe2446
6931722 vdisk using failfast or multipath can hang during heavy I/O
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
11004
diff
changeset
|
101 #define VDC_OP_DRING_RESERVED 0x08 /* use dring reserved entry */ |
12191
647d64f09759
6931950 vdisk does not timeout when backend does not exist
Alexandre Chartre <Alexandre.Chartre@oracle.com>
parents:
11975
diff
changeset
|
102 #define VDC_OP_RESUBMIT 0x10 /* I/O is being resubmitted */ |
11004
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
103 |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
104 #define VDC_OP_ERRCHK (VDC_OP_ERRCHK_BACKEND | VDC_OP_ERRCHK_CONFLICT) |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
105 #define VDC_OP_NORMAL (VDC_OP_STATE_RUNNING | VDC_OP_ERRCHK) |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
106 |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
107 /* |
3078
aa37b7e3c5c7
6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents:
2793
diff
changeset
|
108 * 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
|
109 */ |
aa37b7e3c5c7
6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents:
2793
diff
changeset
|
110 #define VDCUNIT_SHIFT 3 |
aa37b7e3c5c7
6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents:
2793
diff
changeset
|
111 #define VDCPART_MASK 7 |
aa37b7e3c5c7
6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents:
2793
diff
changeset
|
112 |
aa37b7e3c5c7
6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents:
2793
diff
changeset
|
113 #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
|
114 #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
|
115 |
aa37b7e3c5c7
6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents:
2793
diff
changeset
|
116 /* |
1991 | 117 * 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
|
118 * (NOTE: Uses the same format and definitions as the sd(7D) driver) |
1991 | 119 */ |
3078
aa37b7e3c5c7
6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents:
2793
diff
changeset
|
120 #define VD_MAKE_DEV(instance, minor) ((instance << VDCUNIT_SHIFT) | minor) |
1991 | 121 |
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
|
122 #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
|
123 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
|
124 (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
|
125 |
12191
647d64f09759
6931950 vdisk does not timeout when backend does not exist
Alexandre Chartre <Alexandre.Chartre@oracle.com>
parents:
11975
diff
changeset
|
126 /* max number of handshake retries per server */ |
647d64f09759
6931950 vdisk does not timeout when backend does not exist
Alexandre Chartre <Alexandre.Chartre@oracle.com>
parents:
11975
diff
changeset
|
127 #define VDC_HSHAKE_RETRIES 3 |
1991 | 128 |
12191
647d64f09759
6931950 vdisk does not timeout when backend does not exist
Alexandre Chartre <Alexandre.Chartre@oracle.com>
parents:
11975
diff
changeset
|
129 /* minimum number of attribute negotiations before handshake failure */ |
647d64f09759
6931950 vdisk does not timeout when backend does not exist
Alexandre Chartre <Alexandre.Chartre@oracle.com>
parents:
11975
diff
changeset
|
130 #define VDC_HATTR_MIN_INITIAL 3 |
647d64f09759
6931950 vdisk does not timeout when backend does not exist
Alexandre Chartre <Alexandre.Chartre@oracle.com>
parents:
11975
diff
changeset
|
131 #define VDC_HATTR_MIN 1 |
1991 | 132 |
2410
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
133 /* |
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
134 * 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
|
135 * 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
|
136 * 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
|
137 * 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
|
138 * 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
|
139 * 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
|
140 */ |
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
141 #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
|
142 (ddi_get_lbolt() + ((timeout) * MAX(1, (mul)))) |
1991 | 143 |
144 /* | |
145 * Macros to manipulate Descriptor Ring variables in the soft state | |
146 * structure. | |
147 */ | |
2410
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
148 #define VDC_GET_NEXT_REQ_ID(vdc) ((vdc)->req_id++) |
1991 | 149 |
150 #define VDC_GET_DRING_ENTRY_PTR(vdc, idx) \ | |
5365 | 151 (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
|
152 (idx * (vdc)->dring_entry_size)) |
1991 | 153 |
154 #define VDC_MARK_DRING_ENTRY_FREE(vdc, idx) \ | |
155 { \ | |
156 vd_dring_entry_t *dep = NULL; \ | |
157 ASSERT(vdc != NULL); \ | |
5365 | 158 ASSERT(idx < vdc->dring_len); \ |
1991 | 159 ASSERT(vdc->dring_mem_info.vaddr != NULL); \ |
5365 | 160 dep = (vd_dring_entry_t *)(uintptr_t) \ |
161 (vdc->dring_mem_info.vaddr + \ | |
1991 | 162 (idx * vdc->dring_entry_size)); \ |
163 ASSERT(dep != NULL); \ | |
164 dep->hdr.dstate = VIO_DESC_FREE; \ | |
165 } | |
166 | |
167 /* Initialise the Session ID and Sequence Num in the DRing msg */ | |
168 #define VDC_INIT_DRING_DATA_MSG_IDS(dmsg, vdc) \ | |
169 ASSERT(vdc != NULL); \ | |
170 dmsg.tag.vio_sid = vdc->session_id; \ | |
2032
b9ba1b330453
6422255 vdc could handle handshake restarts better
lm66018
parents:
1991
diff
changeset
|
171 dmsg.seq_num = vdc->seq_num; |
1991 | 172 |
173 /* | |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
174 * The states that the read thread can be in. |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
175 */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
176 typedef enum vdc_rd_state { |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
177 VDC_READ_IDLE, /* idling - conn is not up */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
178 VDC_READ_WAITING, /* waiting for data */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
179 VDC_READ_PENDING, /* pending data avail for read */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
180 VDC_READ_RESET /* channel was reset - stop reads */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
181 } vdc_rd_state_t; |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
182 |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
183 /* |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
184 * The states that the vdc-vds connection can be in. |
1991 | 185 */ |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
186 typedef enum vdc_state { |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
187 VDC_STATE_INIT, /* device is initialized */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
188 VDC_STATE_INIT_WAITING, /* waiting for ldc connection */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
189 VDC_STATE_NEGOTIATE, /* doing handshake negotiation */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
190 VDC_STATE_HANDLE_PENDING, /* handle requests in backup dring */ |
11004
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
191 VDC_STATE_FAULTED, /* multipath backend is inaccessible */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
192 VDC_STATE_FAILED, /* device is not usable */ |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
193 VDC_STATE_RUNNING, /* running and accepting requests */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
194 VDC_STATE_DETACH, /* detaching */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
195 VDC_STATE_RESETTING /* resetting connection with vds */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
196 } vdc_state_t; |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
197 |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
198 /* |
11004
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
199 * States of the service provided by a vds server |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
200 */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
201 typedef enum vdc_service_state { |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
202 VDC_SERVICE_NONE = -1, /* no state define */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
203 VDC_SERVICE_OFFLINE, /* no connection with the service */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
204 VDC_SERVICE_CONNECTED, /* connection established */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
205 VDC_SERVICE_ONLINE, /* connection and backend available */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
206 VDC_SERVICE_FAILED, /* connection failed */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
207 VDC_SERVICE_FAULTED /* connection but backend unavailable */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
208 } vdc_service_state_t; |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
209 |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
210 /* |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
211 * The states that the vdc instance can be in. |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
212 */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
213 typedef enum vdc_lc_state { |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
214 VDC_LC_ATTACHING, /* driver is attaching */ |
12191
647d64f09759
6931950 vdisk does not timeout when backend does not exist
Alexandre Chartre <Alexandre.Chartre@oracle.com>
parents:
11975
diff
changeset
|
215 VDC_LC_ONLINE_PENDING, /* driver is attached, handshake pending */ |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
216 VDC_LC_ONLINE, /* driver is attached and online */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
217 VDC_LC_DETACHING /* driver is detaching */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
218 } vdc_lc_state_t; |
1991 | 219 |
220 /* | |
221 * Local Descriptor Ring entry | |
222 * | |
223 * vdc creates a Local (private) descriptor ring the same size as the | |
224 * public descriptor ring it exports to vds. | |
225 */ | |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
226 |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
227 typedef enum { |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
228 VIO_read_dir, /* read data from server */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
229 VIO_write_dir, /* write data to server */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
230 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
|
231 } vio_desc_direction_t; |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
232 |
1991 | 233 typedef struct vdc_local_desc { |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
234 boolean_t is_free; /* local state - inuse or not */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
235 |
1991 | 236 int operation; /* VD_OP_xxx to be performed */ |
237 caddr_t addr; /* addr passed in by consumer */ | |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
238 int slice; |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
239 diskaddr_t offset; /* disk offset */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
240 size_t nbytes; |
11004
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
241 struct buf *buf; /* buf of operation */ |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
242 vio_desc_direction_t dir; /* direction of transfer */ |
11004
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
243 int flags; /* flags of operation */ |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
244 |
1991 | 245 caddr_t align_addr; /* used if addr non-aligned */ |
246 ldc_mem_handle_t desc_mhdl; /* Mem handle of buf */ | |
247 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
|
248 |
1991 | 249 } vdc_local_desc_t; |
250 | |
251 /* | |
11004
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
252 * I/O queue used for checking backend or failfast |
5658 | 253 */ |
254 typedef struct vdc_io { | |
255 struct vdc_io *vio_next; /* next pending I/O in the queue */ | |
11004
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
256 int vio_index; /* descriptor index */ |
5658 | 257 clock_t vio_qtime; /* time the I/O was queued */ |
258 } vdc_io_t; | |
259 | |
260 /* | |
6480
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
261 * Per vDisk server channel states |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
262 */ |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
263 #define VDC_LDC_INIT 0x0001 |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
264 #define VDC_LDC_CB 0x0002 |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
265 #define VDC_LDC_OPEN 0x0004 |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
266 #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
|
267 |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
268 /* |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
269 * vDisk server information |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
270 */ |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
271 typedef struct vdc_server { |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
272 struct vdc_server *next; /* Next server */ |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
273 struct vdc *vdcp; /* Ptr to vdc struct */ |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
274 uint64_t id; /* Server port id */ |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
275 uint64_t state; /* Server state */ |
11004
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
276 vdc_service_state_t svc_state; /* Service state */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
277 vdc_service_state_t log_state; /* Last state logged */ |
6480
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
278 uint64_t ldc_id; /* Server LDC id */ |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
279 ldc_handle_t ldc_handle; /* Server LDC handle */ |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
280 ldc_status_t ldc_state; /* Server LDC state */ |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
281 uint64_t ctimeout; /* conn tmout (secs) */ |
12191
647d64f09759
6931950 vdisk does not timeout when backend does not exist
Alexandre Chartre <Alexandre.Chartre@oracle.com>
parents:
11975
diff
changeset
|
282 uint_t hshake_cnt; /* handshakes count */ |
647d64f09759
6931950 vdisk does not timeout when backend does not exist
Alexandre Chartre <Alexandre.Chartre@oracle.com>
parents:
11975
diff
changeset
|
283 uint_t hattr_cnt; /* attr. neg. count */ |
647d64f09759
6931950 vdisk does not timeout when backend does not exist
Alexandre Chartre <Alexandre.Chartre@oracle.com>
parents:
11975
diff
changeset
|
284 uint_t hattr_total; /* attr. neg. total */ |
6480
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
285 } vdc_server_t; |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
286 |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
287 /* |
1991 | 288 * vdc soft state structure |
289 */ | |
290 typedef struct vdc { | |
291 | |
292 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
|
293 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
|
294 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
|
295 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
|
296 kcondvar_t membind_cv; /* signal when mem can be bound */ |
11004
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
297 boolean_t self_reset; /* self initiated reset */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
298 kcondvar_t io_pending_cv; /* signal on pending I/O */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
299 boolean_t io_pending; /* pending I/O */ |
1991 | 300 |
301 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
|
302 vdc_lc_state_t lifecycle; /* Current state of the vdc instance */ |
12191
647d64f09759
6931950 vdisk does not timeout when backend does not exist
Alexandre Chartre <Alexandre.Chartre@oracle.com>
parents:
11975
diff
changeset
|
303 uint_t hattr_min; /* min. # attribute negotiations */ |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
304 |
4963
ce6338ba4a73
6531913 vds can lose access to vdisks built from files located on the root fs
achartre
parents:
4848
diff
changeset
|
305 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
|
306 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
|
307 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
|
308 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
|
309 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
|
310 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
|
311 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
|
312 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
|
313 vd_slice_t slice[V_NUMPAR]; /* logical partitions */ |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
314 |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
315 kthread_t *msg_proc_thr; /* main msg processing thread */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
316 |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
317 kmutex_t read_lock; /* lock to protect read */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
318 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
|
319 vdc_rd_state_t read_state; /* current read state */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
320 |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
321 uint32_t sync_op_cnt; /* num of active sync operations */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
322 boolean_t sync_op_blocked; /* blocked waiting to do sync op */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
323 kcondvar_t sync_blocked_cv; /* cv wait for other syncs to finish */ |
1991 | 324 |
325 uint64_t session_id; /* common ID sent with all messages */ | |
326 uint64_t seq_num; /* most recent sequence num generated */ | |
327 uint64_t seq_num_reply; /* Last seq num ACK/NACK'ed by vds */ | |
328 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
|
329 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
|
330 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
|
331 |
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
332 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
|
333 int instance; /* driver instance number */ |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
334 |
2410
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
335 vio_ver_t ver; /* version number agreed with server */ |
1991 | 336 vd_disk_type_t vdisk_type; /* type of device/disk being imported */ |
5365 | 337 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
|
338 uint64_t vdisk_size; /* device size in blocks */ |
1991 | 339 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
|
340 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
|
341 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
|
342 int vio_bshift; /* shift for vio blk conversion */ |
5365 | 343 uint64_t operations; /* bitmask of ops. server supports */ |
1991 | 344 struct dk_cinfo *cinfo; /* structure to store DKIOCINFO data */ |
345 struct dk_minfo *minfo; /* structure for DKIOCGMEDIAINFO data */ | |
2531
65c5d20aa275
6419154 libpcp pcp_init routine should accept service names
narayan
parents:
2410
diff
changeset
|
346 ddi_devid_t devid; /* device id */ |
4848 | 347 boolean_t ctimeout_reached; /* connection timeout has expired */ |
1991 | 348 |
5658 | 349 /* |
350 * The ownership fields are protected by the lock mutex. The | |
351 * ownership_lock mutex is used to serialize ownership operations; | |
352 * it should be acquired before the lock mutex. | |
353 */ | |
354 kmutex_t ownership_lock; /* serialize ownership ops */ | |
355 int ownership; /* ownership status flags */ | |
356 kthread_t *ownership_thread; /* ownership thread */ | |
357 kcondvar_t ownership_cv; /* cv for ownership update */ | |
358 | |
359 /* | |
11004
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
360 * The eio and failfast fields are protected by the lock mutex. |
5658 | 361 */ |
11004
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
362 kthread_t *eio_thread; /* error io thread */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
363 kcondvar_t eio_cv; /* cv for eio thread update */ |
4bcbed8266fd
6726533 vdisk failover should handle storage/storage-path failures (a la mpxio)
Alexandre Chartre <Alexandre.Chartre@Sun.COM>
parents:
10971
diff
changeset
|
364 vdc_io_t *eio_queue; /* error io queue */ |
5658 | 365 clock_t failfast_interval; /* interval in microsecs */ |
366 | |
6099
b338715e1b52
6503157 guest domain I/O statistics need to be made available to iostat(1M)
lm66018
parents:
5874
diff
changeset
|
367 /* |
b338715e1b52
6503157 guest domain I/O statistics need to be made available to iostat(1M)
lm66018
parents:
5874
diff
changeset
|
368 * 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
|
369 * 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
|
370 */ |
b338715e1b52
6503157 guest domain I/O statistics need to be made available to iostat(1M)
lm66018
parents:
5874
diff
changeset
|
371 kstat_t *io_stats; |
b338715e1b52
6503157 guest domain I/O statistics need to be made available to iostat(1M)
lm66018
parents:
5874
diff
changeset
|
372 kstat_t *err_stats; |
b338715e1b52
6503157 guest domain I/O statistics need to be made available to iostat(1M)
lm66018
parents:
5874
diff
changeset
|
373 |
6480
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
374 ldc_dring_handle_t dring_hdl; /* dring handle */ |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
375 ldc_mem_info_t dring_mem_info; /* dring information */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
376 uint_t dring_curr_idx; /* current index */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
377 uint32_t dring_len; /* dring length */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
378 uint32_t dring_max_cookies; /* dring max cookies */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
379 uint32_t dring_cookie_count; /* num cookies */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
380 uint32_t dring_entry_size; /* descriptor size */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
381 ldc_mem_cookie_t *dring_cookie; /* dring cookies */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
382 uint64_t dring_ident; /* dring ident */ |
1991 | 383 |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
384 uint64_t threads_pending; /* num of threads */ |
1991 | 385 |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
386 vdc_local_desc_t *local_dring; /* local dring */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
387 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
|
388 int local_dring_backup_tail; /* backup dring tail */ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
389 int local_dring_backup_len; /* backup dring len */ |
1991 | 390 |
6480
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
391 int num_servers; /* no. of servers */ |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
392 vdc_server_t *server_list; /* vdisk server list */ |
d50f51fd3502
6622004 vdc should support multi-pathing using multiple vdisk servers
narayan
parents:
6099
diff
changeset
|
393 vdc_server_t *curr_server; /* curr vdisk server */ |
1991 | 394 } vdc_t; |
395 | |
396 /* | |
5658 | 397 * Ownership status flags |
398 */ | |
399 #define VDC_OWNERSHIP_NONE 0x00 /* no ownership wanted */ | |
400 #define VDC_OWNERSHIP_WANTED 0x01 /* ownership is wanted */ | |
401 #define VDC_OWNERSHIP_GRANTED 0x02 /* ownership has been granted */ | |
402 #define VDC_OWNERSHIP_RESET 0x04 /* ownership has been reset */ | |
403 | |
404 /* | |
405 * Reservation conflict panic message | |
406 */ | |
407 #define VDC_RESV_CONFLICT_FMT_STR "Reservation Conflict\nDisk: " | |
408 #define VDC_RESV_CONFLICT_FMT_LEN (sizeof (VDC_RESV_CONFLICT_FMT_STR)) | |
409 | |
410 /* | |
1991 | 411 * Debugging macros |
412 */ | |
413 #ifdef DEBUG | |
414 extern int vdc_msglevel; | |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
415 extern uint64_t vdc_matchinst; |
1991 | 416 |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
417 #define DMSG(_vdc, err_level, format, ...) \ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
418 do { \ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
419 if (vdc_msglevel > err_level && \ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
420 (vdc_matchinst & (1ull << (_vdc)->instance))) \ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
421 cmn_err(CE_CONT, "?[%d,t@%p] %s: "format, \ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
422 (_vdc)->instance, (void *)curthread, \ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
423 __func__, __VA_ARGS__); \ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
424 _NOTE(CONSTANTCONDITION) \ |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
425 } while (0); |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
426 |
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
427 #define DMSGX(err_level, format, ...) \ |
2410
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
428 do { \ |
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
429 if (vdc_msglevel > err_level) \ |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
430 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
|
431 _NOTE(CONSTANTCONDITION) \ |
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
432 } while (0); |
1991 | 433 |
434 #define VDC_DUMP_DRING_MSG(dmsgp) \ | |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
435 DMSGX(0, "sq:%lu start:%d end:%d ident:%lu\n", \ |
1991 | 436 dmsgp->seq_num, dmsgp->start_idx, \ |
437 dmsgp->end_idx, dmsgp->dring_ident); | |
438 | |
439 #else /* !DEBUG */ | |
2410
0faef06c73cd
6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents:
2032
diff
changeset
|
440 #define DMSG(err_level, ...) |
2793
a30c4090b49f
6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents:
2531
diff
changeset
|
441 #define DMSGX(err_level, format, ...) |
1991 | 442 #define VDC_DUMP_DRING_MSG(dmsgp) |
443 | |
444 #endif /* !DEBUG */ | |
445 | |
446 #ifdef __cplusplus | |
447 } | |
448 #endif | |
449 | |
450 #endif /* _VDC_H */ |