Print this page
OS-7088 cyclics corked on overlay socket with full queue
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/overlay_impl.h
+++ new/usr/src/uts/common/sys/overlay_impl.h
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 13 * Copyright 2016 Joyent, Inc.
14 14 */
15 15
16 16 #ifndef _SYS_OVERLAY_IMPL_H
17 17 #define _SYS_OVERLAY_IMPL_H
18 18
19 19 /*
20 20 * Overlay device support
21 21 */
22 22
23 23 #include <sys/overlay.h>
24 24 #include <sys/overlay_common.h>
25 25 #include <sys/overlay_plugin.h>
26 26 #include <sys/overlay_target.h>
27 27 #include <sys/ksynch.h>
28 28 #include <sys/list.h>
29 29 #include <sys/avl.h>
30 30 #include <sys/ksocket.h>
31 31 #include <sys/socket.h>
32 32 #include <sys/refhash.h>
33 33 #include <sys/ethernet.h>
34 34 #include <sys/list.h>
35 35
36 36 #ifdef __cplusplus
37 37 extern "C" {
38 38 #endif
39 39
40 40 #define OVEP_VERSION_ONE 0x1
41 41
42 42 typedef struct overlay_plugin {
43 43 kmutex_t ovp_mutex;
44 44 list_node_t ovp_link; /* overlay_plugin_lock */
45 45 uint_t ovp_active; /* ovp_mutex */
46 46 const char *ovp_name; /* RO */
47 47 const overlay_plugin_ops_t *ovp_ops; /* RO */
48 48 const char *const *ovp_props; /* RO */
49 49 uint_t ovp_nprops; /* RO */
50 50 uint_t ovp_id_size; /* RO */
51 51 overlay_plugin_flags_t ovp_flags; /* RO */
52 52 overlay_plugin_dest_t ovp_dest; /* RO */
53 53 } overlay_plugin_t;
54 54
55 55 typedef struct overlay_mux {
56 56 list_node_t omux_lnode;
57 57 ksocket_t omux_ksock; /* RO */
58 58 overlay_plugin_t *omux_plugin; /* RO: associated encap */
59 59 int omux_domain; /* RO: socket domain */
60 60 int omux_family; /* RO: socket family */
61 61 int omux_protocol; /* RO: socket protocol */
62 62 struct sockaddr *omux_addr; /* RO: socket address */
63 63 socklen_t omux_alen; /* RO: sockaddr len */
64 64 kmutex_t omux_lock; /* Protects everything below */
65 65 uint_t omux_count; /* Active instances */
66 66 avl_tree_t omux_devices; /* Tree of devices */
67 67 } overlay_mux_t;
68 68
69 69 typedef enum overlay_target_flag {
70 70 OVERLAY_T_TEARDOWN = 0x1
71 71 } overlay_target_flag_t;
72 72
73 73 typedef struct overlay_target {
74 74 kmutex_t ott_lock;
75 75 kcondvar_t ott_cond;
76 76 overlay_target_mode_t ott_mode; /* RO */
77 77 overlay_plugin_dest_t ott_dest; /* RO */
78 78 uint64_t ott_id; /* RO */
79 79 overlay_target_flag_t ott_flags; /* ott_lock */
80 80 uint_t ott_ocount; /* ott_lock */
81 81 union { /* ott_lock */
82 82 overlay_target_point_t ott_point;
83 83 struct overlay_target_dyn {
84 84 refhash_t *ott_dhash;
85 85 avl_tree_t ott_tree;
86 86 } ott_dyn;
87 87 } ott_u;
88 88 } overlay_target_t;
89 89
|
↓ open down ↓ |
89 lines elided |
↑ open up ↑ |
90 90 typedef enum overlay_dev_flag {
91 91 OVERLAY_F_ACTIVATED = 0x01, /* Activate ioctl completed */
92 92 OVERLAY_F_IN_MUX = 0x02, /* Currently in a mux */
93 93 OVERLAY_F_IN_TX = 0x04, /* Currently doing tx */
94 94 OVERLAY_F_IN_RX = 0x08, /* Currently doing rx */
95 95 OVERLAY_F_IOMASK = 0x0c, /* A mask for rx and tx */
96 96 OVERLAY_F_MDDROP = 0x10, /* Drop traffic for metadata update */
97 97 OVERLAY_F_STOPMASK = 0x1e, /* None set when stopping */
98 98 OVERLAY_F_VARPD = 0x20, /* varpd plugin exists */
99 99 OVERLAY_F_DEGRADED = 0x40, /* device is degraded */
100 - OVERLAY_F_MASK = 0x7f /* mask of everything */
100 + OVERLAY_F_TXSTOPPED = 0x80, /* device needs max_tx_update */
101 + OVERLAY_F_MASK = 0xff /* mask of everything */
101 102 } overlay_dev_flag_t;
102 103
103 104 typedef struct overlay_dev {
104 105 kmutex_t odd_lock;
105 106 kcondvar_t odd_iowait;
106 107 list_node_t odd_link; /* overlay_dev_lock */
107 108 mac_handle_t odd_mh; /* RO */
108 109 overlay_plugin_t *odd_plugin; /* RO */
109 110 datalink_id_t odd_linkid; /* RO */
110 111 void *odd_pvoid; /* RO -- only used by plugin */
111 112 uint_t odd_ref; /* protected by odd_lock */
112 113 uint_t odd_mtu; /* protected by odd_lock */
113 114 overlay_dev_flag_t odd_flags; /* protected by odd_lock */
114 115 uint_t odd_rxcount; /* protected by odd_lock */
115 116 uint_t odd_txcount; /* protected by odd_lock */
116 117 overlay_mux_t *odd_mux; /* protected by odd_lock */
117 118 uint64_t odd_vid; /* RO if active else odd_lock */
118 119 avl_node_t odd_muxnode; /* managed by mux */
119 120 overlay_target_t *odd_target; /* See big theory statement */
120 121 char odd_fmamsg[OVERLAY_STATUS_BUFLEN]; /* odd_lock */
121 122 } overlay_dev_t;
122 123
123 124 typedef enum overlay_target_entry_flags {
124 125 OVERLAY_ENTRY_F_PENDING = 0x01, /* lookup in progress */
125 126 OVERLAY_ENTRY_F_VALID = 0x02, /* entry is currently valid */
126 127 OVERLAY_ENTRY_F_DROP = 0x04, /* always drop target */
127 128 OVERLAY_ENTRY_F_VALID_MASK = 0x06
128 129 } overlay_target_entry_flags_t;
129 130
130 131 typedef struct overlay_target_entry {
131 132 kmutex_t ote_lock;
132 133 refhash_link_t ote_reflink; /* hashtable link */
133 134 avl_node_t ote_avllink; /* iteration link */
134 135 list_node_t ote_qlink;
135 136 overlay_target_entry_flags_t ote_flags; /* RW: state flags */
136 137 uint8_t ote_addr[ETHERADDRL]; /* RO: mac addr */
137 138 overlay_target_t *ote_ott; /* RO */
138 139 overlay_dev_t *ote_odd; /* RO */
139 140 overlay_target_point_t ote_dest; /* RW: destination */
140 141 mblk_t *ote_chead; /* RW: blocked mb chain head */
141 142 mblk_t *ote_ctail; /* RW: blocked mb chain tail */
142 143 size_t ote_mbsize; /* RW: outstanding mblk size */
143 144 hrtime_t ote_vtime; /* RW: valid timestamp */
144 145 } overlay_target_entry_t;
145 146
146 147
147 148 #define OVERLAY_CTL "overlay"
148 149
149 150 extern dev_info_t *overlay_dip;
150 151
151 152 extern mblk_t *overlay_m_tx(void *, mblk_t *);
152 153
153 154 typedef int (*overlay_dev_iter_f)(overlay_dev_t *, void *);
154 155 extern void overlay_dev_iter(overlay_dev_iter_f, void *);
155 156
156 157 extern void overlay_plugin_init(void);
157 158 extern overlay_plugin_t *overlay_plugin_lookup(const char *);
158 159 extern void overlay_plugin_rele(overlay_plugin_t *);
159 160 extern void overlay_plugin_fini(void);
160 161 typedef int (*overlay_plugin_walk_f)(overlay_plugin_t *, void *);
161 162 extern void overlay_plugin_walk(overlay_plugin_walk_f, void *);
162 163
163 164 extern void overlay_io_start(overlay_dev_t *, overlay_dev_flag_t);
164 165 extern void overlay_io_done(overlay_dev_t *, overlay_dev_flag_t);
165 166
166 167 extern void overlay_mux_init(void);
167 168 extern void overlay_mux_fini(void);
168 169
169 170 extern overlay_mux_t *overlay_mux_open(overlay_plugin_t *, int, int, int,
170 171 struct sockaddr *, socklen_t, int *);
171 172 extern void overlay_mux_close(overlay_mux_t *);
172 173 extern void overlay_mux_add_dev(overlay_mux_t *, overlay_dev_t *);
173 174 extern void overlay_mux_remove_dev(overlay_mux_t *, overlay_dev_t *);
174 175 extern int overlay_mux_tx(overlay_mux_t *, struct msghdr *, mblk_t *);
175 176
176 177 extern void overlay_prop_init(overlay_prop_handle_t);
177 178
178 179 extern void overlay_target_init(void);
179 180 extern int overlay_target_busy(void);
180 181 extern int overlay_target_open(dev_t *, int, int, cred_t *);
181 182 extern int overlay_target_ioctl(dev_t, int, intptr_t, int, cred_t *, int *);
182 183 extern int overlay_target_close(dev_t, int, int, cred_t *);
183 184 extern void overlay_target_free(overlay_dev_t *);
184 185
185 186 #define OVERLAY_TARGET_OK 0
186 187 #define OVERLAY_TARGET_DROP 1
187 188 #define OVERLAY_TARGET_ASYNC 2
188 189 extern int overlay_target_lookup(overlay_dev_t *, mblk_t *, struct sockaddr *,
189 190 socklen_t *);
190 191 extern void overlay_target_quiesce(overlay_target_t *);
191 192 extern void overlay_target_fini(void);
192 193
193 194 extern void overlay_fm_init(void);
194 195 extern void overlay_fm_fini(void);
195 196 extern void overlay_fm_degrade(overlay_dev_t *, const char *);
196 197 extern void overlay_fm_restore(overlay_dev_t *);
197 198
198 199 extern overlay_dev_t *overlay_hold_by_dlid(datalink_id_t);
199 200 extern void overlay_hold_rele(overlay_dev_t *);
200 201
201 202 #ifdef __cplusplus
202 203 }
203 204 #endif
204 205
205 206 #endif /* _SYS_OVERLAY_IMPL_H */
|
↓ open down ↓ |
95 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX