2 * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2002-2015 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 * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
8 * This software is available to you under a choice of one of two
9 * licenses. You may choose to be licensed under the terms of the GNU
10 * General Public License (GPL) Version 2, available from the file
11 * COPYING in the main directory of this source tree, or the
12 * OpenIB.org BSD license below:
14 * Redistribution and use in source and binary forms, with or
15 * without modification, are permitted provided that the following
18 * - Redistributions of source code must retain the above
19 * copyright notice, this list of conditions and the following
22 * - Redistributions in binary form must reproduce the above
23 * copyright notice, this list of conditions and the following
24 * disclaimer in the documentation and/or other materials
25 * provided with the distribution.
27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
31 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40 * Implementation of opensm helper functions.
45 #endif /* HAVE_CONFIG_H */
50 #include <arpa/inet.h>
51 #include <sys/socket.h>
52 #include <complib/cl_debug.h>
53 #include <iba/ib_types.h>
54 #include <opensm/osm_file_ids.h>
55 #define FILE_ID OSM_FILE_HELPER_C
56 #include <opensm/osm_helper.h>
57 #include <opensm/osm_log.h>
59 #define LINE_LENGTH 256
61 #define ARR_SIZE(a) (sizeof(a)/sizeof((a)[0]))
63 /* we use two tables - one for queries and one for responses */
64 static const char *ib_sa_method_str[] = {
71 "SubnAdmReport", /* 6 */
83 "SubnAdmGetTable", /* 12 */
84 "SubnAdmGetTraceTable", /* 13 */
85 "SubnAdmGetMulti", /* 14 */
86 "SubnAdmDelete", /* 15 */
90 #define OSM_SA_METHOD_STR_UNKNOWN_VAL (ARR_SIZE(ib_sa_method_str) - 1)
92 static const char *ib_sa_resp_method_str[] = {
94 "SubnAdmGetResp", /* 81 */
95 "RESERVED (SetResp?)", /* 82 */
99 "SubnAdmReportResp", /* 86 */
111 "SubnAdmGetTableResp", /* 92 */
113 "SubnAdmGetMultiResp", /* 94 */
114 "SubnAdmDeleteResp", /* 95 */
118 static const char *ib_sm_method_str[] = {
126 "SubnTrapRepress", /* 7 */
135 "RESERVED10", /* 10 */
136 "SubnGetResp", /* 11 */
137 "RESERVED12", /* 12 */
138 "RESERVED13", /* 13 */
139 "RESERVED14", /* 14 */
140 "RESERVED15", /* 15 */
141 "RESERVED16", /* 16 */
142 "RESERVED17", /* 17 */
143 "RESERVED18", /* 18 */
144 "RESERVED19", /* 19 */
145 "RESERVED1A", /* 1A */
146 "RESERVED1B", /* 1B */
147 "RESERVED1C", /* 1C */
148 "RESERVED1D", /* 1D */
149 "RESERVED1E", /* 1E */
150 "RESERVED1F", /* 1F */
154 #define OSM_SM_METHOD_STR_UNKNOWN_VAL (ARR_SIZE(ib_sm_method_str) - 1)
156 static const char *ib_sm_attr_str[] = {
158 "ClassPortInfo", /* 1 */
160 "InformInfo", /* 3 */
173 "NodeDescription", /* 10 */
175 "SwitchInfo", /* 12 */
179 "P_KeyTable", /* 16 */
180 "SLtoVLMappingTable", /* 17 */
181 "VLArbitrationTable", /* 18 */
182 "LinearForwardingTable", /* 19 */
183 "RandomForwardingTable", /* 1A */
184 "MulticastForwardingTable", /* 1B */
190 "UNKNOWN" /* 21 - always highest value */
193 #define OSM_SM_ATTR_STR_UNKNOWN_VAL (ARR_SIZE(ib_sm_attr_str) - 1)
195 static const char *ib_sa_attr_str[] = {
197 "ClassPortInfo", /* 1 */
199 "InformInfo", /* 3 */
213 "NodeRecord", /* 11 */
214 "PortInfoRecord", /* 12 */
215 "SLtoVLMappingTableRecord", /* 13 */
216 "SwitchInfoRecord", /* 14 */
217 "LinearForwardingTableRecord", /* 15 */
218 "RandomForwardingTableRecord", /* 16 */
219 "MulticastForwardingTableRecord", /* 17 */
220 "SMInfoRecord", /* 18 */
222 "RandomForwardingTable", /* 1A */
223 "MulticastForwardingTable", /* 1B */
228 "LinkRecord", /* 20 */
244 "GuidInfoRecord", /* 30 */
245 "ServiceRecord", /* 31 */
247 "P_KeyTableRecord", /* 33 */
249 "PathRecord", /* 35 */
250 "VLArbitrationTableRecord", /* 36 */
252 "MCMemberRecord", /* 38 */
253 "TraceRecord", /* 39 */
254 "MultiPathRecord", /* 3A */
255 "ServiceAssociationRecord", /* 3B */
439 "InformInfoRecord", /* F3 */
440 "UNKNOWN" /* F4 - always highest value */
443 #define OSM_SA_ATTR_STR_UNKNOWN_VAL (ARR_SIZE(ib_sa_attr_str) - 1)
445 static int ordered_rates[] = {
446 0, 0, /* 0, 1 - reserved */
447 1, /* 2 - 2.5 Gbps */
453 10, /* 8 - 60 Gbps */
454 13, /* 9 - 80 Gbps */
455 14, /* 10 - 120 Gbps */
456 4, /* 11 - 14 Gbps (17 Gbps equiv) */
457 12, /* 12 - 56 Gbps (68 Gbps equiv) */
458 16, /* 13 - 112 Gbps (136 Gbps equiv) */
459 17, /* 14 - 168 Gbps (204 Gbps equiv) */
460 7, /* 15 - 25 Gbps (31.25 Gbps equiv) */
461 15, /* 16 - 100 Gbps (125 Gbps equiv) */
462 18, /* 17 - 200 Gbps (250 Gbps equiv) */
463 19, /* 18 - 300 Gbps (375 Gbps equiv) */
464 8, /* 19 - 28 Gbps (35 Gbps equiv) */
465 11, /* 20 - 50 Gbps (62.5 Gbps equiv) */
468 int sprint_uint8_arr(char *buf, size_t size,
469 const uint8_t * arr, size_t len)
473 for (i = 0, n = 0; i < len; i++) {
474 n += snprintf(buf + n, size - n, "%s%u", i == 0 ? "" : ",",
482 const char *ib_get_sa_method_str(IN uint8_t method)
485 method = method & 0x7f;
486 if (method > OSM_SA_METHOD_STR_UNKNOWN_VAL)
487 method = OSM_SA_METHOD_STR_UNKNOWN_VAL;
488 /* it is a response - use the response table */
489 return ib_sa_resp_method_str[method];
491 if (method > OSM_SA_METHOD_STR_UNKNOWN_VAL)
492 method = OSM_SA_METHOD_STR_UNKNOWN_VAL;
493 return ib_sa_method_str[method];
497 const char *ib_get_sm_method_str(IN uint8_t method)
500 method = (method & 0x0F) | 0x10;
501 if (method > OSM_SM_METHOD_STR_UNKNOWN_VAL)
502 method = OSM_SM_METHOD_STR_UNKNOWN_VAL;
503 return ib_sm_method_str[method];
506 const char *ib_get_sm_attr_str(IN ib_net16_t attr)
508 uint16_t host_attr = cl_ntoh16(attr);
510 if (attr == IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO)
511 return "MLNXExtendedPortInfo";
513 if (host_attr > OSM_SM_ATTR_STR_UNKNOWN_VAL)
514 host_attr = OSM_SM_ATTR_STR_UNKNOWN_VAL;
516 return ib_sm_attr_str[host_attr];
519 const char *ib_get_sa_attr_str(IN ib_net16_t attr)
521 uint16_t host_attr = cl_ntoh16(attr);
523 if (host_attr > OSM_SA_ATTR_STR_UNKNOWN_VAL)
524 host_attr = OSM_SA_ATTR_STR_UNKNOWN_VAL;
526 return ib_sa_attr_str[host_attr];
529 const char *ib_get_trap_str(ib_net16_t trap_num)
531 switch (cl_ntoh16(trap_num)) {
532 case SM_GID_IN_SERVICE_TRAP: /* 64 */
533 return "GID in service";
534 case SM_GID_OUT_OF_SERVICE_TRAP: /* 65 */
535 return "GID out of service";
536 case SM_MGID_CREATED_TRAP: /* 66 */
537 return "New mcast group created";
538 case SM_MGID_DESTROYED_TRAP: /* 67 */
539 return "Mcast group deleted";
540 case SM_UNPATH_TRAP: /* 68 */
541 return "UnPath, Path no longer valid";
542 case SM_REPATH_TRAP: /* 69 */
543 return "RePath, Path recomputed";
544 case SM_LINK_STATE_CHANGED_TRAP: /* 128 */
545 return "Link state change";
546 case SM_LINK_INTEGRITY_THRESHOLD_TRAP: /* 129 */
547 return "Local Link integrity threshold reached";
548 case SM_BUFFER_OVERRUN_THRESHOLD_TRAP: /* 130 */
549 return "Excessive Buffer Overrun Threshold reached";
550 case SM_WATCHDOG_TIMER_EXPIRED_TRAP: /* 131 */
551 return "Flow Control Update watchdog timer expired";
552 case SM_LOCAL_CHANGES_TRAP: /* 144 */
554 "CapabilityMask, NodeDescription, Link [Width|Speed] Enabled, SM priority changed";
555 case SM_SYS_IMG_GUID_CHANGED_TRAP: /* 145 */
556 return "System Image GUID changed";
557 case SM_BAD_MKEY_TRAP: /* 256 */
559 case SM_BAD_PKEY_TRAP: /* 257 */
561 case SM_BAD_QKEY_TRAP: /* 258 */
563 case SM_BAD_SWITCH_PKEY_TRAP: /* 259 */
564 return "Bad P_Key (switch external port)";
571 const ib_gid_t ib_zero_gid = { {0} };
573 static ib_api_status_t dbg_do_line(IN char **pp_local, IN uint32_t buf_size,
574 IN const char *p_prefix_str,
575 IN const char *p_new_str,
576 IN uint32_t * p_total_len)
578 char line[LINE_LENGTH];
581 sprintf(line, "%s%s", p_prefix_str, p_new_str);
582 len = (uint32_t) strlen(line);
584 if (*p_total_len + sizeof('\0') > buf_size)
585 return IB_INSUFFICIENT_MEMORY;
587 strcpy(*pp_local, line);
592 static void dbg_get_capabilities_str(IN char *p_buf, IN uint32_t buf_size,
593 IN const char *p_prefix_str,
594 IN const ib_port_info_t * p_pi)
596 uint32_t total_len = 0;
597 char *p_local = p_buf;
599 strcpy(p_local, "Capability Mask:\n");
600 p_local += strlen(p_local);
602 if (p_pi->capability_mask & IB_PORT_CAP_RESV0) {
603 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
604 "IB_PORT_CAP_RESV0\n",
605 &total_len) != IB_SUCCESS)
608 if (p_pi->capability_mask & IB_PORT_CAP_IS_SM) {
609 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
610 "IB_PORT_CAP_IS_SM\n",
611 &total_len) != IB_SUCCESS)
614 if (p_pi->capability_mask & IB_PORT_CAP_HAS_NOTICE) {
615 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
616 "IB_PORT_CAP_HAS_NOTICE\n",
617 &total_len) != IB_SUCCESS)
620 if (p_pi->capability_mask & IB_PORT_CAP_HAS_TRAP) {
621 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
622 "IB_PORT_CAP_HAS_TRAP\n",
623 &total_len) != IB_SUCCESS)
626 if (p_pi->capability_mask & IB_PORT_CAP_HAS_IPD) {
627 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
628 "IB_PORT_CAP_HAS_IPD\n",
629 &total_len) != IB_SUCCESS)
632 if (p_pi->capability_mask & IB_PORT_CAP_HAS_AUTO_MIG) {
633 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
634 "IB_PORT_CAP_HAS_AUTO_MIG\n",
635 &total_len) != IB_SUCCESS)
638 if (p_pi->capability_mask & IB_PORT_CAP_HAS_SL_MAP) {
639 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
640 "IB_PORT_CAP_HAS_SL_MAP\n",
641 &total_len) != IB_SUCCESS)
644 if (p_pi->capability_mask & IB_PORT_CAP_HAS_NV_MKEY) {
645 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
646 "IB_PORT_CAP_HAS_NV_MKEY\n",
647 &total_len) != IB_SUCCESS)
650 if (p_pi->capability_mask & IB_PORT_CAP_HAS_NV_PKEY) {
651 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
652 "IB_PORT_CAP_HAS_NV_PKEY\n",
653 &total_len) != IB_SUCCESS)
656 if (p_pi->capability_mask & IB_PORT_CAP_HAS_LED_INFO) {
657 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
658 "IB_PORT_CAP_HAS_LED_INFO\n",
659 &total_len) != IB_SUCCESS)
662 if (p_pi->capability_mask & IB_PORT_CAP_SM_DISAB) {
663 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
664 "IB_PORT_CAP_SM_DISAB\n",
665 &total_len) != IB_SUCCESS)
668 if (p_pi->capability_mask & IB_PORT_CAP_HAS_SYS_IMG_GUID) {
669 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
670 "IB_PORT_CAP_HAS_SYS_IMG_GUID\n",
671 &total_len) != IB_SUCCESS)
674 if (p_pi->capability_mask & IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP) {
675 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
676 "IB_PORT_CAP_PKEY_SW_EXT_PORT_TRAP\n",
677 &total_len) != IB_SUCCESS)
680 if (p_pi->capability_mask & IB_PORT_CAP_HAS_CABLE_INFO) {
681 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
682 "IB_PORT_CAP_HAS_CABLE_INFO\n",
683 &total_len) != IB_SUCCESS)
686 if (p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) {
687 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
688 "IB_PORT_CAP_HAS_EXT_SPEEDS\n",
689 &total_len) != IB_SUCCESS)
692 if (p_pi->capability_mask & IB_PORT_CAP_HAS_CAP_MASK2) {
693 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
694 "IB_PORT_CAP_HAS_CAP_MASK2\n",
695 &total_len) != IB_SUCCESS)
698 if (p_pi->capability_mask & IB_PORT_CAP_HAS_COM_MGT) {
699 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
700 "IB_PORT_CAP_HAS_COM_MGT\n",
701 &total_len) != IB_SUCCESS)
704 if (p_pi->capability_mask & IB_PORT_CAP_HAS_SNMP) {
705 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
706 "IB_PORT_CAP_HAS_SNMP\n",
707 &total_len) != IB_SUCCESS)
710 if (p_pi->capability_mask & IB_PORT_CAP_REINIT) {
711 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
712 "IB_PORT_CAP_REINIT\n",
713 &total_len) != IB_SUCCESS)
716 if (p_pi->capability_mask & IB_PORT_CAP_HAS_DEV_MGT) {
717 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
718 "IB_PORT_CAP_HAS_DEV_MGT\n",
719 &total_len) != IB_SUCCESS)
722 if (p_pi->capability_mask & IB_PORT_CAP_HAS_VEND_CLS) {
723 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
724 "IB_PORT_CAP_HAS_VEND_CLS\n",
725 &total_len) != IB_SUCCESS)
728 if (p_pi->capability_mask & IB_PORT_CAP_HAS_DR_NTC) {
729 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
730 "IB_PORT_CAP_HAS_DR_NTC\n",
731 &total_len) != IB_SUCCESS)
734 if (p_pi->capability_mask & IB_PORT_CAP_HAS_CAP_NTC) {
735 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
736 "IB_PORT_CAP_HAS_CAP_NTC\n",
737 &total_len) != IB_SUCCESS)
740 if (p_pi->capability_mask & IB_PORT_CAP_HAS_BM) {
741 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
742 "IB_PORT_CAP_HAS_BM\n",
743 &total_len) != IB_SUCCESS)
746 if (p_pi->capability_mask & IB_PORT_CAP_HAS_LINK_RT_LATENCY) {
747 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
748 "IB_PORT_CAP_HAS_LINK_RT_LATENCY\n",
749 &total_len) != IB_SUCCESS)
752 if (p_pi->capability_mask & IB_PORT_CAP_HAS_CLIENT_REREG) {
753 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
754 "IB_PORT_CAP_HAS_CLIENT_REREG\n",
755 &total_len) != IB_SUCCESS)
758 if (p_pi->capability_mask & IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC) {
759 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
760 "IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC\n",
761 &total_len) != IB_SUCCESS)
764 if (p_pi->capability_mask & IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL) {
765 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
766 "IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL\n",
767 &total_len) != IB_SUCCESS)
770 if (p_pi->capability_mask & IB_PORT_CAP_HAS_VEND_MADS) {
771 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
772 "IB_PORT_CAP_HAS_VEND_MADS\n",
773 &total_len) != IB_SUCCESS)
776 if (p_pi->capability_mask & IB_PORT_CAP_HAS_MCAST_PKEY_TRAP_SUPPRESS) {
777 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
778 "IB_PORT_CAP_HAS_MCAST_PKEY_TRAP_SUPPRESS\n",
779 &total_len) != IB_SUCCESS)
782 if (p_pi->capability_mask & IB_PORT_CAP_HAS_MCAST_FDB_TOP) {
783 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
784 "IB_PORT_CAP_HAS_MCAST_FDB_TOP\n",
785 &total_len) != IB_SUCCESS)
788 if (p_pi->capability_mask & IB_PORT_CAP_HAS_HIER_INFO) {
789 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
790 "IB_PORT_CAP_HAS_HIER_INFO\n",
791 &total_len) != IB_SUCCESS)
796 static void dbg_get_capabilities2_str(IN char *p_buf, IN uint32_t buf_size,
797 IN const char *p_prefix_str,
798 IN const ib_port_info_t * p_pi)
800 uint32_t total_len = 0;
801 char *p_local = p_buf;
803 strcpy(p_local, "Capability Mask2:\n");
804 p_local += strlen(p_local);
806 if (p_pi->capability_mask2 & IB_PORT_CAP2_IS_SET_NODE_DESC_SUPPORTED) {
807 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
808 "IB_PORT_CAP2_IS_SET_NODE_DESC_SUPPORTED\n",
809 &total_len) != IB_SUCCESS)
812 if (p_pi->capability_mask2 & IB_PORT_CAP2_IS_PORT_INFO_EXT_SUPPORTED) {
813 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
814 "IB_PORT_CAP2_IS_PORT_INFO_EXT_SUPPORTED\n",
815 &total_len) != IB_SUCCESS)
818 if (p_pi->capability_mask2 & IB_PORT_CAP2_IS_VIRT_SUPPORTED) {
819 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
820 "IB_PORT_CAP2_IS_VIRT_SUPPORTED\n",
821 &total_len) != IB_SUCCESS)
824 if (p_pi->capability_mask2 & IB_PORT_CAP2_IS_SWITCH_PORT_STATE_TBL_SUPP) {
825 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
826 "IB_PORT_CAP2_IS_SWITCH_PORT_STATE_TBL_SUPP\n",
827 &total_len) != IB_SUCCESS)
830 if (p_pi->capability_mask2 & IB_PORT_CAP2_IS_LINK_WIDTH_2X_SUPPORTED) {
831 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
832 "IB_PORT_CAP2_IS_LINK_WIDTH_2X_SUPPORTED\n",
833 &total_len) != IB_SUCCESS)
838 static void osm_dump_port_info_to_buf(IN ib_net64_t node_guid,
839 IN ib_net64_t port_guid,
841 IN const ib_port_info_t * p_pi,
849 "\t\t\t\tport number..............%u\n"
850 "\t\t\t\tnode_guid................0x%016" PRIx64 "\n"
851 "\t\t\t\tport_guid................0x%016" PRIx64 "\n"
852 "\t\t\t\tm_key....................0x%016" PRIx64 "\n"
853 "\t\t\t\tsubnet_prefix............0x%016" PRIx64 "\n"
854 "\t\t\t\tbase_lid.................%u\n"
855 "\t\t\t\tmaster_sm_base_lid.......%u\n"
856 "\t\t\t\tcapability_mask..........0x%X\n"
857 "\t\t\t\tdiag_code................0x%X\n"
858 "\t\t\t\tm_key_lease_period.......0x%X\n"
859 "\t\t\t\tlocal_port_num...........%u\n"
860 "\t\t\t\tlink_width_enabled.......0x%X\n"
861 "\t\t\t\tlink_width_supported.....0x%X\n"
862 "\t\t\t\tlink_width_active........0x%X\n"
863 "\t\t\t\tlink_speed_supported.....0x%X\n"
864 "\t\t\t\tport_state...............%s\n"
865 "\t\t\t\tstate_info2..............0x%X\n"
866 "\t\t\t\tm_key_protect_bits.......0x%X\n"
867 "\t\t\t\tlmc......................0x%X\n"
868 "\t\t\t\tlink_speed...............0x%X\n"
869 "\t\t\t\tmtu_smsl.................0x%X\n"
870 "\t\t\t\tvl_cap_init_type.........0x%X\n"
871 "\t\t\t\tvl_high_limit............0x%X\n"
872 "\t\t\t\tvl_arb_high_cap..........0x%X\n"
873 "\t\t\t\tvl_arb_low_cap...........0x%X\n"
874 "\t\t\t\tinit_rep_mtu_cap.........0x%X\n"
875 "\t\t\t\tvl_stall_life............0x%X\n"
876 "\t\t\t\tvl_enforce...............0x%X\n"
877 "\t\t\t\tm_key_violations.........0x%X\n"
878 "\t\t\t\tp_key_violations.........0x%X\n"
879 "\t\t\t\tq_key_violations.........0x%X\n"
880 "\t\t\t\tguid_cap.................0x%X\n"
881 "\t\t\t\tclient_reregister........0x%X\n"
882 "\t\t\t\tmcast_pkey_trap_suppr....0x%X\n"
883 "\t\t\t\tsubnet_timeout...........0x%X\n"
884 "\t\t\t\tresp_time_value..........0x%X\n"
885 "\t\t\t\terror_threshold..........0x%X\n"
886 "\t\t\t\tmax_credit_hint..........0x%X\n"
887 "\t\t\t\tlink_round_trip_latency..0x%X\n"
888 "\t\t\t\tcapability_mask2.........0x%X\n"
889 "\t\t\t\tlink_speed_ext_active....0x%X\n"
890 "\t\t\t\tlink_speed_ext_supported.0x%X\n"
891 "\t\t\t\tlink_speed_ext_enabled...0x%X\n",
892 port_num, cl_ntoh64(node_guid), cl_ntoh64(port_guid),
893 cl_ntoh64(p_pi->m_key), cl_ntoh64(p_pi->subnet_prefix),
894 cl_ntoh16(p_pi->base_lid),
895 cl_ntoh16(p_pi->master_sm_base_lid),
896 cl_ntoh32(p_pi->capability_mask),
897 cl_ntoh16(p_pi->diag_code),
898 cl_ntoh16(p_pi->m_key_lease_period),
899 p_pi->local_port_num, p_pi->link_width_enabled,
900 p_pi->link_width_supported, p_pi->link_width_active,
901 ib_port_info_get_link_speed_sup(p_pi),
902 ib_get_port_state_str(ib_port_info_get_port_state
903 (p_pi)), p_pi->state_info2,
904 ib_port_info_get_mpb(p_pi), ib_port_info_get_lmc(p_pi),
905 p_pi->link_speed, p_pi->mtu_smsl, p_pi->vl_cap,
906 p_pi->vl_high_limit, p_pi->vl_arb_high_cap,
907 p_pi->vl_arb_low_cap, p_pi->mtu_cap,
908 p_pi->vl_stall_life, p_pi->vl_enforce,
909 cl_ntoh16(p_pi->m_key_violations),
910 cl_ntoh16(p_pi->p_key_violations),
911 cl_ntoh16(p_pi->q_key_violations), p_pi->guid_cap,
912 ib_port_info_get_client_rereg(p_pi),
913 ib_port_info_get_mcast_pkey_trap_suppress(p_pi),
914 ib_port_info_get_timeout(p_pi),
915 ib_port_info_get_resp_time_value(p_pi),
916 p_pi->error_threshold, cl_ntoh16(p_pi->max_credit_hint),
917 cl_ntoh32(p_pi->link_rt_latency),
918 cl_ntoh16(p_pi->capability_mask2),
919 ib_port_info_get_link_speed_ext_active(p_pi),
920 ib_port_info_get_link_speed_ext_sup(p_pi),
921 p_pi->link_speed_ext_enabled);
925 void osm_dump_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
926 IN ib_net64_t port_guid, IN uint8_t port_num,
927 IN const ib_port_info_t * p_pi,
928 IN osm_log_level_t log_level)
930 if (osm_log_is_active(p_log, log_level)) {
933 osm_dump_port_info_to_buf(node_guid, port_guid,
934 port_num, p_pi, buf);
936 osm_log(p_log, log_level, "%s", buf);
938 /* show the capabilities masks */
939 if (p_pi->capability_mask) {
940 dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",
942 osm_log(p_log, log_level, "%s", buf);
944 if ((p_pi->capability_mask & IB_PORT_CAP_HAS_CAP_MASK2) &&
945 p_pi->capability_mask2) {
946 dbg_get_capabilities2_str(buf, BUF_SIZE, "\t\t\t\t",
948 osm_log(p_log, log_level, "%s", buf);
953 void osm_dump_port_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
954 IN ib_net64_t port_guid, IN uint8_t port_num,
955 IN const ib_port_info_t * p_pi, IN const int file_id,
956 IN osm_log_level_t log_level)
958 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
961 osm_dump_port_info_to_buf(node_guid, port_guid,
962 port_num, p_pi, buf);
964 osm_log_v2(p_log, log_level, file_id, "%s", buf);
966 /* show the capabilities masks */
967 if (p_pi->capability_mask) {
968 dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",
970 osm_log_v2(p_log, log_level, file_id, "%s", buf);
972 if ((p_pi->capability_mask & IB_PORT_CAP_HAS_CAP_MASK2) &&
973 p_pi->capability_mask2) {
974 dbg_get_capabilities2_str(buf, BUF_SIZE, "\t\t\t\t",
976 osm_log(p_log, log_level, "%s", buf);
981 static void osm_dump_mlnx_ext_port_info_to_buf(IN ib_net64_t node_guid,
982 IN ib_net64_t port_guid, IN uint8_t port_num,
983 IN const ib_mlnx_ext_port_info_t * p_pi,
990 "MLNX ExtendedPortInfo dump:\n"
991 "\t\t\t\tport number..............%u\n"
992 "\t\t\t\tnode_guid................0x%016" PRIx64 "\n"
993 "\t\t\t\tport_guid................0x%016" PRIx64 "\n"
994 "\t\t\t\tStateChangeEnable........0x%X\n"
995 "\t\t\t\tLinkSpeedSupported.......0x%X\n"
996 "\t\t\t\tLinkSpeedEnabled.........0x%X\n"
997 "\t\t\t\tLinkSpeedActive..........0x%X\n",
998 port_num, cl_ntoh64(node_guid), cl_ntoh64(port_guid),
999 p_pi->state_change_enable, p_pi->link_speed_supported,
1000 p_pi->link_speed_enabled, p_pi->link_speed_active);
1004 void osm_dump_mlnx_ext_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
1005 IN ib_net64_t port_guid, IN uint8_t port_num,
1006 IN const ib_mlnx_ext_port_info_t * p_pi,
1007 IN osm_log_level_t log_level)
1009 if (osm_log_is_active(p_log, log_level)) {
1012 osm_dump_mlnx_ext_port_info_to_buf(node_guid, port_guid,
1013 port_num, p_pi, buf);
1015 osm_log(p_log, log_level, "%s", buf);
1019 void osm_dump_mlnx_ext_port_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
1020 IN ib_net64_t port_guid, IN uint8_t port_num,
1021 IN const ib_mlnx_ext_port_info_t * p_pi,
1022 IN const int file_id, IN osm_log_level_t log_level)
1024 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
1027 osm_dump_mlnx_ext_port_info_to_buf(node_guid, port_guid,
1028 port_num, p_pi, buf);
1030 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1034 static void osm_dump_portinfo_record_to_buf(IN const ib_portinfo_record_t * p_pir,
1040 const ib_port_info_t *p_pi = &p_pir->port_info;
1043 "PortInfo Record dump:\n"
1045 "\t\t\t\tEndPortLid...............%u\n"
1046 "\t\t\t\tPortNum..................%u\n"
1047 "\t\t\t\tOptions..................0x%X\n"
1048 "\t\t\t\tPortInfo dump:\n"
1049 "\t\t\t\tm_key....................0x%016" PRIx64 "\n"
1050 "\t\t\t\tsubnet_prefix............0x%016" PRIx64 "\n"
1051 "\t\t\t\tbase_lid.................%u\n"
1052 "\t\t\t\tmaster_sm_base_lid.......%u\n"
1053 "\t\t\t\tcapability_mask..........0x%X\n"
1054 "\t\t\t\tdiag_code................0x%X\n"
1055 "\t\t\t\tm_key_lease_period.......0x%X\n"
1056 "\t\t\t\tlocal_port_num...........%u\n"
1057 "\t\t\t\tlink_width_enabled.......0x%X\n"
1058 "\t\t\t\tlink_width_supported.....0x%X\n"
1059 "\t\t\t\tlink_width_active........0x%X\n"
1060 "\t\t\t\tlink_speed_supported.....0x%X\n"
1061 "\t\t\t\tport_state...............%s\n"
1062 "\t\t\t\tstate_info2..............0x%X\n"
1063 "\t\t\t\tm_key_protect_bits.......0x%X\n"
1064 "\t\t\t\tlmc......................0x%X\n"
1065 "\t\t\t\tlink_speed...............0x%X\n"
1066 "\t\t\t\tmtu_smsl.................0x%X\n"
1067 "\t\t\t\tvl_cap_init_type.........0x%X\n"
1068 "\t\t\t\tvl_high_limit............0x%X\n"
1069 "\t\t\t\tvl_arb_high_cap..........0x%X\n"
1070 "\t\t\t\tvl_arb_low_cap...........0x%X\n"
1071 "\t\t\t\tinit_rep_mtu_cap.........0x%X\n"
1072 "\t\t\t\tvl_stall_life............0x%X\n"
1073 "\t\t\t\tvl_enforce...............0x%X\n"
1074 "\t\t\t\tm_key_violations.........0x%X\n"
1075 "\t\t\t\tp_key_violations.........0x%X\n"
1076 "\t\t\t\tq_key_violations.........0x%X\n"
1077 "\t\t\t\tguid_cap.................0x%X\n"
1078 "\t\t\t\tclient_reregister........0x%X\n"
1079 "\t\t\t\tmcast_pkey_trap_suppr....0x%X\n"
1080 "\t\t\t\tsubnet_timeout...........0x%X\n"
1081 "\t\t\t\tresp_time_value..........0x%X\n"
1082 "\t\t\t\terror_threshold..........0x%X\n"
1083 "\t\t\t\tmax_credit_hint..........0x%X\n"
1084 "\t\t\t\tlink_round_trip_latency..0x%X\n"
1085 "\t\t\t\tcapability_mask2.........0x%X\n"
1086 "\t\t\t\tlink_speed_ext_active....0x%X\n"
1087 "\t\t\t\tlink_speed_ext_supported.0x%X\n"
1088 "\t\t\t\tlink_speed_ext_enabled...0x%X\n",
1089 cl_ntoh16(p_pir->lid), p_pir->port_num, p_pir->options,
1090 cl_ntoh64(p_pi->m_key), cl_ntoh64(p_pi->subnet_prefix),
1091 cl_ntoh16(p_pi->base_lid),
1092 cl_ntoh16(p_pi->master_sm_base_lid),
1093 cl_ntoh32(p_pi->capability_mask),
1094 cl_ntoh16(p_pi->diag_code),
1095 cl_ntoh16(p_pi->m_key_lease_period),
1096 p_pi->local_port_num, p_pi->link_width_enabled,
1097 p_pi->link_width_supported, p_pi->link_width_active,
1098 ib_port_info_get_link_speed_sup(p_pi),
1099 ib_get_port_state_str(ib_port_info_get_port_state
1100 (p_pi)), p_pi->state_info2,
1101 ib_port_info_get_mpb(p_pi), ib_port_info_get_lmc(p_pi),
1102 p_pi->link_speed, p_pi->mtu_smsl, p_pi->vl_cap,
1103 p_pi->vl_high_limit, p_pi->vl_arb_high_cap,
1104 p_pi->vl_arb_low_cap, p_pi->mtu_cap,
1105 p_pi->vl_stall_life, p_pi->vl_enforce,
1106 cl_ntoh16(p_pi->m_key_violations),
1107 cl_ntoh16(p_pi->p_key_violations),
1108 cl_ntoh16(p_pi->q_key_violations), p_pi->guid_cap,
1109 ib_port_info_get_client_rereg(p_pi),
1110 ib_port_info_get_mcast_pkey_trap_suppress(p_pi),
1111 ib_port_info_get_timeout(p_pi),
1112 ib_port_info_get_resp_time_value(p_pi),
1113 p_pi->error_threshold, cl_ntoh16(p_pi->max_credit_hint),
1114 cl_ntoh32(p_pi->link_rt_latency),
1115 cl_ntoh16(p_pi->capability_mask2),
1116 ib_port_info_get_link_speed_ext_active(p_pi),
1117 ib_port_info_get_link_speed_ext_sup(p_pi),
1118 p_pi->link_speed_ext_enabled);
1122 void osm_dump_portinfo_record(IN osm_log_t * p_log,
1123 IN const ib_portinfo_record_t * p_pir,
1124 IN osm_log_level_t log_level)
1126 if (osm_log_is_active(p_log, log_level)) {
1128 const ib_port_info_t *p_pi = &p_pir->port_info;
1130 osm_dump_portinfo_record_to_buf(p_pir, buf);
1132 osm_log(p_log, log_level, "%s", buf);
1134 /* show the capabilities masks */
1135 if (p_pi->capability_mask) {
1136 dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",
1138 osm_log(p_log, log_level, "%s", buf);
1140 if ((p_pi->capability_mask & IB_PORT_CAP_HAS_CAP_MASK2) &&
1141 p_pi->capability_mask2) {
1142 dbg_get_capabilities2_str(buf, BUF_SIZE, "\t\t\t\t",
1144 osm_log(p_log, log_level, "%s", buf);
1149 void osm_dump_portinfo_record_v2(IN osm_log_t * p_log,
1150 IN const ib_portinfo_record_t * p_pir,
1151 IN const int file_id,
1152 IN osm_log_level_t log_level)
1154 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
1156 const ib_port_info_t *p_pi = &p_pir->port_info;
1158 osm_dump_portinfo_record_to_buf(p_pir, buf);
1160 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1162 /* show the capabilities masks */
1163 if (p_pi->capability_mask) {
1164 dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",
1166 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1168 if ((p_pi->capability_mask & IB_PORT_CAP_HAS_CAP_MASK2) &&
1169 p_pi->capability_mask2) {
1170 dbg_get_capabilities2_str(buf, BUF_SIZE, "\t\t\t\t",
1172 osm_log(p_log, log_level, "%s", buf);
1177 static void osm_dump_guid_info_to_buf(IN ib_net64_t node_guid,
1178 IN ib_net64_t port_guid,
1179 IN uint8_t block_num,
1180 IN const ib_guid_info_t * p_gi,
1188 "\t\t\t\tblock number............%u\n"
1189 "\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
1190 "\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
1191 "\t\t\t\tGUID 0..................0x%016" PRIx64 "\n"
1192 "\t\t\t\tGUID 1..................0x%016" PRIx64 "\n"
1193 "\t\t\t\tGUID 2..................0x%016" PRIx64 "\n"
1194 "\t\t\t\tGUID 3..................0x%016" PRIx64 "\n"
1195 "\t\t\t\tGUID 4..................0x%016" PRIx64 "\n"
1196 "\t\t\t\tGUID 5..................0x%016" PRIx64 "\n"
1197 "\t\t\t\tGUID 6..................0x%016" PRIx64 "\n"
1198 "\t\t\t\tGUID 7..................0x%016" PRIx64 "\n",
1199 block_num, cl_ntoh64(node_guid), cl_ntoh64(port_guid),
1200 cl_ntoh64(p_gi->guid[0]), cl_ntoh64(p_gi->guid[1]),
1201 cl_ntoh64(p_gi->guid[2]), cl_ntoh64(p_gi->guid[3]),
1202 cl_ntoh64(p_gi->guid[4]), cl_ntoh64(p_gi->guid[5]),
1203 cl_ntoh64(p_gi->guid[6]), cl_ntoh64(p_gi->guid[7]));
1207 void osm_dump_guid_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
1208 IN ib_net64_t port_guid, IN uint8_t block_num,
1209 IN const ib_guid_info_t * p_gi,
1210 IN osm_log_level_t log_level)
1212 if (osm_log_is_active(p_log, log_level)) {
1215 osm_dump_guid_info_to_buf(node_guid, port_guid,
1216 block_num, p_gi, buf);
1218 osm_log(p_log, log_level, "%s", buf);
1222 void osm_dump_guid_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
1223 IN ib_net64_t port_guid, IN uint8_t block_num,
1224 IN const ib_guid_info_t * p_gi,
1225 IN const int file_id,
1226 IN osm_log_level_t log_level)
1228 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
1231 osm_dump_guid_info_to_buf(node_guid, port_guid,
1232 block_num, p_gi, buf);
1234 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1238 static void osm_dump_guidinfo_record_to_buf(IN const ib_guidinfo_record_t * p_gir,
1244 const ib_guid_info_t *p_gi = &p_gir->guid_info;
1247 "GUIDInfo Record dump:\n"
1249 "\t\t\t\tLid.....................%u\n"
1250 "\t\t\t\tBlockNum................0x%X\n"
1251 "\t\t\t\tReserved................0x%X\n"
1252 "\t\t\t\tGUIDInfo dump:\n"
1253 "\t\t\t\tReserved................0x%X\n"
1254 "\t\t\t\tGUID 0..................0x%016" PRIx64 "\n"
1255 "\t\t\t\tGUID 1..................0x%016" PRIx64 "\n"
1256 "\t\t\t\tGUID 2..................0x%016" PRIx64 "\n"
1257 "\t\t\t\tGUID 3..................0x%016" PRIx64 "\n"
1258 "\t\t\t\tGUID 4..................0x%016" PRIx64 "\n"
1259 "\t\t\t\tGUID 5..................0x%016" PRIx64 "\n"
1260 "\t\t\t\tGUID 6..................0x%016" PRIx64 "\n"
1261 "\t\t\t\tGUID 7..................0x%016" PRIx64 "\n",
1262 cl_ntoh16(p_gir->lid), p_gir->block_num, p_gir->resv,
1263 cl_ntoh32(p_gir->reserved),
1264 cl_ntoh64(p_gi->guid[0]), cl_ntoh64(p_gi->guid[1]),
1265 cl_ntoh64(p_gi->guid[2]), cl_ntoh64(p_gi->guid[3]),
1266 cl_ntoh64(p_gi->guid[4]), cl_ntoh64(p_gi->guid[5]),
1267 cl_ntoh64(p_gi->guid[6]), cl_ntoh64(p_gi->guid[7]));
1270 void osm_dump_guidinfo_record(IN osm_log_t * p_log,
1271 IN const ib_guidinfo_record_t * p_gir,
1272 IN osm_log_level_t log_level)
1274 if (osm_log_is_active(p_log, log_level)) {
1277 osm_dump_guidinfo_record_to_buf(p_gir, buf);
1279 osm_log(p_log, log_level, "%s", buf);
1283 void osm_dump_guidinfo_record_v2(IN osm_log_t * p_log,
1284 IN const ib_guidinfo_record_t * p_gir,
1285 IN const int file_id,
1286 IN osm_log_level_t log_level)
1288 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
1291 osm_dump_guidinfo_record_to_buf(p_gir, buf);
1293 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1297 static void osm_dump_node_info_to_buf(IN const ib_node_info_t * p_ni,
1305 "\t\t\t\tbase_version............0x%X\n"
1306 "\t\t\t\tclass_version...........0x%X\n"
1307 "\t\t\t\tnode_type...............%s\n"
1308 "\t\t\t\tnum_ports...............%u\n"
1309 "\t\t\t\tsys_guid................0x%016" PRIx64 "\n"
1310 "\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
1311 "\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
1312 "\t\t\t\tpartition_cap...........0x%X\n"
1313 "\t\t\t\tdevice_id...............0x%X\n"
1314 "\t\t\t\trevision................0x%X\n"
1315 "\t\t\t\tport_num................%u\n"
1316 "\t\t\t\tvendor_id...............0x%X\n",
1317 p_ni->base_version, p_ni->class_version,
1318 ib_get_node_type_str(p_ni->node_type), p_ni->num_ports,
1319 cl_ntoh64(p_ni->sys_guid), cl_ntoh64(p_ni->node_guid),
1320 cl_ntoh64(p_ni->port_guid),
1321 cl_ntoh16(p_ni->partition_cap),
1322 cl_ntoh16(p_ni->device_id), cl_ntoh32(p_ni->revision),
1323 ib_node_info_get_local_port_num(p_ni),
1324 cl_ntoh32(ib_node_info_get_vendor_id(p_ni)));
1328 void osm_dump_node_info(IN osm_log_t * p_log, IN const ib_node_info_t * p_ni,
1329 IN osm_log_level_t log_level)
1331 if (osm_log_is_active(p_log, log_level)) {
1334 osm_dump_node_info_to_buf(p_ni, buf);
1336 osm_log(p_log, log_level, "%s", buf);
1340 void osm_dump_node_info_v2(IN osm_log_t * p_log, IN const ib_node_info_t * p_ni,
1341 IN const int file_id, IN osm_log_level_t log_level)
1343 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
1346 osm_dump_node_info_to_buf(p_ni, buf);
1348 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1352 static void osm_dump_node_record_to_buf(IN const ib_node_record_t * p_nr,
1358 char desc[sizeof(p_nr->node_desc.description) + 1];
1359 const ib_node_info_t *p_ni = &p_nr->node_info;
1361 memcpy(desc, p_nr->node_desc.description,
1362 sizeof(p_nr->node_desc.description));
1363 desc[sizeof(desc) - 1] = '\0';
1365 "Node Record dump:\n"
1367 "\t\t\t\tLid.....................%u\n"
1368 "\t\t\t\tReserved................0x%X\n"
1369 "\t\t\t\tNodeInfo dump:\n"
1370 "\t\t\t\tbase_version............0x%X\n"
1371 "\t\t\t\tclass_version...........0x%X\n"
1372 "\t\t\t\tnode_type...............%s\n"
1373 "\t\t\t\tnum_ports...............%u\n"
1374 "\t\t\t\tsys_guid................0x%016" PRIx64 "\n"
1375 "\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
1376 "\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
1377 "\t\t\t\tpartition_cap...........0x%X\n"
1378 "\t\t\t\tdevice_id...............0x%X\n"
1379 "\t\t\t\trevision................0x%X\n"
1380 "\t\t\t\tport_num................%u\n"
1381 "\t\t\t\tvendor_id...............0x%X\n"
1382 "\t\t\t\tNodeDescription\n"
1384 cl_ntoh16(p_nr->lid), cl_ntoh16(p_nr->resv),
1385 p_ni->base_version, p_ni->class_version,
1386 ib_get_node_type_str(p_ni->node_type), p_ni->num_ports,
1387 cl_ntoh64(p_ni->sys_guid), cl_ntoh64(p_ni->node_guid),
1388 cl_ntoh64(p_ni->port_guid),
1389 cl_ntoh16(p_ni->partition_cap),
1390 cl_ntoh16(p_ni->device_id), cl_ntoh32(p_ni->revision),
1391 ib_node_info_get_local_port_num(p_ni),
1392 cl_ntoh32(ib_node_info_get_vendor_id(p_ni)), desc);
1396 void osm_dump_node_record(IN osm_log_t * p_log,
1397 IN const ib_node_record_t * p_nr,
1398 IN osm_log_level_t log_level)
1400 if (osm_log_is_active(p_log, log_level)) {
1403 osm_dump_node_record_to_buf(p_nr, buf);
1405 osm_log(p_log, log_level, "%s", buf);
1409 void osm_dump_node_record_v2(IN osm_log_t * p_log,
1410 IN const ib_node_record_t * p_nr,
1411 IN const int file_id,
1412 IN osm_log_level_t log_level)
1414 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
1417 osm_dump_node_record_to_buf(p_nr, buf);
1419 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1423 static void osm_dump_path_record_to_buf(IN const ib_path_rec_t * p_pr,
1429 char gid_str[INET6_ADDRSTRLEN];
1430 char gid_str2[INET6_ADDRSTRLEN];
1433 "PathRecord dump:\n"
1434 "\t\t\t\tservice_id..............0x%016" PRIx64 "\n"
1435 "\t\t\t\tdgid....................%s\n"
1436 "\t\t\t\tsgid....................%s\n"
1437 "\t\t\t\tdlid....................%u\n"
1438 "\t\t\t\tslid....................%u\n"
1439 "\t\t\t\thop_flow_raw............0x%X\n"
1440 "\t\t\t\ttclass..................0x%X\n"
1441 "\t\t\t\tnum_path_revers.........0x%X\n"
1442 "\t\t\t\tpkey....................0x%X\n"
1443 "\t\t\t\tqos_class...............0x%X\n"
1444 "\t\t\t\tsl......................0x%X\n"
1445 "\t\t\t\tmtu.....................0x%X\n"
1446 "\t\t\t\trate....................0x%X\n"
1447 "\t\t\t\tpkt_life................0x%X\n"
1448 "\t\t\t\tpreference..............0x%X\n"
1449 "\t\t\t\tresv2...................0x%02X%02X%02X%02X%02X%02X\n",
1450 cl_ntoh64(p_pr->service_id),
1451 inet_ntop(AF_INET6, p_pr->dgid.raw, gid_str,
1453 inet_ntop(AF_INET6, p_pr->sgid.raw, gid_str2,
1455 cl_ntoh16(p_pr->dlid), cl_ntoh16(p_pr->slid),
1456 cl_ntoh32(p_pr->hop_flow_raw), p_pr->tclass,
1457 p_pr->num_path, cl_ntoh16(p_pr->pkey),
1458 ib_path_rec_qos_class(p_pr), ib_path_rec_sl(p_pr),
1459 p_pr->mtu, p_pr->rate, p_pr->pkt_life, p_pr->preference,
1460 p_pr->resv2[0], p_pr->resv2[1], p_pr->resv2[2],
1461 p_pr->resv2[3], p_pr->resv2[4], p_pr->resv2[5]);
1465 void osm_dump_path_record(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr,
1466 IN osm_log_level_t log_level)
1468 if (osm_log_is_active(p_log, log_level)) {
1471 osm_dump_path_record_to_buf(p_pr, buf);
1473 osm_log(p_log, log_level, "%s", buf);
1477 void osm_dump_path_record_v2(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr,
1478 IN const int file_id, IN osm_log_level_t log_level)
1480 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
1483 osm_dump_path_record_to_buf(p_pr, buf);
1485 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1489 static void osm_dump_multipath_record_to_buf(IN const ib_multipath_rec_t * p_mpr,
1495 char gid_str[INET6_ADDRSTRLEN];
1496 char buf_line[1024];
1497 ib_gid_t const *p_gid = p_mpr->gids;
1500 if (p_mpr->sgid_count) {
1501 for (i = 0; i < p_mpr->sgid_count; i++) {
1502 n += sprintf(buf_line + n,
1503 "\t\t\t\tsgid%02d.................."
1505 inet_ntop(AF_INET6, p_gid->raw,
1511 if (p_mpr->dgid_count) {
1512 for (i = 0; i < p_mpr->dgid_count; i++) {
1513 n += sprintf(buf_line + n,
1514 "\t\t\t\tdgid%02d.................."
1516 inet_ntop(AF_INET6, p_gid->raw,
1523 "MultiPath Record dump:\n"
1524 "\t\t\t\thop_flow_raw............0x%X\n"
1525 "\t\t\t\ttclass..................0x%X\n"
1526 "\t\t\t\tnum_path_revers.........0x%X\n"
1527 "\t\t\t\tpkey....................0x%X\n"
1528 "\t\t\t\tqos_class...............0x%X\n"
1529 "\t\t\t\tsl......................0x%X\n"
1530 "\t\t\t\tmtu.....................0x%X\n"
1531 "\t\t\t\trate....................0x%X\n"
1532 "\t\t\t\tpkt_life................0x%X\n"
1533 "\t\t\t\tindependence............0x%X\n"
1534 "\t\t\t\tsgid_count..............0x%X\n"
1535 "\t\t\t\tdgid_count..............0x%X\n"
1536 "\t\t\t\tservice_id..............0x%016" PRIx64 "\n"
1538 cl_ntoh32(p_mpr->hop_flow_raw), p_mpr->tclass,
1539 p_mpr->num_path, cl_ntoh16(p_mpr->pkey),
1540 ib_multipath_rec_qos_class(p_mpr),
1541 ib_multipath_rec_sl(p_mpr), p_mpr->mtu, p_mpr->rate,
1542 p_mpr->pkt_life, p_mpr->independence,
1543 p_mpr->sgid_count, p_mpr->dgid_count,
1544 cl_ntoh64(ib_multipath_rec_service_id(p_mpr)),
1549 void osm_dump_multipath_record(IN osm_log_t * p_log,
1550 IN const ib_multipath_rec_t * p_mpr,
1551 IN osm_log_level_t log_level)
1553 if (osm_log_is_active(p_log, log_level)) {
1556 osm_dump_multipath_record_to_buf(p_mpr, buf);
1558 osm_log(p_log, log_level, "%s", buf);
1562 void osm_dump_multipath_record_v2(IN osm_log_t * p_log,
1563 IN const ib_multipath_rec_t * p_mpr,
1564 IN const int file_id,
1565 IN osm_log_level_t log_level)
1567 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
1570 osm_dump_multipath_record_to_buf(p_mpr, buf);
1572 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1576 static void osm_dump_mc_record_to_buf(IN const ib_member_rec_t * p_mcmr,
1582 char gid_str[INET6_ADDRSTRLEN];
1583 char gid_str2[INET6_ADDRSTRLEN];
1586 "MCMember Record dump:\n"
1587 "\t\t\t\tMGID....................%s\n"
1588 "\t\t\t\tPortGid.................%s\n"
1589 "\t\t\t\tqkey....................0x%X\n"
1590 "\t\t\t\tmlid....................0x%X\n"
1591 "\t\t\t\tmtu.....................0x%X\n"
1592 "\t\t\t\tTClass..................0x%X\n"
1593 "\t\t\t\tpkey....................0x%X\n"
1594 "\t\t\t\trate....................0x%X\n"
1595 "\t\t\t\tpkt_life................0x%X\n"
1596 "\t\t\t\tSLFlowLabelHopLimit.....0x%X\n"
1597 "\t\t\t\tScopeState..............0x%X\n"
1598 "\t\t\t\tProxyJoin...............0x%X\n",
1599 inet_ntop(AF_INET6, p_mcmr->mgid.raw, gid_str,
1601 inet_ntop(AF_INET6, p_mcmr->port_gid.raw, gid_str2,
1603 cl_ntoh32(p_mcmr->qkey), cl_ntoh16(p_mcmr->mlid),
1604 p_mcmr->mtu, p_mcmr->tclass, cl_ntoh16(p_mcmr->pkey),
1605 p_mcmr->rate, p_mcmr->pkt_life,
1606 cl_ntoh32(p_mcmr->sl_flow_hop),
1607 p_mcmr->scope_state, p_mcmr->proxy_join);
1611 void osm_dump_mc_record(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr,
1612 IN osm_log_level_t log_level)
1614 if (osm_log_is_active(p_log, log_level)) {
1617 osm_dump_mc_record_to_buf(p_mcmr, buf);
1619 osm_log(p_log, log_level, "%s", buf);
1623 void osm_dump_mc_record_v2(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr,
1624 IN const int file_id, IN osm_log_level_t log_level)
1626 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
1629 osm_dump_mc_record_to_buf(p_mcmr, buf);
1631 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1635 static void osm_dump_service_record_to_buf(IN const ib_service_record_t * p_sr,
1641 char gid_str[INET6_ADDRSTRLEN];
1642 char buf_service_key[35];
1643 char buf_service_name[65];
1645 sprintf(buf_service_key,
1646 "0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
1647 p_sr->service_key[0], p_sr->service_key[1],
1648 p_sr->service_key[2], p_sr->service_key[3],
1649 p_sr->service_key[4], p_sr->service_key[5],
1650 p_sr->service_key[6], p_sr->service_key[7],
1651 p_sr->service_key[8], p_sr->service_key[9],
1652 p_sr->service_key[10], p_sr->service_key[11],
1653 p_sr->service_key[12], p_sr->service_key[13],
1654 p_sr->service_key[14], p_sr->service_key[15]);
1655 strncpy(buf_service_name, (char *)p_sr->service_name, 64);
1656 buf_service_name[64] = '\0';
1659 "Service Record dump:\n"
1660 "\t\t\t\tServiceID...............0x%016" PRIx64 "\n"
1661 "\t\t\t\tServiceGID..............%s\n"
1662 "\t\t\t\tServiceP_Key............0x%X\n"
1663 "\t\t\t\tServiceLease............0x%X\n"
1664 "\t\t\t\tServiceKey..............%s\n"
1665 "\t\t\t\tServiceName.............%s\n"
1666 "\t\t\t\tServiceData8.1..........0x%X\n"
1667 "\t\t\t\tServiceData8.2..........0x%X\n"
1668 "\t\t\t\tServiceData8.3..........0x%X\n"
1669 "\t\t\t\tServiceData8.4..........0x%X\n"
1670 "\t\t\t\tServiceData8.5..........0x%X\n"
1671 "\t\t\t\tServiceData8.6..........0x%X\n"
1672 "\t\t\t\tServiceData8.7..........0x%X\n"
1673 "\t\t\t\tServiceData8.8..........0x%X\n"
1674 "\t\t\t\tServiceData8.9..........0x%X\n"
1675 "\t\t\t\tServiceData8.10.........0x%X\n"
1676 "\t\t\t\tServiceData8.11.........0x%X\n"
1677 "\t\t\t\tServiceData8.12.........0x%X\n"
1678 "\t\t\t\tServiceData8.13.........0x%X\n"
1679 "\t\t\t\tServiceData8.14.........0x%X\n"
1680 "\t\t\t\tServiceData8.15.........0x%X\n"
1681 "\t\t\t\tServiceData8.16.........0x%X\n"
1682 "\t\t\t\tServiceData16.1.........0x%X\n"
1683 "\t\t\t\tServiceData16.2.........0x%X\n"
1684 "\t\t\t\tServiceData16.3.........0x%X\n"
1685 "\t\t\t\tServiceData16.4.........0x%X\n"
1686 "\t\t\t\tServiceData16.5.........0x%X\n"
1687 "\t\t\t\tServiceData16.6.........0x%X\n"
1688 "\t\t\t\tServiceData16.7.........0x%X\n"
1689 "\t\t\t\tServiceData16.8.........0x%X\n"
1690 "\t\t\t\tServiceData32.1.........0x%X\n"
1691 "\t\t\t\tServiceData32.2.........0x%X\n"
1692 "\t\t\t\tServiceData32.3.........0x%X\n"
1693 "\t\t\t\tServiceData32.4.........0x%X\n"
1694 "\t\t\t\tServiceData64.1.........0x%016" PRIx64 "\n"
1695 "\t\t\t\tServiceData64.2.........0x%016" PRIx64 "\n",
1696 cl_ntoh64(p_sr->service_id),
1697 inet_ntop(AF_INET6, p_sr->service_gid.raw, gid_str,
1699 cl_ntoh16(p_sr->service_pkey),
1700 cl_ntoh32(p_sr->service_lease),
1701 buf_service_key, buf_service_name,
1702 p_sr->service_data8[0], p_sr->service_data8[1],
1703 p_sr->service_data8[2], p_sr->service_data8[3],
1704 p_sr->service_data8[4], p_sr->service_data8[5],
1705 p_sr->service_data8[6], p_sr->service_data8[7],
1706 p_sr->service_data8[8], p_sr->service_data8[9],
1707 p_sr->service_data8[10], p_sr->service_data8[11],
1708 p_sr->service_data8[12], p_sr->service_data8[13],
1709 p_sr->service_data8[14], p_sr->service_data8[15],
1710 cl_ntoh16(p_sr->service_data16[0]),
1711 cl_ntoh16(p_sr->service_data16[1]),
1712 cl_ntoh16(p_sr->service_data16[2]),
1713 cl_ntoh16(p_sr->service_data16[3]),
1714 cl_ntoh16(p_sr->service_data16[4]),
1715 cl_ntoh16(p_sr->service_data16[5]),
1716 cl_ntoh16(p_sr->service_data16[6]),
1717 cl_ntoh16(p_sr->service_data16[7]),
1718 cl_ntoh32(p_sr->service_data32[0]),
1719 cl_ntoh32(p_sr->service_data32[1]),
1720 cl_ntoh32(p_sr->service_data32[2]),
1721 cl_ntoh32(p_sr->service_data32[3]),
1722 cl_ntoh64(p_sr->service_data64[0]),
1723 cl_ntoh64(p_sr->service_data64[1]));
1727 void osm_dump_service_record(IN osm_log_t * p_log,
1728 IN const ib_service_record_t * p_sr,
1729 IN osm_log_level_t log_level)
1731 if (osm_log_is_active(p_log, log_level)) {
1734 osm_dump_service_record_to_buf(p_sr, buf);
1736 osm_log(p_log, log_level, "%s", buf);
1740 void osm_dump_service_record_v2(IN osm_log_t * p_log,
1741 IN const ib_service_record_t * p_sr,
1742 IN const int file_id,
1743 IN osm_log_level_t log_level)
1745 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
1748 osm_dump_service_record_to_buf(p_sr, buf);
1750 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1754 static void osm_dump_inform_info_to_buf_generic(IN const ib_inform_info_t * p_ii,
1761 uint8_t resp_time_val;
1762 char gid_str[INET6_ADDRSTRLEN];
1764 ib_inform_info_get_qpn_resp_time(p_ii->g_or_v.generic.
1765 qpn_resp_time_val, &qpn,
1768 "InformInfo dump:\n"
1769 "\t\t\t\tgid.....................%s\n"
1770 "\t\t\t\tlid_range_begin.........%u\n"
1771 "\t\t\t\tlid_range_end...........%u\n"
1772 "\t\t\t\tis_generic..............0x%X\n"
1773 "\t\t\t\tsubscribe...............0x%X\n"
1774 "\t\t\t\ttrap_type...............0x%X\n"
1775 "\t\t\t\ttrap_num................%u\n"
1776 "\t\t\t\tqpn.....................0x%06X\n"
1777 "\t\t\t\tresp_time_val...........0x%X\n"
1778 "\t\t\t\tnode_type...............0x%06X\n" "",
1779 inet_ntop(AF_INET6, p_ii->gid.raw, gid_str,
1781 cl_ntoh16(p_ii->lid_range_begin),
1782 cl_ntoh16(p_ii->lid_range_end),
1783 p_ii->is_generic, p_ii->subscribe,
1784 cl_ntoh16(p_ii->trap_type),
1785 cl_ntoh16(p_ii->g_or_v.generic.trap_num),
1786 cl_ntoh32(qpn), resp_time_val,
1787 cl_ntoh32(ib_inform_info_get_prod_type(p_ii)));
1791 static void osm_dump_inform_info_to_buf(IN const ib_inform_info_t * p_ii,
1798 uint8_t resp_time_val;
1799 char gid_str[INET6_ADDRSTRLEN];
1801 ib_inform_info_get_qpn_resp_time(p_ii->g_or_v.generic.
1802 qpn_resp_time_val, &qpn,
1805 "InformInfo dump:\n"
1806 "\t\t\t\tgid.....................%s\n"
1807 "\t\t\t\tlid_range_begin.........%u\n"
1808 "\t\t\t\tlid_range_end...........%u\n"
1809 "\t\t\t\tis_generic..............0x%X\n"
1810 "\t\t\t\tsubscribe...............0x%X\n"
1811 "\t\t\t\ttrap_type...............0x%X\n"
1812 "\t\t\t\tdev_id..................0x%X\n"
1813 "\t\t\t\tqpn.....................0x%06X\n"
1814 "\t\t\t\tresp_time_val...........0x%X\n"
1815 "\t\t\t\tvendor_id...............0x%06X\n" "",
1816 inet_ntop(AF_INET6, p_ii->gid.raw, gid_str,
1818 cl_ntoh16(p_ii->lid_range_begin),
1819 cl_ntoh16(p_ii->lid_range_end),
1820 p_ii->is_generic, p_ii->subscribe,
1821 cl_ntoh16(p_ii->trap_type),
1822 cl_ntoh16(p_ii->g_or_v.vend.dev_id),
1823 cl_ntoh32(qpn), resp_time_val,
1824 cl_ntoh32(ib_inform_info_get_prod_type(p_ii)));
1828 void osm_dump_inform_info(IN osm_log_t * p_log,
1829 IN const ib_inform_info_t * p_ii,
1830 IN osm_log_level_t log_level)
1832 if (osm_log_is_active(p_log, log_level)) {
1835 if (p_ii->is_generic)
1836 osm_dump_inform_info_to_buf_generic(p_ii, buf);
1838 osm_dump_inform_info_to_buf(p_ii, buf);
1840 osm_log(p_log, log_level, "%s", buf);
1844 void osm_dump_inform_info_v2(IN osm_log_t * p_log,
1845 IN const ib_inform_info_t * p_ii,
1846 IN const int file_id,
1847 IN osm_log_level_t log_level)
1849 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
1852 if (p_ii->is_generic)
1853 osm_dump_inform_info_to_buf_generic(p_ii, buf);
1855 osm_dump_inform_info_to_buf(p_ii, buf);
1857 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1861 static void osm_dump_inform_info_record_to_buf_generic(IN const ib_inform_info_record_t * p_iir,
1867 char gid_str[INET6_ADDRSTRLEN];
1868 char gid_str2[INET6_ADDRSTRLEN];
1870 uint8_t resp_time_val;
1872 ib_inform_info_get_qpn_resp_time(p_iir->inform_info.g_or_v.
1873 generic.qpn_resp_time_val,
1874 &qpn, &resp_time_val);
1876 "InformInfo Record dump:\n"
1878 "\t\t\t\tSubscriberGID...........%s\n"
1879 "\t\t\t\tSubscriberEnum..........0x%X\n"
1880 "\t\t\t\tInformInfo dump:\n"
1881 "\t\t\t\tgid.....................%s\n"
1882 "\t\t\t\tlid_range_begin.........%u\n"
1883 "\t\t\t\tlid_range_end...........%u\n"
1884 "\t\t\t\tis_generic..............0x%X\n"
1885 "\t\t\t\tsubscribe...............0x%X\n"
1886 "\t\t\t\ttrap_type...............0x%X\n"
1887 "\t\t\t\ttrap_num................%u\n"
1888 "\t\t\t\tqpn.....................0x%06X\n"
1889 "\t\t\t\tresp_time_val...........0x%X\n"
1890 "\t\t\t\tnode_type...............0x%06X\n" "",
1891 inet_ntop(AF_INET6, p_iir->subscriber_gid.raw,
1892 gid_str, sizeof gid_str),
1893 cl_ntoh16(p_iir->subscriber_enum),
1894 inet_ntop(AF_INET6, p_iir->inform_info.gid.raw,
1895 gid_str2, sizeof gid_str2),
1896 cl_ntoh16(p_iir->inform_info.lid_range_begin),
1897 cl_ntoh16(p_iir->inform_info.lid_range_end),
1898 p_iir->inform_info.is_generic,
1899 p_iir->inform_info.subscribe,
1900 cl_ntoh16(p_iir->inform_info.trap_type),
1901 cl_ntoh16(p_iir->inform_info.g_or_v.generic.
1902 trap_num), cl_ntoh32(qpn),
1904 cl_ntoh32(ib_inform_info_get_prod_type
1905 (&p_iir->inform_info)));
1909 static void osm_dump_inform_info_record_to_buf(IN const ib_inform_info_record_t * p_iir,
1915 char gid_str[INET6_ADDRSTRLEN];
1916 char gid_str2[INET6_ADDRSTRLEN];
1918 uint8_t resp_time_val;
1920 ib_inform_info_get_qpn_resp_time(p_iir->inform_info.g_or_v.
1921 generic.qpn_resp_time_val,
1922 &qpn, &resp_time_val);
1924 "InformInfo Record dump:\n"
1926 "\t\t\t\tSubscriberGID...........%s\n"
1927 "\t\t\t\tSubscriberEnum..........0x%X\n"
1928 "\t\t\t\tInformInfo dump:\n"
1929 "\t\t\t\tgid.....................%s\n"
1930 "\t\t\t\tlid_range_begin.........%u\n"
1931 "\t\t\t\tlid_range_end...........%u\n"
1932 "\t\t\t\tis_generic..............0x%X\n"
1933 "\t\t\t\tsubscribe...............0x%X\n"
1934 "\t\t\t\ttrap_type...............0x%X\n"
1935 "\t\t\t\tdev_id..................0x%X\n"
1936 "\t\t\t\tqpn.....................0x%06X\n"
1937 "\t\t\t\tresp_time_val...........0x%X\n"
1938 "\t\t\t\tvendor_id...............0x%06X\n" "",
1939 inet_ntop(AF_INET6, p_iir->subscriber_gid.raw,
1940 gid_str, sizeof gid_str),
1941 cl_ntoh16(p_iir->subscriber_enum),
1942 inet_ntop(AF_INET6, p_iir->inform_info.gid.raw,
1943 gid_str2, sizeof gid_str2),
1944 cl_ntoh16(p_iir->inform_info.lid_range_begin),
1945 cl_ntoh16(p_iir->inform_info.lid_range_end),
1946 p_iir->inform_info.is_generic,
1947 p_iir->inform_info.subscribe,
1948 cl_ntoh16(p_iir->inform_info.trap_type),
1949 cl_ntoh16(p_iir->inform_info.g_or_v.vend.
1950 dev_id), cl_ntoh32(qpn),
1952 cl_ntoh32(ib_inform_info_get_prod_type
1953 (&p_iir->inform_info)));
1957 void osm_dump_inform_info_record(IN osm_log_t * p_log,
1958 IN const ib_inform_info_record_t * p_iir,
1959 IN osm_log_level_t log_level)
1961 if (osm_log_is_active(p_log, log_level)) {
1964 if (p_iir->inform_info.is_generic)
1965 osm_dump_inform_info_record_to_buf_generic(p_iir, buf);
1967 osm_dump_inform_info_record_to_buf(p_iir, buf);
1969 osm_log(p_log, log_level, "%s", buf);
1973 void osm_dump_inform_info_record_v2(IN osm_log_t * p_log,
1974 IN const ib_inform_info_record_t * p_iir,
1975 IN const int file_id,
1976 IN osm_log_level_t log_level)
1978 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
1981 if (p_iir->inform_info.is_generic)
1982 osm_dump_inform_info_record_to_buf_generic(p_iir, buf);
1984 osm_dump_inform_info_record_to_buf(p_iir, buf);
1986 osm_log_v2(p_log, log_level, file_id, "%s", buf);
1990 static void osm_dump_link_record_to_buf(IN const ib_link_record_t * p_lr,
1997 "Link Record dump:\n"
1998 "\t\t\t\tfrom_lid................%u\n"
1999 "\t\t\t\tfrom_port_num...........%u\n"
2000 "\t\t\t\tto_port_num.............%u\n"
2001 "\t\t\t\tto_lid..................%u\n",
2002 cl_ntoh16(p_lr->from_lid),
2003 p_lr->from_port_num,
2004 p_lr->to_port_num, cl_ntoh16(p_lr->to_lid));
2008 void osm_dump_link_record(IN osm_log_t * p_log,
2009 IN const ib_link_record_t * p_lr,
2010 IN osm_log_level_t log_level)
2012 if (osm_log_is_active(p_log, log_level)) {
2015 osm_dump_link_record_to_buf(p_lr, buf);
2017 osm_log(p_log, log_level, "%s", buf);
2021 void osm_dump_link_record_v2(IN osm_log_t * p_log,
2022 IN const ib_link_record_t * p_lr,
2023 IN const int file_id,
2024 IN osm_log_level_t log_level)
2026 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2029 osm_dump_link_record_to_buf(p_lr, buf);
2031 osm_log_v2(p_log, log_level, file_id, "%s", buf);
2035 static void osm_dump_switch_info_to_buf(IN const ib_switch_info_t * p_si,
2042 "SwitchInfo dump:\n"
2043 "\t\t\t\tlin_cap.................0x%X\n"
2044 "\t\t\t\trand_cap................0x%X\n"
2045 "\t\t\t\tmcast_cap...............0x%X\n"
2046 "\t\t\t\tlin_top.................0x%X\n"
2047 "\t\t\t\tdef_port................%u\n"
2048 "\t\t\t\tdef_mcast_pri_port......%u\n"
2049 "\t\t\t\tdef_mcast_not_port......%u\n"
2050 "\t\t\t\tlife_state..............0x%X\n"
2051 "\t\t\t\tlids_per_port...........%u\n"
2052 "\t\t\t\tpartition_enf_cap.......0x%X\n"
2053 "\t\t\t\tflags...................0x%X\n"
2054 "\t\t\t\tmcast_top...............0x%X\n",
2055 cl_ntoh16(p_si->lin_cap), cl_ntoh16(p_si->rand_cap),
2056 cl_ntoh16(p_si->mcast_cap), cl_ntoh16(p_si->lin_top),
2057 p_si->def_port, p_si->def_mcast_pri_port,
2058 p_si->def_mcast_not_port, p_si->life_state,
2059 cl_ntoh16(p_si->lids_per_port),
2060 cl_ntoh16(p_si->enforce_cap), p_si->flags,
2061 cl_ntoh16(p_si->mcast_top));
2065 void osm_dump_switch_info(IN osm_log_t * p_log,
2066 IN const ib_switch_info_t * p_si,
2067 IN osm_log_level_t log_level)
2069 if (osm_log_is_active(p_log, log_level)) {
2072 osm_dump_switch_info_to_buf(p_si, buf);
2074 osm_log(p_log, OSM_LOG_VERBOSE, "%s", buf);
2078 void osm_dump_switch_info_v2(IN osm_log_t * p_log,
2079 IN const ib_switch_info_t * p_si,
2080 IN const int file_id,
2081 IN osm_log_level_t log_level)
2083 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2086 osm_dump_switch_info_to_buf(p_si, buf);
2088 osm_log_v2(p_log, OSM_LOG_VERBOSE, file_id, "%s", buf);
2092 static void osm_dump_switch_info_record_to_buf(IN const ib_switch_info_record_t * p_sir,
2099 "SwitchInfo Record dump:\n"
2101 "\t\t\t\tlid.....................%u\n"
2102 "\t\t\t\tSwitchInfo dump:\n"
2103 "\t\t\t\tlin_cap.................0x%X\n"
2104 "\t\t\t\trand_cap................0x%X\n"
2105 "\t\t\t\tmcast_cap...............0x%X\n"
2106 "\t\t\t\tlin_top.................0x%X\n"
2107 "\t\t\t\tdef_port................%u\n"
2108 "\t\t\t\tdef_mcast_pri_port......%u\n"
2109 "\t\t\t\tdef_mcast_not_port......%u\n"
2110 "\t\t\t\tlife_state..............0x%X\n"
2111 "\t\t\t\tlids_per_port...........%u\n"
2112 "\t\t\t\tpartition_enf_cap.......0x%X\n"
2113 "\t\t\t\tflags...................0x%X\n",
2114 cl_ntoh16(p_sir->lid),
2115 cl_ntoh16(p_sir->switch_info.lin_cap),
2116 cl_ntoh16(p_sir->switch_info.rand_cap),
2117 cl_ntoh16(p_sir->switch_info.mcast_cap),
2118 cl_ntoh16(p_sir->switch_info.lin_top),
2119 p_sir->switch_info.def_port,
2120 p_sir->switch_info.def_mcast_pri_port,
2121 p_sir->switch_info.def_mcast_not_port,
2122 p_sir->switch_info.life_state,
2123 cl_ntoh16(p_sir->switch_info.lids_per_port),
2124 cl_ntoh16(p_sir->switch_info.enforce_cap),
2125 p_sir->switch_info.flags);
2129 void osm_dump_switch_info_record(IN osm_log_t * p_log,
2130 IN const ib_switch_info_record_t * p_sir,
2131 IN osm_log_level_t log_level)
2133 if (osm_log_is_active(p_log, log_level)) {
2136 osm_dump_switch_info_record_to_buf(p_sir, buf);
2138 osm_log(p_log, log_level, "%s", buf);
2142 void osm_dump_switch_info_record_v2(IN osm_log_t * p_log,
2143 IN const ib_switch_info_record_t * p_sir,
2144 IN const int file_id,
2145 IN osm_log_level_t log_level)
2147 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2150 osm_dump_switch_info_record_to_buf(p_sir, buf);
2152 osm_log_v2(p_log, log_level, file_id, "%s", buf);
2156 static void osm_dump_pkey_block_to_buf(IN uint64_t port_guid,
2157 IN uint16_t block_num,
2158 IN uint8_t port_num,
2159 IN const ib_pkey_table_t * p_pkey_tbl,
2162 if (!buf || !p_pkey_tbl)
2165 char buf_line[1024];
2168 for (i = 0, n = 0; i < 32; i++)
2169 n += sprintf(buf_line + n, " 0x%04x |",
2170 cl_ntoh16(p_pkey_tbl->pkey_entry[i]));
2173 "P_Key table dump:\n"
2174 "\t\t\tport_guid...........0x%016" PRIx64 "\n"
2175 "\t\t\tblock_num...........0x%X\n"
2176 "\t\t\tport_num............%u\n\tP_Key Table: %s\n",
2177 cl_ntoh64(port_guid), block_num, port_num, buf_line);
2181 void osm_dump_pkey_block(IN osm_log_t * p_log, IN uint64_t port_guid,
2182 IN uint16_t block_num, IN uint8_t port_num,
2183 IN const ib_pkey_table_t * p_pkey_tbl,
2184 IN osm_log_level_t log_level)
2186 if (osm_log_is_active(p_log, log_level)) {
2189 osm_dump_pkey_block_to_buf(port_guid, block_num, port_num,
2192 osm_log(p_log, log_level, "%s", buf);
2196 void osm_dump_pkey_block_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
2197 IN uint16_t block_num, IN uint8_t port_num,
2198 IN const ib_pkey_table_t * p_pkey_tbl,
2199 IN const int file_id,
2200 IN osm_log_level_t log_level)
2202 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2205 osm_dump_pkey_block_to_buf(port_guid, block_num,
2206 port_num, p_pkey_tbl, buf);
2208 osm_log_v2(p_log, log_level, file_id, "%s", buf);
2212 static void osm_dump_slvl_map_table_to_buf(IN uint64_t port_guid,
2213 IN uint8_t in_port_num,
2214 IN uint8_t out_port_num,
2215 IN const ib_slvl_table_t * p_slvl_tbl,
2218 if (!buf || !p_slvl_tbl)
2221 char buf_line1[1024], buf_line2[1024];
2225 for (i = 0, n = 0; i < 16; i++)
2226 n += sprintf(buf_line1 + n, " %-2u |", i);
2227 for (i = 0, n = 0; i < 16; i++)
2228 n += sprintf(buf_line2 + n, "0x%01X |",
2229 ib_slvl_table_get(p_slvl_tbl, i));
2232 "\t\t\tport_guid............0x%016" PRIx64 "\n"
2233 "\t\t\tin_port_num..........%u\n"
2234 "\t\t\tout_port_num.........%u\n\tSL: | %s\n\tVL: | %s\n",
2235 cl_ntoh64(port_guid), in_port_num, out_port_num,
2236 buf_line1, buf_line2);
2240 void osm_dump_slvl_map_table(IN osm_log_t * p_log, IN uint64_t port_guid,
2241 IN uint8_t in_port_num, IN uint8_t out_port_num,
2242 IN const ib_slvl_table_t * p_slvl_tbl,
2243 IN osm_log_level_t log_level)
2245 if (osm_log_is_active(p_log, log_level)) {
2248 osm_dump_slvl_map_table_to_buf(port_guid, in_port_num,
2249 out_port_num, p_slvl_tbl, buf);
2251 osm_log(p_log, log_level, "%s", buf);
2255 void osm_dump_slvl_map_table_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
2256 IN uint8_t in_port_num, IN uint8_t out_port_num,
2257 IN const ib_slvl_table_t * p_slvl_tbl,
2258 IN const int file_id,
2259 IN osm_log_level_t log_level)
2261 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2264 osm_dump_slvl_map_table_to_buf(port_guid, in_port_num,
2265 out_port_num, p_slvl_tbl, buf);
2267 osm_log_v2(p_log, log_level, file_id, "%s", buf);
2271 static void osm_dump_vl_arb_table_to_buf(IN uint64_t port_guid,
2272 IN uint8_t block_num,
2273 IN uint8_t port_num,
2274 IN const ib_vl_arb_table_t * p_vla_tbl,
2277 if (!buf || !p_vla_tbl)
2280 char buf_line1[1024], buf_line2[1024];
2283 for (i = 0, n = 0; i < 32; i++)
2284 n += sprintf(buf_line1 + n, " 0x%01X |",
2285 p_vla_tbl->vl_entry[i].vl);
2286 for (i = 0, n = 0; i < 32; i++)
2287 n += sprintf(buf_line2 + n, " 0x%01X |",
2288 p_vla_tbl->vl_entry[i].weight);
2290 "VLArb dump:\n" "\t\t\tport_guid...........0x%016"
2291 PRIx64 "\n" "\t\t\tblock_num...........0x%X\n"
2292 "\t\t\tport_num............%u\n\tVL : | %s\n\tWEIGHT:| %s\n",
2293 cl_ntoh64(port_guid), block_num, port_num, buf_line1,
2298 void osm_dump_vl_arb_table(IN osm_log_t * p_log, IN uint64_t port_guid,
2299 IN uint8_t block_num, IN uint8_t port_num,
2300 IN const ib_vl_arb_table_t * p_vla_tbl,
2301 IN osm_log_level_t log_level)
2303 if (osm_log_is_active(p_log, log_level)) {
2306 osm_dump_vl_arb_table_to_buf(port_guid, block_num,
2307 port_num, p_vla_tbl, buf);
2309 osm_log(p_log, log_level, "%s", buf);
2313 void osm_dump_vl_arb_table_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
2314 IN uint8_t block_num, IN uint8_t port_num,
2315 IN const ib_vl_arb_table_t * p_vla_tbl,
2316 IN const int file_id,
2317 IN osm_log_level_t log_level)
2319 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2322 osm_dump_vl_arb_table_to_buf(port_guid, block_num,
2323 port_num, p_vla_tbl, buf);
2325 osm_log_v2(p_log, log_level, file_id, "%s", buf);
2329 static void osm_dump_sm_info_to_buf(IN const ib_sm_info_t * p_smi,
2337 "\t\t\t\tguid....................0x%016" PRIx64 "\n"
2338 "\t\t\t\tsm_key..................0x%016" PRIx64 "\n"
2339 "\t\t\t\tact_count...............%u\n"
2340 "\t\t\t\tpriority................%u\n"
2341 "\t\t\t\tsm_state................%u\n",
2342 cl_ntoh64(p_smi->guid), cl_ntoh64(p_smi->sm_key),
2343 cl_ntoh32(p_smi->act_count),
2344 ib_sminfo_get_priority(p_smi),
2345 ib_sminfo_get_state(p_smi));
2349 void osm_dump_sm_info(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,
2350 IN osm_log_level_t log_level)
2352 if (osm_log_is_active(p_log, log_level)) {
2355 osm_dump_sm_info_to_buf(p_smi, buf);
2357 osm_log(p_log, OSM_LOG_DEBUG, "%s", buf);
2361 void osm_dump_sm_info_v2(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,
2362 IN const int file_id, IN osm_log_level_t log_level)
2364 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2367 osm_dump_sm_info_to_buf(p_smi, buf);
2369 osm_log_v2(p_log, OSM_LOG_DEBUG, file_id, "%s", buf);
2373 static void osm_dump_sm_info_record_to_buf(IN const ib_sminfo_record_t * p_smir,
2376 if (!buf || !p_smir)
2380 "SMInfo Record dump:\n"
2382 "\t\t\t\tLid.....................%u\n"
2383 "\t\t\t\tReserved................0x%X\n"
2384 "\t\t\t\tSMInfo dump:\n"
2385 "\t\t\t\tguid....................0x%016" PRIx64 "\n"
2386 "\t\t\t\tsm_key..................0x%016" PRIx64 "\n"
2387 "\t\t\t\tact_count...............%u\n"
2388 "\t\t\t\tpriority................%u\n"
2389 "\t\t\t\tsm_state................%u\n",
2390 cl_ntoh16(p_smir->lid), cl_ntoh16(p_smir->resv0),
2391 cl_ntoh64(p_smir->sm_info.guid),
2392 cl_ntoh64(p_smir->sm_info.sm_key),
2393 cl_ntoh32(p_smir->sm_info.act_count),
2394 ib_sminfo_get_priority(&p_smir->sm_info),
2395 ib_sminfo_get_state(&p_smir->sm_info));
2399 void osm_dump_sm_info_record(IN osm_log_t * p_log,
2400 IN const ib_sminfo_record_t * p_smir,
2401 IN osm_log_level_t log_level)
2403 if (osm_log_is_active(p_log, log_level)) {
2406 osm_dump_sm_info_record_to_buf(p_smir, buf);
2408 osm_log(p_log, OSM_LOG_DEBUG, "%s", buf);
2412 void osm_dump_sm_info_record_v2(IN osm_log_t * p_log,
2413 IN const ib_sminfo_record_t * p_smir,
2414 IN const int file_id,
2415 IN osm_log_level_t log_level)
2417 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2420 osm_dump_sm_info_record_to_buf(p_smir, buf);
2422 osm_log_v2(p_log, OSM_LOG_DEBUG, file_id, "%s", buf);
2426 static void osm_dump_notice_to_buf_generic(IN const ib_mad_notice_attr_t * p_ntci,
2429 if (!log_buf || !p_ntci)
2432 char gid_str[INET6_ADDRSTRLEN];
2433 char gid_str2[INET6_ADDRSTRLEN];
2439 /* immediate data based on the trap */
2440 switch (cl_ntoh16(p_ntci->g_or_v.generic.trap_num)) {
2441 case SM_GID_IN_SERVICE_TRAP: /* 64 */
2442 case SM_GID_OUT_OF_SERVICE_TRAP: /* 65 */
2443 case SM_MGID_CREATED_TRAP: /* 66 */
2444 case SM_MGID_DESTROYED_TRAP: /* 67 */
2446 "\t\t\t\tsrc_gid..................%s\n",
2447 inet_ntop(AF_INET6, p_ntci->data_details.
2448 ntc_64_67.gid.raw, gid_str,
2451 case SM_LINK_STATE_CHANGED_TRAP: /* 128 */
2453 "\t\t\t\tsw_lid...................%u\n",
2454 cl_ntoh16(p_ntci->data_details.ntc_128.sw_lid));
2456 case SM_LINK_INTEGRITY_THRESHOLD_TRAP: /* 129 */
2457 case SM_BUFFER_OVERRUN_THRESHOLD_TRAP: /* 130 */
2458 case SM_WATCHDOG_TIMER_EXPIRED_TRAP: /* 131 */
2460 "\t\t\t\tlid......................%u\n"
2461 "\t\t\t\tport_num.................%u\n",
2462 cl_ntoh16(p_ntci->data_details.
2464 p_ntci->data_details.ntc_129_131.port_num);
2466 case SM_LOCAL_CHANGES_TRAP: /* 144 */
2468 "\t\t\t\tlid......................%u\n"
2469 "\t\t\t\tlocal_changes............%u\n"
2470 "\t\t\t\tnew_cap_mask.............0x%08x\n"
2471 "\t\t\t\tchange_flags.............0x%x\n"
2472 "\t\t\t\tcap_mask2................0x%x\n",
2473 cl_ntoh16(p_ntci->data_details.ntc_144.lid),
2474 p_ntci->data_details.ntc_144.local_changes,
2475 cl_ntoh32(p_ntci->data_details.ntc_144.
2477 cl_ntoh16(p_ntci->data_details.ntc_144.
2479 cl_ntoh16(p_ntci->data_details.ntc_144.
2482 case SM_SYS_IMG_GUID_CHANGED_TRAP: /* 145 */
2484 "\t\t\t\tlid......................%u\n"
2485 "\t\t\t\tnew_sys_guid.............0x%016"
2487 cl_ntoh16(p_ntci->data_details.ntc_145.
2489 cl_ntoh64(p_ntci->data_details.ntc_145.
2492 case SM_BAD_MKEY_TRAP: /* 256 */
2494 "\t\t\t\tlid......................%u\n"
2495 "\t\t\t\tdrslid...................%u\n"
2496 "\t\t\t\tmethod...................0x%x\n"
2497 "\t\t\t\tattr_id..................0x%x\n"
2498 "\t\t\t\tattr_mod.................0x%x\n"
2499 "\t\t\t\tm_key....................0x%016"
2501 "\t\t\t\tdr_notice................%d\n"
2502 "\t\t\t\tdr_path_truncated........%d\n"
2503 "\t\t\t\tdr_hop_count.............%u\n",
2504 cl_ntoh16(p_ntci->data_details.ntc_256.lid),
2505 cl_ntoh16(p_ntci->data_details.ntc_256.
2507 p_ntci->data_details.ntc_256.method,
2508 cl_ntoh16(p_ntci->data_details.ntc_256.
2510 cl_ntoh32(p_ntci->data_details.ntc_256.
2512 cl_ntoh64(p_ntci->data_details.ntc_256.
2514 p_ntci->data_details.ntc_256.
2516 p_ntci->data_details.ntc_256.
2518 p_ntci->data_details.ntc_256.
2519 dr_trunc_hop & 0x3f);
2520 n += snprintf(buff + n, sizeof(buff) - n,
2521 "Directed Path Dump of %u hop path:"
2522 "\n\t\t\t\tPath = ",
2523 p_ntci->data_details.ntc_256.
2524 dr_trunc_hop & 0x3f);
2525 n += sprint_uint8_arr(buff + n, sizeof(buff) - n,
2526 p_ntci->data_details.ntc_256.
2528 (p_ntci->data_details.ntc_256.
2529 dr_trunc_hop & 0x3f) + 1);
2530 if (n >= sizeof(buff)) {
2531 n = sizeof(buff) - 2;
2534 snprintf(buff + n, sizeof(buff) - n, "\n");
2536 case SM_BAD_PKEY_TRAP: /* 257 */
2537 case SM_BAD_QKEY_TRAP: /* 258 */
2539 "\t\t\t\tlid1.....................%u\n"
2540 "\t\t\t\tlid2.....................%u\n"
2541 "\t\t\t\tkey......................0x%x\n"
2542 "\t\t\t\tsl.......................%d\n"
2543 "\t\t\t\tqp1......................0x%x\n"
2544 "\t\t\t\tqp2......................0x%x\n"
2545 "\t\t\t\tgid1.....................%s\n"
2546 "\t\t\t\tgid2.....................%s\n",
2547 cl_ntoh16(p_ntci->data_details.ntc_257_258.
2549 cl_ntoh16(p_ntci->data_details.ntc_257_258.
2551 cl_ntoh32(p_ntci->data_details.ntc_257_258.key),
2552 cl_ntoh32(p_ntci->data_details.ntc_257_258.
2554 cl_ntoh32(p_ntci->data_details.ntc_257_258.
2556 cl_ntoh32(p_ntci->data_details.ntc_257_258.
2558 inet_ntop(AF_INET6, p_ntci->data_details.
2559 ntc_257_258.gid1.raw, gid_str,
2561 inet_ntop(AF_INET6, p_ntci->data_details.
2562 ntc_257_258.gid2.raw, gid_str2,
2565 case SM_BAD_SWITCH_PKEY_TRAP: /* 259 */
2567 "\t\t\t\tdata_valid...............0x%x\n"
2568 "\t\t\t\tlid1.....................%u\n"
2569 "\t\t\t\tlid2.....................%u\n"
2570 "\t\t\t\tpkey.....................0x%x\n"
2571 "\t\t\t\tsl.......................%d\n"
2572 "\t\t\t\tqp1......................0x%x\n"
2573 "\t\t\t\tqp2......................0x%x\n"
2574 "\t\t\t\tgid1.....................%s\n"
2575 "\t\t\t\tgid2.....................%s\n"
2576 "\t\t\t\tsw_lid...................%u\n"
2577 "\t\t\t\tport_no..................%u\n",
2578 cl_ntoh16(p_ntci->data_details.ntc_259.
2580 cl_ntoh16(p_ntci->data_details.ntc_259.lid1),
2581 cl_ntoh16(p_ntci->data_details.ntc_259.lid2),
2582 cl_ntoh16(p_ntci->data_details.ntc_259.pkey),
2583 cl_ntoh32(p_ntci->data_details.ntc_259.
2585 cl_ntoh32(p_ntci->data_details.ntc_259.
2587 cl_ntoh32(p_ntci->data_details.ntc_259.qp2),
2588 inet_ntop(AF_INET6, p_ntci->data_details.
2589 ntc_259.gid1.raw, gid_str,
2591 inet_ntop(AF_INET6, p_ntci->data_details.
2592 ntc_259.gid2.raw, gid_str2,
2594 cl_ntoh16(p_ntci->data_details.ntc_259.sw_lid),
2595 p_ntci->data_details.ntc_259.port_no);
2600 "Generic Notice dump:\n"
2601 "\t\t\t\ttype.....................%u\n"
2602 "\t\t\t\tprod_type................%u (%s)\n"
2603 "\t\t\t\ttrap_num.................%u\n%s",
2604 ib_notice_get_type(p_ntci),
2605 cl_ntoh32(ib_notice_get_prod_type(p_ntci)),
2606 ib_get_producer_type_str(ib_notice_get_prod_type
2608 cl_ntoh16(p_ntci->g_or_v.generic.trap_num), buff);
2612 static void osm_dump_notice_to_buf(IN const ib_mad_notice_attr_t * p_ntci,
2615 if (!buf || !p_ntci)
2619 "Vendor Notice dump:\n"
2620 "\t\t\t\ttype.....................%u\n"
2621 "\t\t\t\tvendor...................%u\n"
2622 "\t\t\t\tdevice_id................%u\n",
2623 cl_ntoh16(ib_notice_get_type(p_ntci)),
2624 cl_ntoh32(ib_notice_get_vend_id(p_ntci)),
2625 cl_ntoh16(p_ntci->g_or_v.vend.dev_id));
2629 void osm_dump_notice(IN osm_log_t * p_log,
2630 IN const ib_mad_notice_attr_t * p_ntci,
2631 IN osm_log_level_t log_level)
2633 if (osm_log_is_active(p_log, log_level)) {
2636 if (ib_notice_is_generic(p_ntci))
2637 osm_dump_notice_to_buf_generic(p_ntci, buf);
2639 osm_dump_notice_to_buf(p_ntci, buf);
2641 osm_log(p_log, log_level, "%s", buf);
2645 void osm_dump_notice_v2(IN osm_log_t * p_log,
2646 IN const ib_mad_notice_attr_t * p_ntci,
2647 IN const int file_id, IN osm_log_level_t log_level)
2649 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2652 if (ib_notice_is_generic(p_ntci))
2653 osm_dump_notice_to_buf_generic(p_ntci, buf);
2655 osm_dump_notice_to_buf(p_ntci, buf);
2657 osm_log_v2(p_log, log_level, file_id, "%s", buf);
2661 static void osm_dump_dr_smp_to_buf(IN const ib_smp_t * p_smp, OUT char * buf,
2671 "\t\t\t\tbase_ver................0x%X\n"
2672 "\t\t\t\tmgmt_class..............0x%X\n"
2673 "\t\t\t\tclass_ver...............0x%X\n"
2674 "\t\t\t\tmethod..................0x%X (%s)\n",
2675 p_smp->base_ver, p_smp->mgmt_class,
2676 p_smp->class_ver, p_smp->method,
2677 ib_get_sm_method_str(p_smp->method));
2679 if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
2680 n += snprintf(buf + n, buf_size - n,
2681 "\t\t\t\tD bit...................0x%X\n"
2682 "\t\t\t\tstatus..................0x%X\n",
2684 cl_ntoh16(ib_smp_get_status(p_smp)));
2686 n += snprintf(buf + n, buf_size - n,
2687 "\t\t\t\tstatus..................0x%X\n",
2688 cl_ntoh16(p_smp->status));
2691 n += snprintf(buf + n, buf_size - n,
2692 "\t\t\t\thop_ptr.................0x%X\n"
2693 "\t\t\t\thop_count...............0x%X\n"
2694 "\t\t\t\ttrans_id................0x%" PRIx64 "\n"
2695 "\t\t\t\tattr_id.................0x%X (%s)\n"
2696 "\t\t\t\tresv....................0x%X\n"
2697 "\t\t\t\tattr_mod................0x%X\n"
2698 "\t\t\t\tm_key...................0x%016" PRIx64
2699 "\n", p_smp->hop_ptr, p_smp->hop_count,
2700 cl_ntoh64(p_smp->trans_id),
2701 cl_ntoh16(p_smp->attr_id),
2702 ib_get_sm_attr_str(p_smp->attr_id),
2703 cl_ntoh16(p_smp->resv),
2704 cl_ntoh32(p_smp->attr_mod),
2705 cl_ntoh64(p_smp->m_key));
2707 if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
2709 n += snprintf(buf + n, buf_size - n,
2710 "\t\t\t\tdr_slid.................%u\n"
2711 "\t\t\t\tdr_dlid.................%u\n",
2712 cl_ntoh16(p_smp->dr_slid),
2713 cl_ntoh16(p_smp->dr_dlid));
2715 n += snprintf(buf + n, buf_size - n,
2716 "\n\t\t\t\tInitial path: ");
2717 n += sprint_uint8_arr(buf + n, buf_size - n,
2718 p_smp->initial_path,
2719 p_smp->hop_count + 1);
2721 n += snprintf(buf + n, buf_size - n,
2722 "\n\t\t\t\tReturn path: ");
2723 n += sprint_uint8_arr(buf + n, buf_size - n,
2725 p_smp->hop_count + 1);
2727 n += snprintf(buf + n, buf_size - n,
2728 "\n\t\t\t\tReserved: ");
2729 for (i = 0; i < 7; i++) {
2730 n += snprintf(buf + n, buf_size - n,
2731 "[%0X]", p_smp->resv1[i]);
2733 n += snprintf(buf + n, buf_size - n, "\n");
2735 for (i = 0; i < 64; i += 16) {
2736 n += snprintf(buf + n, buf_size - n,
2737 "\n\t\t\t\t%02X %02X %02X %02X "
2738 "%02X %02X %02X %02X"
2739 " %02X %02X %02X %02X %02X %02X %02X %02X\n",
2750 p_smp->data[i + 10],
2751 p_smp->data[i + 11],
2752 p_smp->data[i + 12],
2753 p_smp->data[i + 13],
2754 p_smp->data[i + 14],
2755 p_smp->data[i + 15]);
2758 /* not a Direct Route so provide source and destination lids */
2759 n += snprintf(buf + n, buf_size - n,
2760 "\t\t\t\tMAD IS LID ROUTED\n");
2765 void osm_dump_dr_smp(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
2766 IN osm_log_level_t log_level)
2768 if (osm_log_is_active(p_log, log_level)) {
2771 osm_dump_dr_smp_to_buf(p_smp, buf, BUF_SIZE);
2773 osm_log(p_log, log_level, "%s", buf);
2777 void osm_dump_dr_smp_v2(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
2778 IN const int file_id, IN osm_log_level_t log_level)
2780 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2783 osm_dump_dr_smp_to_buf(p_smp, buf, BUF_SIZE);
2785 osm_log_v2(p_log, log_level, file_id, "%s", buf);
2789 static void osm_dump_sa_mad_to_buf(IN const ib_sa_mad_t * p_mad, OUT char * buf)
2794 /* make sure the mad is valid */
2795 if (p_mad == NULL) {
2796 sprintf(buf, "NULL MAD POINTER\n");
2802 "\t\t\t\tbase_ver................0x%X\n"
2803 "\t\t\t\tmgmt_class..............0x%X\n"
2804 "\t\t\t\tclass_ver...............0x%X\n"
2805 "\t\t\t\tmethod..................0x%X (%s)\n"
2806 "\t\t\t\tstatus..................0x%X\n"
2807 "\t\t\t\tresv....................0x%X\n"
2808 "\t\t\t\ttrans_id................0x%" PRIx64 "\n"
2809 "\t\t\t\tattr_id.................0x%X (%s)\n"
2810 "\t\t\t\tresv1...................0x%X\n"
2811 "\t\t\t\tattr_mod................0x%X\n"
2812 "\t\t\t\trmpp_version............0x%X\n"
2813 "\t\t\t\trmpp_type...............0x%X\n"
2814 "\t\t\t\trmpp_flags..............0x%X\n"
2815 "\t\t\t\trmpp_status.............0x%X\n"
2816 "\t\t\t\tseg_num.................0x%X\n"
2817 "\t\t\t\tpayload_len/new_win.....0x%X\n"
2818 "\t\t\t\tsm_key..................0x%016" PRIx64 "\n"
2819 "\t\t\t\tattr_offset.............0x%X\n"
2820 "\t\t\t\tresv2...................0x%X\n"
2821 "\t\t\t\tcomp_mask...............0x%016" PRIx64 "\n",
2822 p_mad->base_ver, p_mad->mgmt_class, p_mad->class_ver,
2823 p_mad->method, ib_get_sa_method_str(p_mad->method),
2824 cl_ntoh16(p_mad->status), cl_ntoh16(p_mad->resv),
2825 cl_ntoh64(p_mad->trans_id), cl_ntoh16(p_mad->attr_id),
2826 ib_get_sa_attr_str(p_mad->attr_id),
2827 cl_ntoh16(p_mad->resv1), cl_ntoh32(p_mad->attr_mod),
2828 p_mad->rmpp_version, p_mad->rmpp_type,
2829 p_mad->rmpp_flags, p_mad->rmpp_status,
2830 cl_ntoh32(p_mad->seg_num),
2831 cl_ntoh32(p_mad->paylen_newwin),
2832 cl_ntoh64(p_mad->sm_key), cl_ntoh16(p_mad->attr_offset),
2833 cl_ntoh16(p_mad->resv3), cl_ntoh64(p_mad->comp_mask));
2839 void osm_dump_sa_mad(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_mad,
2840 IN osm_log_level_t log_level)
2842 if (osm_log_is_active(p_log, log_level)) {
2845 osm_dump_sa_mad_to_buf(p_mad, buf);
2847 osm_log(p_log, log_level, "%s\n", buf);
2851 void osm_dump_sa_mad_v2(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_mad,
2852 IN const int file_id, IN osm_log_level_t log_level)
2854 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2857 osm_dump_sa_mad_to_buf(p_mad, buf);
2859 osm_log_v2(p_log, log_level, file_id, "%s", buf);
2863 static void osm_dump_dr_path_to_buf(IN const osm_dr_path_t * p_path,
2864 OUT char * buf, IN size_t buf_size)
2866 if (!buf || !p_path)
2871 n = sprintf(buf, "Directed Path Dump of %u hop path: "
2872 "Path = ", p_path->hop_count);
2874 sprint_uint8_arr(buf + n, buf_size - n, p_path->path,
2875 p_path->hop_count + 1);
2879 void osm_dump_dr_path(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,
2880 IN osm_log_level_t log_level)
2882 if (osm_log_is_active(p_log, log_level)) {
2885 osm_dump_dr_path_to_buf(p_path, buf, BUF_SIZE);
2887 osm_log(p_log, log_level, "%s\n", buf);
2891 void osm_dump_dr_path_v2(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,
2892 IN const int file_id, IN osm_log_level_t log_level)
2894 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2897 osm_dump_dr_path_to_buf(p_path, buf, BUF_SIZE);
2899 osm_log_v2(p_log, log_level, file_id, "%s\n", buf);
2903 static void osm_dump_smp_dr_path_to_buf(IN const ib_smp_t * p_smp,
2904 OUT char * buf, IN size_t buf_size)
2911 n = sprintf(buf, "Received SMP on a %u hop path: "
2912 "Initial path = ", p_smp->hop_count);
2913 n += sprint_uint8_arr(buf + n, buf_size - n,
2914 p_smp->initial_path,
2915 p_smp->hop_count + 1);
2917 n += snprintf(buf + n, buf_size - n, ", Return path = ");
2918 n += sprint_uint8_arr(buf + n, buf_size - n,
2919 p_smp->return_path, p_smp->hop_count + 1);
2923 void osm_dump_smp_dr_path(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
2924 IN osm_log_level_t log_level)
2926 if (osm_log_is_active(p_log, log_level)) {
2929 osm_dump_smp_dr_path_to_buf(p_smp, buf, BUF_SIZE);
2931 osm_log(p_log, log_level, "%s\n", buf);
2935 void osm_dump_smp_dr_path_v2(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
2936 IN const int file_id, IN osm_log_level_t log_level)
2938 if (osm_log_is_active_v2(p_log, log_level, file_id)) {
2941 osm_dump_smp_dr_path_to_buf(p_smp, buf, BUF_SIZE);
2943 osm_log_v2(p_log, log_level, file_id, "%s\n", buf);
2947 void osm_dump_dr_path_as_buf(IN size_t max_len,
2948 IN const osm_dr_path_t * p_path,
2951 sprint_uint8_arr(buf, max_len, p_path->path, p_path->hop_count + 1);
2954 static const char *sm_signal_str[] = {
2955 "OSM_SIGNAL_NONE", /* 0 */
2956 "OSM_SIGNAL_SWEEP", /* 1 */
2957 "OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST", /* 2 */
2958 "OSM_SIGNAL_PERFMGR_SWEEP", /* 3 */
2959 "OSM_SIGNAL_GUID_PROCESS_REQUEST", /* 4 */
2960 "UNKNOWN SIGNAL!!" /* 5 */
2963 const char *osm_get_sm_signal_str(IN osm_signal_t signal)
2965 if (signal > OSM_SIGNAL_MAX)
2966 signal = OSM_SIGNAL_MAX;
2967 return sm_signal_str[signal];
2970 static const char *disp_msg_str[] = {
2972 "OSM_MSG_MAD_NODE_INFO",
2973 "OSM_MSG_MAD_PORT_INFO",
2974 "OSM_MSG_MAD_SWITCH_INFO",
2975 "OSM_MSG_MAD_GUID_INFO",
2976 "OSM_MSG_MAD_NODE_DESC",
2977 "OSM_MSG_MAD_NODE_RECORD",
2978 "OSM_MSG_MAD_PORTINFO_RECORD",
2979 "OSM_MSG_MAD_SERVICE_RECORD",
2980 "OSM_MSG_MAD_PATH_RECORD",
2981 "OSM_MSG_MAD_MCMEMBER_RECORD",
2982 "OSM_MSG_MAD_LINK_RECORD",
2983 "OSM_MSG_MAD_SMINFO_RECORD",
2984 "OSM_MSG_MAD_CLASS_PORT_INFO",
2985 "OSM_MSG_MAD_INFORM_INFO",
2986 "OSM_MSG_MAD_LFT_RECORD",
2988 "OSM_MSG_MAD_SM_INFO",
2989 "OSM_MSG_MAD_NOTICE",
2990 "OSM_MSG_LIGHT_SWEEP_FAIL",
2992 "OSM_MSG_MAD_PKEY_TBL_RECORD",
2993 "OSM_MSG_MAD_VL_ARB_RECORD",
2994 "OSM_MSG_MAD_SLVL_TBL_RECORD",
2996 "OSM_MSG_MAD_VL_ARB",
2998 "OSM_MSG_MAD_GUIDINFO_RECORD",
2999 "OSM_MSG_MAD_INFORM_INFO_RECORD",
3000 "OSM_MSG_MAD_SWITCH_INFO_RECORD",
3001 "OSM_MSG_MAD_MFT_RECORD",
3002 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
3003 "OSM_MSG_MAD_MULTIPATH_RECORD",
3005 "OSM_MSG_MAD_PORT_COUNTERS",
3006 "OSM_MSG_MAD_MLNX_EXT_PORT_INFO",
3010 const char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg)
3012 if (msg >= OSM_MSG_MAX)
3013 msg = OSM_MSG_MAX-1;
3014 return disp_msg_str[msg];
3017 static const char *port_state_str_fixed_width[] = {
3026 const char *osm_get_port_state_str_fixed_width(IN uint8_t port_state)
3028 if (port_state > IB_LINK_ACTIVE)
3029 port_state = IB_LINK_ACTIVE + 1;
3030 return port_state_str_fixed_width[port_state];
3033 static const char *node_type_str_fixed_width[] = {
3040 const char *osm_get_node_type_str_fixed_width(IN uint8_t node_type)
3042 if (node_type > IB_NODE_TYPE_ROUTER)
3044 return node_type_str_fixed_width[node_type];
3047 const char *osm_get_manufacturer_str(IN uint64_t guid_ho)
3049 /* note that the max vendor string length is 11 */
3050 static const char *intel_str = "Intel";
3051 static const char *mellanox_str = "Mellanox";
3052 static const char *redswitch_str = "Redswitch";
3053 static const char *silverstorm_str = "SilverStorm";
3054 static const char *topspin_str = "Topspin";
3055 static const char *fujitsu_str = "Fujitsu";
3056 static const char *voltaire_str = "Voltaire";
3057 static const char *yotta_str = "YottaYotta";
3058 static const char *pathscale_str = "PathScale";
3059 static const char *ibm_str = "IBM";
3060 static const char *divergenet_str = "DivergeNet";
3061 static const char *flextronics_str = "Flextronics";
3062 static const char *agilent_str = "Agilent";
3063 static const char *obsidian_str = "Obsidian";
3064 static const char *baymicro_str = "BayMicro";
3065 static const char *lsilogic_str = "LSILogic";
3066 static const char *ddn_str = "DataDirect";
3067 static const char *panta_str = "Panta";
3068 static const char *hp_str = "HP";
3069 static const char *rioworks_str = "Rioworks";
3070 static const char *sun_str = "Sun";
3071 static const char *leafntwks_str = "3LeafNtwks";
3072 static const char *xsigo_str = "Xsigo";
3073 static const char *dell_str = "Dell";
3074 static const char *supermicro_str = "SuperMicro";
3075 static const char *openib_str = "OpenIB";
3076 static const char *unknown_str = "Unknown";
3077 static const char *bull_str = "Bull";
3079 switch ((uint32_t) (guid_ho >> (5 * 8))) {
3080 case OSM_VENDOR_ID_INTEL:
3082 case OSM_VENDOR_ID_MELLANOX:
3083 case OSM_VENDOR_ID_MELLANOX2:
3084 case OSM_VENDOR_ID_MELLANOX3:
3085 case OSM_VENDOR_ID_MELLANOX4:
3086 case OSM_VENDOR_ID_MELLANOX5:
3087 return mellanox_str;
3088 case OSM_VENDOR_ID_REDSWITCH:
3089 return redswitch_str;
3090 case OSM_VENDOR_ID_SILVERSTORM:
3091 return silverstorm_str;
3092 case OSM_VENDOR_ID_TOPSPIN:
3094 case OSM_VENDOR_ID_FUJITSU:
3095 case OSM_VENDOR_ID_FUJITSU2:
3097 case OSM_VENDOR_ID_VOLTAIRE:
3098 return voltaire_str;
3099 case OSM_VENDOR_ID_YOTTAYOTTA:
3101 case OSM_VENDOR_ID_PATHSCALE:
3102 return pathscale_str;
3103 case OSM_VENDOR_ID_IBM:
3104 case OSM_VENDOR_ID_IBM2:
3106 case OSM_VENDOR_ID_DIVERGENET:
3107 return divergenet_str;
3108 case OSM_VENDOR_ID_FLEXTRONICS:
3109 return flextronics_str;
3110 case OSM_VENDOR_ID_AGILENT:
3112 case OSM_VENDOR_ID_OBSIDIAN:
3113 return obsidian_str;
3114 case OSM_VENDOR_ID_BAYMICRO:
3115 return baymicro_str;
3116 case OSM_VENDOR_ID_LSILOGIC:
3117 return lsilogic_str;
3118 case OSM_VENDOR_ID_DDN:
3120 case OSM_VENDOR_ID_PANTA:
3122 case OSM_VENDOR_ID_HP:
3123 case OSM_VENDOR_ID_HP2:
3124 case OSM_VENDOR_ID_HP3:
3125 case OSM_VENDOR_ID_HP4:
3127 case OSM_VENDOR_ID_RIOWORKS:
3128 return rioworks_str;
3129 case OSM_VENDOR_ID_SUN:
3130 case OSM_VENDOR_ID_SUN2:
3132 case OSM_VENDOR_ID_3LEAFNTWKS:
3133 return leafntwks_str;
3134 case OSM_VENDOR_ID_XSIGO:
3136 case OSM_VENDOR_ID_DELL:
3138 case OSM_VENDOR_ID_SUPERMICRO:
3139 return supermicro_str;
3140 case OSM_VENDOR_ID_OPENIB:
3142 case OSM_VENDOR_ID_BULL:
3149 static const char *mtu_str_fixed_width[] = {
3158 const char *osm_get_mtu_str(IN uint8_t mtu)
3160 if (mtu > IB_MTU_LEN_4096)
3161 return mtu_str_fixed_width[0];
3163 return mtu_str_fixed_width[mtu];
3166 static const char *lwa_str_fixed_width[] = {
3186 const char *osm_get_lwa_str(IN uint8_t lwa)
3189 return lwa_str_fixed_width[0];
3191 return lwa_str_fixed_width[lwa];
3194 static const char *lsa_str_fixed_width[] = {
3202 static const char *lsea_str_fixed_width[] = {
3208 const char *osm_get_lsa_str(IN uint8_t lsa, IN uint8_t lsea, IN uint8_t state,
3211 if (lsa > IB_LINK_SPEED_ACTIVE_10 || state == IB_LINK_DOWN)
3212 return lsa_str_fixed_width[3];
3213 if (lsea == IB_LINK_SPEED_EXT_ACTIVE_NONE) {
3217 return lsa_str_fixed_width[lsa];
3219 if (lsea > IB_LINK_SPEED_EXT_ACTIVE_25)
3220 return lsa_str_fixed_width[3];
3221 return lsea_str_fixed_width[lsea];
3224 static const char *sm_mgr_signal_str[] = {
3225 "OSM_SM_SIGNAL_NONE", /* 0 */
3226 "OSM_SM_SIGNAL_DISCOVERY_COMPLETED", /* 1 */
3227 "OSM_SM_SIGNAL_POLLING_TIMEOUT", /* 2 */
3228 "OSM_SM_SIGNAL_DISCOVER", /* 3 */
3229 "OSM_SM_SIGNAL_DISABLE", /* 4 */
3230 "OSM_SM_SIGNAL_HANDOVER", /* 5 */
3231 "OSM_SM_SIGNAL_HANDOVER_SENT", /* 6 */
3232 "OSM_SM_SIGNAL_ACKNOWLEDGE", /* 7 */
3233 "OSM_SM_SIGNAL_STANDBY", /* 8 */
3234 "OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED", /* 9 */
3235 "OSM_SM_SIGNAL_WAIT_FOR_HANDOVER", /* 10 */
3236 "UNKNOWN STATE!!" /* 11 */
3239 const char *osm_get_sm_mgr_signal_str(IN osm_sm_signal_t signal)
3241 if (signal > OSM_SM_SIGNAL_MAX)
3242 signal = OSM_SM_SIGNAL_MAX;
3243 return sm_mgr_signal_str[signal];
3246 static const char *sm_mgr_state_str[] = {
3247 "NOTACTIVE", /* 0 */
3248 "DISCOVERING", /* 1 */
3251 "UNKNOWN STATE!!" /* 4 */
3254 const char *osm_get_sm_mgr_state_str(IN uint16_t state)
3256 return state < ARR_SIZE(sm_mgr_state_str) ?
3257 sm_mgr_state_str[state] :
3258 sm_mgr_state_str[ARR_SIZE(sm_mgr_state_str) - 1];
3261 int ib_mtu_is_valid(IN const int mtu)
3263 if (mtu < IB_MIN_MTU || mtu > IB_MAX_MTU)
3268 int ib_rate_is_valid(IN const int rate)
3270 if (rate < IB_MIN_RATE || rate > IB_MAX_RATE)
3275 int ib_path_compare_rates(IN const int rate1, IN const int rate2)
3277 int orate1 = 0, orate2 = 0;
3279 CL_ASSERT(rate1 >= IB_MIN_RATE && rate1 <= IB_MAX_RATE);
3280 CL_ASSERT(rate2 >= IB_MIN_RATE && rate2 <= IB_MAX_RATE);
3282 if (rate1 <= IB_MAX_RATE)
3283 orate1 = ordered_rates[rate1];
3284 if (rate2 <= IB_MAX_RATE)
3285 orate2 = ordered_rates[rate2];
3286 if (orate1 < orate2)
3288 if (orate1 == orate2)
3293 static int find_ordered_rate(IN const int rate)
3297 for (i = IB_MIN_RATE; i <= IB_MAX_RATE; i++) {
3298 if (ordered_rates[i] == rate)
3304 int ib_path_rate_get_prev(IN const int rate)
3308 CL_ASSERT(rate >= IB_MIN_RATE && rate <= IB_MAX_RATE);
3310 if (rate <= IB_MIN_RATE)
3312 if (rate > IB_MAX_RATE)
3314 orate = ordered_rates[rate];
3316 return find_ordered_rate(orate);
3319 int ib_path_rate_get_next(IN const int rate)
3323 CL_ASSERT(rate >= IB_MIN_RATE && rate <= IB_MAX_RATE);
3325 if (rate < IB_MIN_RATE)
3327 if (rate >= IB_MAX_RATE)
3329 orate = ordered_rates[rate];
3331 return find_ordered_rate(orate);