annotate usr/src/uts/sun4v/sys/vdc.h @ 2531:65c5d20aa275

6419154 libpcp pcp_init routine should accept service names 6428416 CPUs greater than NCPU are stopped too early in boot 6436930 qcn drv needs to handle EWOULDBLOCK returned by hv_cnputchar 6437727 vDisk should support EFI labels 6437738 vDisk should support devid 6441930 fillsysinfo should cap max sun4v queue size to kernel limits 6441933 The broken MD detection code should be improved 6445825 domaining_enabled variable does not tell the whole story 6449959 vDisk DKIOCSETWCE/DKIOCGETWCE ioctls are not correctly implemented 6451118 Elevate libpcp from a platform lib to a sun4v lib 6451490 ldc_chkq incorrectly returns queue empty when data is available on streaming mode channel 6456875 VIO drivers should use LDC shared memory for better performance 6456880 LDC link layer fails to clear interrupt state properly 6456928 drd service is not enabled if installed through an upgrade 6457162 vswitch needs to cope with dropped pkts when talking to obp 6457166 vswitch calculating bounded range of descriptors incorrectly
author narayan
date Thu, 10 Aug 2006 13:51:43 -0700
parents 0faef06c73cd
children a30c4090b49f
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 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
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"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
82 #define VDC_MD_DISK_NAME "disk"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
83 #define VDC_MD_CFG_HDL "cfg-handle"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
84 #define VDC_ID_PROP "id"
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
85
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
86 /*
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
87 * 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
88 * 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
89 * 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
90 * 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
91 * 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
92 */
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
93 #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
94 #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
95 #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
96
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
97 /*
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
98 * Scheme to store the instance number and the slice number in the minor number.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
99 * (Uses the same format and definitions as the sd(7D) driver)
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
100 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
101 #define VD_MAKE_DEV(instance, minor) ((instance << SDUNIT_SHIFT) | minor)
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
102
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
103 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
104 * 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
105 * 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
106 *
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
107 * 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
108 * the reboot of the service domain.
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
109 */
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
110 #define VDC_RETRIES 10
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
111
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
112 #define VDC_USEC_TIMEOUT_MIN (30 * MICROSEC) /* 30 sec */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
113
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
114 /*
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
115 * 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
116 * 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
117 * 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
118 * 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
119 * 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
120 * 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
121 */
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
122 #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
123 (ddi_get_lbolt() + ((timeout) * MAX(1, (mul))))
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
124
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
125 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
126 * Macros to manipulate Descriptor Ring variables in the soft state
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
127 * structure.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
128 */
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
129 #define VDC_GET_NEXT_REQ_ID(vdc) ((vdc)->req_id++)
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
130
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
131 #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
132 (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
133 (idx * (vdc)->dring_entry_size))
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
134
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
135 #define VDC_MARK_DRING_ENTRY_FREE(vdc, idx) \
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 vd_dring_entry_t *dep = NULL; \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
138 ASSERT(vdc != NULL); \
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
139 ASSERT((idx >= 0) && (idx < vdc->dring_len)); \
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
140 ASSERT(vdc->dring_mem_info.vaddr != NULL); \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
141 dep = (vd_dring_entry_t *)(vdc->dring_mem_info.vaddr + \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
142 (idx * vdc->dring_entry_size)); \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
143 ASSERT(dep != NULL); \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
144 dep->hdr.dstate = VIO_DESC_FREE; \
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
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
147 /* Initialise the Session ID and Sequence Num in the DRing msg */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
148 #define VDC_INIT_DRING_DATA_MSG_IDS(dmsg, vdc) \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
149 ASSERT(vdc != NULL); \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
150 dmsg.tag.vio_sid = vdc->session_id; \
2032
b9ba1b330453 6422255 vdc could handle handshake restarts better
lm66018
parents: 1991
diff changeset
151 dmsg.seq_num = vdc->seq_num;
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
152
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
153 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
154 * The states the message processing thread can be in.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
155 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
156 typedef enum vdc_thr_state {
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
157 VDC_THR_RUNNING, /* thread is running & ready to process */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
158 VDC_THR_STOP, /* The detach func signals the thread to stop */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
159 VDC_THR_DONE /* Thread has exited */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
160 } vdc_thr_state_t;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
161
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
162 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
163 * Local Descriptor Ring entry
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
164 *
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
165 * 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
166 * public descriptor ring it exports to vds.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
167 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
168 typedef struct vdc_local_desc {
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
169 kmutex_t lock; /* protects all fields */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
170 kcondvar_t cv; /* indicate processing done */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
171 int flags; /* Dring entry state, etc */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
172 int operation; /* VD_OP_xxx to be performed */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
173 caddr_t addr; /* addr passed in by consumer */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
174 caddr_t align_addr; /* used if addr non-aligned */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
175 struct buf *buf; /* buf passed to strategy() */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
176 ldc_mem_handle_t desc_mhdl; /* Mem handle of buf */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
177 vd_dring_entry_t *dep; /* public Dring Entry Pointer */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
178 } vdc_local_desc_t;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
179
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
180 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
181 * vdc soft state structure
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
182 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
183 typedef struct vdc {
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
184 kmutex_t attach_lock; /* used by CV which waits in attach */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
185 kcondvar_t attach_cv; /* signal when attach can finish */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
186
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
187 kmutex_t lock; /* protects next 2 sections of vars */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
188 kcondvar_t cv; /* signal when upper layers can send */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
189
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
190 int initialized; /* keeps track of what's init'ed */
2032
b9ba1b330453 6422255 vdc could handle handshake restarts better
lm66018
parents: 1991
diff changeset
191 int hshake_cnt; /* number of failed handshakes */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
192 int open; /* count of outstanding opens */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
193 int dkio_flush_pending; /* # outstanding DKIO flushes */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
194
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
195 uint64_t session_id; /* common ID sent with all messages */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
196 uint64_t seq_num; /* most recent sequence num generated */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
197 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
198 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
199 uint64_t req_id_proc; /* Last request ID processed by vdc */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
200 vd_state_t state; /* Current handshake state */
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
201
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
202 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
203 int instance; /* driver instance number */
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
204 vio_ver_t ver; /* version number agreed with server */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
205 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
206 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
207 uint64_t vdisk_size; /* device size in blocks */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
208 uint64_t max_xfer_sz; /* maximum block size of a descriptor */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
209 uint64_t block_size; /* device block size used */
2032
b9ba1b330453 6422255 vdc could handle handshake restarts better
lm66018
parents: 1991
diff changeset
210 struct dk_label *label; /* structure to store disk label */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
211 struct dk_cinfo *cinfo; /* structure to store DKIOCINFO data */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
212 struct dk_minfo *minfo; /* structure for DKIOCGMEDIAINFO data */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
213 struct vtoc *vtoc; /* structure to store VTOC data */
2531
65c5d20aa275 6419154 libpcp pcp_init routine should accept service names
narayan
parents: 2410
diff changeset
214 ddi_devid_t devid; /* device id */
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
215
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
216 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
217 * The mutex 'msg_proc_lock' protects the following group of fields.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
218 *
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
219 * The callback function checks to see if LDC triggered it due to
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
220 * there being data available and the callback will signal to
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
221 * the message processing thread waiting on 'msg_proc_cv'.
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
222 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
223 kmutex_t msg_proc_lock;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
224 kcondvar_t msg_proc_cv;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
225 boolean_t msg_pending;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
226 vdc_thr_state_t msg_proc_thr_state;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
227 kthread_t *msg_proc_thr_id;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
228
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
229 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
230 * The mutex 'dring_lock' protects the following group of fields.
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 kmutex_t dring_lock;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
233 ldc_mem_info_t dring_mem_info;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
234 uint_t dring_curr_idx;
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
235 uint_t dring_proc_idx;
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
236 uint32_t dring_len;
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
237 uint32_t dring_max_cookies;
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
238 uint32_t dring_cookie_count;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
239 uint32_t dring_entry_size;
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
240 boolean_t dring_notify_server;
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
241 ldc_mem_cookie_t *dring_cookie;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
242 uint64_t dring_ident;
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 vdc_local_desc_t *local_dring;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
245
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
246 uint64_t ldc_id;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
247 ldc_status_t ldc_state;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
248 ldc_handle_t ldc_handle;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
249 ldc_dring_handle_t ldc_dring_hdl;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
250 } vdc_t;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
251
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
252 /*
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
253 * Debugging macros
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
254 */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
255 #ifdef DEBUG
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
256 extern int vdc_msglevel;
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
257
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
258 #define DMSG(err_level, format, ...) \
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
259 do { \
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
260 if (vdc_msglevel > err_level) \
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
261 cmn_err(CE_CONT, "?%s"format, __func__, __VA_ARGS__);\
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
262 _NOTE(CONSTANTCONDITION) \
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
263 } while (0);
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
264
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
265 #define VDC_DUMP_DRING_MSG(dmsgp) \
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
266 DMSG(0, "sq:%lu start:%d end:%d ident:%lu\n", \
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
267 dmsgp->seq_num, dmsgp->start_idx, \
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
268 dmsgp->end_idx, dmsgp->dring_ident);
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
269
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
270 #else /* !DEBUG */
2410
0faef06c73cd 6432376 vds and vdc don't negotiate max transfer size supported correctly
lm66018
parents: 2032
diff changeset
271 #define DMSG(err_level, ...)
1991
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
272 #define VDC_DUMP_DRING_MSG(dmsgp)
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
273
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
274 #endif /* !DEBUG */
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
275
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
276 #ifdef __cplusplus
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
277 }
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
278 #endif
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
279
f29baf5bf770 FWARC 2005/633 Project Q Logial Domaining Umbrella
heppo
parents:
diff changeset
280 #endif /* _VDC_H */