1 /*
2 * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
4 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
5 * Copyright (c) 2009 HNR Consulting. All rights reserved.
6 *
7 * This software is available to you under a choice of one of two
8 * licenses. You may choose to be licensed under the terms of the GNU
9 * General Public License (GPL) Version 2, available from the file
10 * COPYING in the main directory of this source tree, or the
11 * OpenIB.org BSD license below:
12 *
13 * Redistribution and use in source and binary forms, with or
14 * without modification, are permitted provided that the following
15 * conditions are met:
16 *
17 * - Redistributions of source code must retain the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer.
20 *
21 * - Redistributions in binary form must reproduce the above
22 * copyright notice, this list of conditions and the following
23 * disclaimer in the documentation and/or other materials
24 * provided with the distribution.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 * SOFTWARE.
34 *
35 */
36
37 #ifndef _OSM_HELPER_H_
38 #define _OSM_HELPER_H_
39
40 #include <iba/ib_types.h>
41 #include <complib/cl_dispatcher.h>
42 #include <opensm/osm_base.h>
43 #include <opensm/osm_log.h>
44 #include <opensm/osm_msgdef.h>
45 #include <opensm/osm_path.h>
46
47 #ifdef __cplusplus
48 # define BEGIN_C_DECLS extern "C" {
49 # define END_C_DECLS }
50 #else /* !__cplusplus */
51 # define BEGIN_C_DECLS
52 # define END_C_DECLS
53 #endif /* __cplusplus */
54
55 BEGIN_C_DECLS
56 /*
57 * Abstract:
58 * Declaration of helpful functions.
59 */
60 /****f* OpenSM: Helper/ib_get_sa_method_str
61 * NAME
62 * ib_get_sa_method_str
63 *
64 * DESCRIPTION
65 * Returns a string for the specified SA Method value.
66 *
67 * SYNOPSIS
68 */
69 const char *ib_get_sa_method_str(IN uint8_t method);
70 /*
71 * PARAMETERS
72 * method
73 * [in] Network order METHOD ID value.
74 *
75 * RETURN VALUES
76 * Pointer to the method string.
77 *
78 * NOTES
79 *
80 * SEE ALSO
81 *********/
82
83 /****f* OpenSM: Helper/ib_get_sm_method_str
84 * NAME
85 * ib_get_sm_method_str
86 *
87 * DESCRIPTION
88 * Returns a string for the specified SM Method value.
89 *
90 * SYNOPSIS
91 */
92 const char *ib_get_sm_method_str(IN uint8_t method);
93 /*
94 * PARAMETERS
95 * method
96 * [in] Network order METHOD ID value.
97 *
98 * RETURN VALUES
99 * Pointer to the method string.
100 *
101 * NOTES
102 *
103 * SEE ALSO
104 *********/
105
106 /****f* OpenSM: Helper/ib_get_sm_attr_str
107 * NAME
108 * ib_get_sm_attr_str
109 *
110 * DESCRIPTION
111 * Returns a string for the specified SM attribute value.
112 *
113 * SYNOPSIS
114 */
115 const char *ib_get_sm_attr_str(IN ib_net16_t attr);
116 /*
117 * PARAMETERS
118 * attr
119 * [in] Network order attribute ID value.
120 *
121 * RETURN VALUES
122 * Pointer to the attribute string.
123 *
124 * NOTES
125 *
126 * SEE ALSO
127 *********/
128
129 /****f* OpenSM: Helper/ib_get_sa_attr_str
130 * NAME
131 * ib_get_sa_attr_str
132 *
133 * DESCRIPTION
134 * Returns a string for the specified SA attribute value.
135 *
136 * SYNOPSIS
137 */
138 const char *ib_get_sa_attr_str(IN ib_net16_t attr);
139 /*
140 * PARAMETERS
141 * attr
142 * [in] Network order attribute ID value.
143 *
144 * RETURN VALUES
145 * Pointer to the attribute string.
146 *
147 * NOTES
148 *
149 * SEE ALSO
150 *********/
151
152 /****f* OpenSM: Helper/ib_get_trap_str
153 * NAME
154 * ib_get_trap_str
155 *
156 * DESCRIPTION
157 * Returns a name for the specified trap.
158 *
159 * SYNOPSIS
160 */
161 const char *ib_get_trap_str(uint16_t trap_num);
162 /*
163 * PARAMETERS
164 * trap_num
165 * [in] Network order trap number.
166 *
167 * RETURN VALUES
168 * Name of the trap.
169 *
170 *********/
171
172 extern const ib_gid_t ib_zero_gid;
173
174 /****f* IBA Base: Types/ib_gid_is_notzero
175 * NAME
176 * ib_gid_is_notzero
177 *
178 * DESCRIPTION
179 * Returns a boolean indicating whether or not the GID is zero.
180 *
181 * SYNOPSIS
182 */
ib_gid_is_notzero(IN const ib_gid_t * p_gid)183 static inline boolean_t ib_gid_is_notzero(IN const ib_gid_t * p_gid)
184 {
185 return memcmp(p_gid, &ib_zero_gid, sizeof(*p_gid));
186 }
187
188 /*
189 * PARAMETERS
190 * p_gid
191 * [in] Pointer to the GID object.
192 *
193 * RETURN VALUES
194 * Returns TRUE if GID is not zero.
195 * FALSE otherwise.
196 *
197 * NOTES
198 *
199 * SEE ALSO
200 * ib_gid_t
201 *********/
202
203 /****f* OpenSM: Helper/osm_dump_port_info
204 * NAME
205 * osm_dump_port_info
206 *
207 * DESCRIPTION
208 * Dumps the PortInfo attribute to the log.
209 *
210 * SYNOPSIS
211 */
212 void osm_dump_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
213 IN ib_net64_t port_guid, IN uint8_t port_num,
214 IN const ib_port_info_t * p_pi,
215 IN osm_log_level_t log_level);
216
217 void osm_dump_port_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
218 IN ib_net64_t port_guid, IN uint8_t port_num,
219 IN const ib_port_info_t * p_pi,
220 IN const int file_id,
221 IN osm_log_level_t log_level);
222
223 /*
224 * PARAMETERS
225 * p_log
226 * [in] Pointer to the osm_log_t object
227 *
228 * node_guid
229 * [in] Node GUID that owns this port.
230 *
231 * port_guid
232 * [in] Port GUID for this port.
233 *
234 * port_num
235 * [in] Port number for this port.
236 *
237 * p_pi
238 * [in] Pointer to the PortInfo attribute
239 *
240 * log_level
241 * [in] Log verbosity level with which to dump the data.
242 *
243 * RETURN VALUES
244 * None.
245 *
246 * NOTES
247 *
248 * SEE ALSO
249 *********/
250
251 /****f* OpenSM: Helper/osm_dump_guid_info
252 * NAME
253 * osm_dump_guid_info
254 *
255 * DESCRIPTION
256 * Dumps the GUIDInfo attribute to the log.
257 *
258 * SYNOPSIS
259 */
260 void osm_dump_guid_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
261 IN ib_net64_t port_guid, IN uint8_t block_num,
262 IN const ib_guid_info_t * p_gi,
263 IN osm_log_level_t log_level);
264
265 void osm_dump_guid_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
266 IN ib_net64_t port_guid, IN uint8_t block_num,
267 IN const ib_guid_info_t * p_gi,
268 IN const int file_id,
269 IN osm_log_level_t log_level);
270 /*
271 * PARAMETERS
272 * p_log
273 * [in] Pointer to the osm_log_t object.
274 *
275 * node_guid
276 * [in] Node GUID that owns this port.
277 *
278 * port_guid
279 * [in] Port GUID for this port.
280 *
281 * block_num
282 * [in] Block number.
283 *
284 * p_gi
285 * [in] Pointer to the GUIDInfo attribute.
286 *
287 * log_level
288 * [in] Log verbosity level with which to dump the data.
289 *
290 * RETURN VALUES
291 * None.
292 *
293 * NOTES
294 *
295 * SEE ALSO
296 *********/
297
298 void osm_dump_mlnx_ext_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
299 IN ib_net64_t port_guid, IN uint8_t port_num,
300 IN const ib_mlnx_ext_port_info_t * p_pi,
301 IN osm_log_level_t log_level);
302
303 void osm_dump_mlnx_ext_port_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
304 IN ib_net64_t port_guid, IN uint8_t port_num,
305 IN const ib_mlnx_ext_port_info_t * p_pi,
306 IN const int file_id,
307 IN osm_log_level_t log_level);
308
309 void osm_dump_path_record(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr,
310 IN osm_log_level_t log_level);
311
312 void osm_dump_path_record_v2(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr,
313 IN const int file_id, IN osm_log_level_t log_level);
314
315 void osm_dump_multipath_record(IN osm_log_t * p_log,
316 IN const ib_multipath_rec_t * p_mpr,
317 IN osm_log_level_t log_level);
318
319 void osm_dump_multipath_record_v2(IN osm_log_t * p_log,
320 IN const ib_multipath_rec_t * p_mpr,
321 IN const int file_id, IN osm_log_level_t log_level);
322
323 void osm_dump_node_record(IN osm_log_t * p_log,
324 IN const ib_node_record_t * p_nr,
325 IN osm_log_level_t log_level);
326
327 void osm_dump_node_record_v2(IN osm_log_t * p_log,
328 IN const ib_node_record_t * p_nr,
329 IN const int file_id, IN osm_log_level_t log_level);
330
331 void osm_dump_mc_record(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr,
332 IN osm_log_level_t log_level);
333
334 void osm_dump_mc_record_v2(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr,
335 IN const int file_id, IN osm_log_level_t log_level);
336
337 void osm_dump_link_record(IN osm_log_t * p_log,
338 IN const ib_link_record_t * p_lr,
339 IN osm_log_level_t log_level);
340
341 void osm_dump_link_record_v2(IN osm_log_t * p_log,
342 IN const ib_link_record_t * p_lr,
343 IN const int file_id, IN osm_log_level_t log_level);
344
345 void osm_dump_service_record(IN osm_log_t * p_log,
346 IN const ib_service_record_t * p_sr,
347 IN osm_log_level_t log_level);
348
349 void osm_dump_service_record_v2(IN osm_log_t * p_log,
350 IN const ib_service_record_t * p_sr,
351 IN const int file_id, IN osm_log_level_t log_level);
352
353 void osm_dump_portinfo_record(IN osm_log_t * p_log,
354 IN const ib_portinfo_record_t * p_pir,
355 IN osm_log_level_t log_level);
356
357 void osm_dump_portinfo_record_v2(IN osm_log_t * p_log,
358 IN const ib_portinfo_record_t * p_pir,
359 IN const int file_id, IN osm_log_level_t log_level);
360
361 void osm_dump_guidinfo_record(IN osm_log_t * p_log,
362 IN const ib_guidinfo_record_t * p_gir,
363 IN osm_log_level_t log_level);
364
365 void osm_dump_guidinfo_record_v2(IN osm_log_t * p_log,
366 IN const ib_guidinfo_record_t * p_gir,
367 IN const int file_id, IN osm_log_level_t log_level);
368
369 void osm_dump_inform_info(IN osm_log_t * p_log,
370 IN const ib_inform_info_t * p_ii,
371 IN osm_log_level_t log_level);
372
373 void osm_dump_inform_info_v2(IN osm_log_t * p_log,
374 IN const ib_inform_info_t * p_ii,
375 IN const int file_id, IN osm_log_level_t log_level);
376
377 void osm_dump_inform_info_record(IN osm_log_t * p_log,
378 IN const ib_inform_info_record_t * p_iir,
379 IN osm_log_level_t log_level);
380
381 void osm_dump_inform_info_record_v2(IN osm_log_t * p_log,
382 IN const ib_inform_info_record_t * p_iir,
383 IN const int file_id, IN osm_log_level_t log_level);
384
385 void osm_dump_switch_info_record(IN osm_log_t * p_log,
386 IN const ib_switch_info_record_t * p_sir,
387 IN osm_log_level_t log_level);
388
389 void osm_dump_switch_info_record_v2(IN osm_log_t * p_log,
390 IN const ib_switch_info_record_t * p_sir,
391 IN const int file_id, IN osm_log_level_t log_level);
392
393 void osm_dump_sm_info_record(IN osm_log_t * p_log,
394 IN const ib_sminfo_record_t * p_smir,
395 IN osm_log_level_t log_level);
396
397 void osm_dump_sm_info_record_v2(IN osm_log_t * p_log,
398 IN const ib_sminfo_record_t * p_smir,
399 IN const int file_id, IN osm_log_level_t log_level);
400
401 void osm_dump_pkey_block(IN osm_log_t * p_log, IN uint64_t port_guid,
402 IN uint16_t block_num, IN uint8_t port_num,
403 IN const ib_pkey_table_t * p_pkey_tbl,
404 IN osm_log_level_t log_level);
405
406 void osm_dump_pkey_block_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
407 IN uint16_t block_num, IN uint8_t port_num,
408 IN const ib_pkey_table_t * p_pkey_tbl,
409 IN const int file_id,
410 IN osm_log_level_t log_level);
411
412 void osm_dump_slvl_map_table(IN osm_log_t * p_log, IN uint64_t port_guid,
413 IN uint8_t in_port_num, IN uint8_t out_port_num,
414 IN const ib_slvl_table_t * p_slvl_tbl,
415 IN osm_log_level_t log_level);
416
417 void osm_dump_slvl_map_table_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
418 IN uint8_t in_port_num, IN uint8_t out_port_num,
419 IN const ib_slvl_table_t * p_slvl_tbl,
420 IN const int file_id,
421 IN osm_log_level_t log_level);
422
423
424 void osm_dump_vl_arb_table(IN osm_log_t * p_log, IN uint64_t port_guid,
425 IN uint8_t block_num, IN uint8_t port_num,
426 IN const ib_vl_arb_table_t * p_vla_tbl,
427 IN osm_log_level_t log_level);
428
429 void osm_dump_vl_arb_table_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
430 IN uint8_t block_num, IN uint8_t port_num,
431 IN const ib_vl_arb_table_t * p_vla_tbl,
432 IN const int file_id,
433 IN osm_log_level_t log_level);
434
435 /****f* OpenSM: Helper/osm_dump_port_info
436 * NAME
437 * osm_dump_port_info
438 *
439 * DESCRIPTION
440 * Dumps the PortInfo attribute to the log.
441 *
442 * SYNOPSIS
443 */
444 void osm_dump_node_info(IN osm_log_t * p_log,
445 IN const ib_node_info_t * p_ni,
446 IN osm_log_level_t log_level);
447
448 void osm_dump_node_info_v2(IN osm_log_t * p_log,
449 IN const ib_node_info_t * p_ni,
450 IN const int file_id,
451 IN osm_log_level_t log_level);
452 /*
453 * PARAMETERS
454 * p_log
455 * [in] Pointer to the osm_log_t object
456 *
457 * p_ni
458 * [in] Pointer to the NodeInfo attribute
459 *
460 * log_level
461 * [in] Log verbosity level with which to dump the data.
462 *
463 * RETURN VALUES
464 * None.
465 *
466 * NOTES
467 *
468 * SEE ALSO
469 *********/
470
471 /****f* OpenSM: Helper/osm_dump_sm_info
472 * NAME
473 * osm_dump_sm_info
474 *
475 * DESCRIPTION
476 * Dumps the SMInfo attribute to the log.
477 *
478 * SYNOPSIS
479 */
480 void osm_dump_sm_info(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,
481 IN osm_log_level_t log_level);
482
483 void osm_dump_sm_info_v2(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,
484 IN const int file_id, IN osm_log_level_t log_level);
485
486 /*
487 * PARAMETERS
488 * p_log
489 * [in] Pointer to the osm_log_t object
490 *
491 * p_smi
492 * [in] Pointer to the SMInfo attribute
493 *
494 * log_level
495 * [in] Log verbosity level with which to dump the data.
496 *
497 * RETURN VALUES
498 * None.
499 *
500 * NOTES
501 *
502 * SEE ALSO
503 *********/
504
505 /****f* OpenSM: Helper/osm_dump_switch_info
506 * NAME
507 * osm_dump_switch_info
508 *
509 * DESCRIPTION
510 * Dumps the SwitchInfo attribute to the log.
511 *
512 * SYNOPSIS
513 */
514 void osm_dump_switch_info(IN osm_log_t * p_log,
515 IN const ib_switch_info_t * p_si,
516 IN osm_log_level_t log_level);
517
518 void osm_dump_switch_info_v2(IN osm_log_t * p_log,
519 IN const ib_switch_info_t * p_si,
520 IN const int file_id,
521 IN osm_log_level_t log_level);
522 /*
523 * PARAMETERS
524 * p_log
525 * [in] Pointer to the osm_log_t object
526 *
527 * p_si
528 * [in] Pointer to the SwitchInfo attribute
529 *
530 * log_level
531 * [in] Log verbosity level with which to dump the data.
532 *
533 * RETURN VALUES
534 * None.
535 *
536 * NOTES
537 *
538 * SEE ALSO
539 *********/
540
541 /****f* OpenSM: Helper/osm_dump_notice
542 * NAME
543 * osm_dump_notice
544 *
545 * DESCRIPTION
546 * Dumps the Notice attribute to the log.
547 *
548 * SYNOPSIS
549 */
550 void osm_dump_notice(IN osm_log_t * p_log,
551 IN const ib_mad_notice_attr_t * p_ntci,
552 IN osm_log_level_t log_level);
553
554 void osm_dump_notice_v2(IN osm_log_t * p_log,
555 IN const ib_mad_notice_attr_t * p_ntci,
556 IN const int file_id,
557 IN osm_log_level_t log_level);
558 /*
559 * PARAMETERS
560 * p_log
561 * [in] Pointer to the osm_log_t object
562 *
563 * p_ntci
564 * [in] Pointer to the Notice attribute
565 *
566 * log_level
567 * [in] Log verbosity level with which to dump the data.
568 *
569 * RETURN VALUES
570 * None.
571 *
572 * NOTES
573 *
574 * SEE ALSO
575 *********/
576
577 /****f* IBA Base: Types/osm_get_disp_msg_str
578 * NAME
579 * osm_get_disp_msg_str
580 *
581 * DESCRIPTION
582 * Returns a string for the specified Dispatcher message.
583 *
584 * SYNOPSIS
585 */
586 const char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg);
587 /*
588 * PARAMETERS
589 * msg
590 * [in] Dispatcher message ID value.
591 *
592 * RETURN VALUES
593 * Pointer to the message description string.
594 *
595 * NOTES
596 *
597 * SEE ALSO
598 *********/
599
600 void osm_dump_dr_path(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,
601 IN osm_log_level_t level);
602
603 void osm_dump_dr_path_v2(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,
604 IN const int file_id, IN osm_log_level_t level);
605
606
607 void osm_dump_smp_dr_path(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
608 IN osm_log_level_t level);
609
610 void osm_dump_smp_dr_path_v2(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
611 IN const int file_id, IN osm_log_level_t level);
612
613 void osm_dump_dr_smp(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
614 IN osm_log_level_t level);
615
616 void osm_dump_dr_smp_v2(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
617 IN const int file_id, IN osm_log_level_t level);
618
619 void osm_dump_sa_mad(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_smp,
620 IN osm_log_level_t level);
621
622 void osm_dump_sa_mad_v2(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_smp,
623 IN const int file_id, IN osm_log_level_t level);
624
625 void osm_dump_dr_path_as_buf(IN size_t max_len, IN const osm_dr_path_t * p_path,
626 OUT char* buf);
627
628
629 /****f* IBA Base: Types/osm_get_sm_signal_str
630 * NAME
631 * osm_get_sm_signal_str
632 *
633 * DESCRIPTION
634 * Returns a string for the specified SM state.
635 *
636 * SYNOPSIS
637 */
638 const char *osm_get_sm_signal_str(IN osm_signal_t signal);
639 /*
640 * PARAMETERS
641 * state
642 * [in] Signal value
643 *
644 * RETURN VALUES
645 * Pointer to the signal description string.
646 *
647 * NOTES
648 *
649 * SEE ALSO
650 *********/
651
652 const char *osm_get_port_state_str_fixed_width(IN uint8_t port_state);
653
654 const char *osm_get_node_type_str_fixed_width(IN uint8_t node_type);
655
656 const char *osm_get_manufacturer_str(IN uint64_t guid_ho);
657
658 const char *osm_get_mtu_str(IN uint8_t mtu);
659
660 const char *osm_get_lwa_str(IN uint8_t lwa);
661
662 const char *osm_get_lsa_str(IN uint8_t lsa, IN uint8_t lsea, IN uint8_t state,
663 IN uint8_t fdr10);
664
665 /****f* IBA Base: Types/osm_get_sm_mgr_signal_str
666 * NAME
667 * osm_get_sm_mgr_signal_str
668 *
669 * DESCRIPTION
670 * Returns a string for the specified SM manager signal.
671 *
672 * SYNOPSIS
673 */
674 const char *osm_get_sm_mgr_signal_str(IN osm_sm_signal_t signal);
675 /*
676 * PARAMETERS
677 * signal
678 * [in] SM manager signal
679 *
680 * RETURN VALUES
681 * Pointer to the signal description string.
682 *
683 * NOTES
684 *
685 * SEE ALSO
686 *********/
687
688 /****f* IBA Base: Types/osm_get_sm_mgr_state_str
689 * NAME
690 * osm_get_sm_mgr_state_str
691 *
692 * DESCRIPTION
693 * Returns a string for the specified SM manager state.
694 *
695 * SYNOPSIS
696 */
697 const char *osm_get_sm_mgr_state_str(IN uint16_t state);
698 /*
699 * PARAMETERS
700 * state
701 * [in] SM manager state
702 *
703 * RETURN VALUES
704 * Pointer to the state description string.
705 *
706 * NOTES
707 *
708 * SEE ALSO
709 *********/
710
711 /****f* IBA Base: Types/ib_mtu_is_valid
712 * NAME
713 * ib_mtu_is_valid
714 *
715 * DESCRIPTION
716 * Validates encoded MTU
717 *
718 * SYNOPSIS
719 */
720 int ib_mtu_is_valid(IN const int mtu);
721 /*
722 * PARAMETERS
723 * mtu
724 * [in] Encoded path mtu.
725 *
726 * RETURN VALUES
727 * Returns an int indicating mtu is valid (1)
728 * or invalid (0).
729 *
730 * NOTES
731 *
732 * SEE ALSO
733 *********/
734
735 /****f* IBA Base: Types/ib_rate_is_valid
736 * NAME
737 * ib_rate_is_valid
738 *
739 * DESCRIPTION
740 * Validates encoded rate
741 *
742 * SYNOPSIS
743 */
744 int ib_rate_is_valid(IN const int rate);
745 /*
746 * PARAMETERS
747 * rate
748 * [in] Encoded path rate.
749 *
750 * RETURN VALUES
751 * Returns an int indicating rate is valid (1)
752 * or invalid (0).
753 *
754 * NOTES
755 *
756 * SEE ALSO
757 *********/
758
759 /****f* IBA Base: Types/ib_path_compare_rates
760 * NAME
761 * ib_path_compare_rates
762 *
763 * DESCRIPTION
764 * Compares the encoded values for two path rates and
765 * return value is based on the ordered comparison of
766 * the path rates (or path rate equivalents).
767 *
768 * SYNOPSIS
769 */
770 int ib_path_compare_rates(IN const int rate1, IN const int rate2);
771
772 /*
773 * PARAMETERS
774 * rate1
775 * [in] Encoded path rate 1.
776 *
777 * rate2
778 * [in] Encoded path rate 2.
779 *
780 * RETURN VALUES
781 * Returns an int indicating less than (-1), equal to (0), or
782 * greater than (1) rate1 as compared with rate2.
783 *
784 * NOTES
785 *
786 * SEE ALSO
787 *********/
788
789 /****f* IBA Base: Types/ib_path_rate_get_prev
790 * NAME
791 * ib_path_rate_get_prev
792 *
793 * DESCRIPTION
794 * Obtains encoded rate for the rate previous to the one requested.
795 *
796 * SYNOPSIS
797 */
798 int ib_path_rate_get_prev(IN const int rate);
799
800 /*
801 * PARAMETERS
802 * rate
803 * [in] Encoded path rate.
804 *
805 * RETURN VALUES
806 * Returns an int indicating encoded rate or
807 * 0 if none can be found.
808 *
809 * NOTES
810 *
811 * SEE ALSO
812 *********/
813
814 /****f* IBA Base: Types/ib_path_rate_get_next
815 * NAME
816 * ib_path_rate_get_next
817 *
818 * DESCRIPTION
819 * Obtains encoded rate for the rate subsequent to the one requested.
820 *
821 * SYNOPSIS
822 */
823 int ib_path_rate_get_next(IN const int rate);
824
825 /*
826 * PARAMETERS
827 * rate
828 * [in] Encoded path rate.
829 *
830 * RETURN VALUES
831 * Returns an int indicating encoded rate or
832 * 0 if none can be found.
833 *
834 * NOTES
835 *
836 * SEE ALSO
837 *********/
838
839 /****f* OpenSM: Helper/sprint_uint8_arr
840 * NAME
841 * sprint_uint8_arr
842 *
843 * DESCRIPTION
844 * Create the comma-separated string of numbers
845 * from input array of uint8 numbers
846 * (e.g. "1,2,3,4")
847 *
848 * SYNOPSIS
849 */
850 int sprint_uint8_arr(IN char *buf, IN size_t size,
851 IN const uint8_t * arr, IN size_t len);
852
853 /*
854 * PARAMETERS
855 * buf
856 * [in] Pointer to the output buffer
857 *
858 * size
859 * [in] Size of the output buffer
860 *
861 * arr
862 * [in] Pointer to the input array of uint8
863 *
864 * len
865 * [in] Size of the input array
866 *
867 * RETURN VALUES
868 * Return the number of characters printed to the buffer
869 *
870 * NOTES
871 *
872 * SEE ALSO
873 *********/
874
875
876 END_C_DECLS
877 #endif /* _OSM_HELPER_H_ */
878