2 * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
4 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38 * Implementation of opensm helper functions.
43 #endif /* HAVE_CONFIG_H */
48 #include <arpa/inet.h>
49 #include <sys/socket.h>
50 #include <complib/cl_debug.h>
51 #include <iba/ib_types.h>
52 #include <opensm/osm_helper.h>
53 #include <opensm/osm_log.h>
55 #define LINE_LENGTH 256
57 #define ARR_SIZE(a) (sizeof(a)/sizeof((a)[0]))
59 /* we use two tables - one for queries and one for responses */
60 static const char *const __ib_sa_method_str[] = {
67 "SubnAdmReport", /* 6 */
79 "SubnAdmGetTable", /* 12 */
80 "SubnAdmGetTraceTable", /* 13 */
81 "SubnAdmGetMulti", /* 14 */
82 "SubnAdmDelete", /* 15 */
86 static const char *const __ib_sa_resp_method_str[] = {
88 "SubnAdmGetResp", /* 81 */
89 "RESERVED (SetResp?)", /* 82 */
93 "SubnAdmReportResp", /* 86 */
105 "SubnAdmGetTableResp", /* 92 */
107 "SubnAdmGetMultiResp", /* 94 */
108 "SubnAdmDeleteResp", /* 95 */
112 #define OSM_SA_METHOD_STR_UNKNOWN_VAL 0x16
114 static const char *const __ib_sm_method_str[] = {
122 "SubnTrapRepress", /* 7 */
131 "RESERVED10", /* 10 */
132 "SubnGetResp", /* 11 */
133 "RESERVED12", /* 12 */
134 "RESERVED13", /* 13 */
135 "RESERVED14", /* 14 */
136 "RESERVED15", /* 15 */
137 "RESERVED16", /* 16 */
138 "RESERVED17", /* 17 */
139 "RESERVED18", /* 18 */
140 "RESERVED19", /* 19 */
141 "RESERVED1A", /* 1A */
142 "RESERVED1B", /* 1B */
143 "RESERVED1C", /* 1C */
144 "RESERVED1D", /* 1D */
145 "RESERVED1E", /* 1E */
146 "RESERVED1F", /* 1F */
150 #define OSM_SM_METHOD_STR_UNKNOWN_VAL 0x21
152 static const char *const __ib_sm_attr_str[] = {
154 "ClassPortInfo", /* 1 */
156 "InformInfo", /* 3 */
169 "NodeDescription", /* 10 */
171 "SwitchInfo", /* 12 */
175 "P_KeyTable", /* 16 */
176 "SLtoVLMappingTable", /* 17 */
177 "VLArbitrationTable", /* 18 */
178 "LinearForwardingTable", /* 19 */
179 "RandomForwardingTable", /* 1A */
180 "MulticastForwardingTable", /* 1B */
186 "UNKNOWN" /* 21 - always highest value */
189 #define OSM_SM_ATTR_STR_UNKNOWN_VAL 0x21
191 static const char *const __ib_sa_attr_str[] = {
193 "ClassPortInfo", /* 1 */
195 "InformInfo", /* 3 */
209 "NodeRecord", /* 11 */
210 "PortInfoRecord", /* 12 */
211 "SLtoVLMappingTableRecord", /* 13 */
212 "SwitchInfoRecord", /* 14 */
213 "LinearForwardingTableRecord", /* 15 */
214 "RandomForwardingTableRecord", /* 16 */
215 "MulticastForwardingTableRecord", /* 17 */
216 "SMInfoRecord", /* 18 */
218 "RandomForwardingTable", /* 1A */
219 "MulticastForwardingTable", /* 1B */
224 "LinkRecord", /* 20 */
240 "GuidInfoRecord", /* 30 */
241 "ServiceRecord", /* 31 */
243 "P_KeyTableRecord", /* 33 */
245 "PathRecord", /* 35 */
246 "VLArbitrationTableRecord", /* 36 */
248 "MCMemberRecord", /* 38 */
249 "TraceRecord", /* 39 */
250 "MultiPathRecord", /* 3A */
251 "ServiceAssociationRecord", /* 3B */
435 "InformInfoRecord", /* F3 */
436 "UNKNOWN" /* F4 - always highest value */
439 #define OSM_SA_ATTR_STR_UNKNOWN_VAL 0xF4
441 /**********************************************************************
442 **********************************************************************/
443 const char *ib_get_sa_method_str(IN uint8_t method)
446 method = method & 0x7f;
447 if (method >= OSM_SA_METHOD_STR_UNKNOWN_VAL)
448 method = OSM_SA_METHOD_STR_UNKNOWN_VAL;
449 /* it is a response - use the response table */
450 return (__ib_sa_resp_method_str[method]);
452 if (method >= OSM_SA_METHOD_STR_UNKNOWN_VAL)
453 method = OSM_SA_METHOD_STR_UNKNOWN_VAL;
454 return (__ib_sa_method_str[method]);
458 /**********************************************************************
459 **********************************************************************/
460 const char *ib_get_sm_method_str(IN uint8_t method)
463 method = (method & 0x0F) | 0x10;
464 if (method >= OSM_SM_METHOD_STR_UNKNOWN_VAL)
465 method = OSM_SM_METHOD_STR_UNKNOWN_VAL;
466 return (__ib_sm_method_str[method]);
469 /**********************************************************************
470 **********************************************************************/
471 const char *ib_get_sm_attr_str(IN ib_net16_t attr)
474 host_attr = cl_ntoh16(attr);
476 if (host_attr >= OSM_SM_ATTR_STR_UNKNOWN_VAL)
477 host_attr = OSM_SM_ATTR_STR_UNKNOWN_VAL;
479 return (__ib_sm_attr_str[host_attr]);
482 /**********************************************************************
483 **********************************************************************/
484 const char *ib_get_sa_attr_str(IN ib_net16_t attr)
487 host_attr = cl_ntoh16(attr);
489 if (host_attr >= OSM_SA_ATTR_STR_UNKNOWN_VAL)
490 host_attr = OSM_SA_ATTR_STR_UNKNOWN_VAL;
492 return (__ib_sa_attr_str[host_attr]);
495 /**********************************************************************
496 **********************************************************************/
497 const char *ib_get_trap_str(ib_net16_t trap_num)
499 switch(cl_ntoh16(trap_num))
502 return "GID in service";
504 return "GID out of service";
506 return "New mcast group created";
508 return "Mcast group deleted";
510 return "UnPath, Path no longer valid";
512 return "RePath, Path recomputed";
514 return "Link state change";
516 return "Local Link integrity threshold reached";
518 return "Excessive Buffer Overrun Threshold reached";
520 return "Flow Control Update watchdog timer expired";
522 return "CapabilityMask, NodeDescription, Link [Width|Speed] Enabled changed";
524 return "System Image GUID changed";
532 return "Bad P_Key (switch external port)";
539 /**********************************************************************
540 **********************************************************************/
541 static ib_api_status_t
542 dbg_do_line(IN char **pp_local,
543 IN const uint32_t buf_size,
544 IN const char *const p_prefix_str,
545 IN const char *const p_new_str, IN uint32_t * const p_total_len)
547 char line[LINE_LENGTH];
550 sprintf(line, "%s%s", p_prefix_str, p_new_str);
551 len = (uint32_t) strlen(line);
553 if (*p_total_len + sizeof('\0') > buf_size)
554 return (IB_INSUFFICIENT_MEMORY);
556 strcpy(*pp_local, line);
561 /**********************************************************************
562 **********************************************************************/
564 dbg_get_capabilities_str(IN char *p_buf,
565 IN const uint32_t buf_size,
566 IN const char *const p_prefix_str,
567 IN const ib_port_info_t * const p_pi)
569 uint32_t total_len = 0;
570 char *p_local = p_buf;
572 strcpy(p_local, "Capability Mask:\n");
573 p_local += strlen(p_local);
575 if (p_pi->capability_mask & IB_PORT_CAP_RESV0) {
576 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
577 "IB_PORT_CAP_RESV0\n",
578 &total_len) != IB_SUCCESS)
581 if (p_pi->capability_mask & IB_PORT_CAP_IS_SM) {
582 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
583 "IB_PORT_CAP_IS_SM\n",
584 &total_len) != IB_SUCCESS)
587 if (p_pi->capability_mask & IB_PORT_CAP_HAS_NOTICE) {
588 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
589 "IB_PORT_CAP_HAS_NOTICE\n",
590 &total_len) != IB_SUCCESS)
593 if (p_pi->capability_mask & IB_PORT_CAP_HAS_TRAP) {
594 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
595 "IB_PORT_CAP_HAS_TRAP\n",
596 &total_len) != IB_SUCCESS)
599 if (p_pi->capability_mask & IB_PORT_CAP_HAS_IPD) {
600 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
601 "IB_PORT_CAP_HAS_IPD\n",
602 &total_len) != IB_SUCCESS)
605 if (p_pi->capability_mask & IB_PORT_CAP_HAS_AUTO_MIG) {
606 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
607 "IB_PORT_CAP_HAS_AUTO_MIG\n",
608 &total_len) != IB_SUCCESS)
611 if (p_pi->capability_mask & IB_PORT_CAP_HAS_SL_MAP) {
612 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
613 "IB_PORT_CAP_HAS_SL_MAP\n",
614 &total_len) != IB_SUCCESS)
617 if (p_pi->capability_mask & IB_PORT_CAP_HAS_NV_MKEY) {
618 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
619 "IB_PORT_CAP_HAS_NV_MKEY\n",
620 &total_len) != IB_SUCCESS)
623 if (p_pi->capability_mask & IB_PORT_CAP_HAS_NV_PKEY) {
624 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
625 "IB_PORT_CAP_HAS_NV_PKEY\n",
626 &total_len) != IB_SUCCESS)
629 if (p_pi->capability_mask & IB_PORT_CAP_HAS_LED_INFO) {
630 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
631 "IB_PORT_CAP_HAS_LED_INFO\n",
632 &total_len) != IB_SUCCESS)
635 if (p_pi->capability_mask & IB_PORT_CAP_SM_DISAB) {
636 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
637 "IB_PORT_CAP_SM_DISAB\n",
638 &total_len) != IB_SUCCESS)
641 if (p_pi->capability_mask & IB_PORT_CAP_HAS_SYS_IMG_GUID) {
642 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
643 "IB_PORT_CAP_HAS_SYS_IMG_GUID\n",
644 &total_len) != IB_SUCCESS)
647 if (p_pi->capability_mask & IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP) {
648 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
649 "IB_PORT_CAP_PKEY_SW_EXT_PORT_TRAP\n",
650 &total_len) != IB_SUCCESS)
653 if (p_pi->capability_mask & IB_PORT_CAP_RESV13) {
654 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
655 "IB_PORT_CAP_RESV13\n",
656 &total_len) != IB_SUCCESS)
659 if (p_pi->capability_mask & IB_PORT_CAP_RESV14) {
660 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
661 "IB_PORT_CAP_RESV14\n",
662 &total_len) != IB_SUCCESS)
665 if (p_pi->capability_mask & IB_PORT_CAP_RESV15) {
666 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
667 "IB_PORT_CAP_RESV15\n",
668 &total_len) != IB_SUCCESS)
671 if (p_pi->capability_mask & IB_PORT_CAP_HAS_COM_MGT) {
672 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
673 "IB_PORT_CAP_HAS_COM_MGT\n",
674 &total_len) != IB_SUCCESS)
677 if (p_pi->capability_mask & IB_PORT_CAP_HAS_SNMP) {
678 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
679 "IB_PORT_CAP_HAS_SNMP\n",
680 &total_len) != IB_SUCCESS)
683 if (p_pi->capability_mask & IB_PORT_CAP_REINIT) {
684 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
685 "IB_PORT_CAP_REINIT\n",
686 &total_len) != IB_SUCCESS)
689 if (p_pi->capability_mask & IB_PORT_CAP_HAS_DEV_MGT) {
690 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
691 "IB_PORT_CAP_HAS_DEV_MGT\n",
692 &total_len) != IB_SUCCESS)
695 if (p_pi->capability_mask & IB_PORT_CAP_HAS_VEND_CLS) {
696 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
697 "IB_PORT_CAP_HAS_VEND_CLS\n",
698 &total_len) != IB_SUCCESS)
701 if (p_pi->capability_mask & IB_PORT_CAP_HAS_DR_NTC) {
702 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
703 "IB_PORT_CAP_HAS_DR_NTC\n",
704 &total_len) != IB_SUCCESS)
707 if (p_pi->capability_mask & IB_PORT_CAP_HAS_CAP_NTC) {
708 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
709 "IB_PORT_CAP_HAS_CAP_NTC\n",
710 &total_len) != IB_SUCCESS)
713 if (p_pi->capability_mask & IB_PORT_CAP_HAS_BM) {
714 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
715 "IB_PORT_CAP_HAS_BM\n",
716 &total_len) != IB_SUCCESS)
719 if (p_pi->capability_mask & IB_PORT_CAP_HAS_LINK_RT_LATENCY) {
720 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
721 "IB_PORT_CAP_HAS_LINK_RT_LATENCY\n",
722 &total_len) != IB_SUCCESS)
725 if (p_pi->capability_mask & IB_PORT_CAP_HAS_CLIENT_REREG) {
726 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
727 "IB_PORT_CAP_HAS_CLIENT_REREG\n",
728 &total_len) != IB_SUCCESS)
731 if (p_pi->capability_mask & IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC) {
732 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
733 "IB_PORT_CAP_HAS_OTHER_LOCAL_CHANGES_NTC\n",
734 &total_len) != IB_SUCCESS)
737 if (p_pi->capability_mask & IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL) {
738 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
739 "IB_PORT_CAP_HAS_LINK_SPEED_WIDTH_PAIRS_TBL\n",
740 &total_len) != IB_SUCCESS)
743 if (p_pi->capability_mask & IB_PORT_CAP_RESV28) {
744 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
745 "IB_PORT_CAP_RESV28\n",
746 &total_len) != IB_SUCCESS)
749 if (p_pi->capability_mask & IB_PORT_CAP_RESV29) {
750 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
751 "IB_PORT_CAP_RESV29\n",
752 &total_len) != IB_SUCCESS)
755 if (p_pi->capability_mask & IB_PORT_CAP_RESV30) {
756 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
757 "IB_PORT_CAP_RESV30\n",
758 &total_len) != IB_SUCCESS)
761 if (p_pi->capability_mask & IB_PORT_CAP_RESV31) {
762 if (dbg_do_line(&p_local, buf_size, p_prefix_str,
763 "IB_PORT_CAP_RESV31\n",
764 &total_len) != IB_SUCCESS)
769 /**********************************************************************
770 **********************************************************************/
772 osm_dump_port_info(IN osm_log_t * const p_log,
773 IN const ib_net64_t node_guid,
774 IN const ib_net64_t port_guid,
775 IN const uint8_t port_num,
776 IN const ib_port_info_t * const p_pi,
777 IN const osm_log_level_t log_level)
779 if (osm_log_is_active(p_log, log_level)) {
782 osm_log(p_log, log_level,
784 "\t\t\t\tport number.............%u\n"
785 "\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
786 "\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
787 "\t\t\t\tm_key...................0x%016" PRIx64 "\n"
788 "\t\t\t\tsubnet_prefix...........0x%016" PRIx64 "\n"
789 "\t\t\t\tbase_lid................%u\n"
790 "\t\t\t\tmaster_sm_base_lid......%u\n"
791 "\t\t\t\tcapability_mask.........0x%X\n"
792 "\t\t\t\tdiag_code...............0x%X\n"
793 "\t\t\t\tm_key_lease_period......0x%X\n"
794 "\t\t\t\tlocal_port_num..........%u\n"
795 "\t\t\t\tlink_width_enabled......0x%X\n"
796 "\t\t\t\tlink_width_supported....0x%X\n"
797 "\t\t\t\tlink_width_active.......0x%X\n"
798 "\t\t\t\tlink_speed_supported....0x%X\n"
799 "\t\t\t\tport_state..............%s\n"
800 "\t\t\t\tstate_info2.............0x%X\n"
801 "\t\t\t\tm_key_protect_bits......0x%X\n"
802 "\t\t\t\tlmc.....................0x%X\n"
803 "\t\t\t\tlink_speed..............0x%X\n"
804 "\t\t\t\tmtu_smsl................0x%X\n"
805 "\t\t\t\tvl_cap_init_type........0x%X\n"
806 "\t\t\t\tvl_high_limit...........0x%X\n"
807 "\t\t\t\tvl_arb_high_cap.........0x%X\n"
808 "\t\t\t\tvl_arb_low_cap..........0x%X\n"
809 "\t\t\t\tinit_rep_mtu_cap........0x%X\n"
810 "\t\t\t\tvl_stall_life...........0x%X\n"
811 "\t\t\t\tvl_enforce..............0x%X\n"
812 "\t\t\t\tm_key_violations........0x%X\n"
813 "\t\t\t\tp_key_violations........0x%X\n"
814 "\t\t\t\tq_key_violations........0x%X\n"
815 "\t\t\t\tguid_cap................0x%X\n"
816 "\t\t\t\tclient_reregister.......0x%X\n"
817 "\t\t\t\tsubnet_timeout..........0x%X\n"
818 "\t\t\t\tresp_time_value.........0x%X\n"
819 "\t\t\t\terror_threshold.........0x%X\n",
821 cl_ntoh64(node_guid),
822 cl_ntoh64(port_guid),
823 cl_ntoh64(p_pi->m_key),
824 cl_ntoh64(p_pi->subnet_prefix),
825 cl_ntoh16(p_pi->base_lid),
826 cl_ntoh16(p_pi->master_sm_base_lid),
827 cl_ntoh32(p_pi->capability_mask),
828 cl_ntoh16(p_pi->diag_code),
829 cl_ntoh16(p_pi->m_key_lease_period),
830 p_pi->local_port_num,
831 p_pi->link_width_enabled,
832 p_pi->link_width_supported,
833 p_pi->link_width_active,
834 ib_port_info_get_link_speed_sup(p_pi),
835 ib_get_port_state_str(ib_port_info_get_port_state
836 (p_pi)), p_pi->state_info2,
837 ib_port_info_get_mpb(p_pi), ib_port_info_get_lmc(p_pi),
838 p_pi->link_speed, p_pi->mtu_smsl, p_pi->vl_cap,
839 p_pi->vl_high_limit, p_pi->vl_arb_high_cap,
840 p_pi->vl_arb_low_cap, p_pi->mtu_cap,
841 p_pi->vl_stall_life, p_pi->vl_enforce,
842 cl_ntoh16(p_pi->m_key_violations),
843 cl_ntoh16(p_pi->p_key_violations),
844 cl_ntoh16(p_pi->q_key_violations), p_pi->guid_cap,
845 ib_port_info_get_client_rereg(p_pi),
846 ib_port_info_get_timeout(p_pi), p_pi->resp_time_value,
847 p_pi->error_threshold);
849 /* show the capabilities mask */
850 if (p_pi->capability_mask) {
851 dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",
853 osm_log(p_log, log_level, "%s", buf);
858 /**********************************************************************
859 **********************************************************************/
861 osm_dump_portinfo_record(IN osm_log_t * const p_log,
862 IN const ib_portinfo_record_t * const p_pir,
863 IN const osm_log_level_t log_level)
865 if (osm_log_is_active(p_log, log_level)) {
867 const ib_port_info_t *const p_pi = &p_pir->port_info;
869 osm_log(p_log, log_level,
870 "PortInfo Record dump:\n"
872 "\t\t\t\tEndPortLid..............%u\n"
873 "\t\t\t\tPortNum.................0x%X\n"
874 "\t\t\t\tReserved................0x%X\n"
875 "\t\t\t\tPortInfo dump:\n"
876 "\t\t\t\tm_key...................0x%016" PRIx64 "\n"
877 "\t\t\t\tsubnet_prefix...........0x%016" PRIx64 "\n"
878 "\t\t\t\tbase_lid................%u\n"
879 "\t\t\t\tmaster_sm_base_lid......%u\n"
880 "\t\t\t\tcapability_mask.........0x%X\n"
881 "\t\t\t\tdiag_code...............0x%X\n"
882 "\t\t\t\tm_key_lease_period......0x%X\n"
883 "\t\t\t\tlocal_port_num..........%u\n"
884 "\t\t\t\tlink_width_enabled......0x%X\n"
885 "\t\t\t\tlink_width_supported....0x%X\n"
886 "\t\t\t\tlink_width_active.......0x%X\n"
887 "\t\t\t\tlink_speed_supported....0x%X\n"
888 "\t\t\t\tport_state..............%s\n"
889 "\t\t\t\tstate_info2.............0x%X\n"
890 "\t\t\t\tm_key_protect_bits......0x%X\n"
891 "\t\t\t\tlmc.....................0x%X\n"
892 "\t\t\t\tlink_speed..............0x%X\n"
893 "\t\t\t\tmtu_smsl................0x%X\n"
894 "\t\t\t\tvl_cap_init_type........0x%X\n"
895 "\t\t\t\tvl_high_limit...........0x%X\n"
896 "\t\t\t\tvl_arb_high_cap.........0x%X\n"
897 "\t\t\t\tvl_arb_low_cap..........0x%X\n"
898 "\t\t\t\tinit_rep_mtu_cap........0x%X\n"
899 "\t\t\t\tvl_stall_life...........0x%X\n"
900 "\t\t\t\tvl_enforce..............0x%X\n"
901 "\t\t\t\tm_key_violations........0x%X\n"
902 "\t\t\t\tp_key_violations........0x%X\n"
903 "\t\t\t\tq_key_violations........0x%X\n"
904 "\t\t\t\tguid_cap................0x%X\n"
905 "\t\t\t\tsubnet_timeout..........0x%X\n"
906 "\t\t\t\tresp_time_value.........0x%X\n"
907 "\t\t\t\terror_threshold.........0x%X\n",
908 cl_ntoh16(p_pir->lid),
911 cl_ntoh64(p_pi->m_key),
912 cl_ntoh64(p_pi->subnet_prefix),
913 cl_ntoh16(p_pi->base_lid),
914 cl_ntoh16(p_pi->master_sm_base_lid),
915 cl_ntoh32(p_pi->capability_mask),
916 cl_ntoh16(p_pi->diag_code),
917 cl_ntoh16(p_pi->m_key_lease_period),
918 p_pi->local_port_num,
919 p_pi->link_width_enabled,
920 p_pi->link_width_supported,
921 p_pi->link_width_active,
922 ib_port_info_get_link_speed_sup(p_pi),
923 ib_get_port_state_str(ib_port_info_get_port_state
924 (p_pi)), p_pi->state_info2,
925 ib_port_info_get_mpb(p_pi), ib_port_info_get_lmc(p_pi),
926 p_pi->link_speed, p_pi->mtu_smsl, p_pi->vl_cap,
927 p_pi->vl_high_limit, p_pi->vl_arb_high_cap,
928 p_pi->vl_arb_low_cap, p_pi->mtu_cap,
929 p_pi->vl_stall_life, p_pi->vl_enforce,
930 cl_ntoh16(p_pi->m_key_violations),
931 cl_ntoh16(p_pi->p_key_violations),
932 cl_ntoh16(p_pi->q_key_violations), p_pi->guid_cap,
933 ib_port_info_get_timeout(p_pi), p_pi->resp_time_value,
934 p_pi->error_threshold);
936 /* show the capabilities mask */
937 if (p_pi->capability_mask) {
938 dbg_get_capabilities_str(buf, BUF_SIZE, "\t\t\t\t",
940 osm_log(p_log, log_level, "%s", buf);
945 /**********************************************************************
946 **********************************************************************/
948 osm_dump_guidinfo_record(IN osm_log_t * const p_log,
949 IN const ib_guidinfo_record_t * const p_gir,
950 IN const osm_log_level_t log_level)
952 if (osm_log_is_active(p_log, log_level)) {
953 const ib_guid_info_t *const p_gi = &p_gir->guid_info;
955 osm_log(p_log, log_level,
956 "GUIDInfo Record dump:\n"
958 "\t\t\t\tLid.....................%u\n"
959 "\t\t\t\tBlockNum................0x%X\n"
960 "\t\t\t\tReserved................0x%X\n"
961 "\t\t\t\tGUIDInfo dump:\n"
962 "\t\t\t\tReserved................0x%X\n"
963 "\t\t\t\tGUID 0..................0x%016" PRIx64 "\n"
964 "\t\t\t\tGUID 1..................0x%016" PRIx64 "\n"
965 "\t\t\t\tGUID 2..................0x%016" PRIx64 "\n"
966 "\t\t\t\tGUID 3..................0x%016" PRIx64 "\n"
967 "\t\t\t\tGUID 4..................0x%016" PRIx64 "\n"
968 "\t\t\t\tGUID 5..................0x%016" PRIx64 "\n"
969 "\t\t\t\tGUID 6..................0x%016" PRIx64 "\n"
970 "\t\t\t\tGUID 7..................0x%016" PRIx64 "\n",
971 cl_ntoh16(p_gir->lid),
974 cl_ntoh32(p_gir->reserved),
975 cl_ntoh64(p_gi->guid[0]),
976 cl_ntoh64(p_gi->guid[1]),
977 cl_ntoh64(p_gi->guid[2]),
978 cl_ntoh64(p_gi->guid[3]),
979 cl_ntoh64(p_gi->guid[4]),
980 cl_ntoh64(p_gi->guid[5]),
981 cl_ntoh64(p_gi->guid[6]), cl_ntoh64(p_gi->guid[7]));
985 /**********************************************************************
986 **********************************************************************/
988 osm_dump_node_info(IN osm_log_t * const p_log,
989 IN const ib_node_info_t * const p_ni,
990 IN const osm_log_level_t log_level)
992 if (osm_log_is_active(p_log, log_level)) {
993 osm_log(p_log, log_level,
995 "\t\t\t\tbase_version............0x%X\n"
996 "\t\t\t\tclass_version...........0x%X\n"
997 "\t\t\t\tnode_type...............%s\n"
998 "\t\t\t\tnum_ports...............%u\n"
999 "\t\t\t\tsys_guid................0x%016" PRIx64 "\n"
1000 "\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
1001 "\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
1002 "\t\t\t\tpartition_cap...........0x%X\n"
1003 "\t\t\t\tdevice_id...............0x%X\n"
1004 "\t\t\t\trevision................0x%X\n"
1005 "\t\t\t\tport_num................%u\n"
1006 "\t\t\t\tvendor_id...............0x%X\n",
1008 p_ni->class_version,
1009 ib_get_node_type_str(p_ni->node_type),
1011 cl_ntoh64(p_ni->sys_guid),
1012 cl_ntoh64(p_ni->node_guid),
1013 cl_ntoh64(p_ni->port_guid),
1014 cl_ntoh16(p_ni->partition_cap),
1015 cl_ntoh16(p_ni->device_id),
1016 cl_ntoh32(p_ni->revision),
1017 ib_node_info_get_local_port_num(p_ni),
1018 cl_ntoh32(ib_node_info_get_vendor_id(p_ni)));
1022 /**********************************************************************
1023 **********************************************************************/
1025 osm_dump_node_record(IN osm_log_t * const p_log,
1026 IN const ib_node_record_t * const p_nr,
1027 IN const osm_log_level_t log_level)
1029 if (osm_log_is_active(p_log, log_level)) {
1030 char desc[sizeof(p_nr->node_desc.description) + 1];
1031 const ib_node_info_t *const p_ni = &p_nr->node_info;
1033 memcpy(desc, p_nr->node_desc.description,
1034 sizeof(p_nr->node_desc.description));
1035 desc[sizeof(desc) - 1] = '\0';
1036 osm_log(p_log, log_level,
1037 "Node Record dump:\n"
1039 "\t\t\t\tLid.....................%u\n"
1040 "\t\t\t\tReserved................0x%X\n"
1041 "\t\t\t\tNodeInfo dump:\n"
1042 "\t\t\t\tbase_version............0x%X\n"
1043 "\t\t\t\tclass_version...........0x%X\n"
1044 "\t\t\t\tnode_type...............%s\n"
1045 "\t\t\t\tnum_ports...............%u\n"
1046 "\t\t\t\tsys_guid................0x%016" PRIx64 "\n"
1047 "\t\t\t\tnode_guid...............0x%016" PRIx64 "\n"
1048 "\t\t\t\tport_guid...............0x%016" PRIx64 "\n"
1049 "\t\t\t\tpartition_cap...........0x%X\n"
1050 "\t\t\t\tdevice_id...............0x%X\n"
1051 "\t\t\t\trevision................0x%X\n"
1052 "\t\t\t\tport_num................%u\n"
1053 "\t\t\t\tvendor_id...............0x%X\n"
1054 "\t\t\t\tNodeDescription\n"
1056 cl_ntoh16(p_nr->lid),
1057 cl_ntoh16(p_nr->resv),
1059 p_ni->class_version,
1060 ib_get_node_type_str(p_ni->node_type),
1062 cl_ntoh64(p_ni->sys_guid),
1063 cl_ntoh64(p_ni->node_guid),
1064 cl_ntoh64(p_ni->port_guid),
1065 cl_ntoh16(p_ni->partition_cap),
1066 cl_ntoh16(p_ni->device_id),
1067 cl_ntoh32(p_ni->revision),
1068 ib_node_info_get_local_port_num(p_ni),
1069 cl_ntoh32(ib_node_info_get_vendor_id(p_ni)), desc);
1073 /**********************************************************************
1074 **********************************************************************/
1076 osm_dump_path_record(IN osm_log_t * const p_log,
1077 IN const ib_path_rec_t * const p_pr,
1078 IN const osm_log_level_t log_level)
1080 if (osm_log_is_active(p_log, log_level)) {
1081 osm_log(p_log, log_level,
1082 "PathRecord dump:\n"
1083 "\t\t\t\tservice_id..............0x%016" PRIx64 "\n"
1084 "\t\t\t\tdgid....................0x%016" PRIx64 " : "
1085 "0x%016" PRIx64 "\n"
1086 "\t\t\t\tsgid....................0x%016" PRIx64 " : "
1087 "0x%016" PRIx64 "\n"
1088 "\t\t\t\tdlid....................%u\n"
1089 "\t\t\t\tslid....................%u\n"
1090 "\t\t\t\thop_flow_raw............0x%X\n"
1091 "\t\t\t\ttclass..................0x%X\n"
1092 "\t\t\t\tnum_path_revers.........0x%X\n"
1093 "\t\t\t\tpkey....................0x%X\n"
1094 "\t\t\t\tqos_class...............0x%X\n"
1095 "\t\t\t\tsl......................0x%X\n"
1096 "\t\t\t\tmtu.....................0x%X\n"
1097 "\t\t\t\trate....................0x%X\n"
1098 "\t\t\t\tpkt_life................0x%X\n"
1099 "\t\t\t\tpreference..............0x%X\n"
1100 "\t\t\t\tresv2...................0x%X\n"
1101 "\t\t\t\tresv3...................0x%X\n",
1102 cl_ntoh64(p_pr->service_id),
1103 cl_ntoh64(p_pr->dgid.unicast.prefix),
1104 cl_ntoh64(p_pr->dgid.unicast.interface_id),
1105 cl_ntoh64(p_pr->sgid.unicast.prefix),
1106 cl_ntoh64(p_pr->sgid.unicast.interface_id),
1107 cl_ntoh16(p_pr->dlid),
1108 cl_ntoh16(p_pr->slid),
1109 cl_ntoh32(p_pr->hop_flow_raw),
1112 cl_ntoh16(p_pr->pkey),
1113 ib_path_rec_qos_class(p_pr),
1114 ib_path_rec_sl(p_pr),
1119 *(uint32_t *) & p_pr->resv2,
1120 *((uint16_t *) & p_pr->resv2 + 2));
1124 /**********************************************************************
1125 **********************************************************************/
1127 osm_dump_multipath_record(IN osm_log_t * const p_log,
1128 IN const ib_multipath_rec_t * const p_mpr,
1129 IN const osm_log_level_t log_level)
1131 if (osm_log_is_active(p_log, log_level)) {
1132 char buf_line[1024];
1133 ib_gid_t const *p_gid = p_mpr->gids;
1136 if (p_mpr->sgid_count) {
1137 for (i = 0; i < p_mpr->sgid_count; i++) {
1138 n += sprintf(buf_line + n,
1139 "\t\t\t\tsgid%02d.................."
1140 "0x%016" PRIx64 " : 0x%016" PRIx64
1142 cl_ntoh64(p_gid->unicast.prefix),
1143 cl_ntoh64(p_gid->unicast.
1148 if (p_mpr->dgid_count) {
1149 for (i = 0; i < p_mpr->dgid_count; i++) {
1150 n += sprintf(buf_line + n,
1151 "\t\t\t\tdgid%02d.................."
1152 "0x%016" PRIx64 " : 0x%016" PRIx64
1154 cl_ntoh64(p_gid->unicast.prefix),
1155 cl_ntoh64(p_gid->unicast.
1160 osm_log(p_log, log_level,
1161 "MultiPath Record dump:\n"
1162 "\t\t\t\thop_flow_raw............0x%X\n"
1163 "\t\t\t\ttclass..................0x%X\n"
1164 "\t\t\t\tnum_path_revers.........0x%X\n"
1165 "\t\t\t\tpkey....................0x%X\n"
1166 "\t\t\t\tqos_class...............0x%X\n"
1167 "\t\t\t\tsl......................0x%X\n"
1168 "\t\t\t\tmtu.....................0x%X\n"
1169 "\t\t\t\trate....................0x%X\n"
1170 "\t\t\t\tpkt_life................0x%X\n"
1171 "\t\t\t\tindependence............0x%X\n"
1172 "\t\t\t\tsgid_count..............0x%X\n"
1173 "\t\t\t\tdgid_count..............0x%X\n"
1174 "\t\t\t\tservice_id..............0x%016" PRIx64 "\n"
1176 cl_ntoh32(p_mpr->hop_flow_raw),
1179 cl_ntoh16(p_mpr->pkey),
1180 ib_multipath_rec_qos_class(p_mpr),
1181 ib_multipath_rec_sl(p_mpr),
1185 p_mpr->independence,
1186 p_mpr->sgid_count, p_mpr->dgid_count,
1187 cl_ntoh64(ib_multipath_rec_service_id(p_mpr)),
1192 /**********************************************************************
1193 **********************************************************************/
1195 osm_dump_mc_record(IN osm_log_t * const p_log,
1196 IN const ib_member_rec_t * const p_mcmr,
1197 IN const osm_log_level_t log_level)
1199 if (osm_log_is_active(p_log, log_level)) {
1200 char gid_str[INET6_ADDRSTRLEN];
1201 char gid_str2[INET6_ADDRSTRLEN];
1202 osm_log(p_log, log_level,
1203 "MCMember Record dump:\n"
1204 "\t\t\t\tMGID....................%s\n"
1205 "\t\t\t\tPortGid.................%s\n"
1206 "\t\t\t\tqkey....................0x%X\n"
1207 "\t\t\t\tmlid....................0x%X\n"
1208 "\t\t\t\tmtu.....................0x%X\n"
1209 "\t\t\t\tTClass..................0x%X\n"
1210 "\t\t\t\tpkey....................0x%X\n"
1211 "\t\t\t\trate....................0x%X\n"
1212 "\t\t\t\tpkt_life................0x%X\n"
1213 "\t\t\t\tSLFlowLabelHopLimit.....0x%X\n"
1214 "\t\t\t\tScopeState..............0x%X\n"
1215 "\t\t\t\tProxyJoin...............0x%X\n",
1216 inet_ntop(AF_INET6, p_mcmr->mgid.raw, gid_str,
1218 inet_ntop(AF_INET6, p_mcmr->port_gid.raw, gid_str2,
1220 cl_ntoh32(p_mcmr->qkey),
1221 cl_ntoh16(p_mcmr->mlid),
1224 cl_ntoh16(p_mcmr->pkey),
1227 cl_ntoh32(p_mcmr->sl_flow_hop),
1228 p_mcmr->scope_state, p_mcmr->proxy_join);
1232 /**********************************************************************
1233 **********************************************************************/
1235 osm_dump_service_record(IN osm_log_t * const p_log,
1236 IN const ib_service_record_t * const p_sr,
1237 IN const osm_log_level_t log_level)
1239 if (osm_log_is_active(p_log, log_level)) {
1240 char gid_str[INET6_ADDRSTRLEN];
1241 char buf_service_key[35];
1242 char buf_service_name[65];
1244 sprintf(buf_service_key,
1245 "0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
1246 p_sr->service_key[0],
1247 p_sr->service_key[1],
1248 p_sr->service_key[2],
1249 p_sr->service_key[3],
1250 p_sr->service_key[4],
1251 p_sr->service_key[5],
1252 p_sr->service_key[6],
1253 p_sr->service_key[7],
1254 p_sr->service_key[8],
1255 p_sr->service_key[9],
1256 p_sr->service_key[10],
1257 p_sr->service_key[11],
1258 p_sr->service_key[12],
1259 p_sr->service_key[13],
1260 p_sr->service_key[14], p_sr->service_key[15]);
1261 strncpy(buf_service_name, (char *)p_sr->service_name, 64);
1262 buf_service_name[64] = '\0';
1264 osm_log(p_log, log_level,
1265 "Service Record dump:\n"
1266 "\t\t\t\tServiceID...............0x%016" PRIx64 "\n"
1267 "\t\t\t\tServiceGID..............%s\n"
1268 "\t\t\t\tServiceP_Key............0x%X\n"
1269 "\t\t\t\tServiceLease............0x%X\n"
1270 "\t\t\t\tServiceKey..............%s\n"
1271 "\t\t\t\tServiceName.............%s\n"
1272 "\t\t\t\tServiceData8.1..........0x%X\n"
1273 "\t\t\t\tServiceData8.2..........0x%X\n"
1274 "\t\t\t\tServiceData8.3..........0x%X\n"
1275 "\t\t\t\tServiceData8.4..........0x%X\n"
1276 "\t\t\t\tServiceData8.5..........0x%X\n"
1277 "\t\t\t\tServiceData8.6..........0x%X\n"
1278 "\t\t\t\tServiceData8.7..........0x%X\n"
1279 "\t\t\t\tServiceData8.8..........0x%X\n"
1280 "\t\t\t\tServiceData8.9..........0x%X\n"
1281 "\t\t\t\tServiceData8.10.........0x%X\n"
1282 "\t\t\t\tServiceData8.11.........0x%X\n"
1283 "\t\t\t\tServiceData8.12.........0x%X\n"
1284 "\t\t\t\tServiceData8.13.........0x%X\n"
1285 "\t\t\t\tServiceData8.14.........0x%X\n"
1286 "\t\t\t\tServiceData8.15.........0x%X\n"
1287 "\t\t\t\tServiceData8.16.........0x%X\n"
1288 "\t\t\t\tServiceData16.1.........0x%X\n"
1289 "\t\t\t\tServiceData16.2.........0x%X\n"
1290 "\t\t\t\tServiceData16.3.........0x%X\n"
1291 "\t\t\t\tServiceData16.4.........0x%X\n"
1292 "\t\t\t\tServiceData16.5.........0x%X\n"
1293 "\t\t\t\tServiceData16.6.........0x%X\n"
1294 "\t\t\t\tServiceData16.7.........0x%X\n"
1295 "\t\t\t\tServiceData16.8.........0x%X\n"
1296 "\t\t\t\tServiceData32.1.........0x%X\n"
1297 "\t\t\t\tServiceData32.2.........0x%X\n"
1298 "\t\t\t\tServiceData32.3.........0x%X\n"
1299 "\t\t\t\tServiceData32.4.........0x%X\n"
1300 "\t\t\t\tServiceData64.1.........0x%016" PRIx64 "\n"
1301 "\t\t\t\tServiceData64.2.........0x%016" PRIx64 "\n",
1302 cl_ntoh64(p_sr->service_id),
1303 inet_ntop(AF_INET6, p_sr->service_gid.raw, gid_str,
1305 cl_ntoh16(p_sr->service_pkey),
1306 cl_ntoh32(p_sr->service_lease),
1309 p_sr->service_data8[0], p_sr->service_data8[1],
1310 p_sr->service_data8[2], p_sr->service_data8[3],
1311 p_sr->service_data8[4], p_sr->service_data8[5],
1312 p_sr->service_data8[6], p_sr->service_data8[7],
1313 p_sr->service_data8[8], p_sr->service_data8[9],
1314 p_sr->service_data8[10], p_sr->service_data8[11],
1315 p_sr->service_data8[12], p_sr->service_data8[13],
1316 p_sr->service_data8[14], p_sr->service_data8[15],
1317 cl_ntoh16(p_sr->service_data16[0]),
1318 cl_ntoh16(p_sr->service_data16[1]),
1319 cl_ntoh16(p_sr->service_data16[2]),
1320 cl_ntoh16(p_sr->service_data16[3]),
1321 cl_ntoh16(p_sr->service_data16[4]),
1322 cl_ntoh16(p_sr->service_data16[5]),
1323 cl_ntoh16(p_sr->service_data16[6]),
1324 cl_ntoh16(p_sr->service_data16[7]),
1325 cl_ntoh32(p_sr->service_data32[0]),
1326 cl_ntoh32(p_sr->service_data32[1]),
1327 cl_ntoh32(p_sr->service_data32[2]),
1328 cl_ntoh32(p_sr->service_data32[3]),
1329 cl_ntoh64(p_sr->service_data64[0]),
1330 cl_ntoh64(p_sr->service_data64[1]));
1334 /**********************************************************************
1335 **********************************************************************/
1337 osm_dump_inform_info(IN osm_log_t * const p_log,
1338 IN const ib_inform_info_t * const p_ii,
1339 IN const osm_log_level_t log_level)
1341 if (osm_log_is_active(p_log, log_level)) {
1343 uint8_t resp_time_val;
1345 ib_inform_info_get_qpn_resp_time(p_ii->g_or_v.generic.
1346 qpn_resp_time_val, &qpn,
1348 if (p_ii->is_generic) {
1349 osm_log(p_log, log_level,
1350 "InformInfo dump:\n"
1351 "\t\t\t\tgid.....................0x%016" PRIx64
1352 " : 0x%016" PRIx64 "\n"
1353 "\t\t\t\tlid_range_begin.........%u\n"
1354 "\t\t\t\tlid_range_end...........%u\n"
1355 "\t\t\t\tis_generic..............0x%X\n"
1356 "\t\t\t\tsubscribe...............0x%X\n"
1357 "\t\t\t\ttrap_type...............0x%X\n"
1358 "\t\t\t\ttrap_num................%u\n"
1359 "\t\t\t\tqpn.....................0x%06X\n"
1360 "\t\t\t\tresp_time_val...........0x%X\n"
1361 "\t\t\t\tnode_type...............0x%06X\n" "",
1362 cl_ntoh64(p_ii->gid.unicast.prefix),
1363 cl_ntoh64(p_ii->gid.unicast.interface_id),
1364 cl_ntoh16(p_ii->lid_range_begin),
1365 cl_ntoh16(p_ii->lid_range_end),
1366 p_ii->is_generic, p_ii->subscribe,
1367 cl_ntoh16(p_ii->trap_type),
1368 cl_ntoh16(p_ii->g_or_v.generic.trap_num),
1369 cl_ntoh32(qpn), resp_time_val,
1370 cl_ntoh32(ib_inform_info_get_prod_type(p_ii)));
1372 osm_log(p_log, log_level,
1373 "InformInfo dump:\n"
1374 "\t\t\t\tgid.....................0x%016" PRIx64
1375 " : 0x%016" PRIx64 "\n"
1376 "\t\t\t\tlid_range_begin.........%u\n"
1377 "\t\t\t\tlid_range_end...........%u\n"
1378 "\t\t\t\tis_generic..............0x%X\n"
1379 "\t\t\t\tsubscribe...............0x%X\n"
1380 "\t\t\t\ttrap_type...............0x%X\n"
1381 "\t\t\t\tdev_id..................0x%X\n"
1382 "\t\t\t\tqpn.....................0x%06X\n"
1383 "\t\t\t\tresp_time_val...........0x%X\n"
1384 "\t\t\t\tvendor_id...............0x%06X\n" "",
1385 cl_ntoh64(p_ii->gid.unicast.prefix),
1386 cl_ntoh64(p_ii->gid.unicast.interface_id),
1387 cl_ntoh16(p_ii->lid_range_begin),
1388 cl_ntoh16(p_ii->lid_range_end),
1389 p_ii->is_generic, p_ii->subscribe,
1390 cl_ntoh16(p_ii->trap_type),
1391 cl_ntoh16(p_ii->g_or_v.vend.dev_id),
1392 cl_ntoh32(qpn), resp_time_val,
1393 cl_ntoh32(ib_inform_info_get_prod_type(p_ii)));
1398 /**********************************************************************
1399 **********************************************************************/
1401 osm_dump_inform_info_record(IN osm_log_t * const p_log,
1402 IN const ib_inform_info_record_t * const p_iir,
1403 IN const osm_log_level_t log_level)
1405 if (osm_log_is_active(p_log, log_level)) {
1406 char gid_str[INET6_ADDRSTRLEN];
1407 char gid_str2[INET6_ADDRSTRLEN];
1409 uint8_t resp_time_val;
1411 ib_inform_info_get_qpn_resp_time(p_iir->inform_info.g_or_v.
1412 generic.qpn_resp_time_val,
1413 &qpn, &resp_time_val);
1414 if (p_iir->inform_info.is_generic) {
1415 osm_log(p_log, log_level,
1416 "InformInfo Record dump:\n"
1418 "\t\t\t\tSubscriberGID...........%s\n"
1419 "\t\t\t\tSubscriberEnum..........0x%X\n"
1420 "\t\t\t\tInformInfo dump:\n"
1421 "\t\t\t\tgid.....................%s\n"
1422 "\t\t\t\tlid_range_begin.........%u\n"
1423 "\t\t\t\tlid_range_end...........%u\n"
1424 "\t\t\t\tis_generic..............0x%X\n"
1425 "\t\t\t\tsubscribe...............0x%X\n"
1426 "\t\t\t\ttrap_type...............0x%X\n"
1427 "\t\t\t\ttrap_num................%u\n"
1428 "\t\t\t\tqpn.....................0x%06X\n"
1429 "\t\t\t\tresp_time_val...........0x%X\n"
1430 "\t\t\t\tnode_type...............0x%06X\n" "",
1431 inet_ntop(AF_INET6, p_iir->subscriber_gid.raw,
1432 gid_str, sizeof gid_str),
1433 cl_ntoh16(p_iir->subscriber_enum),
1434 inet_ntop(AF_INET6, p_iir->inform_info.gid.raw,
1435 gid_str2, sizeof gid_str2),
1436 cl_ntoh16(p_iir->inform_info.lid_range_begin),
1437 cl_ntoh16(p_iir->inform_info.lid_range_end),
1438 p_iir->inform_info.is_generic,
1439 p_iir->inform_info.subscribe,
1440 cl_ntoh16(p_iir->inform_info.trap_type),
1441 cl_ntoh16(p_iir->inform_info.g_or_v.generic.
1442 trap_num), cl_ntoh32(qpn),
1444 cl_ntoh32(ib_inform_info_get_prod_type
1445 (&p_iir->inform_info)));
1447 osm_log(p_log, log_level,
1448 "InformInfo Record dump:\n"
1450 "\t\t\t\tSubscriberGID...........%s\n"
1451 "\t\t\t\tSubscriberEnum..........0x%X\n"
1452 "\t\t\t\tInformInfo dump:\n"
1453 "\t\t\t\tgid.....................%s\n"
1454 "\t\t\t\tlid_range_begin.........%u\n"
1455 "\t\t\t\tlid_range_end...........%u\n"
1456 "\t\t\t\tis_generic..............0x%X\n"
1457 "\t\t\t\tsubscribe...............0x%X\n"
1458 "\t\t\t\ttrap_type...............0x%X\n"
1459 "\t\t\t\tdev_id..................0x%X\n"
1460 "\t\t\t\tqpn.....................0x%06X\n"
1461 "\t\t\t\tresp_time_val...........0x%X\n"
1462 "\t\t\t\tvendor_id...............0x%06X\n" "",
1463 inet_ntop(AF_INET6, p_iir->subscriber_gid.raw,
1464 gid_str, sizeof gid_str),
1465 cl_ntoh16(p_iir->subscriber_enum),
1466 inet_ntop(AF_INET6, p_iir->inform_info.gid.raw,
1467 gid_str2, sizeof gid_str2),
1468 cl_ntoh16(p_iir->inform_info.lid_range_begin),
1469 cl_ntoh16(p_iir->inform_info.lid_range_end),
1470 p_iir->inform_info.is_generic,
1471 p_iir->inform_info.subscribe,
1472 cl_ntoh16(p_iir->inform_info.trap_type),
1473 cl_ntoh16(p_iir->inform_info.g_or_v.vend.
1474 dev_id), cl_ntoh32(qpn),
1476 cl_ntoh32(ib_inform_info_get_prod_type
1477 (&p_iir->inform_info)));
1482 /**********************************************************************
1483 **********************************************************************/
1485 osm_dump_link_record(IN osm_log_t * const p_log,
1486 IN const ib_link_record_t * const p_lr,
1487 IN const osm_log_level_t log_level)
1489 if (osm_log_is_active(p_log, log_level)) {
1490 osm_log(p_log, log_level,
1491 "Link Record dump:\n"
1492 "\t\t\t\tfrom_lid................%u\n"
1493 "\t\t\t\tfrom_port_num...........%u\n"
1494 "\t\t\t\tto_port_num.............%u\n"
1495 "\t\t\t\tto_lid..................%u\n",
1496 cl_ntoh16(p_lr->from_lid),
1497 p_lr->from_port_num,
1498 p_lr->to_port_num, cl_ntoh16(p_lr->to_lid));
1502 /**********************************************************************
1503 **********************************************************************/
1505 osm_dump_switch_info(IN osm_log_t * const p_log,
1506 IN const ib_switch_info_t * const p_si,
1507 IN const osm_log_level_t log_level)
1509 if (osm_log_is_active(p_log, log_level)) {
1510 osm_log(p_log, OSM_LOG_VERBOSE,
1511 "SwitchInfo dump:\n"
1512 "\t\t\t\tlin_cap.................0x%X\n"
1513 "\t\t\t\trand_cap................0x%X\n"
1514 "\t\t\t\tmcast_cap...............0x%X\n"
1515 "\t\t\t\tlin_top.................0x%X\n"
1516 "\t\t\t\tdef_port................%u\n"
1517 "\t\t\t\tdef_mcast_pri_port......%u\n"
1518 "\t\t\t\tdef_mcast_not_port......%u\n"
1519 "\t\t\t\tlife_state..............0x%X\n"
1520 "\t\t\t\tlids_per_port...........%u\n"
1521 "\t\t\t\tpartition_enf_cap.......0x%X\n"
1522 "\t\t\t\tflags...................0x%X\n",
1523 cl_ntoh16(p_si->lin_cap),
1524 cl_ntoh16(p_si->rand_cap),
1525 cl_ntoh16(p_si->mcast_cap),
1526 cl_ntoh16(p_si->lin_top),
1528 p_si->def_mcast_pri_port,
1529 p_si->def_mcast_not_port,
1531 cl_ntoh16(p_si->lids_per_port),
1532 cl_ntoh16(p_si->enforce_cap), p_si->flags);
1536 /**********************************************************************
1537 **********************************************************************/
1539 osm_dump_switch_info_record(IN osm_log_t * const p_log,
1540 IN const ib_switch_info_record_t * const p_sir,
1541 IN const osm_log_level_t log_level)
1543 if (osm_log_is_active(p_log, log_level)) {
1544 osm_log(p_log, log_level,
1545 "SwitchInfo Record dump:\n"
1547 "\t\t\t\tlid.....................%u\n"
1548 "\t\t\t\tSwitchInfo dump:\n"
1549 "\t\t\t\tlin_cap.................0x%X\n"
1550 "\t\t\t\trand_cap................0x%X\n"
1551 "\t\t\t\tmcast_cap...............0x%X\n"
1552 "\t\t\t\tlin_top.................0x%X\n"
1553 "\t\t\t\tdef_port................%u\n"
1554 "\t\t\t\tdef_mcast_pri_port......%u\n"
1555 "\t\t\t\tdef_mcast_not_port......%u\n"
1556 "\t\t\t\tlife_state..............0x%X\n"
1557 "\t\t\t\tlids_per_port...........%u\n"
1558 "\t\t\t\tpartition_enf_cap.......0x%X\n"
1559 "\t\t\t\tflags...................0x%X\n",
1560 cl_ntoh16(p_sir->lid),
1561 cl_ntoh16(p_sir->switch_info.lin_cap),
1562 cl_ntoh16(p_sir->switch_info.rand_cap),
1563 cl_ntoh16(p_sir->switch_info.mcast_cap),
1564 cl_ntoh16(p_sir->switch_info.lin_top),
1565 p_sir->switch_info.def_port,
1566 p_sir->switch_info.def_mcast_pri_port,
1567 p_sir->switch_info.def_mcast_not_port,
1568 p_sir->switch_info.life_state,
1569 cl_ntoh16(p_sir->switch_info.lids_per_port),
1570 cl_ntoh16(p_sir->switch_info.enforce_cap),
1571 p_sir->switch_info.flags);
1575 /**********************************************************************
1576 **********************************************************************/
1578 osm_dump_pkey_block(IN osm_log_t * const p_log,
1579 IN uint64_t port_guid,
1580 IN uint16_t block_num,
1581 IN uint8_t port_num,
1582 IN const ib_pkey_table_t * const p_pkey_tbl,
1583 IN const osm_log_level_t log_level)
1585 if (osm_log_is_active(p_log, log_level)) {
1586 char buf_line[1024];
1589 for (i = 0, n = 0; i < 32; i++)
1590 n += sprintf(buf_line + n, " 0x%04x |",
1591 cl_ntoh16(p_pkey_tbl->pkey_entry[i]));
1593 osm_log(p_log, log_level,
1594 "P_Key table dump:\n"
1595 "\t\t\tport_guid...........0x%016" PRIx64 "\n"
1596 "\t\t\tblock_num...........0x%X\n"
1597 "\t\t\tport_num............%u\n\tP_Key Table: %s\n",
1598 cl_ntoh64(port_guid), block_num, port_num, buf_line);
1602 /**********************************************************************
1603 **********************************************************************/
1605 osm_dump_slvl_map_table(IN osm_log_t * const p_log,
1606 IN uint64_t port_guid,
1607 IN uint8_t in_port_num,
1608 IN uint8_t out_port_num,
1609 IN const ib_slvl_table_t * const p_slvl_tbl,
1610 IN const osm_log_level_t log_level)
1612 if (osm_log_is_active(p_log, log_level)) {
1613 char buf_line1[1024], buf_line2[1024];
1617 for (i = 0, n = 0; i < 16; i++)
1618 n += sprintf(buf_line1 + n, " %-2u |", i);
1619 for (i = 0, n = 0; i < 16; i++)
1620 n += sprintf(buf_line2 + n, "0x%01X |",
1621 ib_slvl_table_get(p_slvl_tbl, i));
1622 osm_log(p_log, log_level,
1624 "\t\t\tport_guid............0x%016" PRIx64 "\n"
1625 "\t\t\tin_port_num..........%u\n"
1626 "\t\t\tout_port_num.........%u\n\tSL: | %s\n\tVL: | %s\n",
1627 cl_ntoh64(port_guid),
1628 in_port_num, out_port_num, buf_line1, buf_line2);
1632 /**********************************************************************
1633 **********************************************************************/
1635 osm_dump_vl_arb_table(IN osm_log_t * const p_log,
1636 IN uint64_t port_guid,
1637 IN uint8_t block_num,
1638 IN uint8_t port_num,
1639 IN const ib_vl_arb_table_t * const p_vla_tbl,
1640 IN const osm_log_level_t log_level)
1642 if (osm_log_is_active(p_log, log_level)) {
1643 char buf_line1[1024], buf_line2[1024];
1646 for (i = 0, n = 0; i < 32; i++)
1647 n += sprintf(buf_line1 + n, " 0x%01X |",
1648 p_vla_tbl->vl_entry[i].vl);
1649 for (i = 0, n = 0; i < 32; i++)
1650 n += sprintf(buf_line2 + n, " 0x%01X |",
1651 p_vla_tbl->vl_entry[i].weight);
1652 osm_log(p_log, log_level,
1653 "VLArb dump:\n" "\t\t\tport_guid...........0x%016"
1654 PRIx64 "\n" "\t\t\tblock_num...........0x%X\n"
1655 "\t\t\tport_num............%u\n\tVL : | %s\n\tWEIGHT:| %s\n",
1656 cl_ntoh64(port_guid), block_num, port_num, buf_line1,
1661 /**********************************************************************
1662 **********************************************************************/
1664 osm_dump_sm_info(IN osm_log_t * const p_log,
1665 IN const ib_sm_info_t * const p_smi,
1666 IN const osm_log_level_t log_level)
1668 if (osm_log_is_active(p_log, log_level)) {
1669 osm_log(p_log, OSM_LOG_DEBUG,
1671 "\t\t\t\tguid....................0x%016" PRIx64 "\n"
1672 "\t\t\t\tsm_key..................0x%016" PRIx64 "\n"
1673 "\t\t\t\tact_count...............%u\n"
1674 "\t\t\t\tpriority................%u\n"
1675 "\t\t\t\tsm_state................%u\n",
1676 cl_ntoh64(p_smi->guid),
1677 cl_ntoh64(p_smi->sm_key),
1678 cl_ntoh32(p_smi->act_count),
1679 ib_sminfo_get_priority(p_smi),
1680 ib_sminfo_get_state(p_smi));
1684 /**********************************************************************
1685 **********************************************************************/
1687 osm_dump_sm_info_record(IN osm_log_t * const p_log,
1688 IN const ib_sminfo_record_t * const p_smir,
1689 IN const osm_log_level_t log_level)
1691 if (osm_log_is_active(p_log, log_level)) {
1692 osm_log(p_log, OSM_LOG_DEBUG,
1693 "SMInfo Record dump:\n"
1695 "\t\t\t\tLid.....................%u\n"
1696 "\t\t\t\tReserved................0x%X\n"
1697 "\t\t\t\tSMInfo dump:\n"
1698 "\t\t\t\tguid....................0x%016" PRIx64 "\n"
1699 "\t\t\t\tsm_key..................0x%016" PRIx64 "\n"
1700 "\t\t\t\tact_count...............%u\n"
1701 "\t\t\t\tpriority................%u\n"
1702 "\t\t\t\tsm_state................%u\n",
1703 cl_ntoh16(p_smir->lid),
1704 cl_ntoh16(p_smir->resv0),
1705 cl_ntoh64(p_smir->sm_info.guid),
1706 cl_ntoh64(p_smir->sm_info.sm_key),
1707 cl_ntoh32(p_smir->sm_info.act_count),
1708 ib_sminfo_get_priority(&p_smir->sm_info),
1709 ib_sminfo_get_state(&p_smir->sm_info));
1713 /**********************************************************************
1714 **********************************************************************/
1716 osm_dump_notice(IN osm_log_t * const p_log,
1717 IN const ib_mad_notice_attr_t * p_ntci,
1718 IN const osm_log_level_t log_level)
1720 if (osm_log_is_active(p_log, log_level)) {
1721 if (ib_notice_is_generic(p_ntci)) {
1725 /* immediate data based on the trap */
1726 switch (cl_ntoh16(p_ntci->g_or_v.generic.trap_num)) {
1732 "\t\t\t\tsrc_gid..................0x%016"
1733 PRIx64 ":0x%016" PRIx64 "\n",
1734 cl_ntoh64(p_ntci->data_details.
1735 ntc_64_67.gid.unicast.prefix),
1736 cl_ntoh64(p_ntci->data_details.
1737 ntc_64_67.gid.unicast.
1742 "\t\t\t\tsw_lid...................%u\n",
1743 cl_ntoh16(p_ntci->data_details.ntc_128.
1750 "\t\t\t\tlid......................%u\n"
1751 "\t\t\t\tport_num.................%u\n",
1752 cl_ntoh16(p_ntci->data_details.
1754 p_ntci->data_details.ntc_129_131.
1759 "\t\t\t\tlid......................%u\n"
1760 "\t\t\t\tnew_cap_mask.............0x%08x\n",
1761 cl_ntoh16(p_ntci->data_details.ntc_144.
1763 cl_ntoh32(p_ntci->data_details.ntc_144.
1768 "\t\t\t\tlid......................%u\n"
1769 "\t\t\t\tnew_sys_guid.............0x%016"
1771 cl_ntoh16(p_ntci->data_details.ntc_145.
1773 cl_ntoh64(p_ntci->data_details.ntc_145.
1778 osm_log(p_log, log_level,
1779 "Generic Notice dump:\n"
1780 "\t\t\t\ttype.....................%u\n"
1781 "\t\t\t\tprod_type................%u (%s)\n"
1782 "\t\t\t\ttrap_num.................%u\n%s",
1783 ib_notice_get_type(p_ntci),
1784 cl_ntoh32(ib_notice_get_prod_type(p_ntci)),
1785 ib_get_producer_type_str(ib_notice_get_prod_type
1787 cl_ntoh16(p_ntci->g_or_v.generic.trap_num),
1790 osm_log(p_log, log_level,
1791 "Vendor Notice dump:\n"
1792 "\t\t\t\ttype.....................%u\n"
1793 "\t\t\t\tvendor...................%u\n"
1794 "\t\t\t\tdevice_id................%u\n",
1795 cl_ntoh16(ib_notice_get_type(p_ntci)),
1796 cl_ntoh32(ib_notice_get_vend_id(p_ntci)),
1797 cl_ntoh16(p_ntci->g_or_v.vend.dev_id));
1802 /**********************************************************************
1803 **********************************************************************/
1805 osm_dump_dr_smp(IN osm_log_t * const p_log,
1806 IN const ib_smp_t * const p_smp,
1807 IN const osm_log_level_t log_level)
1809 if (osm_log_is_active(p_log, log_level)) {
1810 char buf[BUF_SIZE], line[BUF_SIZE];
1815 "\t\t\t\tbase_ver................0x%X\n"
1816 "\t\t\t\tmgmt_class..............0x%X\n"
1817 "\t\t\t\tclass_ver...............0x%X\n"
1818 "\t\t\t\tmethod..................0x%X (%s)\n",
1822 p_smp->method, ib_get_sm_method_str(p_smp->method));
1824 if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
1826 "\t\t\t\tD bit...................0x%X\n"
1827 "\t\t\t\tstatus..................0x%X\n",
1828 ib_smp_is_d(p_smp), ib_smp_get_status(p_smp));
1831 "\t\t\t\tstatus..................0x%X\n",
1832 cl_ntoh16(p_smp->status));
1837 "\t\t\t\thop_ptr.................0x%X\n"
1838 "\t\t\t\thop_count...............0x%X\n"
1839 "\t\t\t\ttrans_id................0x%" PRIx64 "\n"
1840 "\t\t\t\tattr_id.................0x%X (%s)\n"
1841 "\t\t\t\tresv....................0x%X\n"
1842 "\t\t\t\tattr_mod................0x%X\n"
1843 "\t\t\t\tm_key...................0x%016" PRIx64 "\n",
1846 cl_ntoh64(p_smp->trans_id),
1847 cl_ntoh16(p_smp->attr_id),
1848 ib_get_sm_attr_str(p_smp->attr_id),
1849 cl_ntoh16(p_smp->resv),
1850 cl_ntoh32(p_smp->attr_mod), cl_ntoh64(p_smp->m_key));
1853 if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
1855 "\t\t\t\tdr_slid.................%u\n"
1856 "\t\t\t\tdr_dlid.................%u\n",
1857 cl_ntoh16(p_smp->dr_slid),
1858 cl_ntoh16(p_smp->dr_dlid));
1861 strcat(buf, "\n\t\t\t\tInitial path: ");
1863 for (i = 0; i <= p_smp->hop_count; i++) {
1866 p_smp->initial_path[i]);
1868 sprintf(line, ",%d",
1869 p_smp->initial_path[i]);
1873 strcat(buf, "\n\t\t\t\tReturn path: ");
1875 for (i = 0; i <= p_smp->hop_count; i++) {
1878 p_smp->return_path[i]);
1880 sprintf(line, ",%d",
1881 p_smp->return_path[i]);
1885 strcat(buf, "\n\t\t\t\tReserved: ");
1887 for (i = 0; i < 7; i++) {
1888 sprintf(line, "[%0X]", p_smp->resv1[i]);
1894 for (i = 0; i < 64; i += 16) {
1895 sprintf(line, "\n\t\t\t\t%02X %02X %02X %02X "
1896 "%02X %02X %02X %02X"
1897 " %02X %02X %02X %02X %02X %02X %02X %02X\n",
1908 p_smp->data[i + 10],
1909 p_smp->data[i + 11],
1910 p_smp->data[i + 12],
1911 p_smp->data[i + 13],
1912 p_smp->data[i + 14],
1913 p_smp->data[i + 15]);
1918 /* not a Direct Route so provide source and destination lids */
1919 strcat(buf, "\t\t\t\tMAD IS LID ROUTED\n");
1922 osm_log(p_log, log_level, "%s\n", buf);
1926 /**********************************************************************
1927 **********************************************************************/
1929 osm_dump_sa_mad(IN osm_log_t * const p_log,
1930 IN const ib_sa_mad_t * const p_mad,
1931 IN const osm_log_level_t log_level)
1933 if (osm_log_is_active(p_log, log_level)) {
1936 /* make sure the mad is valid */
1937 if (p_mad == NULL) {
1938 OSM_LOG(p_log, log_level, "NULL MAD POINTER\n");
1944 "\t\t\t\tbase_ver................0x%X\n"
1945 "\t\t\t\tmgmt_class..............0x%X\n"
1946 "\t\t\t\tclass_ver...............0x%X\n"
1947 "\t\t\t\tmethod..................0x%X (%s)\n"
1948 "\t\t\t\tstatus..................0x%X\n"
1949 "\t\t\t\tresv....................0x%X\n"
1950 "\t\t\t\ttrans_id................0x%" PRIx64 "\n"
1951 "\t\t\t\tattr_id.................0x%X (%s)\n"
1952 "\t\t\t\tresv1...................0x%X\n"
1953 "\t\t\t\tattr_mod................0x%X\n"
1954 "\t\t\t\trmpp_version............0x%X\n"
1955 "\t\t\t\trmpp_type...............0x%X\n"
1956 "\t\t\t\trmpp_flags..............0x%X\n"
1957 "\t\t\t\trmpp_status.............0x%X\n"
1958 "\t\t\t\tseg_num.................0x%X\n"
1959 "\t\t\t\tpayload_len/new_win.....0x%X\n"
1960 "\t\t\t\tsm_key..................0x%016" PRIx64 "\n"
1961 "\t\t\t\tattr_offset.............0x%X\n"
1962 "\t\t\t\tresv2...................0x%X\n"
1963 "\t\t\t\tcomp_mask...............0x%016" PRIx64 "\n",
1967 p_mad->method, ib_get_sa_method_str(p_mad->method),
1968 cl_ntoh16(p_mad->status),
1969 cl_ntoh16(p_mad->resv),
1970 cl_ntoh64(p_mad->trans_id),
1971 cl_ntoh16(p_mad->attr_id),
1972 ib_get_sa_attr_str(p_mad->attr_id),
1973 cl_ntoh16(p_mad->resv1),
1974 cl_ntoh32(p_mad->attr_mod),
1975 p_mad->rmpp_version,
1979 cl_ntoh32(p_mad->seg_num),
1980 cl_ntoh32(p_mad->paylen_newwin),
1981 cl_ntoh64(p_mad->sm_key),
1982 cl_ntoh16(p_mad->attr_offset),
1983 cl_ntoh16(p_mad->resv3), cl_ntoh64(p_mad->comp_mask));
1987 osm_log(p_log, log_level, "%s\n", buf);
1991 /**********************************************************************
1992 **********************************************************************/
1994 osm_dump_dr_path(IN osm_log_t * const p_log,
1995 IN const osm_dr_path_t * const p_path,
1996 IN const osm_log_level_t log_level)
1998 if (osm_log_is_active(p_log, log_level)) {
1999 char buf[BUF_SIZE], line[BUF_SIZE];
2002 sprintf(buf, "Directed Path Dump of %u hop path:"
2003 "\n\t\t\t\tPath = ", p_path->hop_count);
2005 for (i = 0; i <= p_path->hop_count; i++) {
2007 sprintf(line, "%d", p_path->path[i]);
2009 sprintf(line, ",%d", p_path->path[i]);
2012 osm_log(p_log, log_level, "%s\n", buf);
2016 /**********************************************************************
2017 **********************************************************************/
2019 osm_dump_smp_dr_path(IN osm_log_t * const p_log,
2020 IN const ib_smp_t * const p_smp,
2021 IN const osm_log_level_t log_level)
2023 if (osm_log_is_active(p_log, log_level)) {
2024 char buf[BUF_SIZE], line[BUF_SIZE];
2027 sprintf(buf, "Received SMP on a %u hop path:"
2028 "\n\t\t\t\tInitial path = ", p_smp->hop_count);
2030 for (i = 0; i <= p_smp->hop_count; i++) {
2032 sprintf(line, "%d", p_smp->initial_path[i]);
2034 sprintf(line, ",%d", p_smp->initial_path[i]);
2038 strcat(buf, "\n\t\t\t\tReturn path = ");
2040 for (i = 0; i <= p_smp->hop_count; i++) {
2042 sprintf(line, "%d", p_smp->return_path[i]);
2044 sprintf(line, ",%d", p_smp->return_path[i]);
2048 osm_log(p_log, log_level, "%s\n", buf);
2052 static const char *const __osm_sm_signal_str[] = {
2053 "OSM_SIGNAL_NONE", /* 0 */
2054 "OSM_SIGNAL_SWEEP", /* 1 */
2055 "OSM_SIGNAL_IDLE_TIME_PROCESS_REQUEST", /* 2 */
2056 "OSM_SIGNAL_EXIT_STBY", /* 3 */
2057 "OSM_SIGNAL_PERFMGR_SWEEP", /* 4 */
2058 "UNKNOWN SIGNAL!!" /* 5 */
2061 /**********************************************************************
2062 **********************************************************************/
2063 const char *osm_get_sm_signal_str(IN osm_signal_t signal)
2065 if (signal > OSM_SIGNAL_MAX)
2066 signal = OSM_SIGNAL_MAX;
2067 return (__osm_sm_signal_str[signal]);
2070 /**********************************************************************
2071 **********************************************************************/
2073 static const char *const __osm_disp_msg_str[] = {
2075 "OSM_MSG_MAD_NODE_INFO",
2076 "OSM_MSG_MAD_PORT_INFO",
2077 "OSM_MSG_MAD_SWITCH_INFO",
2078 "OSM_MSG_MAD_NODE_DESC",
2079 "OSM_MSG_MAD_NODE_RECORD",
2080 "OSM_MSG_MAD_PORTINFO_RECORD",
2081 "OSM_MSG_MAD_SERVICE_RECORD",
2082 "OSM_MSG_MAD_PATH_RECORD",
2083 "OSM_MSG_MAD_MCMEMBER_RECORD",
2084 "OSM_MSG_MAD_LINK_RECORD",
2085 "OSM_MSG_MAD_SMINFO_RECORD",
2086 "OSM_MSG_MAD_CLASS_PORT_INFO",
2087 "OSM_MSG_MAD_INFORM_INFO",
2088 "OSM_MSG_MAD_LFT_RECORD",
2090 "OSM_MSG_MAD_SM_INFO",
2091 "OSM_MSG_MAD_NOTICE",
2092 "OSM_MSG_LIGHT_SWEEP_FAIL",
2094 "OSM_MSG_MAD_PKEY_TBL_RECORD",
2095 "OSM_MSG_MAD_VL_ARB_RECORD",
2096 "OSM_MSG_MAD_SLVL_TBL_RECORD",
2098 "OSM_MSG_MAD_VL_ARB",
2100 "OSM_MSG_MAD_GUIDINFO_RECORD",
2101 "OSM_MSG_MAD_INFORM_INFO_RECORD",
2102 #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP)
2103 "OSM_MSG_MAD_MULTIPATH_RECORD",
2108 /**********************************************************************
2109 **********************************************************************/
2110 const char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg)
2112 if (msg > OSM_MSG_MAX)
2114 return (__osm_disp_msg_str[msg]);
2117 static const char *const __osm_port_state_str_fixed_width[] = {
2126 /**********************************************************************
2127 **********************************************************************/
2128 const char *osm_get_port_state_str_fixed_width(IN uint8_t port_state)
2130 if (port_state > IB_LINK_ACTIVE)
2131 port_state = IB_LINK_ACTIVE + 1;
2132 return (__osm_port_state_str_fixed_width[port_state]);
2135 static const char *const __osm_node_type_str_fixed_width[] = {
2142 /**********************************************************************
2143 **********************************************************************/
2144 const char *osm_get_node_type_str_fixed_width(IN uint8_t node_type)
2146 if (node_type > IB_NODE_TYPE_ROUTER)
2148 return (__osm_node_type_str_fixed_width[node_type]);
2151 /**********************************************************************
2152 **********************************************************************/
2153 const char *osm_get_manufacturer_str(IN uint64_t const guid_ho)
2155 /* note that the max vendor string length is 11 */
2156 static const char *intel_str = "Intel";
2157 static const char *mellanox_str = "Mellanox";
2158 static const char *redswitch_str = "Redswitch";
2159 static const char *silverstorm_str = "SilverStorm";
2160 static const char *topspin_str = "Topspin";
2161 static const char *fujitsu_str = "Fujitsu";
2162 static const char *voltaire_str = "Voltaire";
2163 static const char *yotta_str = "YottaYotta";
2164 static const char *pathscale_str = "PathScale";
2165 static const char *ibm_str = "IBM";
2166 static const char *divergenet_str = "DivergeNet";
2167 static const char *flextronics_str = "Flextronics";
2168 static const char *agilent_str = "Agilent";
2169 static const char *obsidian_str = "Obsidian";
2170 static const char *baymicro_str = "BayMicro";
2171 static const char *lsilogic_str = "LSILogic";
2172 static const char *ddn_str = "DataDirect";
2173 static const char *panta_str = "Panta";
2174 static const char *hp_str = "HP";
2175 static const char *rioworks_str = "Rioworks";
2176 static const char *sun_str = "Sun";
2177 static const char *leafntwks_str = "3LeafNtwks";
2178 static const char *xsigo_str = "Xsigo";
2179 static const char *unknown_str = "Unknown";
2181 switch ((uint32_t) (guid_ho >> (5 * 8))) {
2182 case OSM_VENDOR_ID_INTEL:
2184 case OSM_VENDOR_ID_MELLANOX:
2185 return (mellanox_str);
2186 case OSM_VENDOR_ID_REDSWITCH:
2187 return (redswitch_str);
2188 case OSM_VENDOR_ID_SILVERSTORM:
2189 return (silverstorm_str);
2190 case OSM_VENDOR_ID_TOPSPIN:
2191 return (topspin_str);
2192 case OSM_VENDOR_ID_FUJITSU:
2193 case OSM_VENDOR_ID_FUJITSU2:
2194 return (fujitsu_str);
2195 case OSM_VENDOR_ID_VOLTAIRE:
2196 return (voltaire_str);
2197 case OSM_VENDOR_ID_YOTTAYOTTA:
2199 case OSM_VENDOR_ID_PATHSCALE:
2200 return (pathscale_str);
2201 case OSM_VENDOR_ID_IBM:
2203 case OSM_VENDOR_ID_DIVERGENET:
2204 return (divergenet_str);
2205 case OSM_VENDOR_ID_FLEXTRONICS:
2206 return (flextronics_str);
2207 case OSM_VENDOR_ID_AGILENT:
2208 return (agilent_str);
2209 case OSM_VENDOR_ID_OBSIDIAN:
2210 return (obsidian_str);
2211 case OSM_VENDOR_ID_BAYMICRO:
2212 return (baymicro_str);
2213 case OSM_VENDOR_ID_LSILOGIC:
2214 return (lsilogic_str);
2215 case OSM_VENDOR_ID_DDN:
2217 case OSM_VENDOR_ID_PANTA:
2219 case OSM_VENDOR_ID_HP:
2220 case OSM_VENDOR_ID_HP2:
2222 case OSM_VENDOR_ID_RIOWORKS:
2223 return (rioworks_str);
2224 case OSM_VENDOR_ID_SUN:
2226 case OSM_VENDOR_ID_3LEAFNTWKS:
2227 return (leafntwks_str);
2228 case OSM_VENDOR_ID_XSIGO:
2231 return (unknown_str);
2235 static const char *const __osm_mtu_str_fixed_width[] = {
2244 /**********************************************************************
2245 **********************************************************************/
2246 const char *osm_get_mtu_str(IN uint8_t const mtu)
2248 if (mtu > IB_MTU_LEN_4096)
2249 return (__osm_mtu_str_fixed_width[0]);
2251 return (__osm_mtu_str_fixed_width[mtu]);
2254 static const char *const __osm_lwa_str_fixed_width[] = {
2266 /**********************************************************************
2267 **********************************************************************/
2268 const char *osm_get_lwa_str(IN uint8_t const lwa)
2271 return (__osm_lwa_str_fixed_width[0]);
2273 return (__osm_lwa_str_fixed_width[lwa]);
2276 /**********************************************************************
2277 **********************************************************************/
2278 static const char *const __osm_lsa_str_fixed_width[] = {
2286 const char *osm_get_lsa_str(IN uint8_t const lsa)
2289 return (__osm_lsa_str_fixed_width[0]);
2291 return (__osm_lsa_str_fixed_width[lsa]);
2294 /**********************************************************************
2295 **********************************************************************/
2297 static const char *const __osm_sm_mgr_signal_str[] = {
2298 "OSM_SM_SIGNAL_NONE", /* 0 */
2299 "OSM_SM_SIGNAL_DISCOVERY_COMPLETED", /* 2 */
2300 "OSM_SM_SIGNAL_POLLING_TIMEOUT", /* 3 */
2301 "OSM_SM_SIGNAL_DISCOVER", /* 4 */
2302 "OSM_SM_SIGNAL_DISABLE", /* 5 */
2303 "OSM_SM_SIGNAL_HANDOVER", /* 6 */
2304 "OSM_SM_SIGNAL_HANDOVER_SENT", /* 7 */
2305 "OSM_SM_SIGNAL_ACKNOWLEDGE", /* 8 */
2306 "OSM_SM_SIGNAL_STANDBY", /* 9 */
2307 "OSM_SM_SIGNAL_MASTER_OR_HIGHER_SM_DETECTED", /* 10 */
2308 "OSM_SM_SIGNAL_WAIT_FOR_HANDOVER", /* 11 */
2309 "UNKNOWN STATE!!" /* 12 */
2312 /**********************************************************************
2313 **********************************************************************/
2314 const char *osm_get_sm_mgr_signal_str(IN osm_sm_signal_t signal)
2316 if (signal > OSM_SM_SIGNAL_MAX)
2317 signal = OSM_SM_SIGNAL_MAX;
2318 return (__osm_sm_mgr_signal_str[signal]);
2321 static const char *const __osm_sm_mgr_state_str[] = {
2322 "NOTACTIVE", /* 0 */
2323 "DISCOVERING", /* 1 */
2326 "UNKNOWN STATE!!" /* 4 */
2329 const char *osm_get_sm_mgr_state_str(IN uint16_t state)
2331 return state < ARR_SIZE(__osm_sm_mgr_state_str) ?
2332 __osm_sm_mgr_state_str[state] :
2333 __osm_sm_mgr_state_str[ARR_SIZE(__osm_sm_mgr_state_str) - 1];