]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/ofed/management/opensm/include/opensm/osm_helper.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / ofed / management / opensm / include / opensm / osm_helper.h
1 /*
2  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
3  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
4  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
5  *
6  * This software is available to you under a choice of one of two
7  * licenses.  You may choose to be licensed under the terms of the GNU
8  * General Public License (GPL) Version 2, available from the file
9  * COPYING in the main directory of this source tree, or the
10  * OpenIB.org BSD license below:
11  *
12  *     Redistribution and use in source and binary forms, with or
13  *     without modification, are permitted provided that the following
14  *     conditions are met:
15  *
16  *      - Redistributions of source code must retain the above
17  *        copyright notice, this list of conditions and the following
18  *        disclaimer.
19  *
20  *      - Redistributions in binary form must reproduce the above
21  *        copyright notice, this list of conditions and the following
22  *        disclaimer in the documentation and/or other materials
23  *        provided with the distribution.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32  * SOFTWARE.
33  *
34  */
35
36 #ifndef _OSM_HELPER_H_
37 #define _OSM_HELPER_H_
38
39 #include <iba/ib_types.h>
40 #include <complib/cl_dispatcher.h>
41 #include <opensm/osm_base.h>
42 #include <opensm/osm_log.h>
43 #include <opensm/osm_msgdef.h>
44 #include <opensm/osm_path.h>
45
46 #ifdef __cplusplus
47 #  define BEGIN_C_DECLS extern "C" {
48 #  define END_C_DECLS   }
49 #else                           /* !__cplusplus */
50 #  define BEGIN_C_DECLS
51 #  define END_C_DECLS
52 #endif                          /* __cplusplus */
53
54 BEGIN_C_DECLS
55 /*
56  * Abstract:
57  *      Declaration of helpful functions.
58  */
59 /****f* OpenSM: Helper/ib_get_sa_method_str
60  * NAME
61  *      ib_get_sa_method_str
62  *
63  * DESCRIPTION
64  *      Returns a string for the specified SA Method value.
65  *
66  * SYNOPSIS
67  */
68 const char *ib_get_sa_method_str(IN uint8_t method);
69 /*
70  * PARAMETERS
71  *      method
72  *              [in] Network order METHOD ID value.
73  *
74  * RETURN VALUES
75  *      Pointer to the method string.
76  *
77  * NOTES
78  *
79  * SEE ALSO
80  *********/
81
82 /****f* OpenSM: Helper/ib_get_sm_method_str
83 * NAME
84 *       ib_get_sm_method_str
85 *
86 * DESCRIPTION
87 *       Returns a string for the specified SM Method value.
88 *
89 * SYNOPSIS
90 */
91 const char *ib_get_sm_method_str(IN uint8_t method);
92 /*
93 * PARAMETERS
94 *       method
95 *               [in] Network order METHOD ID value.
96 *
97 * RETURN VALUES
98 *       Pointer to the method string.
99 *
100 * NOTES
101 *
102 * SEE ALSO
103 *********/
104
105 /****f* OpenSM: Helper/ib_get_sm_attr_str
106 * NAME
107 *       ib_get_sm_attr_str
108 *
109 * DESCRIPTION
110 *       Returns a string for the specified SM attribute value.
111 *
112 * SYNOPSIS
113 */
114 const char *ib_get_sm_attr_str(IN ib_net16_t attr);
115 /*
116 * PARAMETERS
117 *       attr
118 *               [in] Network order attribute ID value.
119 *
120 * RETURN VALUES
121 *       Pointer to the attribute string.
122 *
123 * NOTES
124 *
125 * SEE ALSO
126 *********/
127
128 /****f* OpenSM: Helper/ib_get_sa_attr_str
129 * NAME
130 *       ib_get_sa_attr_str
131 *
132 * DESCRIPTION
133 *       Returns a string for the specified SA attribute value.
134 *
135 * SYNOPSIS
136 */
137 const char *ib_get_sa_attr_str(IN ib_net16_t attr);
138 /*
139 * PARAMETERS
140 *       attr
141 *               [in] Network order attribute ID value.
142 *
143 * RETURN VALUES
144 *       Pointer to the attribute string.
145 *
146 * NOTES
147 *
148 * SEE ALSO
149 *********/
150
151 /****f* OpenSM: Helper/ib_get_trap_str
152 * NAME
153 *       ib_get_trap_str
154 *
155 * DESCRIPTION
156 *       Returns a name for the specified trap.
157 *
158 * SYNOPSIS
159 */
160 const char *ib_get_trap_str(uint16_t trap_num);
161 /*
162 * PARAMETERS
163 *       trap_num
164 *               [in] Network order trap number.
165 *
166 * RETURN VALUES
167 *       Name of the trap.
168 *
169 *********/
170
171 /****f* OpenSM: Helper/osm_dump_port_info
172 * NAME
173 *       osm_dump_port_info
174 *
175 * DESCRIPTION
176 *       Dumps the PortInfo attribute to the log.
177 *
178 * SYNOPSIS
179 */
180 void osm_dump_port_info(IN osm_log_t * const p_log,
181                         IN const ib_net64_t node_guid,
182                         IN const ib_net64_t port_guid,
183                         IN const uint8_t port_num,
184                         IN const ib_port_info_t * const p_pi,
185                         IN const osm_log_level_t log_level);
186 /*
187 * PARAMETERS
188 *       p_log
189 *               [in] Pointer to the osm_log_t object
190 *
191 *       node_guid
192 *               [in] Node GUID that owns this port.
193 *
194 *       port_guid
195 *               [in] Port GUID for this port.
196 *
197 *       port_num
198 *               [in] Port number for this port.
199 *
200 *       p_pi
201 *               [in] Pointer to the PortInfo attribute
202 *
203 *       log_level
204 *               [in] Log verbosity level with which to dump the data.
205 *
206 * RETURN VALUES
207 *       None.
208 *
209 * NOTES
210 *
211 * SEE ALSO
212 *********/
213
214 void
215 osm_dump_path_record(IN osm_log_t * const p_log,
216                      IN const ib_path_rec_t * const p_pr,
217                      IN const osm_log_level_t log_level);
218
219 void
220 osm_dump_multipath_record(IN osm_log_t * const p_log,
221                           IN const ib_multipath_rec_t * const p_mpr,
222                           IN const osm_log_level_t log_level);
223
224 void
225 osm_dump_node_record(IN osm_log_t * const p_log,
226                      IN const ib_node_record_t * const p_nr,
227                      IN const osm_log_level_t log_level);
228
229 void
230 osm_dump_mc_record(IN osm_log_t * const p_log,
231                    IN const ib_member_rec_t * const p_mcmr,
232                    IN const osm_log_level_t log_level);
233
234 void
235 osm_dump_link_record(IN osm_log_t * const p_log,
236                      IN const ib_link_record_t * const p_lr,
237                      IN const osm_log_level_t log_level);
238
239 void
240 osm_dump_service_record(IN osm_log_t * const p_log,
241                         IN const ib_service_record_t * const p_sr,
242                         IN const osm_log_level_t log_level);
243
244 void
245 osm_dump_portinfo_record(IN osm_log_t * const p_log,
246                          IN const ib_portinfo_record_t * const p_pir,
247                          IN const osm_log_level_t log_level);
248
249 void
250 osm_dump_guidinfo_record(IN osm_log_t * const p_log,
251                          IN const ib_guidinfo_record_t * const p_gir,
252                          IN const osm_log_level_t log_level);
253
254 void
255 osm_dump_inform_info(IN osm_log_t * const p_log,
256                      IN const ib_inform_info_t * const p_ii,
257                      IN const osm_log_level_t log_level);
258
259 void
260 osm_dump_inform_info_record(IN osm_log_t * const p_log,
261                             IN const ib_inform_info_record_t * const p_iir,
262                             IN const osm_log_level_t log_level);
263
264 void
265 osm_dump_switch_info_record(IN osm_log_t * const p_log,
266                             IN const ib_switch_info_record_t * const p_sir,
267                             IN const osm_log_level_t log_level);
268
269 void
270 osm_dump_sm_info_record(IN osm_log_t * const p_log,
271                         IN const ib_sminfo_record_t * const p_smir,
272                         IN const osm_log_level_t log_level);
273
274 void
275 osm_dump_pkey_block(IN osm_log_t * const p_log,
276                     IN uint64_t port_guid,
277                     IN uint16_t block_num,
278                     IN uint8_t port_num,
279                     IN const ib_pkey_table_t * const p_pkey_tbl,
280                     IN const osm_log_level_t log_level);
281
282 void
283 osm_dump_slvl_map_table(IN osm_log_t * const p_log,
284                         IN uint64_t port_guid,
285                         IN uint8_t in_port_num,
286                         IN uint8_t out_port_num,
287                         IN const ib_slvl_table_t * const p_slvl_tbl,
288                         IN const osm_log_level_t log_level);
289
290 void
291 osm_dump_vl_arb_table(IN osm_log_t * const p_log,
292                       IN uint64_t port_guid,
293                       IN uint8_t block_num,
294                       IN uint8_t port_num,
295                       IN const ib_vl_arb_table_t * const p_vla_tbl,
296                       IN const osm_log_level_t log_level);
297
298 /****f* OpenSM: Helper/osm_dump_port_info
299 * NAME
300 *       osm_dump_port_info
301 *
302 * DESCRIPTION
303 *       Dumps the PortInfo attribute to the log.
304 *
305 * SYNOPSIS
306 */
307 void osm_dump_node_info(IN osm_log_t * const p_log,
308                         IN const ib_node_info_t * const p_ni,
309                         IN const osm_log_level_t log_level);
310 /*
311 * PARAMETERS
312 *       p_log
313 *               [in] Pointer to the osm_log_t object
314 *
315 *       p_ni
316 *               [in] Pointer to the NodeInfo attribute
317 *
318 *       log_level
319 *               [in] Log verbosity level with which to dump the data.
320 *
321 * RETURN VALUES
322 *       None.
323 *
324 * NOTES
325 *
326 * SEE ALSO
327 *********/
328
329 /****f* OpenSM: Helper/osm_dump_sm_info
330 * NAME
331 *       osm_dump_sm_info
332 *
333 * DESCRIPTION
334 *       Dumps the SMInfo attribute to the log.
335 *
336 * SYNOPSIS
337 */
338 void
339 osm_dump_sm_info(IN osm_log_t * const p_log,
340                  IN const ib_sm_info_t * const p_smi,
341                  IN const osm_log_level_t log_level);
342 /*
343 * PARAMETERS
344 *       p_log
345 *               [in] Pointer to the osm_log_t object
346 *
347 *       p_smi
348 *               [in] Pointer to the SMInfo attribute
349 *
350 *       log_level
351 *               [in] Log verbosity level with which to dump the data.
352 *
353 * RETURN VALUES
354 *       None.
355 *
356 * NOTES
357 *
358 * SEE ALSO
359 *********/
360
361 /****f* OpenSM: Helper/osm_dump_switch_info
362 * NAME
363 *       osm_dump_switch_info
364 *
365 * DESCRIPTION
366 *       Dumps the SwitchInfo attribute to the log.
367 *
368 * SYNOPSIS
369 */
370 void
371 osm_dump_switch_info(IN osm_log_t * const p_log,
372                      IN const ib_switch_info_t * const p_si,
373                      IN const osm_log_level_t log_level);
374 /*
375 * PARAMETERS
376 *       p_log
377 *               [in] Pointer to the osm_log_t object
378 *
379 *       p_si
380 *               [in] Pointer to the SwitchInfo attribute
381 *
382 *       log_level
383 *               [in] Log verbosity level with which to dump the data.
384 *
385 * RETURN VALUES
386 *       None.
387 *
388 * NOTES
389 *
390 * SEE ALSO
391 *********/
392
393 /****f* OpenSM: Helper/osm_dump_notice
394 * NAME
395 *       osm_dump_notice
396 *
397 * DESCRIPTION
398 *       Dumps the Notice attribute to the log.
399 *
400 * SYNOPSIS
401 */
402 void
403 osm_dump_notice(IN osm_log_t * const p_log,
404                 IN const ib_mad_notice_attr_t * p_ntci,
405                 IN const osm_log_level_t log_level);
406 /*
407 * PARAMETERS
408 *       p_log
409 *               [in] Pointer to the osm_log_t object
410 *
411 *       p_ntci
412 *               [in] Pointer to the Notice attribute
413 *
414 *       log_level
415 *               [in] Log verbosity level with which to dump the data.
416 *
417 * RETURN VALUES
418 *       None.
419 *
420 * NOTES
421 *
422 * SEE ALSO
423 *********/
424
425 /****f* IBA Base: Types/osm_get_disp_msg_str
426 * NAME
427 *       osm_get_disp_msg_str
428 *
429 * DESCRIPTION
430 *       Returns a string for the specified Dispatcher message.
431 *
432 * SYNOPSIS
433 */
434 const char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg);
435 /*
436 * PARAMETERS
437 *       msg
438 *               [in] Dispatcher message ID value.
439 *
440 * RETURN VALUES
441 *       Pointer to the message discription string.
442 *
443 * NOTES
444 *
445 * SEE ALSO
446 *********/
447
448 void osm_dump_dr_path(IN osm_log_t * const p_log,
449                       IN const osm_dr_path_t * const p_path,
450                       IN const osm_log_level_t level);
451
452 void osm_dump_smp_dr_path(IN osm_log_t * const p_log,
453                           IN const ib_smp_t * const p_smp,
454                           IN const osm_log_level_t level);
455
456 void osm_dump_dr_smp(IN osm_log_t * const p_log,
457                      IN const ib_smp_t * const p_smp,
458                      IN const osm_log_level_t level);
459
460 void osm_dump_sa_mad(IN osm_log_t * const p_log,
461                      IN const ib_sa_mad_t * const p_smp,
462                      IN const osm_log_level_t level);
463
464 /****f* IBA Base: Types/osm_get_sm_signal_str
465 * NAME
466 *       osm_get_sm_signal_str
467 *
468 * DESCRIPTION
469 *       Returns a string for the specified SM state.
470 *
471 * SYNOPSIS
472 */
473 const char *osm_get_sm_signal_str(IN osm_signal_t signal);
474 /*
475 * PARAMETERS
476 *       state
477 *               [in] Signal value
478 *
479 * RETURN VALUES
480 *       Pointer to the signal discription string.
481 *
482 * NOTES
483 *
484 * SEE ALSO
485 *********/
486
487 const char *osm_get_port_state_str_fixed_width(IN uint8_t port_state);
488
489 const char *osm_get_node_type_str_fixed_width(IN uint8_t node_type);
490
491 const char *osm_get_manufacturer_str(IN uint64_t const guid_ho);
492
493 const char *osm_get_mtu_str(IN uint8_t const mtu);
494
495 const char *osm_get_lwa_str(IN uint8_t const lwa);
496
497 const char *osm_get_mtu_str(IN uint8_t const mtu);
498
499 const char *osm_get_lwa_str(IN uint8_t const lwa);
500
501 const char *osm_get_lsa_str(IN uint8_t const lsa);
502
503 /****f* IBA Base: Types/osm_get_sm_mgr_signal_str
504 * NAME
505 *       osm_get_sm_mgr_signal_str
506 *
507 * DESCRIPTION
508 *       Returns a string for the specified SM manager signal.
509 *
510 * SYNOPSIS
511 */
512 const char *osm_get_sm_mgr_signal_str(IN osm_sm_signal_t signal);
513 /*
514 * PARAMETERS
515 *       signal
516 *               [in] SM manager signal
517 *
518 * RETURN VALUES
519 *       Pointer to the signal discription string.
520 *
521 * NOTES
522 *
523 * SEE ALSO
524 *********/
525
526 /****f* IBA Base: Types/osm_get_sm_mgr_state_str
527 * NAME
528 *       osm_get_sm_mgr_state_str
529 *
530 * DESCRIPTION
531 *       Returns a string for the specified SM manager state.
532 *
533 * SYNOPSIS
534 */
535 const char *osm_get_sm_mgr_state_str(IN uint16_t state);
536 /*
537 * PARAMETERS
538 *       state
539 *               [in] SM manager state
540 *
541 * RETURN VALUES
542 *       Pointer to the state discription string.
543 *
544 * NOTES
545 *
546 * SEE ALSO
547 *********/
548
549 END_C_DECLS
550 #endif                          /* _OSM_HELPER_H_ */