annotate usr/src/uts/sun4v/sys/vdc.h @ 4848:eee1ef6f0e3e

FWARC 2007/363 VIO vDisk MD node updates 6566086 vdc needs an I/O timeout 6575216 IO-DOMAIN-RESET : Guests may lose access to disk services (VDS) if IO domain is rebooted
author achartre
date Fri, 10 Aug 2007 09:13:17 -0700
parents aa37b7e3c5c7
children ce6338ba4a73
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 /*
4848
eee1ef6f0e3e FWARC 2007/363 VIO vDisk MD node updates
achartre
parents: 3078
diff changeset
23 * Copyright 2007 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 #pragma ident "%Z%%M% %I% %E% SMI"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
31
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 * Virtual disk client implementation definitions
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
34 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
35
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
36 #include <sys/sysmacros.h>
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
37 #include <sys/note.h>
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
38
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
39 #include <sys/ldc.h>
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
40 #include <sys/vio_mailbox.h>
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
41 #include <sys/vdsk_mailbox.h>
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
42 #include <sys/vdsk_common.h>
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
43
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
44 #ifdef __cplusplus
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
45 extern "C" {
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
46 #endif
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 #define VDC_DRIVER_NAME "vdc"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
49
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 * 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
52 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
53 #define VDC_SOFT_STATE 0x0001
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
54 #define VDC_LOCKS 0x0002
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
55 #define VDC_MINOR 0x0004
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
56 #define VDC_THREAD 0x0008
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
57 #define VDC_LDC 0x0010
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
58 #define VDC_LDC_INIT 0x0020
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
59 #define VDC_LDC_CB 0x0040
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
60 #define VDC_LDC_OPEN 0x0080
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
61 #define VDC_DRING_INIT 0x0100 /* The DRing was created */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
62 #define VDC_DRING_BOUND 0x0200 /* The DRing was bound to an LDC channel */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
63 #define VDC_DRING_LOCAL 0x0400 /* The local private DRing was allocated */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
64 #define VDC_DRING_ENTRY 0x0800 /* At least one DRing entry was initialised */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
65 #define VDC_DRING (VDC_DRING_INIT | VDC_DRING_BOUND | \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
66 VDC_DRING_LOCAL | VDC_DRING_ENTRY)
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
67 #define VDC_HANDSHAKE 0x1000 /* Indicates if a handshake is in progress */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
68 #define VDC_HANDSHAKE_STOP 0x2000 /* stop further handshakes */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
69
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
70 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
71 * Definitions of strings to be used to create device node properties.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
72 * (vdc uses the capitalised versions of these properties as they are 64-bit)
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
73 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
74 #define VDC_NBLOCKS_PROP_NAME "Nblocks"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
75 #define VDC_SIZE_PROP_NAME "Size"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
76
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
77 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
78 * Definitions of MD nodes/properties.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
79 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
80 #define VDC_MD_CHAN_NAME "channel-endpoint"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
81 #define VDC_MD_VDEV_NAME "virtual-device"
4848
eee1ef6f0e3e FWARC 2007/363 VIO vDisk MD node updates
achartre
parents: 3078
diff changeset
82 #define VDC_MD_PORT_NAME "virtual-device-port"
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
83 #define VDC_MD_DISK_NAME "disk"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
84 #define VDC_MD_CFG_HDL "cfg-handle"
4848
eee1ef6f0e3e FWARC 2007/363 VIO vDisk MD node updates
achartre
parents: 3078
diff changeset
85 #define VDC_MD_TIMEOUT "vdc-timeout"
eee1ef6f0e3e FWARC 2007/363 VIO vDisk MD node updates
achartre
parents: 3078
diff changeset
86 #define VDC_MD_ID "id"
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
87
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
88 /*
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
89 * 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
90 * 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
91 * 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
92 * 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
93 * 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
94 */
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
95 #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
96 #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
97 #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
98
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
99 /*
3078
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
100 * 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
101 */
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
102 #define VDCUNIT_SHIFT 3
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
103 #define VDCPART_MASK 7
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
104
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
105 #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
106 #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
107
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
108 /*
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
109 * 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
110 * (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
111 */
3078
aa37b7e3c5c7 6485548 Can not create zpool on guest domain with an entire vdisk
narayan
parents: 2793
diff changeset
112 #define VD_MAKE_DEV(instance, minor) ((instance << VDCUNIT_SHIFT) | minor)
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 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
115 * 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
116 * 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
117 *
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
118 * 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
119 * the reboot of the service domain.
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
120 */
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
121 #define VDC_RETRIES 10
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
122
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
123 #define VDC_USEC_TIMEOUT_MIN (30 * MICROSEC) /* 30 sec */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
124
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
125 /*
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
126 * 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
127 * 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
128 * 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
129 * 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
130 * 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
131 * 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
132 */
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
133 #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
134 (ddi_get_lbolt() + ((timeout) * MAX(1, (mul))))
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
135
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 * Macros to manipulate Descriptor Ring variables in the soft state
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
138 * structure.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
139 */
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
140 #define VDC_GET_NEXT_REQ_ID(vdc) ((vdc)->req_id++)
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
141
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
142 #define VDC_GET_DRING_ENTRY_PTR(vdc, idx) \
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
143 (vd_dring_entry_t *)((vdc)->dring_mem_info.vaddr + \
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
144 (idx * (vdc)->dring_entry_size))
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
145
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
146 #define VDC_MARK_DRING_ENTRY_FREE(vdc, idx) \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
147 { \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
148 vd_dring_entry_t *dep = NULL; \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
149 ASSERT(vdc != NULL); \
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
150 ASSERT((idx >= 0) && (idx < vdc->dring_len)); \
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
151 ASSERT(vdc->dring_mem_info.vaddr != NULL); \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
152 dep = (vd_dring_entry_t *)(vdc->dring_mem_info.vaddr + \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
153 (idx * vdc->dring_entry_size)); \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
154 ASSERT(dep != NULL); \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
155 dep->hdr.dstate = VIO_DESC_FREE; \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
156 }
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
157
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
158 /* Initialise the Session ID and Sequence Num in the DRing msg */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
159 #define VDC_INIT_DRING_DATA_MSG_IDS(dmsg, vdc) \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
160 ASSERT(vdc != NULL); \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
161 dmsg.tag.vio_sid = vdc->session_id; \
2032
b9ba1b330453 6422255 vdc could handle handshake restarts better
lm66018
parents: 1991
diff changeset
162 dmsg.seq_num = vdc->seq_num;
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
163
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
164 /*
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
165 * The states that the read thread can be in.
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 typedef enum vdc_rd_state {
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
168 VDC_READ_IDLE, /* idling - conn is not up */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
169 VDC_READ_WAITING, /* waiting for data */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
170 VDC_READ_PENDING, /* pending data avail for read */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
171 VDC_READ_RESET /* channel was reset - stop reads */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
172 } vdc_rd_state_t;
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
173
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
174 /*
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
175 * The states that the vdc-vds connection can be in.
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
176 */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
177 typedef enum vdc_state {
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
178 VDC_STATE_INIT, /* device is initialized */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
179 VDC_STATE_INIT_WAITING, /* waiting for ldc connection */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
180 VDC_STATE_NEGOTIATE, /* doing handshake negotiation */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
181 VDC_STATE_HANDLE_PENDING, /* handle requests in backup dring */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
182 VDC_STATE_RUNNING, /* running and accepting requests */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
183 VDC_STATE_DETACH, /* detaching */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
184 VDC_STATE_RESETTING /* resetting connection with vds */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
185 } vdc_state_t;
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
186
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
187 /*
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
188 * The states that the vdc instance can be in.
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
189 */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
190 typedef enum vdc_lc_state {
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
191 VDC_LC_ATTACHING, /* driver is attaching */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
192 VDC_LC_ONLINE, /* driver is attached and online */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
193 VDC_LC_DETACHING /* driver is detaching */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
194 } vdc_lc_state_t;
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
195
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
196 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
197 * Local Descriptor Ring entry
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
198 *
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
199 * 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
200 * public descriptor ring it exports to vds.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
201 */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
202
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
203 typedef enum {
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
204 VIO_read_dir, /* read data from server */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
205 VIO_write_dir, /* write data to server */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
206 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
207 } vio_desc_direction_t;
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
208
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
209 typedef enum {
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
210 CB_STRATEGY, /* non-blocking strategy call */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
211 CB_SYNC /* synchronous operation */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
212 } vio_cb_type_t;
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
213
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
214 typedef struct vdc_local_desc {
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
215 boolean_t is_free; /* local state - inuse or not */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
216
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
217 int operation; /* VD_OP_xxx to be performed */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
218 caddr_t addr; /* addr passed in by consumer */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
219 int slice;
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
220 diskaddr_t offset; /* disk offset */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
221 size_t nbytes;
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
222 vio_cb_type_t cb_type; /* operation type blk/nonblk */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
223 void *cb_arg; /* buf passed to strategy() */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
224 vio_desc_direction_t dir; /* direction of transfer */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
225
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
226 caddr_t align_addr; /* used if addr non-aligned */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
227 ldc_mem_handle_t desc_mhdl; /* Mem handle of buf */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
228 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
229
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
230 } vdc_local_desc_t;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
231
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
232 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
233 * vdc soft state structure
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
234 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
235 typedef struct vdc {
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
236
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
237 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
238 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
239 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
240 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
241 kcondvar_t membind_cv; /* signal when mem can be bound */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
242 boolean_t self_reset;
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
243
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
244 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
245 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
246
2032
b9ba1b330453 6422255 vdc could handle handshake restarts better
lm66018
parents: 1991
diff changeset
247 int hshake_cnt; /* number of failed handshakes */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
248 int open_count; /* count of outstanding opens */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
249 int dkio_flush_pending; /* # outstanding DKIO flushes */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
250
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
251 kthread_t *msg_proc_thr; /* main msg processing thread */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
252
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
253 kmutex_t read_lock; /* lock to protect read */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
254 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
255 vdc_rd_state_t read_state; /* current read state */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
256
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
257 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
258 boolean_t sync_op_pending; /* sync operation is pending */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
259 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
260 uint32_t sync_op_status; /* status of sync operation */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
261 kcondvar_t sync_pending_cv; /* cv wait for sync op to finish */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
262 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
263
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
264 uint64_t session_id; /* common ID sent with all messages */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
265 uint64_t seq_num; /* most recent sequence num generated */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
266 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
267 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
268 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
269 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
270
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
271 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
272 int instance; /* driver instance number */
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
273
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
274 vio_ver_t ver; /* version number agreed with server */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
275 vd_disk_type_t vdisk_type; /* type of device/disk being imported */
2531
65c5d20aa275 6419154 libpcp pcp_init routine should accept service names
narayan
parents: 2410
diff changeset
276 vd_disk_label_t vdisk_label; /* label type of device/disk imported */
65c5d20aa275 6419154 libpcp pcp_init routine should accept service names
narayan
parents: 2410
diff changeset
277 uint64_t vdisk_size; /* device size in blocks */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
278 uint64_t max_xfer_sz; /* maximum block size of a descriptor */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
279 uint64_t block_size; /* device block size used */
2032
b9ba1b330453 6422255 vdc could handle handshake restarts better
lm66018
parents: 1991
diff changeset
280 struct dk_label *label; /* structure to store disk label */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
281 struct dk_cinfo *cinfo; /* structure to store DKIOCINFO data */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
282 struct dk_minfo *minfo; /* structure for DKIOCGMEDIAINFO data */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
283 struct vtoc *vtoc; /* structure to store VTOC data */
2531
65c5d20aa275 6419154 libpcp pcp_init routine should accept service names
narayan
parents: 2410
diff changeset
284 ddi_devid_t devid; /* device id */
4848
eee1ef6f0e3e FWARC 2007/363 VIO vDisk MD node updates
achartre
parents: 3078
diff changeset
285 uint64_t ctimeout; /* connection timeout in seconds */
eee1ef6f0e3e FWARC 2007/363 VIO vDisk MD node updates
achartre
parents: 3078
diff changeset
286 boolean_t ctimeout_reached; /* connection timeout has expired */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
287
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
288 ldc_mem_info_t dring_mem_info; /* dring information */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
289 uint_t dring_curr_idx; /* current index */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
290 uint32_t dring_len; /* dring length */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
291 uint32_t dring_max_cookies; /* dring max cookies */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
292 uint32_t dring_cookie_count; /* num cookies */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
293 uint32_t dring_entry_size; /* descriptor size */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
294 ldc_mem_cookie_t *dring_cookie; /* dring cookies */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
295 uint64_t dring_ident; /* dring ident */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
296
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
297 uint64_t threads_pending; /* num of threads */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
298
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
299 vdc_local_desc_t *local_dring; /* local dring */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
300 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
301 int local_dring_backup_tail; /* backup dring tail */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
302 int local_dring_backup_len; /* backup dring len */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
303
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
304 uint64_t ldc_id; /* LDC channel id */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
305 ldc_status_t ldc_state; /* LDC channel state */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
306 ldc_handle_t ldc_handle; /* LDC handle */
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
307 ldc_dring_handle_t ldc_dring_hdl; /* LDC dring handle */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
308 } vdc_t;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
309
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
310 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
311 * Debugging macros
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
312 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
313 #ifdef DEBUG
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
314 extern int vdc_msglevel;
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
315 extern uint64_t vdc_matchinst;
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
316
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
317 #define DMSG(_vdc, err_level, format, ...) \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
318 do { \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
319 if (vdc_msglevel > err_level && \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
320 (vdc_matchinst & (1ull << (_vdc)->instance))) \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
321 cmn_err(CE_CONT, "?[%d,t@%p] %s: "format, \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
322 (_vdc)->instance, (void *)curthread, \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
323 __func__, __VA_ARGS__); \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
324 _NOTE(CONSTANTCONDITION) \
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
325 } while (0);
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
326
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
327 #define DMSGX(err_level, format, ...) \
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
328 do { \
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
329 if (vdc_msglevel > err_level) \
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
330 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
331 _NOTE(CONSTANTCONDITION) \
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
332 } while (0);
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
333
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
334 #define VDC_DUMP_DRING_MSG(dmsgp) \
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
335 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
336 dmsgp->seq_num, dmsgp->start_idx, \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
337 dmsgp->end_idx, dmsgp->dring_ident);
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
338
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
339 #else /* !DEBUG */
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
340 #define DMSG(err_level, ...)
2793
a30c4090b49f 6458676 memory leak with 12 hours all_solaris_tests.
lm66018
parents: 2531
diff changeset
341 #define DMSGX(err_level, format, ...)
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
342 #define VDC_DUMP_DRING_MSG(dmsgp)
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
343
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
344 #endif /* !DEBUG */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
345
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
346 #ifdef __cplusplus
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
347 }
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
348 #endif
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
349
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
350 #endif /* _VDC_H */