Print this page
4777 ibdm shouldn't abuse ddi_get_time(9f)
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Albert Lee <albert.lee@nexenta.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/ib/mgt/ibdm/ibdm_ibnex.h
+++ new/usr/src/uts/common/sys/ib/mgt/ibdm/ibdm_ibnex.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 +/*
26 + * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
27 + */
25 28
26 29 #ifndef _SYS_IB_MGT_IBDM_IBDM_IBNEX_H
27 30 #define _SYS_IB_MGT_IBDM_IBDM_IBNEX_H
28 31
29 32 /*
30 33 * This file contains the definitions of private interfaces
31 34 * and data structures used between IB nexus and IBDM.
32 35 */
33 36
34 37 #include <sys/ib/ibtl/ibti_common.h>
35 38 #include <sys/ib/mgt/ibmf/ibmf.h>
36 39 #include <sys/ib/mgt/ib_dm_attr.h>
37 40
38 41 #ifdef __cplusplus
39 42 extern "C" {
40 43 #endif
41 44
42 45 /* DM return status codes from private interfaces */
43 46 typedef enum ibdm_status_e {
44 47 IBDM_SUCCESS = 0,
45 48 IBDM_FAILURE = 1
46 49 } ibdm_status_t;
47 50
48 51 /*
49 52 * IBDM events that are passed to IB nexus driver
50 53 * NOTE: These are different from ibt_async_code_t
51 54 */
52 55 typedef enum ibdm_events_e {
53 56 IBDM_EVENT_HCA_ADDED,
54 57 IBDM_EVENT_HCA_REMOVED,
55 58 IBDM_EVENT_IOC_PROP_UPDATE,
56 59 IBDM_EVENT_PORT_UP,
57 60 IBDM_EVENT_PORT_PKEY_CHANGE
58 61 } ibdm_events_t;
59 62
60 63 /*
61 64 * Flags for ibdm_ibnex_get_ioc_list.
62 65 * The flags determine the functioning of ibdm_ibnex_get_ioc_list.
63 66 *
64 67 * IBDM_IBNEX_NORMAL_PROBE
65 68 * Sweep fabric and discover new GIDs only
66 69 * This value should be same as IBNEX_PROBE_ALLOWED_FLAG
67 70 * IBDM_IBNEX_DONOT_PROBE
68 71 * Do not probe, just get the current ioc_list.
69 72 * This value should be same as IBNEX_DONOT_PROBE_FLAG
70 73 * IBDM_IBNEX_REPROBE_ALL
71 74 * Sweep fabric, discover new GIDs. For GIDs
72 75 * discovered before, reprobe the IOCs on it.
73 76 */
74 77 typedef enum ibdm_ibnex_get_ioclist_mtd_e {
75 78 IBDM_IBNEX_NORMAL_PROBE,
76 79 IBDM_IBNEX_DONOT_PROBE,
77 80 IBDM_IBNEX_REPROBE_ALL
78 81 } ibdm_ibnex_get_ioclist_mtd_t;
79 82
80 83
81 84 /*
82 85 * Private data structure called from IBDM timeout handler
83 86 */
84 87 typedef struct ibdm_timeout_cb_args_s {
85 88 struct ibdm_dp_gidinfo_s *cb_gid_info;
86 89 int cb_req_type;
87 90 int cb_ioc_num; /* IOC# */
88 91 int cb_retry_count;
89 92 int cb_srvents_start;
90 93 int cb_srvents_end;
91 94 } ibdm_timeout_cb_args_t;
92 95
93 96 /*
94 97 * Service entry structure
95 98 */
96 99 typedef struct ibdm_srvents_info_s {
97 100 int se_state;
98 101 ib_dm_srv_t se_attr;
99 102 timeout_id_t se_timeout_id; /* IBDM specific */
100 103 ibdm_timeout_cb_args_t se_cb_args;
101 104 } ibdm_srvents_info_t;
102 105
103 106 /* values for "se_state" */
104 107 #define IBDM_SE_VALID 0x1
105 108 #define IBDM_SE_INVALID 0x0
106 109
107 110
108 111 /* I/O Controller information */
109 112 typedef struct ibdm_ioc_info_s {
110 113 ib_dm_ioc_ctrl_profile_t ioc_profile;
111 114 int ioc_state;
112 115 ibdm_srvents_info_t *ioc_serv;
113 116 struct ibdm_gid_s *ioc_gid_list;
114 117 uint_t ioc_nportgids;
115 118 ib_guid_t ioc_iou_guid;
116 119 timeout_id_t ioc_timeout_id;
117 120 timeout_id_t ioc_dc_timeout_id;
118 121 boolean_t ioc_dc_valid;
119 122 boolean_t ioc_iou_dc_valid;
120 123 ibdm_timeout_cb_args_t ioc_cb_args;
121 124 ibdm_timeout_cb_args_t ioc_dc_cb_args;
122 125 ib_guid_t ioc_nodeguid;
123 126 uint16_t ioc_diagcode;
124 127 uint16_t ioc_iou_diagcode;
125 128 uint16_t ioc_diagdeviceid;
126 129 struct ibdm_iou_info_s *ioc_iou_info;
127 130 struct ibdm_ioc_info_s *ioc_next;
128 131
129 132 /* Previous fields for reprobe */
130 133 ibdm_srvents_info_t *ioc_prev_serv;
131 134 struct ibdm_gid_s *ioc_prev_gid_list;
132 135 uint8_t ioc_prev_serv_cnt;
133 136 uint_t ioc_prev_nportgids;
134 137
135 138 /* Flag indicating which IOC info has changed */
136 139 ibt_prop_update_payload_t ioc_info_updated;
137 140
138 141 /*
139 142 * List of HCAs through which IOC is accessible
140 143 * This field will be initialized in ibdm_ibnex_probe_ioc
141 144 * and ibdm_get_ioc_list for all IOCs in the fabric.
142 145 *
143 146 * HCAs could have been added or deleted from the list,
144 147 * on calls to ibdm_ibnex_get_ioc_list & ibdm_ibnex_probe_ioc.
145 148 *
146 149 * Updates to HCAs in the list will be reported by
147 150 * IBDM_EVENT_HCA_DOWN and IBDM_EVENT_IOC_HCA_UNREACHABLE events
148 151 * in the IBDM<->IBDM callback.
149 152 *
150 153 * IOC not visible to the host system(because all HCAs cannot
151 154 * reach the IOC) will be reported in the same manner as TCA
152 155 * ports getting to 0 (using IOC_PROP_UPDATE event).
153 156 */
154 157 struct ibdm_hca_list_s *ioc_hca_list;
155 158
156 159 } ibdm_ioc_info_t;
157 160 _NOTE(SCHEME_PROTECTS_DATA("Serialized access by cv",
158 161 ibdm_ioc_info_s::ioc_next))
159 162 _NOTE(SCHEME_PROTECTS_DATA("Unique per copy of ibdm_ioc_info_t",
160 163 ibdm_ioc_info_s::ioc_info_updated))
161 164 _NOTE(DATA_READABLE_WITHOUT_LOCK(ibdm_ioc_info_s::ioc_dc_valid))
162 165
163 166 /* values for "ioc_state */
164 167 #define IBDM_IOC_STATE_PROBE_SUCCESS 0x0
165 168 #define IBDM_IOC_STATE_PROBE_INVALID 0x1
166 169 #define IBDM_IOC_STATE_PROBE_FAILED 0x2
167 170 #define IBDM_IOC_STATE_REPROBE_PROGRESS 0x4
168 171
169 172 /* I/O Unit Information */
170 173 typedef struct ibdm_iou_info_s {
171 174 ib_dm_io_unitinfo_t iou_info;
172 175 ibdm_ioc_info_t *iou_ioc_info;
173 176 ib_guid_t iou_guid;
174 177 boolean_t iou_dc_valid;
175 178 uint16_t iou_diagcode;
176 179 int iou_niocs_probe_in_progress;
177 180 } ibdm_iou_info_t;
178 181
179 182
180 183 /* P_Key table related info */
181 184 typedef struct ibdm_pkey_tbl_s {
182 185 ib_pkey_t pt_pkey; /* P_Key value */
183 186 ibmf_qp_handle_t pt_qp_hdl; /* QP handle */
184 187 } ibdm_pkey_tbl_t;
185 188 _NOTE(SCHEME_PROTECTS_DATA("Serialized access by cv", ibdm_pkey_tbl_s))
186 189
187 190
188 191 /*
189 192 * Port Attributes structure
190 193 */
191 194 typedef struct ibdm_port_attr_s {
192 195 ibdm_pkey_tbl_t *pa_pkey_tbl;
193 196 ib_guid_t pa_hca_guid;
194 197 ib_guid_t pa_port_guid;
195 198 uint16_t pa_npkeys;
196 199 ibmf_handle_t pa_ibmf_hdl;
197 200 ib_sn_prefix_t pa_sn_prefix;
198 201 uint16_t pa_port_num;
199 202 uint32_t pa_vendorid;
200 203 uint32_t pa_productid;
201 204 uint32_t pa_dev_version;
202 205 ibt_port_state_t pa_state;
203 206 ibmf_saa_handle_t pa_sa_hdl;
204 207 ibmf_impl_caps_t pa_ibmf_caps;
205 208 ibt_hca_hdl_t pa_hca_hdl;
206 209 } ibdm_port_attr_t;
207 210 _NOTE(SCHEME_PROTECTS_DATA("Serialized access by cv", ibdm_port_attr_s))
↓ open down ↓ |
173 lines elided |
↑ open up ↑ |
208 211
209 212 /*
210 213 * HCA list structure.
211 214 */
212 215 typedef struct ibdm_hca_list_s {
213 216 ibdm_port_attr_t *hl_port_attr; /* port attributes */
214 217 struct ibdm_hca_list_s *hl_next; /* ptr to next list */
215 218 ib_guid_t hl_hca_guid; /* HCA GUID */
216 219 uint32_t hl_nports; /* #ports of this HCA */
217 220 uint32_t hl_nports_active; /* #ports active */
218 - time_t hl_attach_time; /* attach time */
221 + hrtime_t hl_attach_time; /* attach time */
219 222 ibt_hca_hdl_t hl_hca_hdl; /* HCA handle */
220 223 ibdm_port_attr_t *hl_hca_port_attr; /* Dummy Port Attr */
221 224 /* for HCA node */
222 225 } ibdm_hca_list_t;
223 226 _NOTE(SCHEME_PROTECTS_DATA("Serialized access by cv", ibdm_hca_list_s))
224 227
225 228 /*
226 229 * The DM callback definitions
227 230 *
228 231 * ibdm_callback_t
229 232 * Pointer to DM callback function
230 233 * IBDM notifies IB nexus of ibdm_event_t using this callback.
231 234 * Arguments
232 235 * arg : The value of "arg" depends on the "event"
233 236 * IBDM_EVENT_CREATE_HCA_NODE (pointer to HCA GUID)
234 237 * IBDM_EVENT_REMOVE_HCA_NODE (pointer to HCA GUID)
235 238 * IBDM_EVENT_IOC_PROP_UPDATE (ibdm_ioc_info_t *)
236 239 *
237 240 * event : ibdm_event_t values
238 241 *
239 242 * Returns : None
240 243 *
241 244 */
242 245 typedef void (*ibdm_callback_t)(void *arg, ibdm_events_t event);
243 246
244 247
245 248 /*
246 249 * DM interface functions
247 250 */
248 251
249 252 /*
250 253 * ibdm_ibnex_register_callback
251 254 * Register the IB nexus IBDM callback routine
252 255 *
253 256 * Arguments : IB nexus IBDM callback routine
254 257 * Return Values : None
255 258 */
256 259 void ibdm_ibnex_register_callback(ibdm_callback_t cb);
257 260
258 261 /*
259 262 * ibdm_ibnex_unregister_callback
260 263 * Unregister IB nexus DM callback with IBDM
261 264 *
262 265 * Arguments : None
263 266 * Return Values : None
264 267 */
265 268 void ibdm_ibnex_unregister_callback();
266 269
267 270
268 271 /*
269 272 * PORT devices handling interfaces.
270 273 *
271 274 * ibdm_ibnex_probe_hcaport
272 275 * Probes the HCA port. If found, returns the port attributes.
273 276 * Caller is responsible for freeing the memory for the port
274 277 * attribute structure by calling ibdm_ibnex_free_port_attr()
275 278 *
276 279 * Arguments : GUID of the HCA and port number
277 280 * Return Values : ibdm_port_attr_t on SUCCESS, NULL on FAILURE.
278 281 */
279 282 ibdm_port_attr_t *ibdm_ibnex_probe_hcaport(ib_guid_t, uint8_t);
280 283
281 284 /*
282 285 * ibdm_ibnex_get_port_attrs
283 286 * Scans the HCA ports for a matching port_guid. If found,
284 287 * returns the port attributes.
285 288 * Caller is responsible for freeing the memory for the port
286 289 * attribute structure by calling ibdm_ibnex_free_port_attr()
287 290 *
288 291 * Arguments : GUID of the port
289 292 * Return Values : ibdm_port_attr_t on SUCCESS, NULL on FAILURE.
290 293 */
291 294 ibdm_port_attr_t *ibdm_ibnex_get_port_attrs(ib_guid_t);
292 295
293 296 /*
294 297 * ibdm_ibnex_free_port_attr()
295 298 * Deallocates the memory from ibnex_get_dip_from_port_guid() and
296 299 * ibdm_ibnex_get_port_attrs() functions.
297 300 */
298 301 void ibdm_ibnex_free_port_attr(ibdm_port_attr_t *);
299 302
300 303
301 304 /*
302 305 * IOC devices handling interfaces.
303 306 *
304 307 * ibdm_ibnex_probe_ioc
305 308 * Probes the IOC device on the fabric. If found, allocates and
306 309 * returns pointer to the ibdm_ioc_info_t. Caller is responsible
307 310 * to free the memory for the ioc attribute structure by calling
308 311 * ibdm_ibnex_free_ioc_list.
309 312 *
310 313 * Arguments :
311 314 * GUID of the IOU and GUID of the IOC
312 315 * reprobe_flag - Set if IOC information has to be reprobed.
313 316 * Return Values : ibdm_ioc_info_t on SUCCESS, NULL on FAILURE.
314 317 */
315 318 ibdm_ioc_info_t *ibdm_ibnex_probe_ioc(ib_guid_t iou_guid, ib_guid_t ioc_guid,
316 319 int reprobe_flag);
317 320
318 321 /*
319 322 * ibdm_ibnex_get_ioc_count
320 323 * Returns number of IOCs currently discovered in the fabric.
321 324 * Arguments : NONE
322 325 * Return Values : number of IOCs seen
323 326 */
324 327 int ibdm_ibnex_get_ioc_count(void);
325 328
326 329 /*
327 330 * ibdm_ibnex_get_ioc_list
328 331 * Returns linked list of ibdm_ioc_info_t structures for all the
329 332 * IOCs present on the fabric. Caller is responsible for freeing
330 333 * the memory allocated for the ioc attribute structure(s) by
331 334 * calling ibdm_ibnex_free_ioc_list().
332 335 *
333 336 * Arguments : list_flag :
334 337 * Get list according to ibdm_ibnex_get_ioclist_mtd_t defination.
335 338 * Return Values : IOC list based containing "ibdm_ioc_info_t"s if
336 339 * successful, otherwise NULL.
337 340 */
338 341 ibdm_ioc_info_t *ibdm_ibnex_get_ioc_list(ibdm_ibnex_get_ioclist_mtd_t);
339 342
340 343 /*
341 344 * ibdm_ibnex_get_ioc_info
342 345 * Returns pointer ibdm_ioc_info_t structures for the request
343 346 * "ioc_guid". Caller is responsible to free the memory by
344 347 * calling ibdm_ibnex_free_ioc_list() when the return value is
345 348 * not NULL.
346 349 *
347 350 * Arguments : GUID of the IOC
348 351 * Return Values : Address of kmem_alloc'ed memory if the IOC exists,
349 352 * otherwise NULL.
350 353 */
351 354 ibdm_ioc_info_t *ibdm_ibnex_get_ioc_info(ib_guid_t ioc_guid);
352 355
353 356 /*
354 357 * ibdm_ibnex_free_ioc_list()
355 358 * Deallocates the memory from ibdm_ibnex_probe_ioc(),
356 359 * ibdm_ibnex_get_ioc_list() and ibdm_ibnex_get_ioc_info()
357 360 */
358 361 void ibdm_ibnex_free_ioc_list(ibdm_ioc_info_t *);
359 362
360 363 /*
361 364 * HCA handling interfaces.
362 365 *
363 366 * ibdm_ibnex_get_hca_list
364 367 * Returns linked list of ibdm_hca_list_t structures for all
365 368 * the HCAs present on the fabric. Caller is responsible for
366 369 * freeing the memory for the hca attribute structure(s) by
367 370 * calling ibdm_ibnex_free_hca_list().
368 371 *
369 372 * Arguments : "hca" contains pointer to pointer of ibdm_hca_list_t
370 373 * : "cnt" contains pointer to number of hca's
371 374 * Return Values : None
372 375 */
373 376 void ibdm_ibnex_get_hca_list(ibdm_hca_list_t **hca, int *cnt);
374 377
375 378 /*
376 379 * ibdm_ibnex_get_hca_info_by_guid
377 380 * Returns a linked list of ibdm_hca_list_t structure that matches the
378 381 * given argument. The caller is responsible for freeing the memory for
379 382 * the hca attribute structure by calling ibdm_ibnex_free_hca_list().
380 383 *
381 384 * Arguments : HCA GUID
382 385 * Return Values : Linked list of ibdm_hca_list_t(s)
383 386 */
384 387 ibdm_hca_list_t *ibdm_ibnex_get_hca_info_by_guid(ib_guid_t);
385 388
386 389 /*
387 390 * ibdm_ibnex_free_hca_list()
388 391 * Deallocates the memory from ibdm_ibnex_get_hca_list() and
389 392 * ibdm_ibnex_get_hca_info_by_guid() functions.
390 393 */
391 394 void ibdm_ibnex_free_hca_list(ibdm_hca_list_t *);
392 395
393 396 /*
394 397 * ibdm_ibnex_update_pkey_tbls
395 398 * Updates the DM P_Key database.
396 399 *
397 400 * Arguments : NONE
398 401 * Return Values : NONE
399 402 */
400 403 void ibdm_ibnex_update_pkey_tbls(void);
401 404
402 405 /*
403 406 * ibdm_ibnex_port_settle_wait
404 407 * Wait until the ports come up
405 408 *
406 409 * Arguments
407 410 * HCA GUID and the maximum wait time since the hca instance attach
408 411 */
409 412 void ibdm_ibnex_port_settle_wait(ib_guid_t, int);
410 413
411 414
412 415 #ifdef __cplusplus
413 416 }
414 417 #endif
415 418
416 419 #endif /* _SYS_IB_MGT_IBDM_IBDM_IBNEX_H */
↓ open down ↓ |
188 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX