Print this page
XXXX introduce drv_sectohz
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/ib/mgt/ibdm/ibdm_impl.h
+++ new/usr/src/uts/common/sys/ib/mgt/ibdm/ibdm_impl.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.
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 25
26 26 #ifndef _SYS_IB_MGT_IBDM_IBDM_IMPL_H
27 27 #define _SYS_IB_MGT_IBDM_IBDM_IMPL_H
28 28
29 29 /*
30 30 * ibdm_impl.h
31 31 *
32 32 * This file contains definitions of the data structures, macros etc
33 33 * related to the IBDM module.
34 34 */
35 35
36 36 #include <sys/ib/mgt/ibdm/ibdm_ibnex.h>
37 37 #include <sys/ib/ibtl/impl/ibtl_util.h>
38 38
39 39 #ifdef __cplusplus
40 40 extern "C" {
41 41 #endif
42 42
43 43 /* values for "cb_req_type" */
44 44 #define IBDM_REQ_TYPE_INVALID 0x0
45 45 #define IBDM_REQ_TYPE_CLASSPORTINFO 0x1
46 46 #define IBDM_REQ_TYPE_IOUINFO 0x2
47 47 #define IBDM_REQ_TYPE_IOCINFO 0x4
48 48 #define IBDM_REQ_TYPE_SRVENTS 0x8
49 49 #define IBDM_REQ_TYPE_IOU_DIAGCODE 0x10
50 50 #define IBDM_REQ_TYPE_IOC_DIAGCODE 0x20
51 51
52 52 typedef struct ibdm_taskq_args_s {
53 53 ibmf_handle_t tq_ibmf_handle;
54 54 ibmf_msg_t *tq_ibmf_msg;
55 55 void *tq_args;
56 56 } ibdm_taskq_args_t;
57 57 _NOTE(SCHEME_PROTECTS_DATA("unique per call", ibdm_taskq_args_t))
58 58 _NOTE(SCHEME_PROTECTS_DATA("unique per call", ib_mad_hdr_t))
59 59 _NOTE(SCHEME_PROTECTS_DATA("unique per call", ibmf_msg_t))
60 60
61 61 #define IBDM_GID_PRESENT 0x1
62 62 #define IBDM_GID_NOT_PRESENT 0x0
63 63
64 64 #define IBDM_IBMF_PKT_DUP_RESP 0x1
65 65 #define IBDM_IBMF_PKT_REUSED 0x2
66 66 #define IBDM_IBMF_PKT_UNEXP_RESP 0x4
67 67
68 68 #define IBDM_MAX_SERV_ENTRIES_PER_REQ 4
69 69
70 70 typedef struct ibdm_gid_s {
71 71 uint64_t gid_dgid_hi;
72 72 uint64_t gid_dgid_lo;
73 73 struct ibdm_gid_s *gid_next;
74 74 } ibdm_gid_t;
75 75
76 76 #define IBDM_GID_PROBE_NOT_DONE 0x00
77 77 #define IBDM_GET_CLASSPORTINFO 0x01
78 78 #define IBDM_GET_IOUNITINFO 0x02
79 79 #define IBDM_GET_IOC_DETAILS 0x04
80 80 #define IBDM_GID_PROBING_COMPLETE 0x08
81 81 #define IBDM_GID_PROBING_SKIPPED 0x10
82 82 #define IBDM_GID_PROBING_FAILED 0x20
83 83 #define IBDM_SET_CLASSPORTINFO 0x40
84 84
85 85 /*
86 86 * Identifiers to distinguish a Cisco FC GW from others.
87 87 * Used to filter a setclassportinfo request.
88 88 */
89 89 #define IBDM_CISCO_COMPANY_ID (0x5ad)
90 90 #define IBDM_CISCO_DEVICE_ID (0xa87c)
91 91
92 92 /*
93 93 * the bit-shift value for OUI in GUID
94 94 * A 64 bit globally unique identifier (GUID) composed of a 24 bit company id
95 95 * and an 48 bit extension identifier, and this value is used to extract
96 96 * the company id from the GUID.
97 97 */
98 98 #define IBDM_OUI_GUID_SHIFT (40)
99 99
100 100 /*
101 101 * The state diagram for the gl_state
102 102 *
103 103 * (in case of Cisco FC GW)
104 104 * IBDM_GID_PROBE_NOT_DONE ---------- 40 -> IBDM_SET_CLASSPORTINFO
105 105 * ----. |
106 106 * | | | (others) |
107 107 * | | 1 |
108 108 * | | | 1
109 109 * | | `-------------. |
110 110 * | | v v
111 111 * | | IBDM_GET_CLASSPORTINFO
112 112 * | |
113 113 * | | |
114 114 * | 2 3
115 115 * | | |
116 116 * | v v
117 117 * | IBDM_GID_PROBING_FAILED IBDM_GET_IOUNITINFO
118 118 * | |
119 119 * 6 4
120 120 * | |
121 121 * v v
122 122 * IBDM_GID_PROBING_SKIPPLED IBDM_GET_IOC_DETAILS
123 123 * |
124 124 * 5
125 125 * |
126 126 * v
127 127 * IBDM_GID_PROBE_COMPLETE
128 128 *
129 129 * Initial state : IBDM_GID_PROBE_NOT_DONE
130 130 * 40 = Port sends setClassPortInfo to activate Cisco FC GW
131 131 * 1 = Port supports DM MAD's and a request to ClassportInfo is sent
132 132 * 3 = Received ClassPortInfo and sent IOUnitInfo
133 133 * 4 = Recevied IOUunitInfo and sent IOC profile, diagcodes, and
134 134 * service entries requests
135 135 * 5 = Received all the IOC information
136 136 * 2 = Failed to probe the GID
137 137 * Port does not support DM MAD's
138 138 * Port did not respond property
139 139 * 6 = A different GID for the same port, skip the probe
140 140 *
141 141 * Reprobe state transition :
142 142 *
143 143 * IBDM_GID_PROBE_COMPLETE
144 144 * |
145 145 * 7
146 146 * |
147 147 * v
148 148 * IBDM_GET_IOC_DETAILS
149 149 * |
150 150 * 8
151 151 * |
152 152 * v
153 153 * IBDM_GID_PROBE_COMPLETE
154 154 *
155 155 * 7 = Reprobe request for one or more IOCs initiated.
156 156 * 8 = Reprobe done(IOC COntroller Profile & Service entries)
157 157 */
158 158
159 159 typedef struct ibdm_dp_gidinfo_s {
160 160 kmutex_t gl_mutex;
161 161 uint_t gl_state;
162 162 int gl_reprobe_flag; /* pass this to taskq */
163 163 struct ibdm_dp_gidinfo_s *gl_next;
164 164 struct ibdm_dp_gidinfo_s *gl_prev;
165 165 ibdm_iou_info_t *gl_iou;
166 166 int gl_pending_cmds;
167 167 ibmf_qp_handle_t gl_qp_hdl;
168 168 uint64_t gl_transactionID;
169 169 ibdm_timeout_cb_args_t gl_iou_cb_args;
170 170 ib_lid_t gl_dlid;
171 171 ib_lid_t gl_slid;
172 172 uint64_t gl_dgid_hi;
173 173 uint64_t gl_dgid_lo;
174 174 uint64_t gl_sgid_hi;
175 175 uint64_t gl_sgid_lo;
176 176 ib_guid_t gl_nodeguid;
177 177 ib_guid_t gl_portguid;
178 178 ib_pkey_t gl_p_key;
179 179 boolean_t gl_is_dm_capable;
180 180 boolean_t gl_redirected;
181 181 uint32_t gl_redirect_dlid;
182 182 uint32_t gl_redirect_QP;
183 183 ib_pkey_t gl_redirect_pkey;
184 184 ib_qkey_t gl_redirect_qkey;
185 185 uint64_t gl_redirectGID_hi;
186 186 uint64_t gl_redirectGID_lo;
187 187 ibmf_handle_t gl_ibmf_hdl;
188 188 ibmf_saa_handle_t gl_sa_hdl;
189 189 timeout_id_t gl_timeout_id;
190 190 ibdm_timeout_cb_args_t gl_cpi_cb_args;
191 191 uint32_t gl_ngids;
192 192 ibdm_gid_t *gl_gid;
193 193 uint32_t gl_resp_timeout;
194 194 int gl_num_iocs;
195 195 ibdm_hca_list_t *gl_hca_list;
196 196 int gl_disconnected;
197 197 uint64_t gl_min_transactionID;
198 198 uint64_t gl_max_transactionID;
199 199 ibdm_iou_info_t *gl_prev_iou;
200 200 uint16_t gl_devid; /* device ID info */
201 201 kcondvar_t gl_probe_cv; /* sync for Cisco FC GW */
202 202 uint32_t gl_flag;
203 203 uint8_t gl_SL:4; /* SL from path_record */
204 204 uint8_t gl_redirectSL:4; /* SL from redirection */
205 205 } ibdm_dp_gidinfo_t;
206 206 _NOTE(MUTEX_PROTECTS_DATA(ibdm_dp_gidinfo_s::gl_mutex,
207 207 ibdm_dp_gidinfo_s::{gl_state gl_timeout_id gl_pending_cmds}))
208 208 _NOTE(SCHEME_PROTECTS_DATA("Serialized access by cv", ibdm_dp_gidinfo_s))
209 209 _NOTE(DATA_READABLE_WITHOUT_LOCK(ibdm_dp_gidinfo_s::{gl_ibmf_hdl gl_sa_hdl}))
210 210 _NOTE(MUTEX_PROTECTS_DATA(ibdm_dp_gidinfo_s::gl_mutex,
211 211 ibdm_ioc_info_s::{ioc_timeout_id ioc_dc_timeout_id}))
212 212 _NOTE(MUTEX_PROTECTS_DATA(ibdm_dp_gidinfo_s::gl_mutex,
213 213 ibdm_srvents_info_s::se_timeout_id))
214 214
215 215 /*
216 216 * The transaction ID for the GID contains of two parts :
217 217 * 1. Upper 32 bits which is unique for each GID.
218 218 * 2. Lower 32 bits which is unique for each MAD.
219 219 * The assumptions are :
220 220 * 1. At most 2 power 32 DM capable GIDs on the IB fabric
221 221 * 2. IBDM sends maximum of 2 power 32 MADs to the same DM GID
222 222 * The limits are sufficient for practical configurations.
223 223 */
224 224 #define IBDM_GID_TRANSACTIONID_SHIFT ((ulong_t)32)
225 225 #define IBDM_GID_TRANSACTIONID_MASK 0xFFFFFFFF00000000ULL
226 226
227 227 typedef struct ibdm_s {
228 228 /* Protects IBDM's critical data */
229 229 kmutex_t ibdm_mutex;
230 230 uint32_t ibdm_hca_count;
231 231 kmutex_t ibdm_hl_mutex;
232 232 kmutex_t ibdm_ibnex_mutex;
233 233 ibdm_hca_list_t *ibdm_hca_list_head;
234 234 ibdm_hca_list_t *ibdm_hca_list_tail;
235 235
236 236 ibdm_dp_gidinfo_t *ibdm_dp_gidlist_head;
237 237 ibdm_dp_gidinfo_t *ibdm_dp_gidlist_tail;
238 238
239 239 kcondvar_t ibdm_probe_cv;
240 240 kcondvar_t ibdm_busy_cv;
241 241 kcondvar_t ibdm_port_settle_cv;
242 242 uint32_t ibdm_ngid_probes_in_progress;
243 243 uint64_t ibdm_transactionID;
244 244 uint32_t ibdm_ngids;
245 245 uint32_t ibdm_busy;
246 246 int ibdm_state;
247 247 ibt_clnt_hdl_t ibdm_ibt_clnt_hdl;
248 248
249 249 /*
250 250 * These are callback routines registered by the IB nexus driver.
251 251 * These callbacks are used to inform the IB nexus driver about
252 252 * the arrival/removal of HCA and IOC's
253 253 */
254 254 ibdm_callback_t ibdm_ibnex_callback;
255 255
256 256 /* Flag indicating - prev_iou during sweep */
257 257 int ibdm_prev_iou;
258 258 } ibdm_t;
259 259 _NOTE(MUTEX_PROTECTS_DATA(ibdm_s::ibdm_mutex, ibdm_s::{ibdm_ibt_clnt_hdl
260 260 ibdm_busy ibdm_state}))
261 261 _NOTE(DATA_READABLE_WITHOUT_LOCK(ibdm_s::ibdm_ibt_clnt_hdl))
262 262 _NOTE(MUTEX_PROTECTS_DATA(ibdm_s::ibdm_hl_mutex,
263 263 ibdm_s::{ibdm_hca_list_head ibdm_hca_list_tail}))
264 264 _NOTE(MUTEX_PROTECTS_DATA(ibdm_s::ibdm_ibnex_mutex,
265 265 ibdm_s::ibdm_ibnex_callback))
266 266 _NOTE(SCHEME_PROTECTS_DATA("Serialized access by cv", ibdm_s))
267 267 _NOTE(LOCK_ORDER(ibdm_s::ibdm_mutex ibdm_dp_gidinfo_s::gl_mutex))
268 268
269 269 /* valid values for ibdm_state */
270 270 #define IBDM_LOCKS_ALLOCED 0x01 /* global locks alloced */
271 271 #define IBDM_CVS_ALLOCED 0x02 /* global "cv"s alloced */
272 272 #define IBDM_IBT_ATTACHED 0x04 /* ibt_attach() called */
273 273 #define IBDM_HCA_ATTACHED 0x08 /* ibdm_handle_hca() called */
274 274
275 275 #define IBDM_8_BIT_MASK 0x00FF
276 276 #define IBDM_16_BIT_MASK 0xFFFF
277 277 #define IBDM_RETRY_COUNT 0x2
278 278
279 279 #define IBDM_BUSY 0x1
280 280 #define IBDM_PROBE_IN_PROGRESS 0x2
281 281 #define IBDM_CISCO_PROBE 0x4
282 282 #define IBDM_CISCO_PROBE_DONE 0x8
283 283
284 284 /*
285 285 * Device Management MAD packet format
286 286 * +--------+------------+------------+------------+------------+
287 287 * | offset | byte 0 | byte 1 | byte 2 | byte 3 |
288 288 * +--------+------------+------------+------------+------------+ --
289 289 * | 0 | | ^
290 290 * +--------+ | sizeof(
291 291 * | ... | Common MAD Header | ib_mad_hdr_t)
292 292 * +--------+ | | (A)
293 293 * | 20 | | v
294 294 * +--------+------------+------------+------------+------------+ --
295 295 * | 24 | | ^
296 296 * +--------+ | |
297 297 * | ... | RMPP Header | |
298 298 * +--------+ | |
299 299 * | 32 | | |
300 300 * +--------+------------+------------+------------+------------+ |
301 301 * | 36 | | |
302 302 * +--------+ Access_Key |
303 303 * | 40 | | IBDM_DM_MAD_
304 304 * +--------+------------+------------+------------+------------+ HDR_SZ
305 305 * | 44 | KeyType | reserved | (B)
306 306 * +--------+------------+------------+------------+------------+ |
307 307 * | 48 | | |
308 308 * +--------+ | |
309 309 * | 52 | Reserved | |
310 310 * +--------+ | |
311 311 * | 56 | | |
312 312 * +--------+------------+------------+------------+------------+ |
313 313 * | 60 | Change_ID | ComponentMask | v
314 314 * +--------+------------+------------+------------+------------+ --
315 315 * | 64 | | ^
316 316 * +--------+ | IBDM_MAD_SIZE
317 317 * | ... | Device Management Data | - (A) - (B)
318 318 * +--------+ | |
319 319 * | 252 | | v
320 320 * +--------+------------+------------+------------+------------+ --
321 321 */
322 322 #define IBDM_MAD_SIZE 256
323 323 #define IBDM_DM_MAD_HDR_SZ 40
324 324
325 325 #define IBDM_DFT_TIMEOUT 4
326 326 #define IBDM_DFT_NRETRIES 3
327 327
↓ open down ↓ |
327 lines elided |
↑ open up ↑ |
328 328 #define IBDM_ENABLE_TASKQ_HANDLING 1
329 329 #define IBDM_DISABLE_TASKQ_HANLDING 0
330 330
331 331 typedef struct ibdm_saa_event_arg_s {
332 332 ibmf_saa_handle_t ibmf_saa_handle;
333 333 ibmf_saa_subnet_event_t ibmf_saa_event;
334 334 ibmf_saa_event_details_t event_details;
335 335 void *callback_arg;
336 336 } ibdm_saa_event_arg_t;
337 337
338 -#define IBDM_TIMEOUT_VALUE(t) (drv_usectohz(t * 1000000))
338 +#define IBDM_TIMEOUT_VALUE(t) drv_sectohz(t)
339 339
340 340 #define IBDM_OUT_IBMFMSG_MADHDR(msg)\
341 341 (msg->im_msgbufs_send.im_bufs_mad_hdr)
342 342
343 343 #define IBDM_IN_IBMFMSG_MADHDR(msg)\
344 344 (msg->im_msgbufs_recv.im_bufs_mad_hdr)
345 345
346 346 #define IBDM_IN_IBMFMSG_STATUS(msg)\
347 347 b2h16(msg->im_msgbufs_recv.im_bufs_mad_hdr->Status)
348 348
349 349 #define IBDM_IN_IBMFMSG_ATTR(msg)\
350 350 b2h16(msg->im_msgbufs_recv.im_bufs_mad_hdr->AttributeID)
351 351
352 352 #define IBDM_IN_IBMFMSG_ATTRMOD(msg)\
353 353 b2h32(msg->im_msgbufs_recv.im_bufs_mad_hdr->AttributeModifier)
354 354
355 355 #define IBDM_IN_IBMFMSG2IOU(msg) (ib_dm_io_unitinfo_t *)\
356 356 (msg->im_msgbufs_recv.im_bufs_cl_data)
357 357
358 358 #define IBDM_IN_IBMFMSG2IOC(msg) (ib_dm_ioc_ctrl_profile_t *)\
359 359 (msg->im_msgbufs_recv.im_bufs_cl_data)
360 360
361 361 #define IBDM_IN_IBMFMSG2SRVENT(msg) (ib_dm_srv_t *)\
362 362 (msg->im_msgbufs_recv.im_bufs_cl_data)
363 363
364 364 #define IBDM_IN_IBMFMSG2DIAGCODE(msg) (uint32_t *)\
365 365 (msg->im_msgbufs_recv.im_bufs_cl_data)
366 366
367 367 #define IBDM_GIDINFO2IOCINFO(gid_info, idx) \
368 368 (ibdm_ioc_info_t *)&gid_info->gl_iou->iou_ioc_info[idx];
369 369
370 370 #define IBDM_IS_IOC_NUM_INVALID(ioc_no, gid_info)\
371 371 ((ioc_no < 1) || (ioc_no >\
372 372 gid_info->gl_iou->iou_info.iou_num_ctrl_slots))
373 373
374 374 #define IBDM_INVALID_PKEY(pkey) \
375 375 (((pkey) == IB_PKEY_INVALID_FULL) || \
376 376 ((pkey) == IB_PKEY_INVALID_LIMITED))
377 377
378 378 #ifdef DEBUG
379 379
380 380 void ibdm_dump_mad_hdr(ib_mad_hdr_t *);
381 381 void ibdm_dump_ibmf_msg(ibmf_msg_t *, int);
382 382 void ibdm_dump_path_info(sa_path_record_t *);
383 383 void ibdm_dump_classportinfo(ib_mad_classportinfo_t *);
384 384 void ibdm_dump_iounitinfo(ib_dm_io_unitinfo_t *);
385 385 void ibdm_dump_ioc_profile(ib_dm_ioc_ctrl_profile_t *);
386 386 void ibdm_dump_service_entries(ib_dm_srv_t *);
387 387 void ibdm_dump_sweep_fabric_timestamp(int);
388 388
389 389 #define ibdm_dump_mad_hdr(a) ibdm_dump_mad_hdr(a)
390 390 #define ibdm_dump_ibmf_msg(a, b) ibdm_dump_ibmf_msg(a, b)
391 391 #define ibdm_dump_path_info(a) ibdm_dump_path_info(a)
392 392 #define ibdm_dump_classportinfo(a) ibdm_dump_classportinfo(a)
393 393 #define ibdm_dump_iounitinfo(a) ibdm_dump_iounitinfo(a)
394 394 #define ibdm_dump_ioc_profile(a) ibdm_dump_ioc_profile(a)
395 395 #define ibdm_dump_service_entries(a) ibdm_dump_service_entries(a)
396 396
397 397 #else
398 398
399 399 #define ibdm_dump_mad_hdr(a)
400 400 #define ibdm_dump_ibmf_msg(a, b)
401 401 #define ibdm_dump_path_info(a)
402 402 #define ibdm_dump_classportinfo(a)
403 403 #define ibdm_dump_iounitinfo(a)
404 404 #define ibdm_dump_ioc_profile(a)
405 405 #define ibdm_dump_service_entries(a)
406 406 #define ibdm_dump_sweep_fabric_timestamp(a)
407 407
408 408 #endif
409 409
410 410 #ifdef __cplusplus
411 411 }
412 412 #endif
413 413
414 414 #endif /* _SYS_IB_MGT_IBDM_IBDM_IMPL_H */
↓ open down ↓ |
66 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX