New opensm component
authoreitan <eitan@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 27 Sep 2005 07:59:33 +0000 (07:59 +0000)
committereitan <eitan@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 27 Sep 2005 07:59:33 +0000 (07:59 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@99 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

249 files changed:
ulp/dirs
ulp/opensm/dirs [new file with mode: 0644]
ulp/opensm/user/dirs [new file with mode: 0644]
ulp/opensm/user/ibtrapgen/Makefile [new file with mode: 0644]
ulp/opensm/user/ibtrapgen/SOURCES [new file with mode: 0644]
ulp/opensm/user/ibtrapgen/ibtrapgen.c [new file with mode: 0644]
ulp/opensm/user/ibtrapgen/ibtrapgen.h [new file with mode: 0644]
ulp/opensm/user/ibtrapgen/main.c [new file with mode: 0644]
ulp/opensm/user/include/complib/cl_byteswap.h [new file with mode: 0644]
ulp/opensm/user/include/complib/cl_signal_osd.h [new file with mode: 0644]
ulp/opensm/user/include/iba/ib_types.h [new file with mode: 0644]
ulp/opensm/user/include/iba/ib_types_extended.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/cl_dispatcher.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/cl_event_wheel.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_attrib_req.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_base.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_base.h.orig [new file with mode: 0755]
ulp/opensm/user/include/opensm/osm_db.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_db_pack.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_drop_mgr.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_errors.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_ft_config_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_fwd_tbl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_helper.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_inform.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_lid_mgr.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_lin_fwd_rcv.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_lin_fwd_rcv_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_lin_fwd_tbl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_link_mgr.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_log.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_mad_pool.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_madw.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_matrix.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_mcast_config_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_mcast_fwd_rcv.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_mcast_fwd_rcv_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_mcast_mgr.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_mcast_tbl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_mcm_info.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_mcm_port.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_mcmember.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_msgdef.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_mtl_bind.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_mtree.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_multicast.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_node.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_node_desc_rcv.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_node_desc_rcv_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_node_info_rcv.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_node_info_rcv_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_opensm.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_partition.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_path.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_pi_config_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_pkey.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_pkey_config_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_pkey_rcv.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_pkey_rcv_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_port.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_port_info_rcv.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_port_info_rcv_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_port_profile.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_rand_fwd_tbl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_remote_sm.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_req.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_req_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_resp.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_class_port_info.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_class_port_info_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_informinfo.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_informinfo_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_lft_record.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_lft_record_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_link_record.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_link_record_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_mad_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_mcmember_record.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_mcmember_record_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_node_record.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_node_record_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_path_record.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_path_record_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_pkey_record.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_pkey_record_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_portinfo_record.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_portinfo_record_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_response.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_service_record.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_service_record_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_slvl_record.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_slvl_record_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_sminfo_record.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_sminfo_record_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_vlarb_record.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sa_vlarb_record_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_service.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_slvl_map_rcv.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_slvl_map_rcv_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sm.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sm_info_get_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sm_mad_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sm_state_mgr.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sminfo_rcv.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sminfo_rcv_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_state_mgr.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_state_mgr_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_stats.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_subnet.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_subnet_config_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sw_info_rcv.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sw_info_rcv_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_sweep_fail_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_switch.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_trap_rcv.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_trap_rcv_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_ts_useraccess.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_ucast_mgr.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_ucast_updn.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_umadt.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_vl15intf.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_vl_arb_rcv.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/osm_vl_arb_rcv_ctrl.h [new file with mode: 0644]
ulp/opensm/user/include/opensm/st.h [new file with mode: 0644]
ulp/opensm/user/include/vendor/osm_vendor.h [new file with mode: 0644]
ulp/opensm/user/include/vendor/osm_vendor_al.h [new file with mode: 0644]
ulp/opensm/user/include/vendor/osm_vendor_api.h [new file with mode: 0644]
ulp/opensm/user/include/vendor/osm_vendor_sa_api.h [new file with mode: 0644]
ulp/opensm/user/include/vendor/osm_vendor_select.h [new file with mode: 0644]
ulp/opensm/user/include/vendor/winosm_common.h [new file with mode: 0644]
ulp/opensm/user/libopensm/Makefile [new file with mode: 0755]
ulp/opensm/user/libopensm/SOURCES [new file with mode: 0644]
ulp/opensm/user/libopensm/osm_helper.c [new file with mode: 0644]
ulp/opensm/user/libopensm/osm_log.c [new file with mode: 0644]
ulp/opensm/user/libopensm/osm_mad_pool.c [new file with mode: 0644]
ulp/opensm/user/libvendor/Makefile [new file with mode: 0644]
ulp/opensm/user/libvendor/SOURCES [new file with mode: 0644]
ulp/opensm/user/libvendor/osm_vendor_al.c [new file with mode: 0644]
ulp/opensm/user/libvendor/osm_vendor_mlx_sa.c [new file with mode: 0644]
ulp/opensm/user/libvendor/winosm_common.c [new file with mode: 0644]
ulp/opensm/user/opensm/Makefile [new file with mode: 0644]
ulp/opensm/user/opensm/SOURCES [new file with mode: 0644]
ulp/opensm/user/opensm/cl_dispatcher.c [new file with mode: 0644]
ulp/opensm/user/opensm/cl_event_wheel.c [new file with mode: 0644]
ulp/opensm/user/opensm/main.c [new file with mode: 0644]
ulp/opensm/user/opensm/opensm.rc [new file with mode: 0644]
ulp/opensm/user/opensm/osm_db_files.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_db_pack.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_drop_mgr.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_fwd_tbl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_inform.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_lid_mgr.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_lin_fwd_rcv.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_lin_fwd_rcv_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_lin_fwd_tbl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_link_mgr.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_matrix.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_mcast_fwd_rcv.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_mcast_fwd_rcv_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_mcast_mgr.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_mcast_tbl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_mcm_info.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_mcm_port.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_mtree.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_multicast.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_node.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_node_desc_rcv.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_node_desc_rcv_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_node_info_rcv.c [new file with mode: 0755]
ulp/opensm/user/opensm/osm_node_info_rcv_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_opensm.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_pkey.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_pkey_rcv.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_pkey_rcv_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_port.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_port_info_rcv.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_port_info_rcv_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_remote_sm.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_req.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_req_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_resp.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_class_port_info.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_class_port_info_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_informinfo.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_informinfo_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_lft_record.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_lft_record_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_link_record.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_link_record_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_mad_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_mcmember_record.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_mcmember_record_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_node_record.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_node_record_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_path_record.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_path_record_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_pkey_record.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_pkey_record_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_portinfo_record.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_portinfo_record_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_response.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_service_record.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_service_record_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_slvl_record.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_slvl_record_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_sminfo_record.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_sminfo_record_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_vlarb_record.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sa_vlarb_record_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_service.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_slvl_map_rcv.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_slvl_map_rcv_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sm.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sm_mad_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sm_state_mgr.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sminfo_rcv.c [new file with mode: 0755]
ulp/opensm/user/opensm/osm_sminfo_rcv_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_state_mgr.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_state_mgr_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_subnet.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sw_info_rcv.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sw_info_rcv_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_sweep_fail_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_switch.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_trap_rcv.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_trap_rcv_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_ucast_mgr.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_ucast_updn.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_vl15intf.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_vl_arb_rcv.c [new file with mode: 0644]
ulp/opensm/user/opensm/osm_vl_arb_rcv_ctrl.c [new file with mode: 0644]
ulp/opensm/user/opensm/st.c [new file with mode: 0644]
ulp/opensm/user/osmtest/Makefile [new file with mode: 0644]
ulp/opensm/user/osmtest/SOURCES [new file with mode: 0644]
ulp/opensm/user/osmtest/error.h [new file with mode: 0644]
ulp/opensm/user/osmtest/main.c [new file with mode: 0644]
ulp/opensm/user/osmtest/osmt_inform.c [new file with mode: 0644]
ulp/opensm/user/osmtest/osmt_inform.h [new file with mode: 0644]
ulp/opensm/user/osmtest/osmt_mtl_regular_qp.c [new file with mode: 0644]
ulp/opensm/user/osmtest/osmt_mtl_regular_qp.h [new file with mode: 0644]
ulp/opensm/user/osmtest/osmt_multicast.c [new file with mode: 0644]
ulp/opensm/user/osmtest/osmt_service.c [new file with mode: 0644]
ulp/opensm/user/osmtest/osmt_slvl_vl_arb.c [new file with mode: 0644]
ulp/opensm/user/osmtest/osmtest.c [new file with mode: 0644]
ulp/opensm/user/osmtest/osmtest.h [new file with mode: 0644]
ulp/opensm/user/osmtest/osmtest_base.h [new file with mode: 0644]
ulp/opensm/user/osmtest/osmtest_subnet.h [new file with mode: 0644]

index d41ec66..75d677a 100644 (file)
--- a/ulp/dirs
+++ b/ulp/dirs
@@ -1,5 +1,6 @@
 DIRS=\\r
        dapl    \\r
        ipoib   \\r
-       srp             \\r
+       srp     \\r
+       opensm  \\r
        wsd\r
diff --git a/ulp/opensm/dirs b/ulp/opensm/dirs
new file mode 100644 (file)
index 0000000..db5a897
--- /dev/null
@@ -0,0 +1,2 @@
+DIRS=\\r
+       user    \r
diff --git a/ulp/opensm/user/dirs b/ulp/opensm/user/dirs
new file mode 100644 (file)
index 0000000..d7822e5
--- /dev/null
@@ -0,0 +1,7 @@
+DIRS=\
+   libvendor \
+   libopensm \
+   opensm \
+   osmtest \
+   ibtrapgen
+
diff --git a/ulp/opensm/user/ibtrapgen/Makefile b/ulp/opensm/user/ibtrapgen/Makefile
new file mode 100644 (file)
index 0000000..9c985f5
--- /dev/null
@@ -0,0 +1,7 @@
+#\r
+# DO NOT EDIT THIS FILE!!!  Edit .\sources. if you want to add a new source\r
+# file to this component.  This file merely indirects to the real make file\r
+# that is shared by all the driver components of the Windows NT DDK\r
+#\r
+\r
+!INCLUDE $(NTMAKEENV)\makefile.def\r
diff --git a/ulp/opensm/user/ibtrapgen/SOURCES b/ulp/opensm/user/ibtrapgen/SOURCES
new file mode 100644 (file)
index 0000000..54e5501
--- /dev/null
@@ -0,0 +1,67 @@
+!if $(FREEBUILD)
+TARGETNAME=ibtrapgen
+!else
+TARGETNAME=ibtrapgend
+!endif
+
+!if !defined(WINIBHOME)
+WINIBHOME=..\..\..\..
+!endif
+
+LIBPATH=$(WINIBHOME)\bin\user\obj$(BUILD_ALT_DIR)
+
+!if defined(OSM_TARGET)
+TARGETPATH=$(OSM_TARGET)\bin\user\obj$(BUILD_ALT_DIR)
+!else
+TARGETPATH=$(WINIBHOME)\bin\user\obj$(BUILD_ALT_DIR)
+!endif
+
+TARGETTYPE=PROGRAM
+UMTYPE=console
+USE_CRTDLL=1
+OVR_DIR=..\addon
+
+
+SOURCES=\
+       main.c \
+       ibtrapgen.c
+
+
+
+OSM_HOME=..
+
+TARGETLIBS=\
+!if $(FREEBUILD)
+                       $(LIBPATH)\*\ibal.lib \
+                       $(LIBPATH)\*\complib.lib \
+                       $(TARGETPATH)\*\osmv_ibal.lib \
+                       $(TARGETPATH)\*\opensm_ibal.lib \
+                       $(CRT_LIB_PATH)\msvcrt.lib
+
+!else
+                       $(LIBPATH)\*\ibald.lib \
+                       $(LIBPATH)\*\complibd.lib \
+                       $(TARGETPATH)\*\osmv_ibald.lib \
+                       $(TARGETPATH)\*\opensm_ibald.lib \
+                       $(CRT_LIB_PATH)\msvcrt.lib
+!endif
+
+#DO NOT TOUCH the order of search path , until ib_types.h merging process will be done
+INCLUDES= \
+       $(OSM_HOME)\include; \
+       $(OSM_HOME); \
+       $(WINIBHOME)\inc; \
+       $(WINIBHOME)\inc\user;
+
+# Could be any special flag needed for this project 
+USER_C_FLAGS=$(USER_C_FLAGS) /MD
+#Add preproccessor definitions
+C_DEFINES=$(C_DEFINES) -DWIN32 -D__WIN__ -D__i386__ -Dinline=__inline -DMT_LITTLE_ENDIAN -DOSM_VENDOR_INTF_AL
+!if !$(FREEBUILD)
+#C_DEFINES=$(C_DEFINES) -D_DEBUG -DDEBUG -DDBG
+C_DEFINES=$(C_DEFINES) 
+!endif
+
+LINKER_FLAGS= $(LINKER_FLAGS)
+MSC_WARNING_LEVEL= /W3
+
diff --git a/ulp/opensm/user/ibtrapgen/ibtrapgen.c b/ulp/opensm/user/ibtrapgen/ibtrapgen.c
new file mode 100644 (file)
index 0000000..c6bd3a2
--- /dev/null
@@ -0,0 +1,442 @@
+/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  This software program is available to you under a choice of one of two
+  licenses.  You may choose to be licensed under either the GNU General Public
+  License (GPL) Version 2, June 1991, available at
+  http://www.fsf.org/copyleft/gpl.html, or the Intel BSD + Patent License,
+  the text of which follows:
+
+  "Recipient" has requested a license and Intel Corporation ("Intel")
+  is willing to grant a license for the software entitled
+  InfiniBand(tm) System Software (the "Software") being provided by
+  Intel Corporation.
+
+  The following definitions apply to this License:
+
+  "Licensed Patents" means patent claims licensable by Intel Corporation which
+  are necessarily infringed by the use or sale of the Software alone or when
+  combined with the operating system referred to below.
+
+  "Recipient" means the party to whom Intel delivers this Software.
+  "Licensee" means Recipient and those third parties that receive a license to
+  any operating system available under the GNU Public License version 2.0 or
+  later.
+
+  Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+
+  The license is provided to Recipient and Recipient's Licensees under the
+  following terms.
+
+  Redistribution and use in source and binary forms of the Software, with or
+  without modification, are permitted provided that the following
+  conditions are met:
+  Redistributions of source code of the Software may retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form of the Software may reproduce the above
+  copyright notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of Intel Corporation nor the names of its contributors shall
+  be used to endorse or promote products derived from this Software without
+  specific prior written permission.
+
+  Intel hereby grants Recipient and Licensees a non-exclusive, worldwide,
+  royalty-free patent license under Licensed Patents to make, use, sell, offer
+  to sell, import and otherwise transfer the Software, if any, in source code
+  and object code form. This license shall include changes to the Software that
+  are error corrections or other minor changes to the Software that do not add
+  functionality or features when the Software is incorporated in any version of
+  a operating system that has been distributed under the GNU General Public
+  License 2.0 or later.  This patent license shall apply to the combination of
+  the Software and any operating system licensed under the GNU Public License
+  version 2.0 or later if, at the time Intel provides the Software to
+  Recipient, such addition of the Software to the then publicly
+  available versions of such operating system available under the GNU
+  Public License version 2.0 or later (whether in gold, beta or alpha
+  form) causes such combination to be covered by the Licensed
+  Patents. The patent license shall not apply to any other
+  combinations which include the Software. No hardware per se is
+  licensed hereunder.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS CONTRIBUTORS
+  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+  OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+  --------------------------------------------------------------------------*/
+
+/*
+ * Abstract:
+ *    Implementation of ibtrapgen_t.
+ *
+ * Environment:
+ *    Linux User Mode
+ *
+ * $Revision: 1.1 $
+ */
+
+#include <complib/cl_qmap.h>
+#include <complib/cl_debug.h>
+#include <vendor/osm_vendor_api.h>
+#include <vendor/osm_vendor_sa_api.h>
+#include "ibtrapgen.h"
+#include <opensm/osm_mad_pool.h>
+#include <opensm/osm_log.h>
+#include <opensm/osm_helper.h>
+
+#define GUID_ARRAY_SIZE 64
+
+/**********************************************************************
+ **********************************************************************/
+/*
+  This function initializes the main object, the log and the Osm Vendor
+*/
+ib_api_status_t
+ibtrapgen_init( IN ibtrapgen_t * const p_ibtrapgen,
+              IN ibtrapgen_opt_t * const p_opt,
+              IN const osm_log_level_t log_flags
+              )
+{
+  ib_api_status_t status;
+
+  /* just making sure - cleanup the static global obj */
+  cl_memclr( p_ibtrapgen, sizeof( *p_ibtrapgen ) );
+
+  /* construct and init the log */
+  p_ibtrapgen->p_log = (osm_log_t *)cl_malloc(sizeof(osm_log_t));
+  osm_log_construct( p_ibtrapgen->p_log );
+  status = osm_log_init( p_ibtrapgen->p_log, p_opt->force_log_flush,
+                         0x0001, p_opt->log_file );
+  if( status != IB_SUCCESS )
+    return ( status );
+
+  osm_log_set_level( p_ibtrapgen->p_log, log_flags );
+
+  /* finaly can declare we are here ... */
+  osm_log( p_ibtrapgen->p_log, OSM_LOG_FUNCS,
+           "ibtrapgen_init: [\n" );
+
+  /* assign all the opts */
+  p_ibtrapgen->p_opt = p_opt;
+
+  /* initialize the osm vendor service object */
+  p_ibtrapgen->p_vendor = osm_vendor_new( p_ibtrapgen->p_log,
+                                        p_opt->transaction_timeout );
+
+  if( p_ibtrapgen->p_vendor == NULL )
+  {
+    status = IB_INSUFFICIENT_RESOURCES;
+    osm_log( p_ibtrapgen->p_log, OSM_LOG_ERROR,
+             "ibtrapgen_init: ERR 0001: "
+             "Unable to allocate vendor object" );
+    goto Exit;
+  }
+
+  /* all mads (actually wrappers) are taken and returned to a pool */
+  osm_mad_pool_construct( &p_ibtrapgen->mad_pool );
+  status = osm_mad_pool_init(
+    &p_ibtrapgen->mad_pool, p_ibtrapgen->p_log );
+  if( status != IB_SUCCESS )
+    goto Exit;
+
+ Exit:
+  osm_log( p_ibtrapgen->p_log, OSM_LOG_FUNCS,
+           "ibtrapgen_init: ]\n" );
+  return ( status );
+}
+
+/****f* opensm: SM/__ibtrapgen_rcv_callback
+ * NAME
+ * __osm_sm_mad_ctrl_rcv_callback
+ *
+ * DESCRIPTION
+ * This is the callback from the transport layer for received MADs.
+ *
+ * SYNOPSIS
+ */
+void
+__ibtrapgen_rcv_callback(
+  IN osm_madw_t *p_madw,
+  IN void *bind_context,
+  IN osm_madw_t *p_req_madw )
+{
+  ibtrapgen_t* p_ibtrapgen = (ibtrapgen_t*)bind_context;
+
+  OSM_LOG_ENTER( p_ibtrapgen->p_log, __ibtrapgen_rcv_callback );
+
+  CL_ASSERT( p_madw );
+
+  osm_log( p_ibtrapgen->p_log, OSM_LOG_VERBOSE,
+           "__ibtrapgen_rcv_callback: Got callback\n",
+           cl_ntoh64(p_madw->p_mad->trans_id) );
+
+  OSM_LOG_EXIT( p_ibtrapgen->p_log );
+}
+
+/****f* opensm: SM/__ibtrapgen_send_err_cb
+ * NAME
+ * __ibtrapgen_send_err_cb
+ *
+ * DESCRIPTION
+ * This is the callback from the transport layer for received MADs.
+ *
+ * SYNOPSIS
+ */
+void
+__ibtrapgen_send_err_cb(
+  IN void *bind_context,
+  IN osm_madw_t *p_madw )
+{
+  ibtrapgen_t* p_ibtrapgen = (ibtrapgen_t*)bind_context;
+
+  OSM_LOG_ENTER( p_ibtrapgen->p_log, __ibtrapgen_send_err_callback );
+
+  osm_log( p_ibtrapgen->p_log, OSM_LOG_ERROR,
+           "__ibtrapgen_send_err_cb: ERR 0011: "
+           "MAD completed in error (%s).\n",
+           ib_get_err_str( p_madw->status ) );
+
+  CL_ASSERT( p_madw );
+
+  osm_log( p_ibtrapgen->p_log, OSM_LOG_ERROR,
+           "__ibtrapgen_send_err_cb: ERR 0012: "
+           "We shouldn't be here!! TID:0x%" PRIx64 ".\n",
+           cl_ntoh64(p_madw->p_mad->trans_id) );
+  OSM_LOG_EXIT( p_ibtrapgen->p_log );
+}
+
+/**********************************************************************
+ **********************************************************************/
+ib_api_status_t
+ibtrapgen_bind( IN ibtrapgen_t * p_ibtrapgen )
+{
+  ib_api_status_t status;
+  uint32_t num_ports = GUID_ARRAY_SIZE;
+  ib_port_attr_t attr_array[GUID_ARRAY_SIZE];
+  osm_bind_info_t bind_info;
+  uint8_t i;
+
+  OSM_LOG_ENTER( p_ibtrapgen->p_log, ibtrapgen_bind );
+
+  /*
+   * Call the transport layer for a list of local port
+   * GUID values.
+   */
+  status = osm_vendor_get_all_port_attr( p_ibtrapgen->p_vendor,
+                                         attr_array, &num_ports );
+  if ( status != IB_SUCCESS )
+  {
+    osm_log( p_ibtrapgen->p_log, OSM_LOG_ERROR,
+             "ibtrapgen_bind: ERR 0002: "
+             "Failure getting local port attributes (%s)\n",
+             ib_get_err_str( status ) );
+    goto Exit;
+  }
+
+  /* make sure the requested port exists */
+  if ( p_ibtrapgen->p_opt->port_num > num_ports )
+  {
+    osm_log( p_ibtrapgen->p_log, OSM_LOG_ERROR,
+             "ibtrapgen_bind: ERR 0003: "
+             "Given port number out of range %u > %u\n",
+             p_ibtrapgen->p_opt->port_num , num_ports );
+    status = IB_NOT_FOUND;
+    goto Exit;
+  }
+
+  for ( i = 0 ; i < num_ports ; i++ )
+  {
+    osm_log(p_ibtrapgen->p_log, OSM_LOG_DEBUG,
+            "ibtrapgen_bind: Found port number:%u "
+            " with GUID:0x%016"PRIx64"\n",
+            i, cl_ntoh64(attr_array[i].port_guid) );
+  }
+  /* check if the port is active */
+/*   if (attr_array[p_ibtrapgen->p_opt->port_num - 1].link_state < 4) */
+/*   { */
+/*     osm_log( p_ibtrapgen->p_log, OSM_LOG_ERROR, */
+/*              "ibtrapgen_bind: ERR 0004: " */
+/*              "Given port number link state is not active: %s.\n", */
+/*              ib_get_port_state_str( */
+/*                attr_array[p_ibtrapgen->p_opt->port_num - 1].link_state ) */
+/*              ); */
+/*     status = IB_NOT_FOUND; */
+/*     goto Exit; */
+/*   } */
+
+  p_ibtrapgen->port_guid = attr_array[p_ibtrapgen->p_opt->port_num - 1].port_guid;
+ /* save sm_lid as we need it when sending the Trap (dest lid)*/
+  p_ibtrapgen->p_opt->sm_lid = attr_array[p_ibtrapgen->p_opt->port_num - 1].sm_lid;
+
+  osm_log(p_ibtrapgen->p_log, OSM_LOG_DEBUG,
+          "ibtrapgen_bind: Port Num:%u "
+          "GUID:0x%016"PRIx64"\n",
+          p_ibtrapgen->p_opt->port_num,
+          p_ibtrapgen->port_guid );
+
+  /* ok finaly bind the sa interface to this port */
+  /* TODO - BIND LIKE THE osm_sm_mad_ctrl does */
+  bind_info.class_version = 1;
+  bind_info.is_report_processor = TRUE;
+  bind_info.is_responder = TRUE;
+  bind_info.is_trap_processor = TRUE;
+  bind_info.mad_class = IB_MCLASS_SUBN_DIR;
+  bind_info.port_guid = p_ibtrapgen->port_guid;
+  bind_info.recv_q_size = OSM_SM_DEFAULT_QP0_RCV_SIZE;
+  bind_info.send_q_size = OSM_SM_DEFAULT_QP0_SEND_SIZE;
+
+  osm_log(p_ibtrapgen->p_log, OSM_LOG_DEBUG,
+          "ibtrapgen_bind: Trying to bind to GUID:0x%016"PRIx64"\n",
+          bind_info.port_guid );
+  p_ibtrapgen->h_bind = osm_vendor_bind( p_ibtrapgen->p_vendor,
+                                    &bind_info,
+                                    &p_ibtrapgen->mad_pool,
+                                    __ibtrapgen_rcv_callback,
+                                    __ibtrapgen_send_err_cb,
+                                    p_ibtrapgen );
+
+  if(  p_ibtrapgen->h_bind == OSM_BIND_INVALID_HANDLE )
+  {
+    osm_log( p_ibtrapgen->p_log, OSM_LOG_ERROR,
+             "ibtrapgen_bind: ERR 0005: "     
+             "Unable to bind to SA\n" );
+    status = IB_ERROR;
+    goto Exit;
+  }
+
+ Exit:
+  OSM_LOG_EXIT( p_ibtrapgen->p_log );
+  return ( status );
+}
+
+/**********************************************************************
+ **********************************************************************/
+void
+ibtrapgen_destroy( IN ibtrapgen_t * p_ibtrapgen )
+{
+  if( p_ibtrapgen->p_vendor )
+  {
+    osm_vendor_delete( &p_ibtrapgen->p_vendor );
+  }
+
+  osm_log_destroy( p_ibtrapgen->p_log );
+  cl_free( p_ibtrapgen->p_log );
+}
+
+/**********************************************************************
+ **********************************************************************/
+
+ib_api_status_t
+ibtrapgen_run( IN ibtrapgen_t * const p_ibtrapgen )
+{
+  osm_madw_t*    p_report_madw;
+  ib_mad_notice_attr_t*   p_report_ntc;
+  ib_mad_t*               p_mad;
+  ib_smp_t*               p_smp_mad;
+  osm_mad_addr_t          mad_addr;
+  static atomic32_t       trap_fwd_trans_id = 0x02DAB000; 
+  ib_api_status_t         status;
+  osm_log_t *p_log =      p_ibtrapgen->p_log;
+  uint16_t                i;
+
+  OSM_LOG_ENTER( p_log, ibtrapgen_run );
+
+  osm_log( p_log, OSM_LOG_INFO,
+           "ibtrapgen_run: "
+           "Sending trap:%u from LID:0x%X %u times\n",
+           p_ibtrapgen->p_opt->trap_num,
+           p_ibtrapgen->p_opt->lid,
+           p_ibtrapgen->p_opt->number );
+  
+  printf("-V- SM lid is : 0x%04X\n",p_ibtrapgen->p_opt->sm_lid);
+  mad_addr.dest_lid = cl_ntoh16(p_ibtrapgen->p_opt->sm_lid);
+  /* ??? - what is path_bits? What should be the value here?? */
+  mad_addr.path_bits = 0;
+  /* ??? - what is static_rate? What should be the value here?? */
+  mad_addr.static_rate = 0;
+  
+  mad_addr.addr_type.smi.source_lid = cl_hton16(p_ibtrapgen->p_opt->lid);
+  mad_addr.addr_type.smi.port_num = p_ibtrapgen->p_opt->src_port;
+  
+  for (i = 1 ; i <= p_ibtrapgen->p_opt->number ; i++ )
+  {
+    p_report_madw = osm_mad_pool_get( &p_ibtrapgen->mad_pool,
+                                      p_ibtrapgen->h_bind,
+                                      MAD_BLOCK_SIZE,
+                                      &mad_addr );
+    
+    if( !p_report_madw )
+    {
+      osm_log(p_log, OSM_LOG_ERROR,
+              "ibtrapgen_run: ERR 00020: "
+              "osm_mad_pool_get failed.\n" );
+      status = IB_ERROR;
+      goto Exit;
+    }
+                                    
+    p_report_madw->resp_expected = FALSE;
+
+    /* advance trap trans id (cant simply ++ on some systems inside ntoh) */
+    p_mad = osm_madw_get_mad_ptr( p_report_madw );
+    ib_mad_init_new(p_mad,
+                    IB_MCLASS_SUBN_LID,
+                    1,
+                    IB_MAD_METHOD_TRAP,
+                    cl_hton64( (uint64_t)cl_atomic_inc( &trap_fwd_trans_id ) ),
+                    IB_MAD_ATTR_NOTICE,
+                    0);
+    
+    p_smp_mad = osm_madw_get_smp_ptr( p_report_madw );
+    
+    /* The payload is analyzed as mad notice attribute */
+    p_report_ntc = (ib_mad_notice_attr_t*)(ib_smp_get_payload_ptr(p_smp_mad));
+    
+    cl_memclr( p_report_ntc, sizeof(*p_report_ntc) );
+    p_report_ntc->generic_type = 0x83; /* is generic subn mgt type */
+    ib_notice_set_prod_type(p_report_ntc, 2); /* A switch generator */
+    p_report_ntc->g_or_v.generic.trap_num = cl_hton16(p_ibtrapgen->p_opt->trap_num);
+    p_report_ntc->issuer_lid = cl_hton16(p_ibtrapgen->p_opt->lid);
+    if (p_ibtrapgen->p_opt->trap_num == 128)
+    {
+      p_report_ntc->data_details.ntc_128.sw_lid = cl_hton16(p_ibtrapgen->p_opt->lid);
+    }
+    else 
+    {
+      p_report_ntc->data_details.ntc_129_131.lid = 
+        cl_hton16(p_ibtrapgen->p_opt->lid);
+      p_report_ntc->data_details.ntc_129_131.port_num = 
+        p_ibtrapgen->p_opt->src_port;
+    }
+
+    status = osm_vendor_send(p_report_madw->h_bind, p_report_madw, FALSE );
+    if (status != IB_SUCCESS)
+    {
+      osm_log(p_log, OSM_LOG_ERROR,
+              "ibtrapgen_run: ERR 0021: "
+              "osm_vendor_send. status = %s\n",
+              ib_get_err_str(status));
+      goto Exit;
+    }
+    osm_log(p_log, OSM_LOG_INFO,
+            "ibtrapgen_run: "
+            "Sent trap number:%u out of:%u\n",
+            i,
+            p_ibtrapgen->p_opt->number );
+    /* sleep according to rate time. The usleep is in usec - need to revert
+       the milisecs to usecs. */
+    usleep(p_ibtrapgen->p_opt->rate*1000);
+  }
+
+ Exit:
+  //  sleep(3);
+  OSM_LOG_EXIT( p_log );
+  return(status);
+}
diff --git a/ulp/opensm/user/ibtrapgen/ibtrapgen.h b/ulp/opensm/user/ibtrapgen/ibtrapgen.h
new file mode 100644 (file)
index 0000000..6fe5486
--- /dev/null
@@ -0,0 +1,313 @@
+/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  This software program is available to you under a choice of one of two
+  licenses.  You may choose to be licensed under either the GNU General Public
+  License (GPL) Version 2, June 1991, available at
+  http://www.fsf.org/copyleft/gpl.html, or the Intel BSD + Patent License,
+  the text of which follows:
+
+  "Recipient" has requested a license and Intel Corporation ("Intel")
+  is willing to grant a license for the software entitled
+  InfiniBand(tm) System Software (the "Software") being provided by
+  Intel Corporation.
+
+  The following definitions apply to this License:
+
+  "Licensed Patents" means patent claims licensable by Intel Corporation which
+  are necessarily infringed by the use or sale of the Software alone or when
+  combined with the operating system referred to below.
+
+  "Recipient" means the party to whom Intel delivers this Software.
+  "Licensee" means Recipient and those third parties that receive a license to
+  any operating system available under the GNU Public License version 2.0 or
+  later.
+
+  Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+
+  The license is provided to Recipient and Recipient's Licensees under the
+  following terms.
+
+  Redistribution and use in source and binary forms of the Software, with or
+  without modification, are permitted provided that the following
+  conditions are met:
+  Redistributions of source code of the Software may retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form of the Software may reproduce the above
+  copyright notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of Intel Corporation nor the names of its contributors shall
+  be used to endorse or promote products derived from this Software without
+  specific prior written permission.
+
+  Intel hereby grants Recipient and Licensees a non-exclusive, worldwide,
+  royalty-free patent license under Licensed Patents to make, use, sell, offer
+  to sell, import and otherwise transfer the Software, if any, in source code
+  and object code form. This license shall include changes to the Software that
+  are error corrections or other minor changes to the Software that do not add
+  functionality or features when the Software is incorporated in any version of
+  a operating system that has been distributed under the GNU General Public
+  License 2.0 or later.  This patent license shall apply to the combination of
+  the Software and any operating system licensed under the GNU Public License
+  version 2.0 or later if, at the time Intel provides the Software to
+  Recipient, such addition of the Software to the then publicly
+  available versions of such operating system available under the GNU
+  Public License version 2.0 or later (whether in gold, beta or alpha
+  form) causes such combination to be covered by the Licensed
+  Patents. The patent license shall not apply to any other
+  combinations which include the Software. No hardware per se is
+  licensed hereunder.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS CONTRIBUTORS
+  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+  OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+  --------------------------------------------------------------------------*/
+
+
+/*
+ * Abstract:
+ *    Declaration of ibtrapgen_t.
+ * This object represents the ibtrapgen object.
+ *
+ * Environment:
+ *    Linux User Mode
+ *
+ * $Revision: 1.1 $
+ */
+
+#ifndef _IBTRAPGEN_H_
+#define _IBTRAPGEN_H_
+
+#include <complib/cl_qmap.h>
+#include <vendor/osm_vendor_api.h>
+#include <vendor/osm_vendor_sa_api.h>
+#include <opensm/osm_mad_pool.h>
+#include <opensm/osm_log.h>
+#include <opensm/osm_helper.h>
+
+/****h* Trap_Generator_App/Ibtrapgen
+ * NAME
+ * Ibtrapgen
+ *
+ * DESCRIPTION
+ * The Ibtrapgen object create/join and leave multicast group.
+ *
+ * AUTHOR
+ * Yael Kalka, Mellanox.
+ *
+ *********/
+
+/****s* Trap_Generator_App/ibtrapgen_opt_t
+ * NAME
+ * ibtrapgen_opt_t
+ *
+ * DESCRIPTION
+ * Ibtrapgen options structure.  This structure contains the various
+ * specific configuration parameters for ibtrapgen.
+ *
+ * SYNOPSYS
+ */
+typedef struct _ibtrapgen_opt
+{
+  uint8_t   trap_num;
+  uint16_t  number;
+  uint16_t  rate;
+  uint16_t  lid;
+  uint16_t  sm_lid;
+  uint8_t  src_port;
+  uint8_t  port_num;
+  uint32_t  transaction_timeout;
+  boolean_t force_log_flush;
+  char *log_file;
+} ibtrapgen_opt_t;
+/*
+ * FIELDS
+ *
+ * trap_num
+ *    Trap number to generate.
+ *
+ * number
+ *    Number of times trap should be generated.
+ *
+ * rate
+ *    Rate of trap generation (in miliseconds)
+ *
+ * lid
+ *    Lid from which the trap should be generated.
+ *
+ * src_port
+ *   Source port from which the trap should be generated.
+ *
+ * port_num
+ *   Port num used for communicating with the SA.
+ * 
+ * SEE ALSO
+ *********/
+
+/****s* Trap Generator App/ibtrapgen_t
+ * NAME
+ * ibtrapgen_t
+ *
+ * DESCRIPTION
+ * Ibtrapgen structure.
+ *
+ * This object should be treated as opaque and should
+ * be manipulated only through the provided functions.
+ *
+ * SYNOPSYS
+ */
+typedef struct _ibtrapgen
+{
+  osm_log_t          *p_log;
+  struct _osm_vendor *p_vendor;
+  osm_bind_handle_t   h_bind;
+  osm_mad_pool_t      mad_pool;
+
+  ibtrapgen_opt_t    *p_opt;
+  ib_net64_t          port_guid;
+} ibtrapgen_t;
+/*
+ * FIELDS
+ * p_log
+ *    Log facility used by all Ibtrapgen components.
+ *
+ * p_vendor
+ *    Pointer to the vendor transport layer.
+ *
+ *  h_bind
+ *     The bind handle obtained by osm_vendor_sa_api/osmv_bind_sa
+ *
+ *  mad_pool
+ *     The mad pool provided for teh vendor layer to allocate mad wrappers in
+ *
+ * p_opt
+ *    ibtrapgen options structure
+ *
+ * guid
+ *    guid for the port over which ibtrapgen is running.
+ *
+ * SEE ALSO
+ *********/
+
+/****f* Trap_Generator_App/ibtrapgen_destroy
+ * NAME
+ * ibtrapgen_destroy
+ *
+ * DESCRIPTION
+ * The ibtrapgen_destroy function destroys an ibtrapgen object, releasing
+ * all resources.
+ *
+ * SYNOPSIS
+ */
+void ibtrapgen_destroy( IN ibtrapgen_t * p_ibtrapgen );
+
+/*
+ * PARAMETERS
+ * p_ibtrapgen
+ *    [in] Pointer to a Trap_Generator_App object to destroy.
+ *
+ * RETURN VALUE
+ * This function does not return a value.
+ *
+ * NOTES
+ * Performs any necessary cleanup of the specified Trap_Generator_App object.
+ * Further operations should not be attempted on the destroyed object.
+ * This function should only be called after a call to ibtrapgen_init.
+ *
+ * SEE ALSO
+ * ibtrapgen_init
+ *********/
+
+/****f* Trap_Generator_App/ibtrapgen_init
+ * NAME
+ * ibtrapgen_init
+ *
+ * DESCRIPTION
+ * The ibtrapgen_init function initializes a Trap_Generator_App object for use.
+ *
+ * SYNOPSIS
+ */
+ib_api_status_t ibtrapgen_init( IN ibtrapgen_t * const p_ibtrapgen,
+                              IN ibtrapgen_opt_t * const p_opt,
+                              IN const osm_log_level_t log_flags
+                              );
+
+/*
+ * PARAMETERS
+ * p_ibtrapgen
+ *    [in] Pointer to an ibtrapgen_t object to initialize.
+ *
+ * p_opt
+ *    [in] Pointer to the options structure.
+ *
+ * log_flags
+ *    [in] Log level flags to set.
+ *
+ * RETURN VALUES
+ * IB_SUCCESS if the Trap_Generator_App object was initialized successfully.
+ *
+ * NOTES
+ * Allows calling other Trap_Generator_App methods.
+ *
+ * SEE ALSO
+ * ibtrapgen object, ibtrapgen_construct, ibtrapgen_destroy
+ *********/
+
+
+/****f* Trap_Generator_App/ibtrapgen_bind
+ * NAME
+ * ibtrapgen_bind
+ *
+ * DESCRIPTION
+ * Binds ibtrapgen to a local port.
+ *
+ * SYNOPSIS
+ */
+ib_api_status_t ibtrapgen_bind( IN ibtrapgen_t * p_ibtrapgen );
+/*
+ * PARAMETERS
+ * p_ibtrapgen
+ *    [in] Pointer to an ibtrapgen_t object.
+ *
+ * RETURN VALUES
+ * IB_SUCCESS if OK
+ *
+ * NOTES
+ *
+ * SEE ALSO
+ *********/
+
+/****f* Trap_Generator_App/ibtrapgen_run
+ * NAME
+ * ibtrapgen_run
+ *
+ * DESCRIPTION
+ * Runs the ibtrapgen flow: Creation of traps.
+ *
+ * SYNOPSIS
+ */
+ib_api_status_t ibtrapgen_run( IN ibtrapgen_t * const p_ibtrapgen );
+
+/*
+ * PARAMETERS
+ * p_ibtrapgen
+ *    [in] Pointer to an ibtrapgen_t object.
+ *
+ * RETURN VALUES
+ * IB_SUCCESS on success
+ *
+ * NOTES
+ *
+ * SEE ALSO
+ *********/
+
+#endif /* */
diff --git a/ulp/opensm/user/ibtrapgen/main.c b/ulp/opensm/user/ibtrapgen/main.c
new file mode 100644 (file)
index 0000000..bb23326
--- /dev/null
@@ -0,0 +1,463 @@
+/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  This software program is available to you under a choice of one of two
+  licenses.  You may choose to be licensed under either the GNU General Public
+  License (GPL) Version 2, June 1991, available at
+  http://www.fsf.org/copyleft/gpl.html, or the Intel BSD + Patent License,
+  the text of which follows:
+
+  "Recipient" has requested a license and Intel Corporation ("Intel")
+  is willing to grant a license for the software entitled
+  InfiniBand(tm) System Software (the "Software") being provided by
+  Intel Corporation.
+
+  The following definitions apply to this License:
+
+  "Licensed Patents" means patent claims licensable by Intel Corporation which
+  are necessarily infringed by the use or sale of the Software alone or when
+  combined with the operating system referred to below.
+
+  "Recipient" means the party to whom Intel delivers this Software.
+  "Licensee" means Recipient and those third parties that receive a license to
+  any operating system available under the GNU Public License version 2.0 or
+  later.
+
+  Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+
+  The license is provided to Recipient and Recipient's Licensees under the
+  following terms.
+
+  Redistribution and use in source and binary forms of the Software, with or
+  without modification, are permitted provided that the following
+  conditions are met:
+  Redistributions of source code of the Software may retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+
+  Redistributions in binary form of the Software may reproduce the above
+  copyright notice, this list of conditions and the following disclaimer in the
+  documentation and/or other materials provided with the distribution.
+
+  Neither the name of Intel Corporation nor the names of its contributors shall
+  be used to endorse or promote products derived from this Software without
+  specific prior written permission.
+
+  Intel hereby grants Recipient and Licensees a non-exclusive, worldwide,
+  royalty-free patent license under Licensed Patents to make, use, sell, offer
+  to sell, import and otherwise transfer the Software, if any, in source code
+  and object code form. This license shall include changes to the Software that
+  are error corrections or other minor changes to the Software that do not add
+  functionality or features when the Software is incorporated in any version of
+  a operating system that has been distributed under the GNU General Public
+  License 2.0 or later.  This patent license shall apply to the combination of
+  the Software and any operating system licensed under the GNU Public License
+  version 2.0 or later if, at the time Intel provides the Software to
+  Recipient, such addition of the Software to the then publicly
+  available versions of such operating system available under the GNU
+  Public License version 2.0 or later (whether in gold, beta or alpha
+  form) causes such combination to be covered by the Licensed
+  Patents. The patent license shall not apply to any other
+  combinations which include the Software. No hardware per se is
+  licensed hereunder.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS CONTRIBUTORS
+  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+  OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+  --------------------------------------------------------------------------*/
+
+
+/*
+ * Abstract:
+ *    Command line interface for ibtrapgen.
+ *    Parse and fill in the options and call the actual code.
+ *    Implemented in ibtrapgen:
+ *     Initialize the ibmgrp object (and log) 
+ *     Bind ibmgrp to the requested IB port.
+ *     Run the actual command
+ *
+ * Environment:
+ *    Linux User Mode
+ *
+ * $Revision: 1.1 $
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#ifndef __WIN__
+#include <getopt.h>
+#endif
+#include <complib/cl_debug.h>
+#include <errno.h>
+#include "ibtrapgen.h"
+
+#define DEFAULT_RETRY_COUNT 3
+#define DEFAULT_TRANS_TIMEOUT_MILLISEC 1000
+
+/**********************************************************************
+ **********************************************************************/
+boolean_t
+ibtrapgen_is_debug()
+{
+#if defined( _DEBUG_ )
+  return TRUE;
+#else
+  return FALSE;
+#endif /* defined( _DEBUG_ ) */
+}
+
+/**********************************************************************
+ **********************************************************************/
+void show_usage(void);
+
+void
+show_usage(  )
+{
+  printf( "\n------- ibtrapgen - Usage and options ----------------------\n" );
+  printf( "Usage: one of the following optional flows:\n" );
+  printf(" ibtrapgen -t|--trap_num <TRAP_NUM> -n|--number <NUM_TRAP_CREATIONS>\n" 
+         "           -r|--rate <TRAP_RATE> -l|--lid <LIDADDR> \n"
+         "           -s|--src_port <SOURCE_PORT> -p|--port_num <PORT_NUM>\n" );
+  printf( "\nOptions:\n" );
+  printf( "-t <TRAP_NUM>\n"
+          "--trap_num <TRAP_NUM>\n"
+          "          This option specifies the number of the trap to generate.\n"
+          "          Valid values are 128-131.\n" );
+  printf( "-n <NUM_TRAP_CREATIONS>\n"
+          "--number <NUM_TRAP_CREATIONS>\n"
+          "          This option specifies the number of times to generate this trap.\n"
+          "          If not specified - default to 1.\n" );
+  printf( "-r <TRAP_RATE>\n"
+          "--rate <TRAP_RATE>\n"
+          "          This option specifies the rate of the trap generation.\n"
+          "          What is the time period between one generation and another?\n"
+          "          The value is given in miliseconds. \n"
+          "          If the number of trap creations is 1 - this value is ignored.\n" );
+  printf( "-l <LIDADDR>\n"
+          "--lid <LIDADDR>\n"
+          "          This option specifies the lid address from where the trap should\n"
+          "          be generated.\n" );
+  printf( "-s <SOURCE_PORT>\n"
+          "--src_port <SOURCE_PORT>\n"
+          "          This option specifies the port number from which the trap should\n"
+          "          be generated. If trap number is 128 - this value is ignored (since\n"
+          "          trap 128 is not sent with a specific port number)\n" );
+  printf( "-p <port num>\n"
+          "--port_num <port num>\n"
+          "          This is the port number used for communicating with\n"
+          "          the SA.\n" );
+  printf( "-h\n"
+          "--help\n" "          Display this usage info then exit.\n\n" );
+  printf( "-o\n"
+          "--out_log_file\n"
+          "          This option defines the log to be the given file.\n"
+          "          By default the log goes to stdout.\n\n");
+  printf( "-v\n"
+          "          This option increases the log verbosity level.\n"
+          "          The -v option may be specified multiple times\n"
+          "          to further increase the verbosity level.\n"
+          "          See the -vf option for more information about.\n"
+          "          log verbosity.\n\n" );
+  printf( "-V\n"
+          "          This option sets the maximum verbosity level and\n"
+          "          forces log flushing.\n"
+          "          The -V is equivalent to '-vf 0xFF -d 2'.\n"
+          "          See the -vf option for more information about.\n"
+          "          log verbosity.\n\n" );
+  printf( "-x <flags>\n"
+          "          This option sets the log verbosity level.\n"
+          "          A flags field must follow the -vf option.\n"
+          "          A bit set/clear in the flags enables/disables a\n"
+          "          specific log level as follows:\n"
+          "          BIT    LOG LEVEL ENABLED\n"
+          "          ----   -----------------\n"
+          "          0x01 - ERROR (error messages)\n"
+          "          0x02 - INFO (basic messages, low volume)\n"
+          "          0x04 - VERBOSE (interesting stuff, moderate volume)\n"
+          "          0x08 - DEBUG (diagnostic, high volume)\n"
+          "          0x10 - FUNCS (function entry/exit, very high volume)\n"
+          "          0x20 - FRAMES (dumps all SMP and GMP frames)\n"
+          "          0x40 - currently unused.\n"
+          "          0x80 - currently unused.\n"
+          "          Without -x, ibtrapgen defaults to ERROR + INFO (0x3).\n"
+          "          Specifying -x 0 disables all messages.\n"
+          "          Specifying -x 0xFF enables all messages (see -V).\n\n" );
+}
+
+/**********************************************************************
+ **********************************************************************/
+/*
+  Converts a GID string of the format 0xPPPPPPPPPPPPPPPP:GGGGGGGGGGGGGGGG 
+  to a gid type
+*/
+int
+str2gid(
+  IN char *str,
+  OUT ib_gid_t *p_gid
+  );
+
+int
+str2gid( 
+  IN char *str,
+  OUT ib_gid_t *p_gid
+  ) 
+{
+  ib_gid_t temp;
+  char buf[38];
+  char *p_prefix, *p_guid;
+
+  CL_ASSERT(p_gid);
+
+  strcpy(buf, str);
+  p_prefix = buf;
+  /*p_guid = index(buf, ':');*/
+  p_guid = strchr( buf, ':' );
+
+  if (! p_guid)
+  {
+    printf("Wrong format for gid %s\n", buf);
+    return 1;
+  }
+  
+  *p_guid = '\0';
+  p_guid++;
+
+  errno = 0;
+  temp.unicast.prefix = cl_hton64(strtoull(p_prefix, NULL, 0));
+  if (errno) {
+    printf("Wrong format for gid prefix:%s (got %u)\n", 
+           p_prefix, errno);
+    return 1;
+  }
+
+  temp.unicast.interface_id = cl_hton64(strtoull(p_guid, NULL, 16));
+  if (errno) {
+    printf("Wrong format for gid guid:%s\n", p_guid);
+    return 1;
+  }
+  
+  *p_gid = temp;
+  return 0;
+}
+
+/**********************************************************************
+ **********************************************************************/
+int OSM_CDECL
+main( int argc,
+      char *argv[] )
+{
+  static ibtrapgen_t ibtrapgen;
+  ibtrapgen_opt_t opt = { 0 };
+  ib_api_status_t status;
+  uint32_t log_flags = OSM_LOG_ERROR | OSM_LOG_INFO;
+  uint32_t next_option;
+  const char *const short_option = "t:n:r:s:l:p:o:vVh";
+
+  /*
+   * In the array below, the 2nd parameter specified the number
+   * of arguments as follows:
+   * 0: no arguments
+   * 1: argument
+   * 2: optional
+   */
+  const struct option long_option[] = {
+    {"trap_num",  1, NULL, 't'},
+    {"number",    1, NULL, 'n'},
+    {"rate",      1, NULL, 'r'},
+    {"lid",       1, NULL, 'l'},
+    {"src_port",  1, NULL, 's'},
+    {"port_num",  1, NULL, 'p'},
+    {"help",      0, NULL, 'h'},
+    {"verbose",   0, NULL, 'v'},
+    {"out_log_file",  1, NULL, 'o'},
+    {"vf",        1, NULL, 'x'},
+    {"V",         0, NULL, 'V'},
+
+    {NULL, 0, NULL, 0}     /* Required at end of array */
+  };
+
+
+  opt.trap_num = 0;
+  opt.number = 1; /* This is the default value */
+  opt.rate = 0;
+  opt.lid = 0;
+  opt.src_port = 0;
+  opt.port_num = 0;
+  opt.log_file = NULL;
+  opt.force_log_flush = FALSE;
+  opt.transaction_timeout = DEFAULT_TRANS_TIMEOUT_MILLISEC;
+
+  do
+  {
+    next_option = getopt_long_only( argc, argv, short_option,
+                                    long_option, NULL );
+    
+    switch ( next_option )
+    {
+    case 't':
+      /*
+       * Define the trap number
+       */
+      opt.trap_num = (uint8_t)atoi( optarg );
+      if ((opt.trap_num < 128) || (opt.trap_num > 131))
+      {
+        printf( "-E- Given trap number is illegal! \n"
+                "    Supportes generation of traps 128-131.\n" );
+        exit(1);
+      }
+      printf( "-I- Trap Number = %u\n", opt.trap_num );
+      break;
+
+    case 'n':
+      /*
+       * Define the number of occurences
+       */
+      opt.number = (uint16_t)atoi( optarg );
+
+      printf( "-I- Number Trap Occurences = %u\n", opt.number );
+      break;
+
+    case 'r':
+      /*
+       * Define the rate of the trap
+       */
+      opt.rate = (uint16_t)atoi( optarg );
+
+      printf( "-I- Trap Rate = %u miliseconds\n", opt.rate );
+      break;
+
+
+    case 'l':
+      /*
+       * Define the source lid of the trap
+       */
+        opt.lid = (uint16_t)strtoul( optarg , NULL , 16);
+
+      printf( "-I- Trap Lid = 0x%04X\n", opt.lid );
+      break;
+      
+    case 's':
+      /*
+       * Define the source port number of the trap
+       */
+      opt.src_port = (uint8_t)atoi( optarg );
+      
+      printf( "-I- Trap Port Number = %u\n", opt.src_port );
+      break;
+
+    case 'p':
+      /*
+       * Specifies port guid with which to bind.
+       */
+      opt.port_num = (uint8_t)atoi( optarg );
+      printf( "-I- Port Num:%u\n", opt.port_num );
+      break;
+    case 'o':
+      opt.log_file = optarg;
+      printf("-I- Log File:%s\n", opt.log_file );
+      break;
+
+    case 'v':
+      /*
+       * Increases log verbosity.
+       */
+      log_flags = ( log_flags << 1 ) | 1;
+      printf( "-I- Verbose option -v (log flags = 0x%X)\n", log_flags );
+      break;
+
+    case 'V':
+      /*
+       * Specifies maximum log verbosity.
+       */
+      log_flags = 0xFFFFFFFF;
+      opt.force_log_flush = TRUE;
+      printf( "-I- Enabling maximum log verbosity\n" );
+      break;
+
+    case 'h':
+      show_usage(  );
+      return 0;
+
+    case 'x':
+      log_flags = strtol( optarg, NULL, 0 );
+      printf( "-I- Verbose option -vf (log flags = 0x%X)\n",
+              log_flags );
+      break;
+
+    case -1:
+      /*      printf( "Done with args\n" ); */
+      break;
+
+    default:            /* something wrong */
+      abort(  );
+    }
+
+  }
+  while( next_option != -1 );
+
+  /* Check for mandatory options */
+  if (opt.trap_num == 0)
+  {
+    printf( "-E- Missing trap number.\n" );
+    exit(1);
+  }
+  if (opt.lid == 0)
+  {
+    printf( "-E- Missing lid.\n" );
+    exit(1);
+  }
+  if (opt.src_port == 0 && opt.trap_num >= 129 && opt.trap_num <= 131)
+  {
+    /* for trap 129-131 should be given source port number */
+    printf( "-E- source port number.\n" );
+    exit(1);
+  }
+  if (opt.port_num == 0)
+  {
+    printf( "-E- Missing port number.\n" );
+    exit(1);
+  }
+  if (opt.rate == 0 && opt.number > 1)
+  {
+    /* for number of traps greater than 1 need to give the rate for the
+       trap generation. */
+    printf( "-E- Missing rate.\n" );
+    exit(1);
+  }
+
+
+  /* init the main object and sub objects (log and osm vendor) */
+  status = ibtrapgen_init( &ibtrapgen, &opt, ( osm_log_level_t ) log_flags );
+  if( status != IB_SUCCESS )
+  {
+    printf("-E- fail to init ibtrapgen.\n");
+    goto Exit;
+  }
+  
+  /* bind to a specific port */
+  status = ibtrapgen_bind( &ibtrapgen );
+  if (status != IB_SUCCESS) exit(status);
+  
+  /* actual work */
+  status = ibtrapgen_run( &ibtrapgen );
+  if (status != IB_SUCCESS)
+  {
+    printf("IBTRAPGEN: FAIL\n");
+  }
+  else
+  {
+    printf("IBTRAPGEN: PASS\n");
+  }
+  
+  //ibtrapgen_destroy( &ibtrapgen );
+  
+ Exit:
+  exit ( status );
+}
diff --git a/ulp/opensm/user/include/complib/cl_byteswap.h b/ulp/opensm/user/include/complib/cl_byteswap.h
new file mode 100644 (file)
index 0000000..2ba5a77
--- /dev/null
@@ -0,0 +1,547 @@
+/*
+ * Copyright (c) 2004,2005 Voltaire, Inc. All rights reserved.   
+ * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.   
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.   
+ *  
+ * This software is available to you under the OpenIB.org BSD license  
+ * below:  
+ *  
+ *     Redistribution and use in source and binary forms, with or  
+ *     without modification, are permitted provided that the following  
+ *     conditions are met:  
+ *  
+ *      - Redistributions of source code must retain the above  
+ *        copyright notice, this list of conditions and the following  
+ *        disclaimer.  
+ *  
+ *      - Redistributions in binary form must reproduce the above  
+ *        copyright notice, this list of conditions and the following  
+ *        disclaimer in the documentation and/or other materials  
+ *        provided with the distribution.  
+ *  
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF   
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND           
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS  
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN  
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  
+ * SOFTWARE.  
+ *  
+ * $Id$
+ */
+
+
+
+/*
+ * Abstract:
+ *     provides byteswapping utilities. Basic fuctions are obtained from platform
+ *  specific implementations from ibyteswap_osd.h.
+ *
+ * Environment:
+ *     All
+ */
+
+
+#ifndef _CL_BYTESWAP_H_
+#define _CL_BYTESWAP_H_
+
+
+#include <complib/cl_memory.h>
+#include <complib/cl_byteswap_osd.h>
+
+
+/****h* Component Library/Byte Swapping
+* NAME
+*      Byte Swapping
+*
+* DESCRIPTION
+*      The byte swapping functions and macros allow swapping bytes from network
+*      byte order to host byte order.
+*
+*      All data transmitted between systems should be in network byte order.
+*      In order to utilize such data, it must be converted to host byte order
+*      before use.
+*
+* SEE ALSO
+*      Functions:
+*              cl_ntoh16, cl_hton16, cl_ntoh32, cl_hton32, cl_ntoh64, cl_hton64,
+*              cl_ntoh
+*
+*      Macros:
+*              CL_NTOH16, CL_HTON16, CL_NTOH32, CL_HTON32, CL_NTOH64, CL_HTON64
+*********/
+
+
+/*
+ * The ibyteswap_osd.h provides the following macros.
+ *             __LITTLE_ENDIAN
+ *             __BIG_ENDIAN
+ *             __BYTE_ORDER
+ *
+ * If the platform provides byte swapping functions, ibyteswap_osd.h also
+ * provides the following macros.
+ *             ntoh16, hton16
+ *             ntoh32, hton32
+ *             ntoh64, hton64
+ */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/****d* Component Library: Byte Swapping/CL_NTOH16
+* NAME
+*      CL_NTOH16
+*
+* DESCRIPTION
+*      The CL_NTOH16 macro converts a 16-bit value from network byte order to
+*      host byte order.  The CL_NTOH16 macro will cause constant values to be
+*      swapped by the pre-processor.  For variables, CL_NTOH16 is less efficient
+*      than the cl_ntoh16 function.
+*
+* SYNOPSIS
+*      CL_NTOH16( val );
+*
+* PARAMETERS
+*      val
+*              [in] 16-bit value to swap from network byte order to host byte order.
+*
+* RESULT
+*      Value of val converted to host byte order.
+*
+* NOTES
+*      This macro is analogous to CL_HTON16.
+*
+* SEE ALSO
+*      Byte Swapping, CL_HTON16, CL_NTOH32, CL_NTOH64,
+*      cl_ntoh16, cl_ntoh32, cl_ntoh64, cl_ntoh
+*********/
+/****d* Component Library: Byte Swapping/CL_HTON16
+* NAME
+*      CL_HTON16
+*
+* DESCRIPTION
+*      The CL_HTON16 macro converts a 16-bit value from host byte order to
+*      network byte order.  The CL_HTON16 macro will cause constant values to be
+*      swapped by the pre-processor.  For variables, CL_HTON16 is less efficient
+*      than the cl_hton16 function.
+*
+* SYNOPSIS
+*      CL_HTON16( val );
+*
+* PARAMETERS
+*      val
+*              [in] 16-bit value to swap from host byte order to network byte order.
+*
+* RESULT
+*      Value of val converted to network byte order.
+*
+* NOTES
+*      This macro is analogous to CL_NTOH16.
+*
+* SEE ALSO
+*      Byte Swapping, CL_NTOH16, CL_HTON32, CL_HTON64,
+*      cl_hton16, cl_hton32, cl_hton64, cl_ntoh
+*********/
+#if CPU_LE
+       #define CL_NTOH16( x )          (uint16_t)(             \
+                       (((uint16_t)(x) & 0x00FF) << 8) |       \
+                       (((uint16_t)(x) & 0xFF00) >> 8) )
+#else
+       #define CL_NTOH16( x )          (x)
+#endif
+#define CL_HTON16                              CL_NTOH16
+
+
+/****f* Component Library: Byte Swapping/cl_ntoh16
+* NAME
+*      cl_ntoh16
+*
+* DESCRIPTION
+*      The cl_ntoh16 function converts a 16-bit value from network byte order to
+*      host byte order.
+*
+* SYNOPSIS
+*      uint16_t
+*      cl_ntoh16(
+*              IN      const uint16_t  val );
+*
+* PARAMETERS
+*      val
+*              [in] Value to swap from network byte order to host byte order.
+*
+* RETURN VALUE
+*      Value of val converted to host byte order.
+*
+* NOTES
+*      This function is analogous to cl_hton16.
+*
+* SEE ALSO
+*      Byte Swapping, cl_hton16, cl_ntoh32, cl_ntoh64, cl_ntoh
+*********/
+/****f* Component Library: Byte Swapping/cl_hton16
+* NAME
+*      cl_hton16
+*
+* DESCRIPTION
+*      The cl_hton16 function converts a 16-bit value from host byte order to
+*      network byte order.
+*
+* SYNOPSIS
+*      uint16_t
+*      cl_hton16(
+*              IN      const uint16_t  val );
+*
+* PARAMETERS
+*      val
+*              [in] Value to swap from host byte order to network byte order .
+*
+* RETURN VALUE
+*      Value of val converted to network byte order.
+*
+* NOTES
+*      This function is analogous to cl_ntoh16.
+*
+* SEE ALSO
+*      Byte Swapping, cl_ntoh16, cl_hton32, cl_hton64, cl_ntoh
+*********/
+#undef cl_ntoh16
+#undef cl_hton16
+#ifndef cl_ntoh16
+       #define cl_ntoh16       CL_NTOH16
+       #define cl_hton16       CL_HTON16
+#endif
+
+
+/****d* Component Library: Byte Swapping/CL_NTOH32
+* NAME
+*      CL_NTOH32
+*
+* DESCRIPTION
+*      The CL_NTOH32 macro converts a 32-bit value from network byte order to
+*      host byte order.  The CL_NTOH32 macro will cause constant values to be
+*      swapped by the pre-processor.  For variables, CL_NTOH32 is less efficient
+*      than the cl_ntoh32 function.
+*
+* SYNOPSIS
+*      CL_NTOH32( val );
+*
+* PARAMETERS
+*      val
+*              [in] 32-bit value to swap from network byte order to host byte order.
+*
+* RESULT
+*      Value of val converted to host byte order.
+*
+* NOTES
+*      This macro is analogous to CL_HTON32.
+*
+* SEE ALSO
+*      Byte Swapping, CL_HTON32, CL_NTOH16, CL_NTOH64,
+*      cl_ntoh16, cl_ntoh32, cl_ntoh64, cl_ntoh
+*********/
+/****d* Component Library: Byte Swapping/CL_HTON32
+* NAME
+*      CL_HTON32
+*
+* DESCRIPTION
+*      The CL_HTON32 macro converts a 32-bit value from host byte order to
+*      network byte order.  The CL_HTON32 macro will cause constant values to be
+*      swapped by the pre-processor.  For variables, CL_HTON32 is less efficient
+*      than the cl_hton32 function.
+*
+* SYNOPSIS
+*      CL_HTON32( val );
+*
+* PARAMETERS
+*      val
+*              [in] 32-bit value to swap from host byte order to network byte order.
+*
+* RESULT
+*      Value of val converted to network byte order.
+*
+* NOTES
+*      This macro is analogous to CL_NTOH32.
+*
+* SEE ALSO
+*      Byte Swapping, CL_NTOH32, CL_HTON16, CL_HTON64,
+*      cl_hton16, cl_hton32, cl_hton64, cl_ntoh
+*********/
+#if CPU_LE
+       #define CL_NTOH32( x )          (uint32_t)(                     \
+                       (((uint32_t)(x) & 0x000000FF) << 24) |  \
+                       (((uint32_t)(x) & 0x0000FF00) << 8) |   \
+                       (((uint32_t)(x) & 0x00FF0000) >> 8) |   \
+                       (((uint32_t)(x) & 0xFF000000) >> 24) )
+#else
+       #define CL_NTOH32( x )          (x)
+#endif
+#define CL_HTON32                              CL_NTOH32
+
+
+/****f* Component Library: Byte Swapping/cl_ntoh32
+* NAME
+*      cl_ntoh32
+*
+* DESCRIPTION
+*      The cl_ntoh32 function converts a 32-bit value from network byte order to
+*      host byte order.
+*
+* SYNOPSIS
+*      uint32_t
+*      cl_ntoh32(
+*              IN      const uint32_t  val );
+*
+* PARAMETERS
+*      val
+*              [in] Value to swap from network byte order to host byte order.
+*
+* RETURN VALUE
+*      Value of val converted in host byte order.
+*
+* NOTES
+*      This function is analogous to cl_hton32.
+*
+* SEE ALSO
+*      Byte Swapping, cl_hton32, cl_ntoh16, cl_ntoh64, cl_ntoh
+*********/
+/****f* Component Library: Byte Swapping/cl_hton32
+* NAME
+*      cl_hton32
+*
+* DESCRIPTION
+*      The cl_hton32 function converts a 32-bit value from host byte order to
+*      network byte order.
+*
+* SYNOPSIS
+*      uint32_t
+*      cl_hton32(
+*              IN      const uint32_t  val );
+*
+* PARAMETERS
+*      val
+*              [in] Value to swap from host byte order to network byte order .
+*
+* RETURN VALUE
+*      Value of val converted to network byte order.
+*
+* NOTES
+*      This function is analogous to cl_ntoh32.
+*
+* SEE ALSO
+*      Byte Swapping, cl_ntoh32, cl_hton16, cl_hton64, cl_ntoh
+*********/
+#undef  cl_ntoh32
+#undef  cl_hton32
+#ifndef cl_ntoh32
+       #define cl_ntoh32       CL_NTOH32
+       #define cl_hton32       CL_HTON32
+#endif
+
+
+/****d* Component Library: Byte Swapping/CL_NTOH64
+* NAME
+*      CL_NTOH64
+*
+* DESCRIPTION
+*      The CL_NTOH64 macro converts a 64-bit value from network byte order to
+*      host byte order.  The CL_NTOH64 macro will cause constant values to be
+*      swapped by the pre-processor.  For variables, CL_NTOH64 is less efficient
+*      than the cl_ntoh64 function.
+*
+* SYNOPSIS
+*      CL_NTOH64( val );
+*
+* PARAMETERS
+*      val
+*              [in] 64-bit value to swap from network byte order to host byte order.
+*
+* RESULT
+*      Value of val converted to host byte order.
+*
+* NOTES
+*      This macro is analogous to CL_HTON64.
+*
+* SEE ALSO
+*      Byte Swapping, CL_HTON64, CL_NTOH16, CL_NTOH32,
+*      cl_ntoh16, cl_ntoh32, cl_ntoh64, cl_ntoh
+*********/
+/****d* Component Library: Byte Swapping/CL_HTON64
+* NAME
+*      CL_HTON64
+*
+* DESCRIPTION
+*      The CL_HTON64 macro converts a 64-bit value from host byte order to
+*      network byte order.  The CL_HTON64 macro will cause constant values to be
+*      swapped by the pre-processor.  For variables, CL_HTON64 is less efficient
+*      than the cl_hton64 function.
+*
+* SYNOPSIS
+*      CL_HTON64( val );
+*
+* PARAMETERS
+*      val
+*              [in] 64-bit value to swap from host byte order to network byte order.
+*
+* RESULT
+*      Value of val converted to network byte order.
+*
+* NOTES
+*      This macro is analogous to CL_NTOH64.
+*
+* SEE ALSO
+*      Byte Swapping, CL_NTOH64, CL_HTON16, CL_HTON32,
+*      cl_hton16, cl_hton32, cl_hton64, cl_ntoh
+*********/
+#if CPU_LE
+       #define CL_NTOH64( x )          (uint64_t)(                                     \
+                       (((uint64_t)(x) & CL_CONST64(0x00000000000000FF)) << 56) |      \
+                       (((uint64_t)(x) & CL_CONST64(0x000000000000FF00)) << 40) |      \
+                       (((uint64_t)(x) & CL_CONST64(0x0000000000FF0000)) << 24) |      \
+                       (((uint64_t)(x) & CL_CONST64(0x00000000FF000000)) << 8 ) |      \
+                       (((uint64_t)(x) & CL_CONST64(0x000000FF00000000)) >> 8 ) |      \
+                       (((uint64_t)(x) & CL_CONST64(0x0000FF0000000000)) >> 24) |      \
+                       (((uint64_t)(x) & CL_CONST64(0x00FF000000000000)) >> 40) |      \
+                       (((uint64_t)(x) & CL_CONST64(0xFF00000000000000)) >> 56) )
+#else
+       #define CL_NTOH64( x )          (x)
+#endif
+#define CL_HTON64                              CL_NTOH64
+
+
+/****f* Component Library: Byte Swapping/cl_ntoh64
+* NAME
+*      cl_ntoh64
+*
+* DESCRIPTION
+*      The cl_ntoh64 function converts a 64-bit value from network byte order to
+*      host byte order.
+*
+* SYNOPSIS
+*      uint64_t
+*      cl_ntoh64(
+*              IN      const uint64_t  val );
+*
+* PARAMETERS
+*      val
+*              [in] Value to swap from network byte order to host byte order.
+*
+* RETURN VALUE
+*      Value of val converted in host byte order.
+*
+* NOTES
+*      This function is analogous to cl_hton64.
+*
+* SEE ALSO
+*      Byte Swapping, cl_hton64, cl_ntoh16, cl_ntoh32, cl_ntoh
+*********/
+/****f* Component Library: Byte Swapping/cl_hton64
+* NAME
+*      cl_hton64
+*
+* DESCRIPTION
+*      The cl_hton64 function converts a 64-bit value from host byte order to
+*      network byte order.
+*
+* SYNOPSIS
+*      uint64_t
+*      cl_hton64(
+*              IN      const uint64_t  val );
+*
+* PARAMETERS
+*      val
+*              [in] Value to swap from host byte order to network byte order .
+*
+* RETURN VALUE
+*      Value of val converted to network byte order.
+*
+* NOTES
+*      This function is analogous to cl_ntoh64.
+*
+* SEE ALSO
+*      Byte Swapping, cl_ntoh64, cl_hton16, cl_hton32, cl_ntoh
+*********/
+#undef cl_ntoh64
+#undef cl_hton64
+#ifndef cl_ntoh64
+       #define cl_ntoh64       CL_NTOH64
+       #define cl_hton64       CL_HTON64
+#endif
+
+
+/****f* Component Library: Byte Swapping/cl_ntoh
+* NAME
+*      cl_ntoh
+*
+* DESCRIPTION
+*      The cl_ntoh function converts a value from network byte order to
+*      host byte order.
+*
+* SYNOPSIS
+*/
+CL_INLINE void CL_API
+cl_ntoh(
+       OUT     char* const                     p_dest,
+       IN      const char* const       p_src,
+       IN      const uint8_t           size )
+{
+#if CPU_LE
+       uint8_t i;
+       char    temp;
+
+       if( p_src == p_dest )
+       {
+               /* Swap in place if source and destination are the same. */
+               for( i = 0; i < size / 2; i++ )
+               {
+                       temp = p_dest[i];
+                       p_dest[i] = p_src[size - 1 - i];
+                       p_dest[size - 1 - i] = temp;
+               }
+       }
+       else
+       {
+               for( i = 0; i < size; i++ )
+                       p_dest[i] = p_src[size - 1 - i];
+       }
+#else
+       /*
+        * If the source and destination are not the same, copy the source to
+        * the destination.
+        */
+       if( p_src != p_dest )
+               cl_memcpy( p_dest, p_src, size );
+#endif
+}
+/*
+* PARAMETERS
+*      p_dest
+*              [in] Pointer to a byte array to contain the converted value of p_src.
+*
+*      p_src
+*              [in] Pointer to a byte array to be converted from network byte
+*              ordering.
+*
+*      size
+*              [in] Number of bytes to swap.p_dest
+*
+* RETURN VALUE
+*      This function does not return a value.
+*
+* NOTES
+*      cl_ntoh can perform in place swapping if both p_src and p_dest point to
+*      the same buffer.
+*
+* SEE ALSO
+*      Byte Swapping, cl_ntoh16, cl_ntoh32, cl_ntoh64
+*********/
+
+
+#ifdef __cplusplus
+}      /* extern "C" */
+#endif
+
+#endif /* _CL_BYTESWAP_H_ */
diff --git a/ulp/opensm/user/include/complib/cl_signal_osd.h b/ulp/opensm/user/include/complib/cl_signal_osd.h
new file mode 100644 (file)
index 0000000..dedd99a
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2005 Mellanox Technologies.  All rights reserved.
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * $Id: cl_signal_osd.h 47 2005-05-30 18:00:40Z sleybo $
+ */
+
+/*
+ * Abstract:
+ *     Declaration of Signal Handler Registration
+ *
+ * Environment:
+ *     All
+ *
+ * $Revision: 1.3 $
+ */
+
+
+#ifndef _CL_SIG_HDL_H_
+#define _CL_SIG_HDL_H_
+
+#include <signal.h>
+
+/****h* Component Library/Signal Handler
+* NAME
+*   Signal Handler Registration
+*
+* DESCRIPTION
+*      The Signal Handler Registration allows to register a callback on the case of incoming signal
+*
+* SEE ALSO
+*********/
+/* TODO : Required when calling signal function in windows*/
+typedef void (__cdecl *cl_sig_hdl)(
+   IN int sig);
+/* Prototypes */
+
+/****f* Component Library: Signal Handler/cl_reg_sig_hdl
+* NAME
+*      cl_reg_sig_hdl
+*
+* DESCRIPTION
+*      Register the handler for the given signal
+*
+* SYNOPSIS
+*/
+
+static inline void 
+cl_reg_sig_hdl(int sig, cl_sig_hdl pfn_sig_hdl);
+
+
+
+/****f* Component Library: Signal Handler/cl_mask_sigint
+* NAME
+*      cl_sig_mask_sigint
+*
+* DESCRIPTION
+*      Mask the kill signal
+*
+* SYNOPSIS
+*/
+
+static inline void 
+cl_sig_mask_sigint(void);
+
+
+
+
+/****f* Component Library: Signal Handler/cl_reg_sig_hdl
+* NAME
+*      cl_reg_sig_hdl
+*
+* DESCRIPTION
+*      Register the handler for the given signal
+*
+* SYNOPSIS
+*/
+static inline void 
+cl_reg_sig_hdl(int sig, cl_sig_hdl pfn_sig_hdl) {
+       signal(sig,pfn_sig_hdl);
+ }
+/*
+*********/
+
+/****f* Component Library: Signal Handler/cl_mask_sigint
+* NAME
+*      cl_sig_mask_sigint
+*
+* DESCRIPTION
+*      Mask the kill signal
+*
+* SYNOPSIS
+*/
+static inline void 
+cl_sig_mask_sigint(void)
+{
+}
+/*
+*********/
+
+#endif /* _CL_SIG_HDL_H_ */
diff --git a/ulp/opensm/user/include/iba/ib_types.h b/ulp/opensm/user/include/iba/ib_types.h
new file mode 100644 (file)
index 0000000..9bd0c18
--- /dev/null
@@ -0,0 +1,9548 @@
+/*
+ * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * $Id: osm_sa.c 3155 2005-08-22 12:09:34Z yael $
+ */
+
+
+#if !defined(__IB_TYPES_H__)
+#define __IB_TYPES_H__
+
+#include <complib/cl_types.h>
+#include <complib/cl_byteswap.h>
+#include <complib/cl_memory.h>
+
+#ifdef __cplusplus
+#  define BEGIN_C_DECLS extern "C" {
+#  define END_C_DECLS   }
+#else /* !__cplusplus */
+#  define BEGIN_C_DECLS
+#  define END_C_DECLS
+#endif /* __cplusplus */
+
+BEGIN_C_DECLS
+
+#if defined( WIN32 ) || defined( _WIN64 )
+    #if defined( EXPORT_AL_SYMBOLS )
+         #define AL_EXPORT     __declspec(dllexport)
+    #else
+         #define AL_EXPORT     __declspec(dllimport)
+    #endif
+
+    #ifdef CL_KERNEL
+        #define AL_API
+        #define AL_INLINE      static inline
+    #else
+        #define AL_API         __stdcall
+        #define AL_INLINE      AL_EXPORT inline
+        /* Defined for some unique access function that are defined only in osm ib_types */
+        #define OSM_INLINE static inline
+    #endif     /* CL_KERNEL */
+#else
+    #define AL_EXPORT  extern
+    #define AL_INLINE  static inline
+    #define OSM_INLINE static inline
+    #define AL_API
+    #define __ptr64
+#endif
+
+
+
+/****h* IBA Base/Constants
+* NAME
+*      Constants
+*
+* DESCRIPTION
+*      The following constants are used throughout the IBA code base.
+*
+*      Definitions are from the InfiniBand Architecture Specification v1.1
+*
+*********/
+
+/****d* IBA Base: Constants/MAD_BLOCK_SIZE
+* NAME
+*      MAD_BLOCK_SIZE
+*
+* DESCRIPTION
+*      Size of a non-RMPP MAD datagram.
+*
+* SOURCE
+*/
+#define MAD_BLOCK_SIZE                                         256
+/**********/
+
+/****d* IBA Base: Constants/MAD_RMPP_HDR_SIZE
+* NAME
+*      MAD_RMPP_HDR_SIZE
+*
+* DESCRIPTION
+*      Size of an RMPP header, including the common MAD header.
+*
+* SOURCE
+*/
+#define MAD_RMPP_HDR_SIZE                                      36
+/**********/
+
+/****d* IBA Base: Constants/MAD_RMPP_DATA_SIZE
+* NAME
+*      MAD_RMPP_DATA_SIZE
+*
+* DESCRIPTION
+*      Size of an RMPP transaction data section.
+*
+* SOURCE
+*/
+#define MAD_RMPP_DATA_SIZE             (MAD_BLOCK_SIZE - MAD_RMPP_HDR_SIZE)
+/**********/
+
+/****d* IBA Base: Constants/MAD_BLOCK_GRH_SIZE
+* NAME
+*      MAD_BLOCK_GRH_SIZE
+*
+* DESCRIPTION
+*      Size of a MAD datagram, including the GRH.
+*
+* SOURCE
+*/
+#define MAD_BLOCK_GRH_SIZE                                     296
+/**********/
+
+/****d* IBA Base: Constants/IB_LID_PERMISSIVE
+* NAME
+*      IB_LID_PERMISSIVE
+*
+* DESCRIPTION
+*      Permissive LID
+*
+* SOURCE
+*/
+#define IB_LID_PERMISSIVE                                      0xFFFF
+/**********/
+
+/****d* IBA Base: Constants/IB_DEFAULT_PKEY
+* NAME
+*      IB_DEFAULT_PKEY
+*
+* DESCRIPTION
+*      P_Key value for the default partition.
+*
+* SOURCE
+*/
+#define IB_DEFAULT_PKEY                                                0xFFFF
+/**********/
+
+/****d* IBA Base: Constants/IB_QP1_WELL_KNOWN_Q_KEY
+* NAME
+*      IB_QP1_WELL_KNOWN_Q_KEY
+*
+* DESCRIPTION
+*      Well-known Q_Key for QP1 privileged mode access (15.4.2).
+*
+* SOURCE
+*/
+#define IB_QP1_WELL_KNOWN_Q_KEY                                CL_NTOH32(0x80010000)
+/*********/
+
+#define IB_QP0                                                         0
+#define IB_QP1                                                         CL_NTOH32(1)
+
+#define IB_QP_PRIVILEGED_Q_KEY                         CL_NTOH32(0x80000000)
+
+/****d* IBA Base: Constants/IB_LID_UCAST_START
+* NAME
+*      IB_LID_UCAST_START
+*
+* DESCRIPTION
+*      Lowest valid unicast LID value.
+*
+* SOURCE
+*/
+#define IB_LID_UCAST_START_HO                          0x0001
+#define IB_LID_UCAST_START                                     (CL_HTON16(IB_LID_UCAST_START_HO))
+/**********/
+
+/****d* IBA Base: Constants/IB_LID_UCAST_END
+* NAME
+*      IB_LID_UCAST_END
+*
+* DESCRIPTION
+*      Highest valid unicast LID value.
+*
+* SOURCE
+*/
+#define IB_LID_UCAST_END_HO                                    0xBFFF
+#define IB_LID_UCAST_END                                       (CL_HTON16(IB_LID_UCAST_END_HO))
+/**********/
+
+/****d* IBA Base: Constants/IB_LID_MCAST_START
+* NAME
+*      IB_LID_MCAST_START
+*
+* DESCRIPTION
+*      Lowest valid multicast LID value.
+*
+* SOURCE
+*/
+#define IB_LID_MCAST_START_HO                          0xC000
+#define IB_LID_MCAST_START                                     (CL_HTON16(IB_LID_MCAST_START_HO))
+/**********/
+
+/****d* IBA Base: Constants/IB_LID_MCAST_END
+* NAME
+*      IB_LID_MCAST_END
+*
+* DESCRIPTION
+*      Highest valid multicast LID value.
+*
+* SOURCE
+*/
+#define IB_LID_MCAST_END_HO                                    0xFFFE
+#define IB_LID_MCAST_END                                       (CL_HTON16(IB_LID_MCAST_END_HO))
+/**********/
+
+/****d* IBA Base: Constants/IB_DEFAULT_SUBNET_PREFIX
+* NAME
+*      IB_DEFAULT_SUBNET_PREFIX
+*
+* DESCRIPTION
+*      Default subnet GID prefix.
+*
+* SOURCE
+*/
+#define IB_DEFAULT_SUBNET_PREFIX                       (CL_HTON64(0xFE80000000000000ULL))
+/**********/
+
+/****d* IBA Base: Constants/IB_NODE_NUM_PORTS_MAX
+* NAME
+*      IB_NODE_NUM_PORTS_MAX
+*
+* DESCRIPTION
+*      Maximum number of ports in a single node (14.2.5.7).
+* SOURCE
+*/
+#define IB_NODE_NUM_PORTS_MAX                          0xFE
+/**********/
+
+/****d* IBA Base: Constants/IB_INVALID_PORT_NUM
+* NAME
+*      IB_INVALID_PORT_NUM
+*
+* DESCRIPTION
+*      Value used to indicate an invalid port number (14.2.5.10).
+*
+* SOURCE
+*/
+#define IB_INVALID_PORT_NUM                                    0xFF
+/*********/
+
+/****d* IBA Base: Constants/IB_SUBNET_PATH_HOPS_MAX
+* NAME
+*      IB_SUBNET_PATH_HOPS_MAX
+*
+* DESCRIPTION
+*      Maximum number of directed route switch hops in a subnet (14.2.1.2).
+*
+* SOURCE
+*/
+#define IB_SUBNET_PATH_HOPS_MAX                                64
+/*********/
+
+/****d* IBA Base: Constants/IB_PKEY_MAX_BLOCKS
+* NAME
+*      IB_PKEY_MAX_BLOCKS
+*
+* DESCRIPTION
+*      Maximum number of PKEY blocks (14.2.5.7).
+*
+* SOURCE
+*/
+#define IB_PKEY_MAX_BLOCKS                                     2048
+/*********/
+
+/****d* IBA Base: Constants/IB_MCAST_MAX_BLOCK_ID
+* NAME
+*      IB_MCAST_MAX_BLOCK_ID
+*
+* DESCRIPTION
+*      Maximum number of Multicast port mask blocks
+*
+* SOURCE
+*/
+#define IB_MCAST_MAX_BLOCK_ID                          511
+/*********/
+
+/****d* IBA Base: Constants/IB_MCAST_BLOCK_ID_MASK_HO
+* NAME
+*      IB_MCAST_BLOCK_ID_MASK_HO
+*
+* DESCRIPTION
+*      Mask (host order) to recover the Multicast block ID.
+*
+* SOURCE
+*/
+#define IB_MCAST_BLOCK_ID_MASK_HO                      0x000001FF
+/*********/
+
+/****d* IBA Base: Constants/IB_MCAST_BLOCK_SIZE
+* NAME
+*      IB_MCAST_BLOCK_SIZE
+*
+* DESCRIPTION
+*      Number of port mask entries in a multicast forwarding table block.
+*
+* SOURCE
+*/
+#define IB_MCAST_BLOCK_SIZE                                    32
+/*********/
+
+/****d* IBA Base: Constants/IB_MCAST_MASK_SIZE
+* NAME
+*      IB_MCAST_MASK_SIZE
+*
+* DESCRIPTION
+*      Number of port mask bits in each entry in the multicast forwarding table.
+*
+* SOURCE
+*/
+#define IB_MCAST_MASK_SIZE                                     16
+/*********/
+
+/****d* IBA Base: Constants/IB_MCAST_POSITION_MASK_HO
+* NAME
+*      IB_MCAST_POSITION_MASK_HO
+*
+* DESCRIPTION
+*      Mask (host order) to recover the multicast block position.
+*
+* SOURCE
+*/
+#define IB_MCAST_POSITION_MASK_HO                              0xF0000000
+/*********/
+
+/****d* IBA Base: Constants/IB_MCAST_POSITION_MAX
+* NAME
+*      IB_MCAST_POSITION_MAX
+*
+* DESCRIPTION
+*      Maximum value for the multicast block position.
+*
+* SOURCE
+*/
+#define IB_MCAST_POSITION_MAX                          0xF
+/*********/
+
+/****d* IBA Base: Constants/IB_MCAST_POSITION_SHIFT
+* NAME
+*      IB_MCAST_POSITION_SHIFT
+*
+* DESCRIPTION
+*      Shift value to normalize the multicast block position value.
+*
+* SOURCE
+*/
+#define IB_MCAST_POSITION_SHIFT                                28
+/*********/
+
+/****d* IBA Base: Constants/IB_PKEY_ENTRIES_MAX
+* NAME
+*      IB_PKEY_ENTRIES_MAX
+*
+* DESCRIPTION
+*      Maximum number of PKEY entries per port (14.2.5.7).
+*
+* SOURCE
+*/
+#define IB_PKEY_ENTRIES_MAX (IB_PKEY_MAX_BLOCKS * IB_NUM_PKEY_ELEMENTS_IN_BLOCK)
+/*********/
+
+/****d* IBA Base: Constants/IB_PKEY_BASE_MASK
+* NAME
+*      IB_PKEY_BASE_MASK
+*
+* DESCRIPTION
+*      Masks for the base P_Key value given a P_Key Entry.
+*
+* SOURCE
+*/
+#define IB_PKEY_BASE_MASK                                      (CL_NTOH16(0x7FFF))
+/*********/
+
+/****d* IBA Base: Constants/IB_PKEY_TYPE_MASK
+* NAME
+*      IB_PKEY_TYPE_MASK
+*
+* DESCRIPTION
+*      Masks for the P_Key membership type given a P_Key Entry.
+*
+* SOURCE
+*/
+#define IB_PKEY_TYPE_MASK                                      (CL_NTOH16(0x8000))
+/*********/
+
+/****d* IBA Base: Constants/IB_MCLASS_SUBN_LID
+* NAME
+*      IB_MCLASS_SUBN_LID
+*
+* DESCRIPTION
+*      Subnet Management Class, Subnet Manager LID routed (13.4.4)
+*
+* SOURCE
+*/
+#define IB_MCLASS_SUBN_LID                                     0x01
+/**********/
+
+/****d* IBA Base: Constants/IB_MCLASS_SUBN_DIR
+* NAME
+*      IB_MCLASS_SUBN_DIR
+*
+* DESCRIPTION
+*      Subnet Management Class, Subnet Manager directed route (13.4.4)
+*
+* SOURCE
+*/
+#define IB_MCLASS_SUBN_DIR                                     0x81
+/**********/
+
+/****d* IBA Base: Constants/IB_MCLASS_SUBN_ADM
+* NAME
+*      IB_MCLASS_SUBN_ADM
+*
+* DESCRIPTION
+*      Subnet Management Class, Subnet Administration (13.4.4)
+*
+* SOURCE
+*/
+#define IB_MCLASS_SUBN_ADM                                     0x03
+/**********/
+
+/****d* IBA Base: Constants/IB_MCLASS_PERF
+* NAME
+*      IB_MCLASS_PERF
+*
+* DESCRIPTION
+*      Subnet Management Class, Performance Manager (13.4.4)
+*
+* SOURCE
+*/
+#define IB_MCLASS_PERF                                         0x04
+/**********/
+
+/****d* IBA Base: Constants/IB_MCLASS_BM
+* NAME
+*      IB_MCLASS_BM
+*
+* DESCRIPTION
+*      Subnet Management Class, Baseboard Manager (13.4.4)
+*
+* SOURCE
+*/
+#define IB_MCLASS_BM                                           0x05
+/**********/
+
+/****d* IBA Base: Constants/IB_MCLASS_DEV_MGMT
+* NAME
+*      IB_MCLASS_DEV_MGMT
+*
+* DESCRIPTION
+*      Subnet Management Class, Device Management (13.4.4)
+*
+* SOURCE
+*/
+#define IB_MCLASS_DEV_MGMT                                     0x06
+/**********/
+
+/****d* IBA Base: Constants/IB_MCLASS_COMM_MGMT
+* NAME
+*      IB_MCLASS_COMM_MGMT
+*
+* DESCRIPTION
+*      Subnet Management Class, Communication Management (13.4.4)
+*
+* SOURCE
+*/
+#define IB_MCLASS_COMM_MGMT                                    0x07
+/**********/
+
+/****d* IBA Base: Constants/IB_MCLASS_SNMP
+* NAME
+*      IB_MCLASS_SNMP
+*
+* DESCRIPTION
+*      Subnet Management Class, SNMP Tunneling (13.4.4)
+*
+* SOURCE
+*/
+#define IB_MCLASS_SNMP                                         0x08
+/**********/
+
+/****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MIN
+* NAME
+*      IB_MCLASS_VENDOR_LOW_RANGE_MIN
+*
+* DESCRIPTION
+*      Subnet Management Class, Vendor Specific Low Range Start
+*
+* SOURCE
+*/
+#define IB_MCLASS_VENDOR_LOW_RANGE_MIN 0x09
+/**********/
+
+/****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MAX
+* NAME
+*      IB_MCLASS_VENDOR_LOW_RANGE_MAX
+*
+* DESCRIPTION
+*      Subnet Management Class, Vendor Specific Low Range End
+*
+* SOURCE
+*/
+#define IB_MCLASS_VENDOR_LOW_RANGE_MAX 0x0f
+/**********/
+
+/****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MIN
+* NAME
+*      IB_MCLASS_VENDOR_HIGH_RANGE_MIN
+*
+* DESCRIPTION
+*      Subnet Management Class, Vendor Specific High Range Start
+*
+* SOURCE
+*/
+#define IB_MCLASS_VENDOR_HIGH_RANGE_MIN 0x30
+/**********/
+
+/****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MAX
+* NAME
+*      IB_MCLASS_VENDOR_HIGH_RANGE_MAX
+*
+* DESCRIPTION
+*      Subnet Management Class, Vendor Specific High Range End
+*
+* SOURCE
+*/
+#define IB_MCLASS_VENDOR_HIGH_RANGE_MAX 0x4f
+/**********/
+
+/****f* IBA Base: Types/ib_class_is_vendor_specific_low
+* NAME
+*      ib_class_is_vendor_specific_low
+*
+* DESCRIPTION
+*      Indicitates if the Class Code if a vendor specific class from 
+*  the low range
+*
+* SYNOPSIS
+*/
+AL_INLINE boolean_t     AL_API
+ib_class_is_vendor_specific_low(
+       IN              const   uint8_t class_code )
+{
+       return( (class_code >= IB_MCLASS_VENDOR_LOW_RANGE_MIN) &&
+           (class_code <= IB_MCLASS_VENDOR_LOW_RANGE_MAX)) ;
+}
+/*
+* PARAMETERS
+*      class_code
+*              [in] The Management Datagram Class Code
+*
+* RETURN VALUE
+*      TRUE if the class is in the Low range of Vendor Specific MADs 
+*      FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+* IB_MCLASS_VENDOR_LOW_RANGE_MIN, IB_MCLASS_VENDOR_LOW_RANGE_MAX
+*********/
+
+/****f* IBA Base: Types/ib_class_is_vendor_specific_high
+* NAME
+*      ib_class_is_vendor_specific_high
+*
+* DESCRIPTION
+*      Indicitates if the Class Code if a vendor specific class from 
+*  the high range
+*
+* SYNOPSIS
+*/
+AL_INLINE boolean_t     AL_API
+ib_class_is_vendor_specific_high(
+       IN              const   uint8_t class_code )
+{
+       return( (class_code >= IB_MCLASS_VENDOR_HIGH_RANGE_MIN) &&
+           (class_code <= IB_MCLASS_VENDOR_HIGH_RANGE_MAX)) ;
+}
+/*
+* PARAMETERS
+*      class_code
+*              [in] The Management Datagram Class Code
+*
+* RETURN VALUE
+*      TRUE if the class is in the High range of Vendor Specific MADs 
+*      FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+* IB_MCLASS_VENDOR_HIGH_RANGE_MIN, IB_MCLASS_VENDOR_HIGH_RANGE_MAX
+*********/
+
+
+/****f* IBA Base: Types/ib_class_is_vendor_specific
+* NAME
+*      ib_class_is_vendor_specific
+*
+* DESCRIPTION
+*      Indicitates if the Class Code if a vendor specific class
+*
+* SYNOPSIS
+*/
+AL_INLINE boolean_t     AL_API
+ib_class_is_vendor_specific(
+       IN              const   uint8_t class_code )
+{
+  return( ib_class_is_vendor_specific_low(class_code) ||
+                        ib_class_is_vendor_specific_high(class_code) );
+}
+/*
+* PARAMETERS
+*      class_code
+*              [in] The Management Datagram Class Code
+*
+* RETURN VALUE
+*      TRUE if the class is a Vendor Specific MAD
+*      FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+*  ib_class_is_vendor_specific_low, ib_class_is_vendor_specific_high
+*********/
+
+/*
+ *     MAD methods
+ */
+/****d* IBA Base: Constants/IB_MAX_METHOD
+* NAME
+*      IB_MAX_METHOD
+*
+* DESCRIPTION
+*      Total number of methods available to a class, not including the R-bit.
+*
+* SOURCE
+*/
+#define IB_MAX_METHODS                                         128
+/**********/
+/****d* IBA Base: Constants/IB_MAD_METHOD_RESP_MASK
+* NAME
+*      IB_MAD_METHOD_RESP_MASK
+*
+* DESCRIPTION
+*      Response mask to extract 'R' bit from the method field. (13.4.5)
+*
+* SOURCE
+*/
+#define IB_MAD_METHOD_RESP_MASK                                0x80
+/**********/
+/****d* IBA Base: Constants/IB_MAD_METHOD_GET
+* NAME
+*      IB_MAD_METHOD_GET
+*
+* DESCRIPTION
+*      Get() Method (13.4.5)
+*
+* SOURCE
+*/
+#define IB_MAD_METHOD_GET                                      0x01
+/**********/
+/****d* IBA Base: Constants/IB_MAD_METHOD_SET
+* NAME
+*      IB_MAD_METHOD_SET
+*
+* DESCRIPTION
+*      Set() Method (13.4.5)
+*
+* SOURCE
+*/
+#define IB_MAD_METHOD_SET                                      0x02
+/**********/
+/****d* IBA Base: Constants/IB_MAD_METHOD_GET_RESP
+* NAME
+*      IB_MAD_METHOD_GET_RESP
+*
+* DESCRIPTION
+*      GetResp() Method (13.4.5)
+*
+* SOURCE
+*/
+#define IB_MAD_METHOD_GET_RESP                         0x81
+/**********/
+
+#define IB_MAD_METHOD_DELETE                           0x15
+
+/****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE
+* NAME
+*      IB_MAD_METHOD_GETTABLE
+*
+* DESCRIPTION
+*      SubnAdmGetTable() Method (15.2.2)
+*
+* SOURCE
+*/
+#define IB_MAD_METHOD_GETTABLE                         0x12
+
+/**********/
+/****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE_RESP
+* NAME
+*      IB_MAD_METHOD_GETTABLE_RESP
+*
+* DESCRIPTION
+*      SubnAdmGetTableResp() Method (15.2.2)
+*
+* SOURCE
+*/
+#define IB_MAD_METHOD_GETTABLE_RESP                    0x92
+
+/**********/
+
+#define IB_MAD_METHOD_GETTRACETABLE                    0x13
+#define IB_MAD_METHOD_GETMULTI                         0x14
+#define IB_MAD_METHOD_GETMULTI_RESP                    0x94
+
+
+/****d* IBA Base: Constants/IB_MAD_METHOD_SEND
+* NAME
+*      IB_MAD_METHOD_SEND
+*
+* DESCRIPTION
+*      Send() Method (13.4.5)
+*
+* SOURCE
+*/
+#define IB_MAD_METHOD_SEND                                     0x03
+/**********/
+/****d* IBA Base: Constants/IB_MAD_METHOD_TRAP
+* NAME
+*      IB_MAD_METHOD_TRAP
+*
+* DESCRIPTION
+*      Trap() Method (13.4.5)
+*
+* SOURCE
+*/
+#define IB_MAD_METHOD_TRAP                                     0x05
+/**********/
+/****d* IBA Base: Constants/IB_MAD_METHOD_REPORT
+* NAME
+*      IB_MAD_METHOD_REPORT
+*
+* DESCRIPTION
+*      Report() Method (13.4.5)
+*
+* SOURCE
+*/
+#define IB_MAD_METHOD_REPORT                           0x06
+/**********/
+/****d* IBA Base: Constants/IB_MAD_METHOD_REPORT_RESP
+* NAME
+*      IB_MAD_METHOD_REPORT_RESP
+*
+* DESCRIPTION
+*      ReportResp() Method (13.4.5)
+*
+* SOURCE
+*/
+#define IB_MAD_METHOD_REPORT_RESP                      0x86
+/**********/
+/****d* IBA Base: Constants/IB_MAD_METHOD_TRAP_REPRESS
+* NAME
+*      IB_MAD_METHOD_TRAP_REPRESS
+*
+* DESCRIPTION
+*      TrapRepress() Method (13.4.5)
+*
+* SOURCE
+*/
+#define IB_MAD_METHOD_TRAP_REPRESS                     0x07
+/**********/
+/****d* IBA Base: Constants/IB_MAD_STATUS_BUSY
+* NAME
+*      IB_MAD_STATUS_BUSY
+*
+* DESCRIPTION
+*      Temporarily busy, MAD discarded (13.4.7)
+*
+* SOURCE
+*/
+#define IB_MAD_STATUS_BUSY                                     (CL_HTON16(0x0001))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_STATUS_REDIRECT
+* NAME
+*      IB_MAD_STATUS_REDIRECT
+*
+* DESCRIPTION
+*      QP Redirection required (13.4.7)
+*
+* SOURCE
+*/
+#define IB_MAD_STATUS_REDIRECT                         (CL_HTON16(0x0002))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_CLASS_VER
+* NAME
+*      IB_MAD_STATUS_UNSUP_CLASS_VER
+*
+* DESCRIPTION
+*      Unsupported class version (13.4.7)
+*
+* SOURCE
+*/
+#define IB_MAD_STATUS_UNSUP_CLASS_VER          (CL_HTON16(0x0004))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD
+* NAME
+*      IB_MAD_STATUS_UNSUP_METHOD
+*
+* DESCRIPTION
+*      Unsupported method (13.4.7)
+*
+* SOURCE
+*/
+#define IB_MAD_STATUS_UNSUP_METHOD                     (CL_HTON16(0x0008))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD_ATTR
+* NAME
+*      IB_MAD_STATUS_UNSUP_METHOD_ATTR
+*
+* DESCRIPTION
+*      Unsupported method/attribute combination (13.4.7)
+*
+* SOURCE
+*/
+#define IB_MAD_STATUS_UNSUP_METHOD_ATTR                (CL_HTON16(0x000C))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_STATUS_INVALID_FIELD
+* NAME
+*      IB_MAD_STATUS_INVALID_FIELD
+*
+* DESCRIPTION
+*      Attribute contains one or more invalid fields (13.4.7)
+*
+* SOURCE
+*/
+#define IB_MAD_STATUS_INVALID_FIELD                    (CL_HTON16(0x001C))
+/**********/
+
+#define IB_MAD_STATUS_CLASS_MASK                       (CL_HTON16(0xFF00))
+
+#define IB_SA_MAD_STATUS_SUCCESS                       (CL_HTON16(0x0000))
+#define IB_SA_MAD_STATUS_NO_RESOURCES          (CL_HTON16(0x0100))
+#define IB_SA_MAD_STATUS_REQ_INVALID           (CL_HTON16(0x0200))
+#define IB_SA_MAD_STATUS_NO_RECORDS                    (CL_HTON16(0x0300))
+#define IB_SA_MAD_STATUS_TOO_MANY_RECORDS      (CL_HTON16(0x0400))
+#define IB_SA_MAD_STATUS_INVALID_GID           (CL_HTON16(0x0500))
+#define IB_SA_MAD_STATUS_INSUF_COMPS           (CL_HTON16(0x0600))
+
+#define IB_DM_MAD_STATUS_NO_IOC_RESP           (CL_HTON16(0x0100))
+#define IB_DM_MAD_STATUS_NO_SVC_ENTRIES                (CL_HTON16(0x0200))
+#define IB_DM_MAD_STATUS_IOC_FAILURE           (CL_HTON16(0x8000))
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_CLASS_PORT_INFO
+* NAME
+*      IB_MAD_ATTR_CLASS_PORT_INFO
+*
+* DESCRIPTION
+*      ClassPortInfo attribute (13.4.8)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_CLASS_PORT_INFO                    (CL_NTOH16(0x0001))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_NOTICE
+* NAME
+*      IB_MAD_ATTR_NOTICE
+*
+* DESCRIPTION
+*      Notice attribute (13.4.8)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_NOTICE                                     (CL_NTOH16(0x0002))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO
+* NAME
+*      IB_MAD_ATTR_INFORM_INFO
+*
+* DESCRIPTION
+*      InformInfo attribute (13.4.8)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_INFORM_INFO                                (CL_NTOH16(0x0003))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_DESC
+* NAME
+*      IB_MAD_ATTR_NODE_DESC
+*
+* DESCRIPTION
+*      NodeDescription attribute (14.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_NODE_DESC                          (CL_NTOH16(0x0010))
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_CTRL
+* NAME
+*      IB_MAD_ATTR_PORT_SMPL_CTRL
+*
+* DESCRIPTION
+*      NodeDescription attribute (16.1.2)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_PORT_SMPL_CTRL                     (CL_NTOH16(0x0010))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_INFO
+* NAME
+*      IB_MAD_ATTR_NODE_INFO
+*
+* DESCRIPTION
+*      NodeInfo attribute (14.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_NODE_INFO                          (CL_NTOH16(0x0011))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_RSLT
+* NAME
+*      IB_MAD_ATTR_PORT_SMPL_RSLT
+*
+* DESCRIPTION
+*      NodeInfo attribute (16.1.2)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_PORT_SMPL_RSLT                     (CL_NTOH16(0x0011))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO
+* NAME
+*      IB_MAD_ATTR_SWITCH_INFO
+*
+* DESCRIPTION
+*      SwitchInfo attribute (14.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_SWITCH_INFO                                (CL_NTOH16(0x0012))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS
+* NAME
+*      IB_MAD_ATTR_PORT_CNTRS
+*
+* DESCRIPTION
+*      SwitchInfo attribute (16.1.2)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_PORT_CNTRS                         (CL_NTOH16(0x0012))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_GUID_INFO
+* NAME
+*      IB_MAD_ATTR_GUID_INFO
+*
+* DESCRIPTION
+*      GUIDInfo attribute (14.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_GUID_INFO                          (CL_NTOH16(0x0014))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_INFO
+* NAME
+*      IB_MAD_ATTR_PORT_INFO
+*
+* DESCRIPTION
+*      PortInfo attribute (14.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_PORT_INFO                          (CL_NTOH16(0x0015))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_P_KEY_TABLE
+* NAME
+*      IB_MAD_ATTR_P_KEY_TABLE
+*
+* DESCRIPTION
+*      PartitionTable attribute (14.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_P_KEY_TABLE                                (CL_NTOH16(0x0016))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_TABLE
+* NAME
+*      IB_MAD_ATTR_SLVL_TABLE
+*
+* DESCRIPTION
+*      SL VL Mapping Table attribute (14.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_SLVL_TABLE                         (CL_NTOH16(0x0017))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_VL_ARBITRATION
+* NAME
+*      IB_MAD_ATTR_VL_ARBITRATION
+*
+* DESCRIPTION
+*      VL Arbitration Table attribute (14.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_VL_ARBITRATION                     (CL_NTOH16(0x0018))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_LIN_FWD_TBL
+* NAME
+*      IB_MAD_ATTR_LIN_FWD_TBL
+*
+* DESCRIPTION
+*      Switch linear forwarding table
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_LIN_FWD_TBL                                (CL_NTOH16(0x0019))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_RND_FWD_TBL
+* NAME
+*      IB_MAD_ATTR_RND_FWD_TBL
+*
+* DESCRIPTION
+*      Switch random forwarding table
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_RND_FWD_TBL                                (CL_NTOH16(0x001A))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_MCAST_FWD_TBL
+* NAME
+*      IB_MAD_ATTR_MCAST_FWD_TBL
+*
+* DESCRIPTION
+*      Switch multicast forwarding table
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_MCAST_FWD_TBL                      (CL_NTOH16(0x001B))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_RECORD
+* NAME
+*      IB_MAD_ATTR_NODE_RECORD
+*
+* DESCRIPTION
+*      NodeRecord attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_NODE_RECORD                                (CL_NTOH16(0x0011))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORTINFO_RECORD
+* NAME
+*      IB_MAD_ATTR_PORTINFO_RECORD
+*
+* DESCRIPTION
+*      PortInfoRecord attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_PORTINFO_RECORD                    (CL_NTOH16(0x0012))
+/**********/
+
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_LINK_RECORD
+* NAME
+*      IB_MAD_ATTR_LINK_RECORD
+*
+* DESCRIPTION
+*      LinkRecord attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_LINK_RECORD                                (CL_NTOH16(0x0020))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_SM_INFO
+* NAME
+*      IB_MAD_ATTR_SM_INFO
+*
+* DESCRIPTION
+*      SMInfo attribute (14.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_SM_INFO                                    (CL_NTOH16(0x0020))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_SMINFO_RECORD
+* NAME
+*      IB_MAD_ATTR_SMINFO_RECORD
+*
+* DESCRIPTION
+*      SmInfoRecord attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_SMINFO_RECORD                      (CL_NTOH16(0x0018))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_VENDOR_DIAG
+* NAME
+*      IB_MAD_ATTR_VENDOR_DIAG
+*
+* DESCRIPTION
+*      VendorDiag attribute (14.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_VENDOR_DIAG                                (CL_NTOH16(0x0030))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_LED_INFO
+* NAME
+*      IB_MAD_ATTR_LED_INFO
+*
+* DESCRIPTION
+*      LedInfo attribute (14.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_LED_INFO                           (CL_NTOH16(0x0031))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_RECORD
+* NAME
+*      IB_MAD_ATTR_SERVICE_RECORD
+*
+* DESCRIPTION
+*      ServiceRecord attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_SERVICE_RECORD                     (CL_NTOH16(0x0031))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_LFT_RECORD
+* NAME
+*      IB_MAD_ATTR_LFT_RECORD
+*
+* DESCRIPTION
+*      LinearForwardingRecord attribute (15.2.5.6)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_LFT_RECORD                 (CL_NTOH16(0x0015))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_PKEYTBL_RECORD
+* NAME
+*      IB_MAD_ATTR_PKEYTBL_RECORD
+*
+* DESCRIPTION
+*      P-KEY table attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_PKEY_TBL_RECORD                    (CL_NTOH16(0x0033))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_PATH_RECORD
+* NAME
+*      IB_MAD_ATTR_PATH_RECORD
+*
+* DESCRIPTION
+*      PathRecord attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_PATH_RECORD                                (CL_NTOH16(0x0035))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_VLARB_RECORD
+* NAME
+*      IB_MAD_ATTR_VLARB_RECORD
+*
+* DESCRIPTION
+*      VL Arbitration Table attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_VLARB_RECORD                       (CL_NTOH16(0x0036))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_RECORD
+* NAME
+*      IB_MAD_ATTR_SLVL_RECORD
+*
+* DESCRIPTION
+*      VSLtoL Map Table attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_SLVL_RECORD                                (CL_NTOH16(0x0013))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_MCMEMBER_RECORD
+* NAME
+*      IB_MAD_ATTR_MCMEMBER_RECORD
+*
+* DESCRIPTION
+*      MCMemberRecord attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_MCMEMBER_RECORD                    (CL_NTOH16(0x0038))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_TRACE_RECORD
+* NAME
+*      IB_MAD_ATTR_MTRACE_RECORD
+*
+* DESCRIPTION
+*      TraceRecord attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_TRACE_RECORD                       (CL_NTOH16(0x0039))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_MULTIPATH_RECORD
+* NAME
+*      IB_MAD_ATTR_MULTIPATH_RECORD
+*
+* DESCRIPTION
+*      MultiPath attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_MULTIPATH_RECORD                   (CL_NTOH16(0x003A))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
+* NAME
+*      IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
+*
+* DESCRIPTION
+*      Service Association attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD             (CL_NTOH16(0x003B))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_IO_UNIT_INFO
+* NAME
+*      IB_MAD_ATTR_IO_UNIT_INFO
+*
+* DESCRIPTION
+*      IOUnitInfo attribute (16.3.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_IO_UNIT_INFO                       (CL_NTOH16(0x0010))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_IO_CONTROLLER_PROFILE
+* NAME
+*      IB_MAD_ATTR_IO_CONTROLLER_PROFILE
+*
+* DESCRIPTION
+*      IOControllerProfile attribute (16.3.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_IO_CONTROLLER_PROFILE      (CL_NTOH16(0x0011))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_ENTRIES
+* NAME
+*      IB_MAD_ATTR_SERVICE_ENTRIES
+*
+* DESCRIPTION
+*      ServiceEntries attribute (16.3.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_SERVICE_ENTRIES                    (CL_NTOH16(0x0012))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT
+* NAME
+*      IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT
+*
+* DESCRIPTION
+*      DiagnosticTimeout attribute (16.3.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT         (CL_NTOH16(0x0020))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_PREPARE_TO_TEST
+* NAME
+*      IB_MAD_ATTR_PREPARE_TO_TEST
+*
+* DESCRIPTION
+*      PrepareToTest attribute (16.3.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_PREPARE_TO_TEST                    (CL_NTOH16(0x0021))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_ONCE
+* NAME
+*      IB_MAD_ATTR_TEST_DEVICE_ONCE
+*
+* DESCRIPTION
+*      TestDeviceOnce attribute (16.3.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_TEST_DEVICE_ONCE           (CL_NTOH16(0x0022))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_LOOP
+* NAME
+*      IB_MAD_ATTR_TEST_DEVICE_LOOP
+*
+* DESCRIPTION
+*      TestDeviceLoop attribute (16.3.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_TEST_DEVICE_LOOP           (CL_NTOH16(0x0023))
+/**********/
+/****d* IBA Base: Constants/IB_MAD_ATTR_DIAG_CODE
+* NAME
+*      IB_MAD_ATTR_DIAG_CODE
+*
+* DESCRIPTION
+*      DiagCode attribute (16.3.3)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_DIAG_CODE                          (CL_NTOH16(0x0024))
+/**********/
+
+/****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
+* NAME
+*      IB_MAD_ATTR_SVC_ASSOCIATION_RECORD
+*
+* DESCRIPTION
+*      Service Association attribute (15.2.5)
+*
+* SOURCE
+*/
+#define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD     (CL_NTOH16(0x003B))
+/**********/
+/****d* IBA Base: Constants/IB_NODE_TYPE_CA
+* NAME
+*      IB_NODE_TYPE_CA
+*
+* DESCRIPTION
+*      Encoded generic node type used in MAD attributes (13.4.8.2)
+*
+* SOURCE
+*/
+#define IB_NODE_TYPE_CA                                                0x01
+/**********/
+/****d* IBA Base: Constants/IB_NODE_TYPE_SWITCH
+* NAME
+*      IB_NODE_TYPE_SWITCH
+*
+* DESCRIPTION
+*      Encoded generic node type used in MAD attributes (13.4.8.2)
+*
+* SOURCE
+*/
+#define IB_NODE_TYPE_SWITCH                                    0x02
+/**********/
+/****d* IBA Base: Constants/IB_NODE_TYPE_ROUTER
+* NAME
+*      IB_NODE_TYPE_ROUTER
+*
+* DESCRIPTION
+*      Encoded generic node type used in MAD attributes (13.4.8.2)
+*
+* SOURCE
+*/
+#define IB_NODE_TYPE_ROUTER                                    0x03
+/**********/
+
+/****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_CA
+* NAME
+*      IB_NOTICE_NODE_TYPE_CA
+*
+* DESCRIPTION
+*      Encoded generic node type used in MAD attributes (13.4.8.2)
+*
+* SOURCE
+*/
+#define IB_NOTICE_NODE_TYPE_CA                         (CL_NTOH32(0x000001))
+/**********/
+/****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_SWITCH
+* NAME
+*      IB_NOTICE_NODE_TYPE_SWITCH
+*
+* DESCRIPTION
+*      Encoded generic node type used in MAD attributes (13.4.8.2)
+*
+* SOURCE
+*/
+#define IB_NOTICE_NODE_TYPE_SWITCH                     (CL_NTOH32(0x000002))
+/**********/
+/****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_ROUTER
+* NAME
+*      IB_NOTICE_NODE_TYPE_ROUTER
+*
+* DESCRIPTION
+*      Encoded generic node type used in MAD attributes (13.4.8.2)
+*
+* SOURCE
+*/
+#define IB_NOTICE_NODE_TYPE_ROUTER                     (CL_NTOH32(0x000003))
+/**********/
+/****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_SUBN_MGMT
+* NAME
+*      IB_NOTICE_NODE_TYPE_SUBN_MGMT
+*
+* DESCRIPTION
+*      Encoded generic node type used in MAD attributes (13.4.8.2).
+*      Note that this value is not defined for the NodeType field
+*      of the NodeInfo attribute (14.2.5.3).
+*
+* SOURCE
+*/
+#define IB_NOTICE_NODE_TYPE_SUBN_MGMT          (CL_NTOH32(0x000004))
+/**********/
+
+/****d* IBA Base: Constants/IB_MTU_LEN_TYPE
+* NAME
+*      IB_MTU_LEN_TYPE
+*
+* DESCRIPTION
+*      Encoded path MTU.
+*              1: 256
+*              2: 512
+*              3: 1024
+*              4: 2048
+*              5: 4096
+*              others: reserved
+*
+* SOURCE
+*/
+#define IB_MTU_LEN_256                                                 1
+#define IB_MTU_LEN_512                                                 2
+#define IB_MTU_LEN_1024                                                        3
+#define IB_MTU_LEN_2048                                                        4
+#define IB_MTU_LEN_4096                                                        5
+#define IB_MAX_MTU                        5
+/**********/
+
+/****d* IBA Base: Constants/IB_PATH_SELECTOR_TYPE
+* NAME
+*      IB_PATH_SELECTOR_TYPE
+*
+* DESCRIPTION
+*      Path selector.
+*              0: greater than rate specified
+*              1: less than rate specified
+*              2: exactly the rate specified
+*              3: largest rate available
+*
+* SOURCE
+*/
+#define IB_PATH_SELECTOR_GREATER_THAN          0
+#define IB_PATH_SELECTOR_LESS_THAN                     1
+#define IB_PATH_SELECTOR_EXACTLY                       2
+#define IB_PATH_SELECTOR_LARGEST                       3
+/**********/
+
+/****d* IBA Base: Constants/IB_SMINFO_STATE_NOTACTIVE
+* NAME
+*      IB_SMINFO_STATE_NOTACTIVE
+*
+* DESCRIPTION
+*      Encoded state value used in the SMInfo attribute.
+*
+* SOURCE
+*/
+#define IB_SMINFO_STATE_NOTACTIVE                      0
+/**********/
+/****d* IBA Base: Constants/IB_SMINFO_STATE_DISCOVERING
+* NAME
+*      IB_SMINFO_STATE_DISCOVERING
+*
+* DESCRIPTION
+*      Encoded state value used in the SMInfo attribute.
+*
+* SOURCE
+*/
+#define IB_SMINFO_STATE_DISCOVERING                    1
+/**********/
+/****d* IBA Base: Constants/IB_SMINFO_STATE_STANDBY
+* NAME
+*      IB_SMINFO_STATE_STANDBY
+*
+* DESCRIPTION
+*      Encoded state value used in the SMInfo attribute.
+*
+* SOURCE
+*/
+#define IB_SMINFO_STATE_STANDBY                                2
+/**********/
+/****d* IBA Base: Constants/IB_SMINFO_STATE_MASTER
+* NAME
+*      IB_SMINFO_STATE_MASTER
+*
+* DESCRIPTION
+*      Encoded state value used in the SMInfo attribute.
+*
+* SOURCE
+*/
+#define IB_SMINFO_STATE_MASTER                         3
+/**********/
+/****d* IBA Base: Constants/IB_PATH_REC_SELECTOR_MASK
+* NAME
+*      IB_PATH_REC_SELECTOR_MASK
+*
+* DESCRIPTION
+*      Mask for the selector field for path record MTU, rate
+*      and packet lifetime.
+*
+* SOURCE
+*/
+#define IB_PATH_REC_SELECTOR_MASK                      0xC0
+/**********/
+/****d* IBA Base: Constants/IB_PATH_REC_BASE_MASK
+* NAME
+*      IB_PATH_REC_BASE_MASK
+*
+* DESCRIPTION
+*      Mask for the base value field for path record MTU, rate
+*      and packet lifetime.
+*
+* SOURCE
+*/
+#define IB_PATH_REC_BASE_MASK                          0x3F
+/**********/
+
+/****h* IBA Base/Type Definitions
+* NAME
+*      Type Definitions
+*
+* DESCRIPTION
+*      Definitions are from the InfiniBand Architecture Specification v1.1
+*
+*********/
+/****d* IBA Base: Types/ib_net16_t
+* NAME
+*      ib_net16_t
+*
+* DESCRIPTION
+*      Defines the network ordered type for 16-bit values.
+*
+* SOURCE
+*/
+typedef uint16_t       ib_net16_t;
+/**********/
+/****d* IBA Base: Types/ib_net32_t
+* NAME
+*      ib_net32_t
+*
+* DESCRIPTION
+*      Defines the network ordered type for 32-bit values.
+*
+* SOURCE
+*/
+typedef uint32_t       ib_net32_t;
+/**********/
+/****d* IBA Base: Types/ib_net64_t
+* NAME
+*      ib_net64_t
+*
+* DESCRIPTION
+*      Defines the network ordered type for 64-bit values.
+*
+* SOURCE
+*/
+typedef uint64_t       ib_net64_t;
+/**********/
+/****d* IBA Base: Types/ib_gid_prefix_t
+* NAME
+*      ib_gid_prefix_t
+*
+* DESCRIPTION
+*
+* SOURCE
+*/
+typedef ib_net64_t             ib_gid_prefix_t;
+/**********/
+
+/****d* IBA Base: Constants/ib_link_states_t
+* NAME
+*      ib_link_states_t
+*
+* DESCRIPTION
+*      Defines the link states of a port.
+*
+* SOURCE
+*/
+#define IB_LINK_NO_CHANGE 0
+#define IB_LINK_DOWN      1
+#define IB_LINK_INIT        2
+#define IB_LINK_ARMED     3
+#define IB_LINK_ACTIVE    4
+#define IB_LINK_ACT_DEFER 5
+/**********/
+
+static const char* const __ib_node_type_str[] =
+{
+       "UNKNOWN",
+       "Channel Adapter",
+       "Switch",
+       "Router",
+       "Subnet Management"
+};
+
+/****f* IBA Base: Types/ib_get_node_type_str
+* NAME
+*      ib_get_node_type_str
+*
+* DESCRIPTION
+*      Returns a string for the specified node type.
+*
+* SYNOPSIS
+*/
+AL_INLINE const char*    AL_API
+ib_get_node_type_str(
+       IN uint32_t node_type )
+{
+       if( node_type >= IB_NOTICE_NODE_TYPE_ROUTER )
+               node_type = 0;
+       return( __ib_node_type_str[node_type] );
+}
+/*
+* PARAMETERS
+*      node_type
+*              [in] Encoded node type as returned in the NodeInfo attribute.
+
+* RETURN VALUES
+*      Pointer to the node type string.
+*
+* NOTES
+*
+* SEE ALSO
+* ib_node_info_t
+*********/
+
+static const char* const __ib_port_state_str[] =
+{
+       "No State Change (NOP)",
+       "DOWN",
+       "INIT",
+       "ARMED",
+       "ACTIVE",
+       "ACTDEFER",
+       "UNKNOWN"
+};
+
+/****f* IBA Base: Types/ib_get_port_state_str
+* NAME
+*      ib_get_port_state_str
+*
+* DESCRIPTION
+*      Returns a string for the specified port state.
+*
+* SYNOPSIS
+*/
+AL_INLINE const char*    AL_API
+ib_get_port_state_str(
+       IN                              uint8_t                                         port_state )
+{
+       if( port_state > IB_LINK_ACTIVE )
+               port_state = IB_LINK_ACTIVE + 1;
+       return( __ib_port_state_str[port_state] );
+}
+/*
+* PARAMETERS
+*      node_type
+*              [in] Encoded port state as returned in the PortInfo attribute.
+
+* RETURN VALUES
+*      Pointer to the port state string.
+*
+* NOTES
+*
+* SEE ALSO
+* ib_port_info_t
+*********/
+
+/****f* IBA Base: Types/ib_get_port_state_from_str
+* NAME
+*      ib_get_port_state_from_str
+*
+* DESCRIPTION
+*      Returns a string for the specified port state.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t    AL_API
+ib_get_port_state_from_str(
+       IN                              char*                                           p_port_state_str )
+{
+       if( !strncmp(p_port_state_str,"No State Change (NOP)",12) )
+               return(0);
+       else if( !strncmp(p_port_state_str, "DOWN",4) )
+               return(1);
+       else if( !strncmp(p_port_state_str, "INIT", 4) )
+               return(2);
+       else if( !strncmp(p_port_state_str,"ARMED" , 5) )
+               return(3);
+       else if( !strncmp(p_port_state_str, "ACTIVE", 6) )
+               return(4);
+       else if( !strncmp(p_port_state_str, "ACTDEFER", 8) )
+               return(5);
+       return(6);
+}
+/*
+* PARAMETERS
+*      p_port_state_str
+*              [in] A string matching one returned by ib_get_port_state_str
+*
+* RETURN VALUES
+*      The appropriate code.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_port_info_t
+*********/
+
+/****d* IBA Base: Constants/Join States
+* NAME
+*      Join States
+*
+* DESCRIPTION
+*      Defines the join state flags for multicast group management.
+*
+* SOURCE
+*/
+#define IB_JOIN_STATE_FULL                     1
+#define IB_JOIN_STATE_NON                      2
+#define IB_JOIN_STATE_SEND_ONLY                4
+/**********/
+
+/****f* IBA Base: Types/ib_pkey_get_base
+* NAME
+*      ib_pkey_get_base
+*
+* DESCRIPTION
+*      Returns the base P_Key value with the membership bit stripped.
+*
+* SYNOPSIS
+*/
+AL_INLINE ib_net16_t     AL_API
+ib_pkey_get_base(
+       IN              const   ib_net16_t                                      pkey )
+{
+       return( (ib_net16_t)(pkey & IB_PKEY_BASE_MASK) );
+}
+/*
+* PARAMETERS
+*      pkey
+*              [in] P_Key value
+*
+* RETURN VALUE
+*      Returns the base P_Key value with the membership bit stripped.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+/****f* IBA Base: Types/ib_pkey_is_full_member
+* NAME
+*      ib_pkey_is_full_member
+*
+* DESCRIPTION
+*      Indicitates if the port is a full member of the parition.
+*
+* SYNOPSIS
+*/
+AL_INLINE boolean_t     AL_API
+ib_pkey_is_full_member(
+       IN              const   ib_net16_t                                      pkey )
+{
+       return( (pkey & IB_PKEY_TYPE_MASK) == IB_PKEY_TYPE_MASK );
+}
+/*
+* PARAMETERS
+*      pkey
+*              [in] P_Key value
+*
+* RETURN VALUE
+*      TRUE if the port is a full member of the partition.
+*      FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+* ib_pkey_get_base, ib_net16_t
+*********/
+
+/****f* IBA Base: Types/ib_pkey_is_invalid
+* NAME
+*      ib_pkey_is_invalid
+*
+* DESCRIPTION
+*      Returns TRUE if the given P_Key is an invalid P_Key
+*  C10-116: the CI shall regard a P_Key as invalid if its low-order
+*           15 bits are all zero...
+*
+* SYNOPSIS
+*/
+OSM_INLINE boolean_t     AL_API
+ib_pkey_is_invalid(
+       IN              const   ib_net16_t                                      pkey )
+{
+  if (ib_pkey_get_base(pkey) == 0x0000)
+    return TRUE;
+
+  return FALSE;
+}
+/*
+* PARAMETERS
+*      pkey
+*              [in] P_Key value
+*
+* RETURN VALUE
+*      Returns the base P_Key value with the membership bit stripped.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****d* IBA Base: Types/ib_gid_t
+* NAME
+*      ib_gid_t
+*
+* DESCRIPTION
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef union _ib_gid
+{
+       uint8_t                                 raw[16];
+       struct _ib_gid_unicast
+       {
+               ib_gid_prefix_t         prefix;
+               ib_net64_t                      interface_id;
+
+       } PACK_SUFFIX unicast;
+
+       struct _ib_gid_multicast
+       {
+               uint8_t                         header[2];
+               uint8_t                         raw_group_id[14];
+
+       } PACK_SUFFIX multicast;
+
+}      PACK_SUFFIX ib_gid_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      raw
+*              GID represented as an unformated byte array.
+*
+*      unicast
+*              Typical unicast representation with subnet prefix and
+*              port GUID.
+*
+*      multicast
+*              Representation for multicast use.
+*
+* SEE ALSO
+*********/
+
+AL_INLINE boolean_t     AL_API
+ib_gid_is_multicast(
+       IN              const   ib_gid_t*                                       p_gid )
+{
+       return( p_gid->raw[0] == 0xFF );
+}
+
+/****f* IBA Base: Types/ib_gid_set_default
+* NAME
+*      ib_gid_set_default
+*
+* DESCRIPTION
+*      Sets a GID to the default value.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_gid_set_default(
+       IN                              ib_gid_t* const                         p_gid,
+       IN              const   ib_net64_t                                      interface_id )
+{
+       p_gid->unicast.prefix = IB_DEFAULT_SUBNET_PREFIX;
+       p_gid->unicast.interface_id = interface_id;
+}
+/*
+* PARAMETERS
+*      p_gid
+*              [in] Pointer to the GID object.
+*
+*      interface_id
+*              [in] Manufacturer assigned EUI64 value of a port.
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_gid_t
+*********/
+/****f* IBA Base: Types/ib_gid_get_subnet_prefix
+* NAME
+*      ib_gid_get_subnet_prefix
+*
+* DESCRIPTION
+*      Gets the subnet prefix from a GID.
+*
+* SYNOPSIS
+*/
+AL_INLINE ib_net64_t     AL_API
+ib_gid_get_subnet_prefix(
+       IN              const   ib_gid_t* const                         p_gid )
+{
+       return( p_gid->unicast.prefix );
+}
+/*
+* PARAMETERS
+*      p_gid
+*              [in] Pointer to the GID object.
+*
+* RETURN VALUES
+*      64-bit subnet prefix value.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_gid_t
+*********/
+/****f* IBA Base: Types/ib_gid_is_link_local
+* NAME
+*      ib_gid_is_link_local
+*
+* DESCRIPTION
+*      Returns TRUE if the unicast GID scoping indicates link local,
+*      FALSE otherwise.
+*
+* SYNOPSIS
+*/
+AL_INLINE boolean_t     AL_API
+ib_gid_is_link_local(
+       IN              const   ib_gid_t* const                         p_gid )
+{
+       return( ib_gid_get_subnet_prefix( p_gid ) == IB_DEFAULT_SUBNET_PREFIX );
+}
+/*
+* PARAMETERS
+*      p_gid
+*              [in] Pointer to the GID object.
+*
+* RETURN VALUES
+*      Returns TRUE if the unicast GID scoping indicates link local,
+*      FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_gid_t
+*********/
+/****f* IBA Base: Types/ib_gid_is_site_local
+* NAME
+*      ib_gid_is_site_local
+*
+* DESCRIPTION
+*      Returns TRUE if the unicast GID scoping indicates site local,
+*      FALSE otherwise.
+*
+* SYNOPSIS
+*/
+AL_INLINE boolean_t     AL_API
+ib_gid_is_site_local(
+       IN              const   ib_gid_t* const                         p_gid )
+{
+       return( ( ib_gid_get_subnet_prefix( p_gid ) &
+               CL_HTON64( 0xFFFFFFFFFFFF0000ULL ) ) == CL_HTON64( 0xFEC0000000000000ULL ) );
+}
+/*
+* PARAMETERS
+*      p_gid
+*              [in] Pointer to the GID object.
+*
+* RETURN VALUES
+*      Returns TRUE if the unicast GID scoping indicates link local,
+*      FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_gid_t
+*********/
+/****f* IBA Base: Types/ib_gid_get_guid
+* NAME
+*      ib_gid_get_guid
+*
+* DESCRIPTION
+*      Gets the guid from a GID.
+*
+* SYNOPSIS
+*/
+AL_INLINE ib_net64_t     AL_API
+ib_gid_get_guid(
+       IN              const   ib_gid_t* const                         p_gid )
+{
+       return( p_gid->unicast.interface_id );
+}
+/*
+* PARAMETERS
+*      p_gid
+*              [in] Pointer to the GID object.
+*
+* RETURN VALUES
+*      64-bit GUID value.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_gid_t
+*********/
+
+/****s* IBA Base: Types/ib_path_rec_t
+* NAME
+*      ib_path_rec_t
+*
+* DESCRIPTION
+*      Path records encapsulate the properties of a given
+*      route between two end-points on a subnet.
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_path_rec
+{
+       uint8_t                                 resv0[8];
+       ib_gid_t                                dgid;
+       ib_gid_t                                sgid;
+       ib_net16_t                              dlid;
+       ib_net16_t                              slid;
+       ib_net32_t                              hop_flow_raw;
+       uint8_t                                 tclass;
+       uint8_t                                 num_path; 
+       ib_net16_t                              pkey;
+       ib_net16_t                              sl;
+       uint8_t                                 mtu;
+       uint8_t                                 rate;
+       uint8_t                                 pkt_life;
+       uint8_t                                 preference;
+       uint8_t                                 resv2[6];
+
+}      PACK_SUFFIX ib_path_rec_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      resv0
+*              Reserved bytes.
+*
+*      dgid
+*              GID of destination port.
+*
+*      sgid
+*              GID of source port.
+*
+*      dlid
+*              LID of destination port.
+*
+*      slid
+*              LID of source port.
+*
+*      hop_flow_raw
+*              Global routing parameters: hop count, flow label and raw bit.
+*
+*      tclass
+*              Another global routing parameter.
+*
+*      num_path
+*     Reversible path - 1 bit to say if path is reversible.
+*              Num-Paths [6:0] In queries, maximum number of paths to return.
+*              In responses, undefined.
+*
+*      pkey
+*              Partition key (P_Key) to use on this path.
+*
+*      resv1
+*              Reserved byte.
+*
+*      sl
+*              Service level to use on this path.
+*
+*      mtu
+*              MTU and MTU selector fields to use on this path
+*
+*      rate
+*              Rate and rate selector fields to use on this path.
+*
+*      pkt_life
+*              Packet lifetime
+*
+*      preference
+*              Indicates the relative merit of this path versus other path
+*              records returned from the SA.  Lower numbers are better.
+*
+*      resv2
+*              Reserved bytes.
+* SEE ALSO
+*********/
+
+/* Path Record Component Masks */
+#define  IB_PR_COMPMASK_DGID              (CL_HTON64(((uint64_t)1)<<2))
+#define  IB_PR_COMPMASK_SGID              (CL_HTON64(((uint64_t)1)<<3))
+#define  IB_PR_COMPMASK_DLID              (CL_HTON64(((uint64_t)1)<<4))
+#define  IB_PR_COMPMASK_SLID              (CL_HTON64(((uint64_t)1)<<5))
+#define  IB_PR_COMPMASK_RAWTRAFFIC         (CL_HTON64(((uint64_t)1)<<6))
+#define  IB_PR_COMPMASK_RESV0             (CL_HTON64(((uint64_t)1)<<7))
+#define  IB_PR_COMPMASK_FLOWLABEL         (CL_HTON64(((uint64_t)1)<<8))
+#define  IB_PR_COMPMASK_HOPLIMIT          (CL_HTON64(((uint64_t)1)<<9))
+#define  IB_PR_COMPMASK_TCLASS            (CL_HTON64(((uint64_t)1)<<10))
+#define  IB_PR_COMPMASK_REVERSIBLE        (CL_HTON64(((uint64_t)1)<<11))
+#define  IB_PR_COMPMASK_NUMBPATH          (CL_HTON64(((uint64_t)1)<<12))
+#define  IB_PR_COMPMASK_PKEY              (CL_HTON64(((uint64_t)1)<<13))
+#define  IB_PR_COMPMASK_RESV1             (CL_HTON64(((uint64_t)1)<<14))
+#define  IB_PR_COMPMASK_SL                (CL_HTON64(((uint64_t)1)<<15))
+#define  IB_PR_COMPMASK_MTUSELEC          (CL_HTON64(((uint64_t)1)<<16))
+#define  IB_PR_COMPMASK_MTU               (CL_HTON64(((uint64_t)1)<<17))
+#define  IB_PR_COMPMASK_RATESELEC         (CL_HTON64(((uint64_t)1)<<18))
+#define  IB_PR_COMPMASK_RATE              (CL_HTON64(((uint64_t)1)<<19))
+#define  IB_PR_COMPMASK_PKTLIFETIMESELEC  (CL_HTON64(((uint64_t)1)<<20))
+#define  IB_PR_COMPMASK_PKTLIFETIME       (CL_HTON64(((uint64_t)1)<<21))
+
+/* Link Record Component Masks */
+#define IB_LR_COMPMASK_FROM_LID           (CL_HTON64(((uint64_t)1)<<0))
+#define IB_LR_COMPMASK_FROM_PORT          (CL_HTON64(((uint64_t)1)<<1))
+#define IB_LR_COMPMASK_TO_PORT            (CL_HTON64(((uint64_t)1)<<2))
+#define  IB_LR_COMPMASK_TO_LID            (CL_HTON64(((uint64_t)1)<<3))
+
+/* VL Arbitration Record MASKs */
+#define IB_VLA_COMPMASK_LID               (CL_HTON64(((uint64_t)1)<<0))
+#define IB_VLA_COMPMASK_OUT_PORT          (CL_HTON64(((uint64_t)1)<<1))
+#define IB_VLA_COMPMASK_BLOCK             (CL_HTON64(((uint64_t)1)<<2))
+/* SLtoVL Mapping Record Masks */
+#define IB_SLVL_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
+#define IB_SLVL_COMPMASK_IN_PORT          (CL_HTON64(((uint64_t)1)<<1))
+#define IB_SLVL_COMPMASK_OUT_PORT         (CL_HTON64(((uint64_t)1)<<2))
+/* P_Key Table Record Masks */
+#define IB_PKEY_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
+#define IB_PKEY_COMPMASK_BLOCK            (CL_HTON64(((uint64_t)1)<<1))
+#define IB_PKEY_COMPMASK_PORT             (CL_HTON64(((uint64_t)1)<<2))
+/* LFT Record MASKS */
+#define IB_LFTR_COMPMASK_LID              (CL_HTON64(((uint64_t)1)<<0))
+#define IB_LFTR_COMPMASK_BLOCK            (CL_HTON64(((uint64_t)1)<<1))
+/* ModeInfo Record MASKS */
+#define IB_NR_COMPMASK_LID                (CL_HTON64(((uint64_t)1)<<0))
+#define IB_NR_COMPMASK_RESERVED1          (CL_HTON64(((uint64_t)1)<<1))
+#define IB_NR_COMPMASK_BASEVERSION        (CL_HTON64(((uint64_t)1)<<2))
+#define IB_NR_COMPMASK_CLASSVERSION       (CL_HTON64(((uint64_t)1)<<3))
+#define  IB_NR_COMPMASK_NODETYPE          (CL_HTON64(((uint64_t)1)<<4))
+#define  IB_NR_COMPMASK_NUMPORTS          (CL_HTON64(((uint64_t)1)<<5))
+#define  IB_NR_COMPMASK_SYSIMAGEGUID      (CL_HTON64(((uint64_t)1)<<6))
+#define  IB_NR_COMPMASK_NODEGUID          (CL_HTON64(((uint64_t)1)<<7))
+#define  IB_NR_COMPMASK_PORTGUID          (CL_HTON64(((uint64_t)1)<<8))
+#define  IB_NR_COMPMASK_PARTCAP           (CL_HTON64(((uint64_t)1)<<9))
+#define  IB_NR_COMPMASK_DEVID             (CL_HTON64(((uint64_t)1)<<10))
+#define  IB_NR_COMPMASK_REV               (CL_HTON64(((uint64_t)1)<<11))
+#define  IB_NR_COMPMASK_PORTNUM           (CL_HTON64(((uint64_t)1)<<12))
+#define  IB_NR_COMPMASK_VENDID            (CL_HTON64(((uint64_t)1)<<13))
+#define  IB_NR_COMPMASK_NODEDESC          (CL_HTON64(((uint64_t)1)<<14))
+/* Service Record Component Mask Sec 15.2.5.14 Ver 1.1*/
+#define IB_SR_COMPMASK_SID                (CL_HTON64(((uint64_t)1)<<0))
+#define IB_SR_COMPMASK_SGID               (CL_HTON64(((uint64_t)1)<<1))
+#define IB_SR_COMPMASK_SPKEY              (CL_HTON64(((uint64_t)1)<<2))
+#define IB_SR_COMPMASK_RES1               (CL_HTON64(((uint64_t)1)<<3))
+#define IB_SR_COMPMASK_SLEASE             (CL_HTON64(((uint64_t)1)<<4))
+#define IB_SR_COMPMASK_SKEY               (CL_HTON64(((uint64_t)1)<<5))
+#define IB_SR_COMPMASK_SNAME              (CL_HTON64(((uint64_t)1)<<6))
+#define IB_SR_COMPMASK_SDATA8_0           (CL_HTON64(((uint64_t)1)<<7))
+#define IB_SR_COMPMASK_SDATA8_1           (CL_HTON64(((uint64_t)1)<<8))
+#define IB_SR_COMPMASK_SDATA8_2           (CL_HTON64(((uint64_t)1)<<9))
+#define IB_SR_COMPMASK_SDATA8_3           (CL_HTON64(((uint64_t)1)<<10))
+#define IB_SR_COMPMASK_SDATA8_4           (CL_HTON64(((uint64_t)1)<<11))
+#define IB_SR_COMPMASK_SDATA8_5           (CL_HTON64(((uint64_t)1)<<12))
+#define IB_SR_COMPMASK_SDATA8_6           (CL_HTON64(((uint64_t)1)<<13))
+#define IB_SR_COMPMASK_SDATA8_7           (CL_HTON64(((uint64_t)1)<<14))
+#define IB_SR_COMPMASK_SDATA8_8           (CL_HTON64(((uint64_t)1)<<15))
+#define IB_SR_COMPMASK_SDATA8_9           (CL_HTON64(((uint64_t)1)<<16))
+#define IB_SR_COMPMASK_SDATA8_10       (CL_HTON64(((uint64_t)1)<<17))
+#define IB_SR_COMPMASK_SDATA8_11       (CL_HTON64(((uint64_t)1)<<18))
+#define IB_SR_COMPMASK_SDATA8_12       (CL_HTON64(((uint64_t)1)<<19))
+#define IB_SR_COMPMASK_SDATA8_13       (CL_HTON64(((uint64_t)1)<<20))
+#define IB_SR_COMPMASK_SDATA8_14       (CL_HTON64(((uint64_t)1)<<21))
+#define IB_SR_COMPMASK_SDATA8_15       (CL_HTON64(((uint64_t)1)<<22))
+#define IB_SR_COMPMASK_SDATA16_0       (CL_HTON64(((uint64_t)1)<<23))
+#define IB_SR_COMPMASK_SDATA16_1       (CL_HTON64(((uint64_t)1)<<24))
+#define IB_SR_COMPMASK_SDATA16_2       (CL_HTON64(((uint64_t)1)<<25))
+#define IB_SR_COMPMASK_SDATA16_3       (CL_HTON64(((uint64_t)1)<<26))
+#define IB_SR_COMPMASK_SDATA16_4       (CL_HTON64(((uint64_t)1)<<27))
+#define IB_SR_COMPMASK_SDATA16_5       (CL_HTON64(((uint64_t)1)<<28))
+#define IB_SR_COMPMASK_SDATA16_6       (CL_HTON64(((uint64_t)1)<<29))
+#define IB_SR_COMPMASK_SDATA16_7       (CL_HTON64(((uint64_t)1)<<30))
+#define IB_SR_COMPMASK_SDATA32_0       (CL_HTON64(((uint64_t)1)<<31))
+#define IB_SR_COMPMASK_SDATA32_1       (CL_HTON64(((uint64_t)1)<<32))
+#define IB_SR_COMPMASK_SDATA32_2       (CL_HTON64(((uint64_t)1)<<33))
+#define IB_SR_COMPMASK_SDATA32_3       (CL_HTON64(((uint64_t)1)<<34))
+#define IB_SR_COMPMASK_SDATA64_0       (CL_HTON64(((uint64_t)1)<<35))
+#define IB_SR_COMPMASK_SDATA64_1       (CL_HTON64(((uint64_t)1)<<36))
+/* Port Info Record Component Masks */
+#define IB_PIR_COMPMASK_LID               (CL_HTON64(((uint64_t)1)<<0))
+#define IB_PIR_COMPMASK_PORTNUM           (CL_HTON64(((uint64_t)1)<<1))
+#define IB_PIR_COMPMASK_RESV1             (CL_HTON64(((uint64_t)1)<<2))
+#define IB_PIR_COMPMASK_MKEY              (CL_HTON64(((uint64_t)1)<<3))
+#define  IB_PIR_COMPMASK_GIDPRE           (CL_HTON64(((uint64_t)1)<<4))
+#define  IB_PIR_COMPMASK_BASELID          (CL_HTON64(((uint64_t)1)<<5))
+#define  IB_PIR_COMPMASK_SMLID            (CL_HTON64(((uint64_t)1)<<6))
+#define  IB_PIR_COMPMASK_CAPMASK          (CL_HTON64(((uint64_t)1)<<7))
+#define  IB_PIR_COMPMASK_DIAGCODE         (CL_HTON64(((uint64_t)1)<<8))
+#define  IB_PIR_COMPMASK_MKEYLEASEPRD     (CL_HTON64(((uint64_t)1)<<9))
+#define  IB_PIR_COMPMASK_LOCALPORTNUM     (CL_HTON64(((uint64_t)1)<<10))
+#define  IB_PIR_COMPMASK_LINKWIDTHENABLED (CL_HTON64(((uint64_t)1)<<11))
+#define  IB_PIR_COMPMASK_LNKWIDTHSUPPORT  (CL_HTON64(((uint64_t)1)<<12))
+#define  IB_PIR_COMPMASK_LNKWIDTHACTIVE   (CL_HTON64(((uint64_t)1)<<13))
+#define  IB_PIR_COMPMASK_LNKSPEEDSUPPORT  (CL_HTON64(((uint64_t)1)<<14))
+#define  IB_PIR_COMPMASK_PORTSTATE        (CL_HTON64(((uint64_t)1)<<15))
+#define  IB_PIR_COMPMASK_PORTPHYSTATE     (CL_HTON64(((uint64_t)1)<<16))
+#define  IB_PIR_COMPMASK_LINKDWNDFLTSTATE (CL_HTON64(((uint64_t)1)<<17))
+#define  IB_PIR_COMPMASK_MKEYPROTBITS     (CL_HTON64(((uint64_t)1)<<18))
+#define  IB_PIR_COMPMASK_RESV2            (CL_HTON64(((uint64_t)1)<<19))
+#define  IB_PIR_COMPMASK_LMC              (CL_HTON64(((uint64_t)1)<<20))
+#define  IB_PIR_COMPMASK_LINKSPEEDACTIVE  (CL_HTON64(((uint64_t)1)<<21))
+#define  IB_PIR_COMPMASK_LINKSPEEDENABLE  (CL_HTON64(((uint64_t)1)<<22))
+#define  IB_PIR_COMPMASK_NEIGHBORMTU      (CL_HTON64(((uint64_t)1)<<23))
+#define  IB_PIR_COMPMASK_MASTERSMSL       (CL_HTON64(((uint64_t)1)<<24))
+#define  IB_PIR_COMPMASK_VLCAP            (CL_HTON64(((uint64_t)1)<<25))
+#define  IB_PIR_COMPMASK_INITTYPE         (CL_HTON64(((uint64_t)1)<<26))
+#define  IB_PIR_COMPMASK_VLHIGHLIMIT      (CL_HTON64(((uint64_t)1)<<27))
+#define  IB_PIR_COMPMASK_VLARBHIGHCAP     (CL_HTON64(((uint64_t)1)<<28))
+#define  IB_PIR_COMPMASK_VLARBLOWCAP      (CL_HTON64(((uint64_t)1)<<29))
+#define  IB_PIR_COMPMASK_INITTYPEREPLY    (CL_HTON64(((uint64_t)1)<<30))
+#define  IB_PIR_COMPMASK_MTUCAP           (CL_HTON64(((uint64_t)1)<<31))
+#define  IB_PIR_COMPMASK_VLSTALLCNT       (CL_HTON64(((uint64_t)1)<<32))
+#define  IB_PIR_COMPMASK_HOQLIFE          (CL_HTON64(((uint64_t)1)<<33))
+#define  IB_PIR_COMPMASK_OPVLS            (CL_HTON64(((uint64_t)1)<<34))
+#define  IB_PIR_COMPMASK_PARENFIN         (CL_HTON64(((uint64_t)1)<<35))
+#define  IB_PIR_COMPMASK_PARENFOUT        (CL_HTON64(((uint64_t)1)<<36))
+#define  IB_PIR_COMPMASK_FILTERRAWIN      (CL_HTON64(((uint64_t)1)<<37))
+#define  IB_PIR_COMPMASK_FILTERRAWOUT     (CL_HTON64(((uint64_t)1)<<38))
+#define  IB_PIR_COMPMASK_MKEYVIO          (CL_HTON64(((uint64_t)1)<<39))
+#define  IB_PIR_COMPMASK_PKEYVIO          (CL_HTON64(((uint64_t)1)<<40))
+#define  IB_PIR_COMPMASK_QKEYVIO          (CL_HTON64(((uint64_t)1)<<41))
+#define  IB_PIR_COMPMASK_GUIDCAP          (CL_HTON64(((uint64_t)1)<<42))
+#define  IB_PIR_COMPMASK_RESV3            (CL_HTON64(((uint64_t)1)<<43))
+#define  IB_PIR_COMPMASK_SUBNTO           (CL_HTON64(((uint64_t)1)<<44))
+#define  IB_PIR_COMPMASK_RESV4            (CL_HTON64(((uint64_t)1)<<45))
+#define  IB_PIR_COMPMASK_RESPTIME         (CL_HTON64(((uint64_t)1)<<46))
+#define  IB_PIR_COMPMASK_LOCALPHYERR      (CL_HTON64(((uint64_t)1)<<47))
+#define  IB_PIR_COMPMASK_OVERRUNERR       (CL_HTON64(((uint64_t)1)<<48))
+/* Multicast Member Record Component Masks */
+#define IB_MCR_COMPMASK_GID         (CL_HTON64(((uint64_t)1)<<0))
+#define IB_MCR_COMPMASK_MGID        (CL_HTON64(((uint64_t)1)<<0))
+#define IB_MCR_COMPMASK_PORT_GID    (CL_HTON64(((uint64_t)1)<<1))
+#define IB_MCR_COMPMASK_QKEY        (CL_HTON64(((uint64_t)1)<<2))
+#define IB_MCR_COMPMASK_MLID        (CL_HTON64(((uint64_t)1)<<3))
+#define IB_MCR_COMPMASK_MTU_SEL     (CL_HTON64(((uint64_t)1)<<4))
+#define IB_MCR_COMPMASK_MTU         (CL_HTON64(((uint64_t)1)<<5))
+#define IB_MCR_COMPMASK_TCLASS      (CL_HTON64(((uint64_t)1)<<6))
+#define IB_MCR_COMPMASK_PKEY        (CL_HTON64(((uint64_t)1)<<7))
+#define IB_MCR_COMPMASK_RATE_SEL    (CL_HTON64(((uint64_t)1)<<8))
+#define IB_MCR_COMPMASK_RATE        (CL_HTON64(((uint64_t)1)<<9))
+#define IB_MCR_COMPMASK_LIFE_SEL    (CL_HTON64(((uint64_t)1)<<10))
+#define IB_MCR_COMPMASK_LIFE        (CL_HTON64(((uint64_t)1)<<11))
+#define IB_MCR_COMPMASK_SL          (CL_HTON64(((uint64_t)1)<<12))
+#define IB_MCR_COMPMASK_FLOW        (CL_HTON64(((uint64_t)1)<<13))
+#define IB_MCR_COMPMASK_HOP         (CL_HTON64(((uint64_t)1)<<14))
+#define IB_MCR_COMPMASK_SCOPE       (CL_HTON64(((uint64_t)1)<<15))
+#define IB_MCR_COMPMASK_JOIN_STATE  (CL_HTON64(((uint64_t)1)<<16))
+#define IB_MCR_COMPMASK_PROXY       (CL_HTON64(((uint64_t)1)<<17))
+
+/****f* IBA Base: Types/ib_path_rec_init_local
+* NAME
+*      ib_path_rec_init_local
+*
+* DESCRIPTION
+*      Initializes a subnet local path record.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_path_rec_init_local(
+       IN                              ib_path_rec_t* const            p_rec,
+       IN                              ib_gid_t* const         p_dgid,
+       IN                              ib_gid_t* const         p_sgid,
+       IN                              ib_net16_t                      dlid,
+       IN                              ib_net16_t                      slid,
+       IN                              uint8_t                         num_path,
+       IN                              ib_net16_t                      pkey,
+       IN                              uint8_t                         sl,
+       IN                              uint8_t                         mtu_selector,
+       IN                              uint8_t                         mtu,
+       IN                              uint8_t                         rate_selector,
+       IN                              uint8_t                         rate,
+       IN                              uint8_t                         pkt_life_selector,
+       IN                              uint8_t                         pkt_life,
+       IN                              uint8_t                         preference )
+{
+       p_rec->dgid = *p_dgid;
+       p_rec->sgid = *p_sgid;
+       p_rec->dlid = dlid;
+       p_rec->slid = slid;
+       p_rec->num_path = num_path;
+       p_rec->pkey = pkey;
+       /* Lower 4 bits of path rec's SL are reserved. */
+       p_rec->sl = cl_ntoh16( sl );
+       p_rec->mtu = (uint8_t)((mtu & IB_PATH_REC_BASE_MASK) |
+                       (uint8_t)(mtu_selector << 6));
+       p_rec->rate = (uint8_t)((rate & IB_PATH_REC_BASE_MASK) |
+                       (uint8_t)(rate_selector << 6));
+       p_rec->pkt_life = (uint8_t)((pkt_life & IB_PATH_REC_BASE_MASK) |
+                       (uint8_t)(pkt_life_selector << 6));
+       p_rec->preference = preference;
+
+       /* Clear global routing fields for local path records */
+       p_rec->hop_flow_raw = 0;
+       p_rec->tclass = 0;
+
+       *((uint64_t*)p_rec->resv0) = 0;
+       *((uint32_t*)p_rec->resv2) = 0;
+       *((uint16_t*)p_rec->resv2 + 2) = 0;
+}
+/*
+* PARAMETERS
+*      p_rec
+*              [in] Pointer to the path record object.
+*
+*      dgid
+*              [in] GID of destination port.
+*
+*      sgid
+*              [in] GID of source port.
+*
+*      dlid
+*              [in] LID of destination port.
+*
+*      slid
+*              [in] LID of source port.
+*
+*      num_path
+*     [in] Reversible path - 1 bit to say if path is reversible.
+*              Num-Paths [6:0] In queries, maximum number of paths to return.
+*              In responses, undefined.
+*
+*      pkey
+*              [in] Partition key (P_Key) to use on this path.
+*
+*      sl
+*              [in] Service level to use on this path.  Lower 4-bits are valid.
+*
+*      mtu_selector
+*              [in] Encoded MTU selector value to use on this path
+*
+*      mtu
+*              [in] Encoded MTU to use on this path
+*
+*      rate_selector
+*              [in] Encoded rate selector value to use on this path.
+*
+*      rate
+*              [in] Encoded rate to use on this path.
+*
+*      pkt_life_selector
+*              [in] Encoded Packet selector value lifetime for this path.
+*
+*      pkt_life
+*              [in] Encoded Packet lifetime for this path.
+*
+*      preference
+*              [in] Indicates the relative merit of this path versus other path
+*              records returned from the SA.  Lower numbers are better.
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_gid_t
+*********/
+
+/****f* IBA Base: Types/ib_path_rec_num_path
+* NAME
+*      ib_path_rec_num_path
+*
+* DESCRIPTION
+*      Get max number of paths to return.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_path_rec_num_path(
+       IN              const   ib_path_rec_t* const            p_rec )
+{
+       return( p_rec->num_path &0x7F );
+}
+/*
+* PARAMETERS
+*      p_rec
+*              [in] Pointer to the path record object.
+*
+* RETURN VALUES
+*      Maximum number of paths toreturn for each unique SGID_DGID combination.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_path_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_path_rec_sl
+* NAME
+*      ib_path_rec_sl
+*
+* DESCRIPTION
+*      Get path service level.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_path_rec_sl(
+       IN              const   ib_path_rec_t* const            p_rec )
+{
+       return( (uint8_t)((cl_ntoh16( p_rec->sl )) & 0xF) );
+}
+/*
+* PARAMETERS
+*      p_rec
+*              [in] Pointer to the path record object.
+*
+* RETURN VALUES
+*      Encoded path MTU.
+*              1: 256
+*              2: 512
+*              3: 1024
+*              4: 2048
+*              5: 4096
+*              others: reserved
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_path_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_path_rec_mtu
+* NAME
+*      ib_path_rec_mtu
+*
+* DESCRIPTION
+*      Get encoded path MTU.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_path_rec_mtu(
+       IN              const   ib_path_rec_t* const            p_rec )
+{
+       return( (uint8_t)(p_rec->mtu & IB_PATH_REC_BASE_MASK) );
+}
+/*
+* PARAMETERS
+*      p_rec
+*              [in] Pointer to the path record object.
+*
+* RETURN VALUES
+*      Encoded path MTU.
+*              1: 256
+*              2: 512
+*              3: 1024
+*              4: 2048
+*              5: 4096
+*              others: reserved
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_path_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_path_rec_mtu_sel
+* NAME
+*      ib_path_rec_mtu_sel
+*
+* DESCRIPTION
+*      Get encoded path MTU selector.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_path_rec_mtu_sel(
+       IN              const   ib_path_rec_t* const            p_rec )
+{
+       return( (uint8_t)((p_rec->mtu & IB_PATH_REC_SELECTOR_MASK) >> 6) );
+}
+/*
+* PARAMETERS
+*      p_rec
+*              [in] Pointer to the path record object.
+*
+* RETURN VALUES
+*      Encoded path MTU selector value (for queries).
+*              0: greater than MTU specified
+*              1: less than MTU specified
+*              2: exactly the MTU specified
+*              3: largest MTU available
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_path_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_path_rec_rate
+* NAME
+*      ib_path_rec_rate
+*
+* DESCRIPTION
+*      Get encoded path rate.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_path_rec_rate(
+       IN              const   ib_path_rec_t* const            p_rec )
+{
+       return( (uint8_t)(p_rec->rate & IB_PATH_REC_BASE_MASK) );
+}
+/*
+* PARAMETERS
+*      p_rec
+*              [in] Pointer to the path record object.
+*
+* RETURN VALUES
+*      Encoded path rate.
+*              2: 2.5 Gb/sec.
+*              3: 10 Gb/sec.
+*              4: 30 Gb/sec.
+*              others: reserved
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_path_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_path_rec_rate_sel
+* NAME
+*      ib_path_rec_rate_sel
+*
+* DESCRIPTION
+*      Get encoded path rate selector.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_path_rec_rate_sel(
+       IN              const   ib_path_rec_t* const            p_rec )
+{
+       return( (uint8_t)((p_rec->rate & IB_PATH_REC_SELECTOR_MASK) >> 6) );
+}
+/*
+* PARAMETERS
+*      p_rec
+*              [in] Pointer to the path record object.
+*
+* RETURN VALUES
+*      Encoded path rate selector value (for queries).
+*              0: greater than rate specified
+*              1: less than rate specified
+*              2: exactly the rate specified
+*              3: largest rate available
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_path_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_path_rec_pkt_life
+* NAME
+*      ib_path_rec_pkt_life
+*
+* DESCRIPTION
+*      Get encoded path pkt_life.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_path_rec_pkt_life(
+       IN              const   ib_path_rec_t* const            p_rec )
+{
+       return( (uint8_t)(p_rec->pkt_life & IB_PATH_REC_BASE_MASK) );
+}
+/*
+* PARAMETERS
+*      p_rec
+*              [in] Pointer to the path record object.
+*
+* RETURN VALUES
+*      Encoded path pkt_life = 4.096 ┬Ásec * 2 PacketLifeTime.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_path_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_path_rec_pkt_life_sel
+* NAME
+*      ib_path_rec_pkt_life_sel
+*
+* DESCRIPTION
+*      Get encoded path pkt_lifetime selector.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_path_rec_pkt_life_sel(
+       IN              const   ib_path_rec_t* const            p_rec )
+{
+       return( (uint8_t)((p_rec->pkt_life & IB_PATH_REC_SELECTOR_MASK) >> 6 ));
+}
+/*
+* PARAMETERS
+*      p_rec
+*              [in] Pointer to the path record object.
+*
+* RETURN VALUES
+*      Encoded path pkt_lifetime selector value (for queries).
+*              0: greater than rate specified
+*              1: less than rate specified
+*              2: exactly the rate specified
+*              3: smallest packet lifetime available
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_path_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_path_rec_flow_lbl
+* NAME
+*      ib_path_rec_flow_lbl
+*
+* DESCRIPTION
+*      Get flow label.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint32_t     AL_API
+ib_path_rec_flow_lbl(
+       IN              const   ib_path_rec_t* const            p_rec )
+{
+       return( ((cl_ntoh32(p_rec->hop_flow_raw) >> 8) & 0x000FFFFF) );
+}
+/*
+* PARAMETERS
+*      p_rec
+*              [in] Pointer to the path record object.
+*
+* RETURN VALUES
+*      Flow label of the path record.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_path_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_path_rec_hop_limit
+* NAME
+*      ib_path_rec_hop_limit
+*
+* DESCRIPTION
+*      Get hop limit.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_path_rec_hop_limit(
+       IN              const   ib_path_rec_t* const            p_rec )
+{
+       return( (uint8_t)(p_rec->hop_flow_raw & 0x000000FF ) );
+}
+/*
+* PARAMETERS
+*      p_rec
+*              [in] Pointer to the path record object.
+*
+* RETURN VALUES
+*      Hop limit of the path record.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_path_rec_t
+*********/
+
+/****s* IBA Base: Constants/IB_CLASS_CAP_TRAP
+* NAME
+*      IB_CLASS_CAP_TRAP
+*
+* DESCRIPTION
+*      ClassPortInfo CapabilityMask bits.  This bit will be set
+*      if the class supports Trap() MADs (13.4.8.1).
+*
+* SEE ALSO
+*      ib_class_port_info_t, IB_CLASS_CAP_GETSET
+*
+* SOURCE
+*/
+#define IB_CLASS_CAP_TRAP                                      0x0001
+/*********/
+/****s* IBA Base: Constants/IB_CLASS_CAP_GETSET
+* NAME
+*      IB_CLASS_CAP_GETSET
+*
+* DESCRIPTION
+*      ClassPortInfo CapabilityMask bits.  This bit will be set
+*      if the class supports Get(Notice) and Set(Notice) MADs (13.4.8.1).
+*
+* SEE ALSO
+*      ib_class_port_info_t, IB_CLASS_CAP_TRAP
+*
+* SOURCE
+*/
+#define IB_CLASS_CAP_GETSET                                    0x0002
+/*********/
+/****s* IBA Base: Constants/IB_CLASS_CAP_GETSET
+* NAME
+*      IB_CLASS_CAP_GETSET
+*
+* DESCRIPTION
+*      Mask bits to extract the reponse time value from the
+*      resp_time_val field of ib_class_port_info_t.
+*
+* SEE ALSO
+*      ib_class_port_info_t
+*
+* SOURCE
+*/
+#define IB_CLASS_RESP_TIME_MASK                                0x1F
+/*********/
+/****s* IBA Base: Types/ib_class_port_info_t
+* NAME
+*      ib_class_port_info_t
+*
+* DESCRIPTION
+*      IBA defined ClassPortInfo attribute (13.4.8.1)
+*      route between two end-points on a subnet.
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_class_port_info
+{
+       uint8_t                                 base_ver;
+       uint8_t                                 class_ver;
+       ib_net16_t                              cap_mask;
+       ib_net32_t                              resp_time_val;
+       ib_gid_t                                redir_gid;
+       ib_net32_t                              redir_tc_sl_fl;
+       ib_net16_t                              redir_lid;
+       ib_net16_t                              redir_pkey;
+       ib_net32_t                              redir_qp;
+       ib_net32_t                              redir_qkey;
+       ib_gid_t                                trap_gid;
+       ib_net32_t                              trap_tc_sl_fl;
+       ib_net16_t                              trap_lid;
+       ib_net16_t                              trap_pkey;
+       ib_net32_t                              trap_hop_qp;
+       ib_net32_t                              trap_qkey;
+
+}      PACK_SUFFIX ib_class_port_info_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      base_ver
+*              Maximum supported MAD Base Version.
+*
+*      class_ver
+*              Maximum supported management class version.
+*
+*      cap_mask
+*              Supported capabilities of this management class.
+*
+*      resp_time_value
+*              Maximum expected response time.
+*
+*      redr_gid
+*              GID to use for redirection, or zero
+*
+*      recdir_tc_sl_fl
+*              Traffic class, service level and flow label the requester
+*              should use if the service is redirected.
+*
+*      redir_lid
+*              LID used for redirection, or zero
+*
+*      redir_pkey
+*              P_Key used for redirection
+*
+*      redir_qp
+*              QP number used for redirection
+*
+*      redir_qkey
+*              Q_Key associated with the redirected QP.  This shall be the
+*              well known Q_Key value.
+*
+*      trap_gid
+*              GID value used for trap messages from this service.
+*
+*      trap_tc_sl_fl
+*              Traffic class, service level and flow label used for
+*              trap messages originated by this service.
+*
+*      trap_lid
+*              LID used for trap messages, or zero
+*
+*      trap_pkey
+*              P_Key used for trap messages
+*
+*      trap_hop_qp
+*              Hop limit (upper 8 bits) and QP number used for trap messages
+*
+*      trap_qkey
+*              Q_Key associated with the trap messages QP.
+*
+* SEE ALSO
+*      IB_CLASS_CAP_GETSET, IB_CLASS_CAP_TRAP
+*
+*********/
+/****s* IBA Base: Types/ib_sm_info_t
+* NAME
+*      ib_sm_info_t
+*
+* DESCRIPTION
+*      SMInfo structure (14.2.5.13).
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_sm_info
+{
+       ib_net64_t                      guid;
+       ib_net64_t                      sm_key;
+       ib_net32_t                      act_count;
+       uint8_t                         pri_state;
+
+}      PACK_SUFFIX ib_sm_info_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      guid
+*              Port GUID for this SM.
+*
+*      sm_key
+*              SM_Key of this SM.
+*
+*      act_count
+*              Activity counter used as a heartbeat.
+*
+*      pri_state
+*              Priority and State information
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_sminfo_get_priority
+* NAME
+*      ib_sminfo_get_priority
+*
+* DESCRIPTION
+*      Returns the priority value.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_sminfo_get_priority(
+       IN              const   ib_sm_info_t* const                     p_smi )
+{
+       return( (uint8_t)((p_smi->pri_state & 0xF0)>>4) );
+}
+/*
+* PARAMETERS
+*      p_smi
+*              [in] Pointer to the SMInfo Attribute.
+*
+* RETURN VALUES
+*      Returns the priority value.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_sminfo_get_state
+* NAME
+*      ib_sminfo_get_state
+*
+* DESCRIPTION
+*      Returns the state value.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_sminfo_get_state(
+       IN              const   ib_sm_info_t* const                     p_smi )
+{
+       return( (uint8_t)(p_smi->pri_state & 0x0F) );
+}
+/*
+* PARAMETERS
+*      p_smi
+*              [in] Pointer to the SMInfo Attribute.
+*
+* RETURN VALUES
+*      Returns the state value.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****s* IBA Base: Types/ib_mad_t
+* NAME
+*      ib_mad_t
+*
+* DESCRIPTION
+*      IBA defined MAD header (13.4.3)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_mad
+{
+       uint8_t                                 base_ver;
+       uint8_t                                 mgmt_class;
+       uint8_t                                 class_ver;
+       uint8_t                                 method;
+       ib_net16_t                              status;
+       ib_net16_t                              class_spec;
+       ib_net64_t                              trans_id;
+       ib_net16_t                              attr_id;
+       ib_net16_t                              resv;
+       ib_net32_t                              attr_mod;
+}      PACK_SUFFIX ib_mad_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      base_ver
+*              MAD base format.
+*
+*      mgmt_class
+*              Class of operation.
+*
+*      class_ver
+*              Version of MAD class-specific format.
+*
+*      method
+*              Method to perform, including 'R' bit.
+*
+*      status
+*              Status of operation.
+*
+*      class_spec
+*              Reserved for subnet management.
+*
+*      trans_id
+*              Transaction ID.
+*
+*      attr_id
+*              Attribute ID.
+*
+*      resv
+*              Reserved field.
+*
+*      attr_mod
+*              Attribute modifier.
+*
+* SEE ALSO
+*********/
+
+
+/****s* IBA Base: Types/ib_rmpp_mad_t
+* NAME
+*      ib_rmpp_mad_t
+*
+* DESCRIPTION
+*      IBA defined MAD RMPP header (13.6.2.1)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_rmpp_mad
+{
+       ib_mad_t                                common_hdr;
+
+       uint8_t                                 rmpp_version;
+       uint8_t                                 rmpp_type;
+       uint8_t                                 rmpp_flags;
+       uint8_t                                 rmpp_status;
+
+       ib_net32_t                              seg_num;
+       ib_net32_t                              paylen_newwin;
+
+}      PACK_SUFFIX ib_rmpp_mad_t;
+#include <complib/cl_packoff.h>
+/*
+* SEE ALSO
+*      ib_mad_t
+*********/
+
+
+/****f* IBA Base: Types/ib_mad_init_new
+* NAME
+*      ib_mad_init_new
+*
+* DESCRIPTION
+*      Initializes a MAD common header.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_mad_init_new(
+       IN                              ib_mad_t* const                         p_mad,
+       IN              const   uint8_t                                         mgmt_class,
+       IN              const   uint8_t                                         class_ver,
+       IN              const   uint8_t                                         method,
+       IN              const   ib_net64_t                                      trans_id,
+       IN              const   ib_net16_t                                      attr_id,
+       IN              const   ib_net32_t                                      attr_mod )
+{
+       CL_ASSERT( p_mad );
+       p_mad->base_ver = 1;
+       p_mad->mgmt_class = mgmt_class;
+       p_mad->class_ver = class_ver;
+       p_mad->method = method;
+       p_mad->status = 0;
+       p_mad->class_spec = 0;
+       p_mad->trans_id = trans_id;
+       p_mad->attr_id = attr_id;
+       p_mad->resv = 0;
+       p_mad->attr_mod = attr_mod;
+}
+/*
+* PARAMETERS
+*      p_mad
+*              [in] Pointer to the MAD common header.
+*
+*      mgmt_class
+*              [in] Class of operation.
+*
+*      class_ver
+*              [in] Version of MAD class-specific format.
+*
+*      method
+*              [in] Method to perform, including 'R' bit.
+*
+*      trans_Id
+*              [in] Transaction ID.
+*
+*      attr_id
+*              [in] Attribute ID.
+*
+*      attr_mod
+*              [in] Attribute modifier.
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_mad_t
+*********/
+
+/****f* IBA Base: Types/ib_mad_init_response
+* NAME
+*      ib_mad_init_response
+*
+* DESCRIPTION
+*      Initializes a MAD common header as a response.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_mad_init_response(
+       IN              const   ib_mad_t* const                         p_req_mad,
+       IN                              ib_mad_t* const                         p_mad,
+       IN              const   ib_net16_t                                      status )
+{
+       CL_ASSERT( p_req_mad );
+       CL_ASSERT( p_mad );
+       *p_mad = *p_req_mad;
+       p_mad->status = status;
+       if( p_mad->method == IB_MAD_METHOD_SET )
+               p_mad->method = IB_MAD_METHOD_GET;
+       p_mad->method |= IB_MAD_METHOD_RESP_MASK;
+}
+/*
+* PARAMETERS
+*      p_req_mad
+*              [in] Pointer to the MAD common header in the original request MAD.
+*
+*      p_mad
+*              [in] Pointer to the MAD common header to initialize.
+*
+*      status
+*              [in] MAD Status value to return;
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*      p_req_mad and p_mad may point to the same MAD.
+*
+* SEE ALSO
+*      ib_mad_t
+*********/
+
+/****f* IBA Base: Types/ib_mad_is_response
+* NAME
+*      ib_mad_is_response
+*
+* DESCRIPTION
+*      Returns TRUE if the MAD is a response ('R' bit set),
+*      FALSE otherwise.
+*
+* SYNOPSIS
+*/
+AL_INLINE boolean_t     AL_API
+ib_mad_is_response(
+       IN              const   ib_mad_t* const                         p_mad )
+{
+       CL_ASSERT( p_mad );
+       return( (p_mad->method & IB_MAD_METHOD_RESP_MASK) ==
+                       IB_MAD_METHOD_RESP_MASK );
+}
+/*
+* PARAMETERS
+*      p_mad
+*              [in] Pointer to the MAD.
+*
+* RETURN VALUES
+*      Returns TRUE if the MAD is a response ('R' bit set),
+*      FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_mad_t
+*********/
+
+
+#define IB_RMPP_TYPE_DATA                      1
+#define IB_RMPP_TYPE_ACK                       2
+#define IB_RMPP_TYPE_STOP                      3
+#define IB_RMPP_TYPE_ABORT                     4
+
+#define IB_RMPP_NO_RESP_TIME           0x1F
+#define IB_RMPP_FLAG_ACTIVE                    0x01
+#define IB_RMPP_FLAG_FIRST                     0x02
+#define IB_RMPP_FLAG_LAST                      0x04
+
+#define IB_RMPP_STATUS_SUCCESS         0
+#define IB_RMPP_STATUS_RESX                    1               /* resources exhausted */
+#define IB_RMPP_STATUS_T2L                     118             /* time too long */
+#define IB_RMPP_STATUS_BAD_LEN         119             /* incon. last and payload len */
+#define IB_RMPP_STATUS_BAD_SEG         120             /* incon. first and segment no */
+#define IB_RMPP_STATUS_BADT                    121             /* bad rmpp type */
+#define IB_RMPP_STATUS_W2S                     122             /* newwindowlast too small */
+#define IB_RMPP_STATUS_S2B                     123             /* segment no too big */
+#define IB_RMPP_STATUS_BAD_STATUS      124             /* illegal status */
+#define IB_RMPP_STATUS_UNV                     125             /* unsupported version */
+#define IB_RMPP_STATUS_TMR                     126             /* too many retries */
+#define IB_RMPP_STATUS_UNSPEC          127             /* unspecified */
+
+
+/****f* IBA Base: Types/ib_rmpp_is_flag_set
+* NAME
+*      ib_rmpp_is_flag_set
+*
+* DESCRIPTION
+*      Returns TRUE if the MAD has the given RMPP flag set.
+*
+* SYNOPSIS
+*/
+AL_INLINE boolean_t     AL_API
+ib_rmpp_is_flag_set(
+       IN              const   ib_rmpp_mad_t* const            p_rmpp_mad,
+       IN              const   uint8_t                                         flag )
+{
+       CL_ASSERT( p_rmpp_mad );
+       return( (p_rmpp_mad->rmpp_flags & flag) == flag );
+}
+/*
+* PARAMETERS
+*      ib_rmpp_mad_t
+*              [in] Pointer to a MAD with an RMPP header.
+*
+*      flag
+*              [in] The RMPP flag being examined.
+*
+* RETURN VALUES
+*      Returns TRUE if the MAD has the given RMPP flag set.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_mad_t, ib_rmpp_mad_t
+*********/
+
+AL_INLINE void     AL_API
+ib_rmpp_set_resp_time(
+       IN                              ib_rmpp_mad_t* const            p_rmpp_mad,
+       IN              const   uint8_t                                         resp_time )
+{
+       CL_ASSERT( p_rmpp_mad );
+       p_rmpp_mad->rmpp_flags |= (resp_time << 3);
+}
+
+
+AL_INLINE uint8_t     AL_API
+ib_rmpp_get_resp_time(
+       IN              const   ib_rmpp_mad_t* const            p_rmpp_mad )
+{
+       CL_ASSERT( p_rmpp_mad );
+       return( (uint8_t)(p_rmpp_mad->rmpp_flags >> 3) );
+}
+
+
+/****d* IBA Base: Constants/IB_SMP_DIRECTION
+* NAME
+*      IB_SMP_DIRECTION
+*
+* DESCRIPTION
+*      The Direction bit for directed route SMPs.
+*
+* SOURCE
+*/
+#define IB_SMP_DIRECTION_HO                    0x8000
+#define IB_SMP_DIRECTION                       (CL_HTON16(IB_SMP_DIRECTION_HO))
+/**********/
+
+/****d* IBA Base: Constants/IB_SMP_STATUS_MASK
+* NAME
+*      IB_SMP_STATUS_MASK
+*
+* DESCRIPTION
+*      Mask value for extracting status from a directed route SMP.
+*
+* SOURCE
+*/
+#define IB_SMP_STATUS_MASK_HO          0x7FFF
+#define IB_SMP_STATUS_MASK                     (CL_HTON16(IB_SMP_STATUS_MASK_HO))
+/**********/
+
+/****s* IBA Base: Types/ib_smp_t
+* NAME
+*      ib_smp_t
+*
+* DESCRIPTION
+*      IBA defined SMP. (14.2.1.2)
+*
+* SYNOPSIS
+*/
+#define IB_SMP_DATA_SIZE 64
+#include <complib/cl_packon.h>
+typedef struct _ib_smp
+{
+       uint8_t                                 base_ver;
+       uint8_t                                 mgmt_class;
+       uint8_t                                 class_ver;
+       uint8_t                                 method;
+       ib_net16_t                              status;
+       uint8_t                                 hop_ptr;
+       uint8_t                                 hop_count;
+       ib_net64_t                              trans_id;
+       ib_net16_t                              attr_id;
+       ib_net16_t                              resv;
+       ib_net32_t                              attr_mod;
+       ib_net64_t                              m_key;
+       ib_net16_t                              dr_slid;
+       ib_net16_t                              dr_dlid;
+       uint32_t                                resv1[7];
+       uint8_t                                 data[IB_SMP_DATA_SIZE];
+       uint8_t                                 initial_path[IB_SUBNET_PATH_HOPS_MAX];
+       uint8_t                                 return_path[IB_SUBNET_PATH_HOPS_MAX];
+
+}      PACK_SUFFIX ib_smp_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      base_ver
+*              MAD base format.
+*
+*      mgmt_class
+*              Class of operation.
+*
+*      class_ver
+*              Version of MAD class-specific format.
+*
+*      method
+*              Method to perform, including 'R' bit.
+*
+*      status
+*              Status of operation.
+*
+*      hop_ptr
+*              Hop pointer for directed route MADs.
+*
+*      hop_count
+*              Hop count for directed route MADs.
+*
+*      trans_Id
+*              Transaction ID.
+*
+*      attr_id
+*              Attribute ID.
+*
+*      resv
+*              Reserved field.
+*
+*      attr_mod
+*              Attribute modifier.
+*
+*      m_key
+*              Management key value.
+*
+*      dr_slid
+*              Directed route source LID.
+*
+*      dr_dlid
+*              Directed route destination LID.
+*
+*      resv0
+*              Reserved for 64 byte alignment.
+*
+*      data
+*              MAD data payload.
+*
+*      initial_path
+*              Outbound port list.
+*
+*      return_path
+*              Inbound port list.
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_smp_get_status
+* NAME
+*      ib_smp_get_status
+*
+* DESCRIPTION
+*      Returns the SMP status value in network order.
+*
+* SYNOPSIS
+*/
+AL_INLINE ib_net16_t     AL_API
+ib_smp_get_status(
+       IN              const   ib_smp_t* const                         p_smp )
+{
+       return( (ib_net16_t)(p_smp->status & IB_SMP_STATUS_MASK) );
+}
+/*
+* PARAMETERS
+*      p_smp
+*              [in] Pointer to the SMP packet.
+*
+* RETURN VALUES
+*      Returns the SMP status value in network order.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_smp_t
+*********/
+
+/****f* IBA Base: Types/ib_smp_is_response
+* NAME
+*      ib_smp_is_response
+*
+* DESCRIPTION
+*      Returns TRUE if the SMP is a response MAD, FALSE otherwise.
+*
+* SYNOPSIS
+*/
+AL_INLINE boolean_t     AL_API
+ib_smp_is_response(
+       IN              const   ib_smp_t* const                         p_smp )
+{
+       return( ib_mad_is_response( (const ib_mad_t*)p_smp ) );
+}
+/*
+* PARAMETERS
+*      p_smp
+*              [in] Pointer to the SMP packet.
+*
+* RETURN VALUES
+*      Returns TRUE if the SMP is a response MAD, FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_smp_t
+*********/
+/****f* IBA Base: Types/ib_smp_is_d
+* NAME
+*      ib_smp_is_d
+*
+* DESCRIPTION
+*      Returns TRUE if the SMP 'D' (direction) bit is set.
+*
+* SYNOPSIS
+*/
+AL_INLINE boolean_t     AL_API
+ib_smp_is_d(
+       IN              const   ib_smp_t* const                         p_smp )
+{
+       return( (p_smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION );
+}
+/*
+* PARAMETERS
+*      p_smp
+*              [in] Pointer to the SMP packet.
+*
+* RETURN VALUES
+*      Returns TRUE if the SMP 'D' (direction) bit is set.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_smp_t
+*********/
+
+/****f* IBA Base: Types/ib_smp_init_new
+* NAME
+*      ib_smp_init_new
+*
+* DESCRIPTION
+*      Initializes a MAD common header.
+*
+* TODO
+*      This is too big for inlining, but leave it here for now
+*      since there is not yet another convient spot.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_smp_init_new(
+       IN                              ib_smp_t* const                         p_smp,
+       IN              const   uint8_t                                         method,
+       IN              const   ib_net64_t                                      trans_id,
+       IN              const   ib_net16_t                                      attr_id,
+       IN              const   ib_net32_t                                      attr_mod,
+       IN              const   uint8_t                                         hop_count,
+       IN              const   ib_net64_t                                      m_key,
+       IN              const   uint8_t*                                        path_out,
+       IN              const   ib_net16_t                                      dr_slid,
+       IN              const   ib_net16_t                                      dr_dlid )
+{
+       CL_ASSERT( p_smp );
+       CL_ASSERT( hop_count < IB_SUBNET_PATH_HOPS_MAX );
+       p_smp->base_ver = 1;
+       p_smp->mgmt_class = IB_MCLASS_SUBN_DIR;
+       p_smp->class_ver = 1;
+       p_smp->method = method;
+       p_smp->status = 0;
+       p_smp->hop_ptr = 0;
+       p_smp->hop_count = hop_count;
+       p_smp->trans_id = trans_id;
+       p_smp->attr_id = attr_id;
+       p_smp->resv = 0;
+       p_smp->attr_mod = attr_mod;
+       p_smp->m_key = m_key;
+       p_smp->dr_slid = dr_slid;
+       p_smp->dr_dlid = dr_dlid;
+
+       cl_memclr( p_smp->resv1,
+                       sizeof(p_smp->resv1) +
+                       sizeof(p_smp->data) +
+                       sizeof(p_smp->initial_path) +
+                       sizeof(p_smp->return_path) );
+
+       /* copy the path */
+       cl_memcpy( &p_smp->initial_path, path_out,
+                       sizeof( p_smp->initial_path ) );
+}
+/*
+* PARAMETERS
+*      p_smp
+*              [in] Pointer to the SMP packet.
+*
+*      method
+*              [in] Method to perform, including 'R' bit.
+*
+*      trans_Id
+*              [in] Transaction ID.
+*
+*      attr_id
+*              [in] Attribute ID.
+*
+*      attr_mod
+*              [in] Attribute modifier.
+*
+*      hop_count
+*              [in] Number of hops in the path.
+*
+*      m_key
+*              [in] Management key for this SMP.
+*
+*      path_out
+*              [in] Port array for outbound path.
+*
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*      Payload area is initialized to zero.
+*
+*
+* SEE ALSO
+*      ib_mad_t
+*********/
+/****f* IBA Base: Types/ib_smp_get_payload_ptr
+* NAME
+*      ib_smp_get_payload_ptr
+*
+* DESCRIPTION
+*      Gets a pointer to the SMP payload area.
+*
+* SYNOPSIS
+*/
+AL_INLINE void*     AL_API
+ib_smp_get_payload_ptr(
+       IN              const   ib_smp_t* const                         p_smp )
+{
+       return( (void*)p_smp->data );
+}
+/*
+* PARAMETERS
+*      p_smp
+*              [in] Pointer to the SMP packet.
+*
+* RETURN VALUES
+*      Pointer to SMP payload area.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_mad_t
+*********/
+
+/****s* IBA Base: Types/ib_node_info_t
+* NAME
+*      ib_node_info_t
+*
+* DESCRIPTION
+*      IBA defined NodeInfo. (14.2.5.3)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_node_info
+{
+       uint8_t                         base_version;
+       uint8_t                         class_version;
+       uint8_t                         node_type;
+       uint8_t                         num_ports;
+       ib_net64_t                      sys_guid;
+       ib_net64_t                      node_guid;
+       ib_net64_t                      port_guid;
+       ib_net16_t                      partition_cap;
+       ib_net16_t                      device_id;
+       ib_net32_t                      revision;
+       ib_net32_t                      port_num_vendor_id;
+
+}      PACK_SUFFIX ib_node_info_t;
+#include <complib/cl_packoff.h>
+/************/
+/****s* IBA Base: Types/ib_sa_mad_t
+* NAME
+*      ib_sa_mad_t
+*
+* DESCRIPTION
+*      IBA defined SA MAD format. (15.2.1)
+*
+* SYNOPSIS
+*/
+#define IB_SA_DATA_SIZE 200
+
+#include <complib/cl_packon.h>
+typedef struct _ib_sa_mad
+{
+       uint8_t                                 base_ver;
+       uint8_t                                 mgmt_class;
+       uint8_t                                 class_ver;
+       uint8_t                                 method;
+       ib_net16_t                              status;
+       ib_net16_t                              resv;
+       ib_net64_t                              trans_id;
+       ib_net16_t                              attr_id;
+       ib_net16_t                              resv1;
+       ib_net32_t                              attr_mod;
+
+       uint8_t                                 rmpp_version;
+       uint8_t                                 rmpp_type;
+       uint8_t                                 rmpp_flags;
+       uint8_t                                 rmpp_status;
+
+       ib_net32_t                              seg_num;
+       ib_net32_t                              paylen_newwin;
+
+       ib_net64_t                              sm_key;
+
+       ib_net16_t                              attr_offset;
+       ib_net16_t                              resv3;
+
+       ib_net64_t                              comp_mask;
+
+       uint8_t                                 data[IB_SA_DATA_SIZE];
+}      PACK_SUFFIX ib_sa_mad_t;
+#include <complib/cl_packoff.h>
+/**********/
+#define IB_SA_MAD_HDR_SIZE (sizeof(ib_sa_mad_t) - IB_SA_DATA_SIZE)
+
+
+
+AL_INLINE uint32_t     AL_API
+ib_get_attr_size(
+       IN              const   ib_net16_t                                      attr_offset )
+{
+       return( ((uint32_t)cl_ntoh16( attr_offset )) << 3 );
+}
+
+AL_INLINE ib_net16_t     AL_API
+ib_get_attr_offset(
+       IN              const   uint32_t                                        attr_size )
+{
+       return( cl_hton16( (uint16_t)(attr_size >> 3) ) );
+}
+
+
+/****f* IBA Base: Types/ib_sa_mad_get_payload_ptr
+* NAME
+*      ib_sa_mad_get_payload_ptr
+*
+* DESCRIPTION
+*      Gets a pointer to the SA MAD's payload area.
+*
+* SYNOPSIS
+*/
+AL_INLINE void*     AL_API
+ib_sa_mad_get_payload_ptr(
+       IN              const   ib_sa_mad_t* const                      p_sa_mad )
+{
+       return( (void*)p_sa_mad->data );
+}
+/*
+* PARAMETERS
+*      p_smp
+*              [in] Pointer to the SA MAD packet.
+*
+* RETURN VALUES
+*      Pointer to SA MAD payload area.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_mad_t
+*********/
+
+#define IB_NODE_INFO_PORT_NUM_MASK             (CL_NTOH32(0xFF000000))
+#define IB_NODE_INFO_VEND_ID_MASK              (CL_NTOH32(0x00FFFFFF))
+#if CPU_LE
+       #define IB_NODE_INFO_PORT_NUM_SHIFT 0
+#else
+       #define IB_NODE_INFO_PORT_NUM_SHIFT 24
+#endif
+
+/****f* IBA Base: Types/ib_node_info_get_local_port_num
+* NAME
+*      ib_node_info_get_local_port_num
+*
+* DESCRIPTION
+*      Gets a the local port number from the NodeInfo attribute.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_node_info_get_local_port_num(
+       IN              const   ib_node_info_t* const           p_ni )
+{
+       return( (uint8_t)(( p_ni->port_num_vendor_id &
+                       IB_NODE_INFO_PORT_NUM_MASK )
+                       >> IB_NODE_INFO_PORT_NUM_SHIFT ));
+}
+/*
+* PARAMETERS
+*      p_ni
+*              [in] Pointer to a NodeInfo attribute.
+*
+* RETURN VALUES
+*      Local port number that returned the attribute.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_node_info_t
+*********/
+/****f* IBA Base: Types/ib_node_info_get_vendor_id
+* NAME
+*      ib_node_info_get_vendor_id
+*
+* DESCRIPTION
+*      Gets the VendorID from the NodeInfo attribute.
+*
+* SYNOPSIS
+*/
+AL_INLINE ib_net32_t     AL_API
+ib_node_info_get_vendor_id(
+       IN              const   ib_node_info_t* const           p_ni )
+{
+       return( (ib_net32_t)( p_ni->port_num_vendor_id &
+                       IB_NODE_INFO_VEND_ID_MASK ) );
+}
+/*
+* PARAMETERS
+*      p_ni
+*              [in] Pointer to a NodeInfo attribute.
+*
+* RETURN VALUES
+*      VendorID that returned the attribute.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_node_info_t
+*********/
+
+#define IB_NODE_DESCRIPTION_SIZE 64
+
+#include <complib/cl_packon.h>
+typedef struct _ib_node_desc
+{
+       // Node String is an array of UTF-8 character that
+       // describes the node in text format
+       // Note that this string is NOT NULL TERMINATED!
+       uint8_t         description[IB_NODE_DESCRIPTION_SIZE];
+
+}      PACK_SUFFIX ib_node_desc_t;
+#include <complib/cl_packoff.h>
+
+#include <complib/cl_packon.h>
+typedef struct _ib_node_record_t
+{
+       ib_net16_t              lid;
+       ib_net16_t              resv;
+       ib_node_info_t  node_info;
+       ib_node_desc_t  node_desc;
+       uint8_t                 pad[4];
+
+}      PACK_SUFFIX ib_node_record_t;
+#include <complib/cl_packoff.h>
+
+/****s* IBA Base: Types/ib_port_info_t
+* NAME
+*      ib_port_info_t
+*
+* DESCRIPTION
+*      IBA defined PortInfo. (14.2.5.6)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_port_info
+{
+       ib_net64_t                      m_key;
+       ib_net64_t                      subnet_prefix;
+       ib_net16_t                      base_lid;
+       ib_net16_t                      master_sm_base_lid;
+       ib_net32_t                      capability_mask;
+       ib_net16_t                      diag_code;
+       ib_net16_t                      m_key_lease_period;
+       uint8_t                         local_port_num;
+       uint8_t                         link_width_enabled;
+       uint8_t                         link_width_supported;
+       uint8_t                         link_width_active;
+  uint8_t                              state_info1; /* LinkSpeedSupported and PortState */
+  uint8_t                              state_info2; /* PortPhysState and LinkDownDefaultState */
+       uint8_t                         mkey_lmc;
+  uint8_t                              link_speed;      /* LinkSpeedEnabled and LinkSpeedActive */
+       uint8_t                         mtu_smsl;
+       uint8_t                         vl_cap;          /* VLCap and InitType */
+       uint8_t                         vl_high_limit;
+       uint8_t                         vl_arb_high_cap;
+       uint8_t                         vl_arb_low_cap;
+       uint8_t                         mtu_cap;
+       uint8_t                         vl_stall_life;
+       uint8_t                         vl_enforce;
+       ib_net16_t                      m_key_violations;
+       ib_net16_t                      p_key_violations;
+       ib_net16_t                      q_key_violations;
+       uint8_t                         guid_cap;
+       uint8_t                         subnet_timeout; /* cli_rereg(1b), resrv(
+2b), timeout(5b) */
+       uint8_t                         resp_time_value;
+       uint8_t                         error_threshold;
+
+}      PACK_SUFFIX ib_port_info_t;
+#include <complib/cl_packoff.h>
+/************/
+
+#define IB_PORT_STATE_MASK                                                     0x0F
+#define IB_PORT_LMC_MASK                                                       0x07
+#define IB_PORT_MPB_MASK                                                       0xC0
+#define IB_PORT_MPB_SHIFT                                                      6
+#define IB_PORT_LINK_SPEED_SHIFT                                       4
+#define IB_PORT_LINK_SPEED_SUPPORTED_MASK                      0xF0
+#define IB_PORT_LINK_SPEED_ACTIVE_MASK       0xF0
+#define IB_PORT_LINK_SPEED_ENABLED_MASK      0x0F
+#define IB_PORT_PHYS_STATE_MASK              0xF0
+#define IB_PORT_PHYS_STATE_SHIFT                                       4
+#define IB_PORT_LNKDWNDFTSTATE_MASK          0x0F
+
+#define IB_PORT_CAP_RESV0         (CL_NTOH32(0x00000001))
+#define IB_PORT_CAP_IS_SM         (CL_NTOH32(0x00000002))
+#define IB_PORT_CAP_HAS_NOTICE    (CL_NTOH32(0x00000004))
+#define IB_PORT_CAP_HAS_TRAP      (CL_NTOH32(0x00000008))
+#define IB_PORT_CAP_HAS_IPD       (CL_NTOH32(0x00000010))
+#define IB_PORT_CAP_HAS_AUTO_MIG  (CL_NTOH32(0x00000020))
+#define IB_PORT_CAP_HAS_SL_MAP    (CL_NTOH32(0x00000040))
+#define IB_PORT_CAP_HAS_NV_MKEY   (CL_NTOH32(0x00000080))
+#define IB_PORT_CAP_HAS_NV_PKEY   (CL_NTOH32(0x00000100))
+#define IB_PORT_CAP_HAS_LED_INFO  (CL_NTOH32(0x00000200))
+#define IB_PORT_CAP_SM_DISAB      (CL_NTOH32(0x00000400))
+#define IB_PORT_CAP_HAS_SYS_IMG_GUID  (CL_NTOH32(0x00000800))
+#define IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP (CL_NTOH32(0x00001000))
+#define IB_PORT_CAP_RESV13        (CL_NTOH32(0x00002000))
+#define IB_PORT_CAP_RESV14        (CL_NTOH32(0x00004000))
+#define IB_PORT_CAP_RESV15        (CL_NTOH32(0x00008000))
+#define IB_PORT_CAP_HAS_COM_MGT   (CL_NTOH32(0x00010000))
+#define IB_PORT_CAP_HAS_SNMP      (CL_NTOH32(0x00020000))
+#define IB_PORT_CAP_REINIT        (CL_NTOH32(0x00040000))
+#define IB_PORT_CAP_HAS_DEV_MGT   (CL_NTOH32(0x00080000))
+#define IB_PORT_CAP_HAS_VEND_CLS  (CL_NTOH32(0x00100000))
+#define IB_PORT_CAP_HAS_DR_NTC    (CL_NTOH32(0x00200000))
+#define IB_PORT_CAP_HAS_CAP_NTC   (CL_NTOH32(0x00400000))
+#define IB_PORT_CAP_HAS_BM        (CL_NTOH32(0x00800000))
+#define IB_PORT_CAP_HAS_LINK_RT_LATENCY (CL_NTOH32(0x01000000))
+#define IB_PORT_CAP_HAS_CLIENT_REREG (CL_NTOH32(0x02000000))
+#define IB_PORT_CAP_RESV26        (CL_NTOH32(0x04000000))
+#define IB_PORT_CAP_RESV27        (CL_NTOH32(0x08000000))
+#define IB_PORT_CAP_RESV28        (CL_NTOH32(0x10000000))
+#define IB_PORT_CAP_RESV29        (CL_NTOH32(0x20000000))
+#define IB_PORT_CAP_RESV30        (CL_NTOH32(0x40000000))
+#define IB_PORT_CAP_RESV31        (CL_NTOH32(0x80000000))
+
+/****f* IBA Base: Types/ib_port_info_get_port_state
+* NAME
+*      ib_port_info_get_port_state
+*
+* DESCRIPTION
+*      Returns the port state.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_port_info_get_port_state(
+       IN              const   ib_port_info_t* const           p_pi )
+{
+       return( (uint8_t)(p_pi->state_info1 & IB_PORT_STATE_MASK) );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      Port state.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+/****f* IBA Base: Types/ib_port_info_set_port_state
+* NAME
+*      ib_port_info_set_port_state
+*
+* DESCRIPTION
+*      Sets the port state.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_port_info_set_port_state(
+       IN                              ib_port_info_t* const           p_pi,
+       IN              const   uint8_t                                         port_state )
+{
+       p_pi->state_info1 = (uint8_t)((p_pi->state_info1 & 0xF0) | port_state );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+*      port_state
+*              [in] Port state value to set.
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+/****f* IBA Base: Types/ib_port_info_get_vl_cap
+* NAME
+*      ib_port_info_get_vl_cap
+*
+* DESCRIPTION
+*      Gets the VL Capability of a port.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_port_info_get_vl_cap(
+       IN const ib_port_info_t* const p_pi)
+{
+       return((p_pi->vl_cap >> 4) & 0x0F);
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      VL_CAP field
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+/****f* IBA Base: Types/ib_port_info_get_op_vls
+* NAME
+*      ib_port_info_get_op_vls
+*
+* DESCRIPTION
+*      Gets the operational VLs on a port.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_port_info_get_op_vls(
+       IN const ib_port_info_t* const p_pi)
+{
+       return((p_pi->vl_enforce >> 4) & 0x0F);
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      OP_VLS field
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+/****f* IBA Base: Types/ib_port_info_set_op_vls
+* NAME
+*      ib_port_info_set_op_vls
+*
+* DESCRIPTION
+*      Sets the operational VLs on a port.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_port_info_set_op_vls(
+       IN                              ib_port_info_t* const           p_pi,
+       IN              const   uint8_t                                         op_vls )
+{
+       p_pi->vl_enforce = (uint8_t)((p_pi->vl_enforce & 0x0F) | (op_vls << 4) );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+*      op_vls
+*              [in] Encoded operation VLs value.
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+/****f* IBA Base: Types/ib_port_info_set_state_no_change
+* NAME
+*      ib_port_info_set_state_no_change
+*
+* DESCRIPTION
+*      Sets the port state fields to the value for "no change".
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_port_info_set_state_no_change(
+       IN                              ib_port_info_t* const           p_pi )
+{
+       ib_port_info_set_port_state( p_pi, 0 );
+       p_pi->state_info2 = 0;
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_link_speed_sup
+* NAME
+*      ib_port_info_get_link_speed_sup
+*
+* DESCRIPTION
+*      Returns the encoded value for the link speed supported.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_port_info_get_link_speed_sup(
+       IN              const   ib_port_info_t* const           p_pi )
+{
+       return( (uint8_t)((p_pi->state_info1 &
+                       IB_PORT_LINK_SPEED_SUPPORTED_MASK) >>
+                       IB_PORT_LINK_SPEED_SHIFT) );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      Returns the encoded value for the link speed supported.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_link_speed_sup
+* NAME
+*      ib_port_info_set_link_speed_sup
+*
+* DESCRIPTION
+*      Given an integer of the supported link speed supported.
+*      Set the appropriate bits in state_info1
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_port_info_set_link_speed_sup(
+       IN                              uint8_t const                           speed,
+       IN                              ib_port_info_t*                         p_pi )
+{
+       p_pi->state_info1 =
+               ( ~IB_PORT_LINK_SPEED_SUPPORTED_MASK & p_pi->state_info1 ) |
+               ( IB_PORT_LINK_SPEED_SUPPORTED_MASK &
+                       (speed << IB_PORT_LINK_SPEED_SHIFT) );
+}
+/*
+* PARAMETERS
+*      speed
+*              [in] Supported Speeds Code.
+*
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      This function does not return a value.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_port_phys_state
+* NAME
+*      ib_port_info_get_port_phys_state
+*
+* DESCRIPTION
+*      Returns the encoded value for the port physical state.
+*
+* SYNOPSIS
+*/
+OSM_INLINE uint8_t     AL_API
+ib_port_info_get_port_phys_state(
+       IN              const   ib_port_info_t* const           p_pi )
+{
+       return( (uint8_t)((p_pi->state_info2 &
+                      IB_PORT_PHYS_STATE_MASK) >>
+                     IB_PORT_PHYS_STATE_SHIFT) );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      Returns the encoded value for the port physical state.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_port_phys_state.
+* NAME
+*      ib_port_info_set_port_phys_state
+*
+* DESCRIPTION
+*      Given an integer of the port physical state,
+*      Set the appropriate bits in state_info2
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_port_info_set_port_phys_state(
+       IN                              uint8_t const                           phys_state,
+       IN                              ib_port_info_t*                         p_pi )
+{
+       p_pi->state_info2 =
+               ( ~IB_PORT_PHYS_STATE_MASK & p_pi->state_info2 ) |
+               ( IB_PORT_PHYS_STATE_MASK &
+        (phys_state << IB_PORT_PHYS_STATE_SHIFT) );
+}
+/*
+* PARAMETERS
+*      phys_state
+*              [in] port physical state.
+*
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      This function does not return a value.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_link_down_def_state
+* NAME
+*      ib_port_info_get_link_down_def_state
+*
+* DESCRIPTION
+*      Returns the link down default state.
+*
+* SYNOPSIS
+*/
+OSM_INLINE uint8_t     AL_API
+ib_port_info_get_link_down_def_state(
+       IN              const   ib_port_info_t* const           p_pi )
+{
+       return( (uint8_t)(p_pi->state_info2 & IB_PORT_LNKDWNDFTSTATE_MASK) );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      link down default state of the port.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_link_down_def_state
+* NAME
+*      ib_port_info_set_link_down_def_state
+*
+* DESCRIPTION
+*      Sets the link down default state of the port.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_port_info_set_link_down_def_state(
+       IN                              ib_port_info_t* const           p_pi,
+       IN              const   uint8_t                                         link_dwn_state )
+{
+       p_pi->state_info2 = (uint8_t)((p_pi->state_info2 & 0xF0) | link_dwn_state );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+*      link_dwn_state
+*              [in] Link down default state of the port.
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_link_speed_active
+* NAME
+*      ib_port_info_get_link_speed_active
+*
+* DESCRIPTION
+*      Returns the Link Speed Active value assigned to this port.
+*
+* SYNOPSIS
+*/
+OSM_INLINE uint8_t    AL_API
+ib_port_info_get_link_speed_active(
+       IN              const   ib_port_info_t* const           p_pi )
+{
+  return( (uint8_t)((p_pi->link_speed &
+                     IB_PORT_LINK_SPEED_ACTIVE_MASK) >>
+                    IB_PORT_LINK_SPEED_SHIFT) );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      Returns the link speed active value assigned to this port.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+#define IB_LINK_WIDTH_ACTIVE_1X                        1
+#define IB_LINK_WIDTH_ACTIVE_4X                        2
+#define IB_LINK_WIDTH_ACTIVE_12X               8
+#define IB_LINK_SPEED_ACTIVE_2_5       1
+#define IB_LINK_SPEED_ACTIVE_5         2
+#define IB_LINK_SPEED_ACTIVE_10        4
+
+/* following v1 ver1.2 p901 */
+#define IB_MAX_RATE                    10
+#define IB_PATH_RECORD_RATE_2_5_GBS            2
+#define IB_PATH_RECORD_RATE_10_GBS             3
+#define IB_PATH_RECORD_RATE_30_GBS             4
+#define IB_PATH_RECORD_RATE_5_GBS              5
+#define IB_PATH_RECORD_RATE_20_GBS             6
+#define IB_PATH_RECORD_RATE_40_GBS             7
+#define IB_PATH_RECORD_RATE_60_GBS             8
+#define IB_PATH_RECORD_RATE_80_GBS             9
+#define IB_PATH_RECORD_RATE_120_GBS            10
+
+/****f* IBA Base: Types/ib_port_info_compute_rate
+* NAME
+*      ib_port_info_compute_rate
+*
+* DESCRIPTION
+*      Returns the encoded value for the path rate.
+*
+* SYNOPSIS
+*/
+
+AL_INLINE uint8_t     AL_API
+ib_port_info_compute_rate(
+       IN              const   ib_port_info_t* const           p_pi )
+{
+  switch (ib_port_info_get_link_speed_active(p_pi))
+  {
+  case IB_LINK_SPEED_ACTIVE_2_5:
+    switch(p_pi->link_width_active)
+    {
+    case IB_LINK_WIDTH_ACTIVE_1X:
+      return IB_PATH_RECORD_RATE_2_5_GBS;
+
+    case IB_LINK_WIDTH_ACTIVE_4X:
+      return IB_PATH_RECORD_RATE_10_GBS;
+
+    case IB_LINK_WIDTH_ACTIVE_12X:
+      return IB_PATH_RECORD_RATE_30_GBS;
+
+    default:
+      return IB_PATH_RECORD_RATE_2_5_GBS;
+    }
+    break;
+  case IB_LINK_SPEED_ACTIVE_5:
+    switch (p_pi->link_width_active)
+    {
+    case IB_LINK_WIDTH_ACTIVE_1X:
+      return IB_PATH_RECORD_RATE_5_GBS;
+      
+    case IB_LINK_WIDTH_ACTIVE_4X:
+      return IB_PATH_RECORD_RATE_20_GBS;
+      
+    case IB_LINK_WIDTH_ACTIVE_12X:
+      return IB_PATH_RECORD_RATE_60_GBS;
+      
+    default:
+      return IB_PATH_RECORD_RATE_5_GBS;
+    }
+    break;
+  case IB_LINK_SPEED_ACTIVE_10:
+    switch (p_pi->link_width_active)
+    {
+    case IB_LINK_WIDTH_ACTIVE_1X:
+      return IB_PATH_RECORD_RATE_10_GBS;
+      
+    case IB_LINK_WIDTH_ACTIVE_4X:
+      return IB_PATH_RECORD_RATE_40_GBS;
+      
+    case IB_LINK_WIDTH_ACTIVE_12X:
+      return IB_PATH_RECORD_RATE_120_GBS;
+      
+    default:
+      return IB_PATH_RECORD_RATE_10_GBS;
+    }
+    break;
+  default:
+    return IB_PATH_RECORD_RATE_2_5_GBS;
+  }
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      Returns the encoded value for the link speed supported.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_path_get_ipd
+* NAME
+*      ib_path_get_ipd
+*
+* DESCRIPTION
+*      Returns the encoded value for the inter packet delay.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_path_get_ipd(
+       IN                              uint8_t                                         local_link_width_supported,
+       IN                              uint8_t                                         path_rec_rate )
+{
+       uint8_t ipd = 0;
+
+       switch(local_link_width_supported)
+       {
+               //link_width_supported = 1: 1x
+               case 1:
+                       break;
+
+               //link_width_supported = 3: 1x or 4x
+               case 3:
+                       switch(path_rec_rate & 0x3F)
+                       {
+                               case IB_PATH_RECORD_RATE_2_5_GBS:
+                                       ipd = 3;
+                                       break;
+                               default:
+                                       break;
+                       }
+                       break;
+
+               //link_width_supported = 11: 1x or 4x or 12x
+               case 11:
+                       switch(path_rec_rate & 0x3F)
+                       {
+                               case IB_PATH_RECORD_RATE_2_5_GBS:
+                                       ipd = 11;
+                                       break;
+                               case IB_PATH_RECORD_RATE_10_GBS:
+                                       ipd = 2;
+                                       break;
+                               default:
+                                       break;
+                       }
+                       break;
+
+               default:
+                       break;
+       }
+
+       return ipd;
+}
+/*
+* PARAMETERS
+*      local_link_width_supported
+*              [in] link with supported for this port
+*
+*      path_rec_rate
+*              [in] rate field of the path record
+*
+* RETURN VALUES
+*      Returns the ipd
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+
+/****f* IBA Base: Types/ib_port_info_get_mtu_cap
+* NAME
+*      ib_port_info_get_mtu_cap
+*
+* DESCRIPTION
+*      Returns the encoded value for the maximum MTU supported by this port.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_port_info_get_mtu_cap(
+       IN              const   ib_port_info_t* const           p_pi )
+{
+       return( (uint8_t)(p_pi->mtu_cap & 0x0F) );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      Returns the LMC value assigned to this port.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+/****f* IBA Base: Types/ib_port_info_get_neighbor_mtu
+* NAME
+*      ib_port_info_get_neighbor_mtu
+*
+* DESCRIPTION
+*      Returns the encoded value for the neighbor MTU at this port.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_port_info_get_neighbor_mtu(
+       IN const ib_port_info_t* const p_pi )
+{
+       return( (uint8_t)((p_pi->mtu_smsl & 0xF0) >> 4) );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      Returns the encoded value for the neighbor MTU at this port.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+/****f* IBA Base: Types/ib_port_info_set_neighbor_mtu
+* NAME
+*      ib_port_info_set_neighbor_mtu
+*
+* DESCRIPTION
+*      Sets the Neighbor MTU value in the PortInfo attribute.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_port_info_set_neighbor_mtu(
+       IN                              ib_port_info_t* const           p_pi,
+       IN              const   uint8_t                                         mtu )
+{
+       CL_ASSERT( mtu <= 5 );
+       CL_ASSERT( mtu != 0 );
+       p_pi->mtu_smsl = (uint8_t)((p_pi->mtu_smsl & 0x0F) | (mtu << 4));
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+*      mtu
+*              [in] Encoded MTU value to set
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_timeout
+* NAME
+*      ib_port_info_set_timeout
+*
+* DESCRIPTION
+*      Sets the encoded subnet timeout value in the PortInfo attribute.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_port_info_set_timeout(
+       IN                              ib_port_info_t* const           p_pi,
+       IN              const   uint8_t                                         timeout )
+{
+       CL_ASSERT( timeout <= 0x1F );
+       p_pi->subnet_timeout = 
+     (uint8_t)(
+       (p_pi->subnet_timeout & 0x80) | (timeout & 0x1F));
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+*      timeout
+*              [in] Encoded timeout value to set
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_client_rereg
+* NAME
+*      ib_port_info_set_client_rereg
+*
+* DESCRIPTION
+*      Sets the encoded client reregistration bit value in the PortInfo attribute.
+*
+* SYNOPSIS
+*/
+OSM_INLINE void     AL_API
+ib_port_info_set_client_rereg(
+       IN                              ib_port_info_t* const   p_pi,
+       IN              const   uint8_t                                         client_rereg )
+{
+       CL_ASSERT( client_rereg <= 0x1 );
+       p_pi->subnet_timeout = 
+     (uint8_t)(
+       (p_pi->subnet_timeout & 0x1F) | ((client_rereg << 7) & 0x80));
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+*      client_rereg
+*              [in] Client reregistration value to set either 1 or 0
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_timeout
+* NAME
+*      ib_port_info_get_timeout
+*
+* DESCRIPTION
+*      Gets the encoded subnet timeout value in the PortInfo attribute.
+*
+* SYNOPSIS
+*/
+OSM_INLINE uint8_t     AL_API
+ib_port_info_get_timeout(
+  IN                           ib_port_info_t const*   p_pi )
+{
+  return(p_pi->subnet_timeout & 0x1F );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      The encoded timeout value
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_client_rereg
+* NAME
+*      ib_port_info_get_client_rereg
+*
+* DESCRIPTION
+*      Gets the encoded client reregistration bit value in the PortInfo attribute.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_port_info_get_client_rereg(
+  IN                           ib_port_info_t const* p_pi )
+{
+  return ( (p_pi->subnet_timeout & 0x80 ) >> 7);
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+*      client_rereg
+*              [in] Client reregistration value to get either 1 or 0
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_hoq_lifetime
+* NAME
+*      ib_port_info_set_hoq_lifetime
+*
+* DESCRIPTION
+*      Sets the Head of Queue Lifetime for which a packet can live in the head 
+*  of VL queue
+*
+* SYNOPSIS
+*/
+OSM_INLINE void     AL_API
+ib_port_info_set_hoq_lifetime(
+  IN           ib_port_info_t* const           p_pi,
+  IN           const   uint8_t                                 hoq_life )
+{
+  p_pi->vl_stall_life = (uint8_t)((hoq_life & 0x1f) |
+                                                                                        (p_pi->vl_stall_life & 0xe0));
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+*      hoq_life
+*              [in] Encoded lifetime value to set
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_hoq_lifetime
+* NAME
+*      ib_port_info_get_hoq_lifetime
+*
+* DESCRIPTION
+*      Gets the Head of Queue Lifetime for which a packet can live in the head 
+*  of VL queue
+*
+* SYNOPSIS
+*/
+OSM_INLINE uint8_t     AL_API
+ib_port_info_get_hoq_lifetime(
+  IN           const ib_port_info_t* const             p_pi )
+{
+  return( (uint8_t)(p_pi->vl_stall_life & 0x1f) );
+}
+
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*     Encoded lifetime value
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_vl_stall_count
+* NAME
+*      ib_port_info_set_vl_stall_count
+*
+* DESCRIPTION
+*      Sets the VL Stall Count which define the number of contigious
+*  HLL (hoq) drops that will put the VL into stalled mode.
+*
+* SYNOPSIS
+*/
+OSM_INLINE void     AL_API
+ib_port_info_set_vl_stall_count(
+  IN           ib_port_info_t* const           p_pi,
+  IN           const   uint8_t                                 vl_stall_count )
+{
+  p_pi->vl_stall_life = (uint8_t)((p_pi->vl_stall_life & 0x1f) |
+                                                                                        ((vl_stall_count << 5) & 0xe0));
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+*      vl_stall_count 
+*              [in] value to set
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_vl_stall_count
+ * NAME
+ *     ib_port_info_get_vl_stall_count
+ *
+ * DESCRIPTION
+ *     Gets the VL Stall Count which define the number of contigious 
+ *  HLL (hoq) drops that will put the VL into stalled mode
+ *
+ * SYNOPSIS
+ */
+AL_INLINE uint8_t     AL_API
+ib_port_info_get_vl_stall_count(
+  IN           const ib_port_info_t* const             p_pi )
+{
+  return( (uint8_t)(p_pi->vl_stall_life & 0xe0) >> 5);
+}
+
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*     vl stall count
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_lmc
+* NAME
+*      ib_port_info_get_lmc
+*
+* DESCRIPTION
+*      Returns the LMC value assigned to this port.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_port_info_get_lmc(
+  IN           const ib_port_info_t* const             p_pi )
+{
+       return( (uint8_t)(p_pi->mkey_lmc & IB_PORT_LMC_MASK) );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      Returns the LMC value assigned to this port.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_lmc
+* NAME
+*      ib_port_info_set_lmc
+*
+* DESCRIPTION
+*      Sets the LMC value in the PortInfo attribute.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_port_info_set_lmc(
+       IN                              ib_port_info_t* const           p_pi,
+       IN              const   uint8_t                                         lmc )
+{
+       CL_ASSERT( lmc <= 0x7 );
+       p_pi->mkey_lmc = (uint8_t)((p_pi->mkey_lmc & 0xF8) | lmc);
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+*      lmc
+*              [in] LMC value to set, must be less than 7.
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_link_speed_enabled
+* NAME
+*      ib_port_info_get_link_speed_enabled
+*
+* DESCRIPTION
+*      Returns the link speed enabled value assigned to this port.
+*
+* SYNOPSIS
+*/
+OSM_INLINE uint8_t     AL_API
+ib_port_info_get_link_speed_enabled(
+       IN              const   ib_port_info_t* const           p_pi )
+{
+       return( (uint8_t)(p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK) );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      Port state.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+/****f* IBA Base: Types/ib_port_info_set_link_speed_enabled
+* NAME
+*      ib_port_info_set_link_speed_enabled
+*
+* DESCRIPTION
+*      Sets the link speed enabled value in the PortInfo attribute.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_port_info_set_link_speed_enabled(
+       IN                              ib_port_info_t* const           p_pi,
+       IN              const   uint8_t                                         link_speed_enabled )
+{
+       p_pi->link_speed = (uint8_t)((p_pi->link_speed & 0xF0) | link_speed_enabled );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+*      link_speed_enabled
+*              [in] link speed enabled value to set.
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_get_mpb
+* NAME
+*      ib_port_info_get_mpb
+*
+* DESCRIPTION
+*      Returns the M_Key protect bits assigned to this port.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_port_info_get_mpb(
+       IN              const   ib_port_info_t* const           p_pi )
+{
+       return( (uint8_t)((p_pi->mkey_lmc & IB_PORT_MPB_MASK) >>
+                       IB_PORT_MPB_SHIFT) );
+}
+/*
+* PARAMETERS
+*      p_ni
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      Returns the M_Key protect bits assigned to this port.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_mpb
+* NAME
+*      ib_port_info_set_mpb
+*
+* DESCRIPTION
+*      Set the M_Key protect bits of this port.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_port_info_set_mpb(
+       IN                              ib_port_info_t*                         p_pi,
+       IN                              uint8_t                                         mpb )
+{
+       p_pi->mkey_lmc =
+               (~IB_PORT_MPB_MASK & p_pi->mkey_lmc) |
+               ( IB_PORT_MPB_MASK & (mpb << IB_PORT_MPB_SHIFT) );
+}
+/*
+* PARAMETERS
+*      mpb
+*              [in] M_Key protect bits
+*      p_ni
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_phy_and_overrun_err_thd
+* NAME
+*      ib_port_info_set_phy_and_overrun_err_thd
+*
+* DESCRIPTION
+*      Sets the Phy Link and Credits Overrun Errors Threshold
+*
+* SYNOPSIS
+*/
+OSM_INLINE void     AL_API
+ib_port_info_set_phy_and_overrun_err_thd(
+  IN           ib_port_info_t* const           p_pi,
+  IN           uint8_t                         phy_threshold,
+  IN           uint8_t                         overrun_threshold )
+{
+  p_pi->error_threshold = 
+        (uint8_t)( ((phy_threshold & 0x0F) << 4) | (overrun_threshold & 0x0F) );
+}
+/*
+* PARAMETERS
+*      p_pi
+*              [in] Pointer to a PortInfo attribute.
+*
+*      phy_threshold
+*              [in] Physical Link Errors Threshold above which Trap 129 is generated 
+*
+*  overrun_threshold
+*     [in] Credits overrun Errors Threshold above which Trap 129 is generated 
+*
+* RETURN VALUES
+*      None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+typedef uint8_t                ib_svc_name_t[64];
+
+#include <complib/cl_packon.h>
+typedef struct _ib_service_record
+{
+       ib_net64_t              service_id;
+       ib_gid_t                service_gid;
+       ib_net16_t              service_pkey;
+       ib_net16_t              resv;
+       ib_net32_t              service_lease;
+       uint8_t                 service_key[16];
+       ib_svc_name_t   service_name;
+       uint8_t                 service_data8[16];
+       ib_net16_t              service_data16[8];
+       ib_net32_t              service_data32[4];
+       ib_net64_t              service_data64[2];
+
+}      PACK_SUFFIX ib_service_record_t;
+#include <complib/cl_packoff.h>
+
+#include <complib/cl_packon.h>
+typedef struct _ib_portinfo_record
+{
+       ib_net16_t              lid;
+       uint8_t                 port_num;
+       uint8_t                 resv;
+       ib_port_info_t  port_info;
+       uint8_t                 pad[6];
+
+}      PACK_SUFFIX ib_portinfo_record_t;
+#include <complib/cl_packoff.h>
+
+#include <complib/cl_packon.h>
+typedef struct _ib_link_record
+{
+       ib_net16_t              from_lid;
+       uint8_t                 from_port_num;
+       uint8_t                 to_port_num;
+       ib_net16_t              to_lid;
+       uint8_t                 pad[2];
+
+}      PACK_SUFFIX ib_link_record_t;
+#include <complib/cl_packoff.h>
+
+#include <complib/cl_packon.h>
+typedef struct _ib_sminfo_record
+{
+       ib_net16_t              lid;
+       uint16_t                resv0;
+       ib_sm_info_t    sm_info;
+       uint8_t                 pad[7];
+
+}      PACK_SUFFIX ib_sminfo_record_t;
+#include <complib/cl_packoff.h>
+
+/****s* IBA Base: Types/ib_lft_record_t
+* NAME
+*      ib_lft_record_t
+*
+* DESCRIPTION
+*      IBA defined LinearForwardingTable. (14.2.5.6)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_lft_record
+{
+       ib_net16_t              lid;
+       ib_net16_t              block_num;
+       uint32_t                   resv0;
+       uint8_t       lft[64];
+}      PACK_SUFFIX ib_lft_record_t;
+#include <complib/cl_packoff.h>
+/************/
+
+/****s* IBA Base: Types/ib_switch_info_t
+* NAME
+*      ib_switch_info_t
+*
+* DESCRIPTION
+*      IBA defined SwitchInfo. (14.2.5.4)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_switch_info
+{
+       ib_net16_t                      lin_cap;
+       ib_net16_t                      rand_cap;
+       ib_net16_t                      mcast_cap;
+       ib_net16_t                      lin_top;
+       uint8_t                         def_port;
+       uint8_t                         def_mcast_pri_port;
+       uint8_t                         def_mcast_not_port;
+       uint8_t                         life_state;
+       ib_net16_t                      lids_per_port;
+       ib_net16_t                      enforce_cap;
+       uint8_t                         flags;
+
+}      PACK_SUFFIX ib_switch_info_t;
+#include <complib/cl_packoff.h>
+/************/
+
+#include <complib/cl_packon.h>
+typedef struct _ib_switch_info_record
+{
+       ib_net16_t                      lid;
+       uint16_t                        resv0;
+       ib_switch_info_t        switch_info;
+       uint8_t                         pad[3];
+
+}      PACK_SUFFIX ib_switch_info_record_t;
+#include <complib/cl_packoff.h>
+
+#define IB_SWITCH_PSC 0x04
+
+/****f* IBA Base: Types/ib_switch_info_get_state_change
+* NAME
+*      ib_switch_info_get_state_change
+*
+* DESCRIPTION
+*      Returns the value of the state change flag.
+*
+* SYNOPSIS
+*/
+AL_INLINE boolean_t     AL_API
+ib_switch_info_get_state_change(
+       IN              const   ib_switch_info_t* const         p_si )
+{
+       return( (p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC );
+}
+/*
+* PARAMETERS
+*      p_si
+*              [in] Pointer to a SwitchInfo attribute.
+*
+* RETURN VALUES
+*      Returns the value of the state change flag.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_switch_info_clear_state_change
+* NAME
+*      ib_switch_info_clear_state_change
+*
+* DESCRIPTION
+*      Clears the switch's state change bit.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_switch_info_clear_state_change(
+       IN                              ib_switch_info_t* const         p_si )
+{
+       p_si->life_state = (uint8_t)(p_si->life_state & 0xFB);
+}
+/*
+* PARAMETERS
+*      p_ni
+*              [in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*      Returns the LMC value assigned to this port.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+
+/****f* IBA Base: Types/ib_switch_info_is_enhanced_port_0
+* NAME
+*      ib_switch_info_is_enhanced_port_0
+*
+* DESCRIPTION
+*      Returns TRUE if the enhancedPort0 bit is on (meaning the switch
+*  port zero supports enhanced functions).
+*  Returns FALSE otherwise.
+*
+* SYNOPSIS
+*/
+OSM_INLINE boolean_t     AL_API
+ib_switch_info_is_enhanced_port_0(
+       IN              const   ib_switch_info_t* const         p_si )
+{
+       return( (p_si->flags & 0x08) == 0x08 );
+}
+/*
+* PARAMETERS
+*      p_si
+*              [in] Pointer to a SwitchInfo attribute.
+*
+* RETURN VALUES
+*      Returns TRUE if the switch supports enhanced port 0. FALSE otherwise.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****s* IBA Base: Types/ib_guid_info_t
+* NAME
+*      ib_guid_info_t
+*
+* DESCRIPTION
+*      IBA defined GuidInfo. (14.2.5.5)
+*
+* SYNOPSIS
+*/
+#define        GUID_TABLE_MAX_ENTRIES          8
+
+#include <complib/cl_packon.h>
+typedef struct _ib_guid_info
+{
+       ib_net64_t                      guid[GUID_TABLE_MAX_ENTRIES];
+
+}      PACK_SUFFIX ib_guid_info_t;
+#include <complib/cl_packoff.h>
+/************/
+
+#define IB_NUM_PKEY_ELEMENTS_IN_BLOCK          32
+/****s* IBA Base: Types/ib_pkey_table_t
+* NAME
+*      ib_pkey_table_t
+*
+* DESCRIPTION
+*      IBA defined PKey table. (14.2.5.7)
+*
+* SYNOPSIS
+*/
+
+#include <complib/cl_packon.h>
+typedef struct _ib_pkey_table
+{
+       ib_net16_t                      pkey_entry[IB_NUM_PKEY_ELEMENTS_IN_BLOCK];
+
+}      PACK_SUFFIX ib_pkey_table_t;
+#include <complib/cl_packoff.h>
+/************/
+
+/****s* IBA Base: Types/ib_pkey_table_record_t
+* NAME
+*      ib_pkey_table_record_t
+*
+* DESCRIPTION
+*      IBA defined P_Key Table Record for SA Query. (15.2.5.11)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_pkey_table_record
+{
+       ib_net16_t                      lid; // for CA: lid of port, for switch lid of port 0
+       uint16_t                                block_num;
+   uint8_t                             port_num; // for swithc: port number, for CA: reserved
+       uint8_t                         reserved1;
+       uint16_t                        reserved2;
+       ib_pkey_table_t pkey_tbl;
+
+}      PACK_SUFFIX ib_pkey_table_record_t;
+#include <complib/cl_packoff.h>
+/************/
+
+#define IB_MAX_NUM_VLS 16
+/****s* IBA Base: Types/ib_slvl_table_t
+* NAME
+*      ib_slvl_table_t
+*
+* DESCRIPTION
+*      IBA defined SL2VL Mapping Table Attribute. (14.2.5.8)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_slvl_table
+{
+       uint8_t raw_vl_by_sl[IB_MAX_NUM_VLS/2];
+}      PACK_SUFFIX ib_slvl_table_t;
+#include <complib/cl_packoff.h>
+/************/
+
+/****s* IBA Base: Types/ib_slvl_table_record_t
+* NAME
+*      ib_slvl_table_record_t
+*
+* DESCRIPTION
+*      IBA defined Sl to VL Mapping Table Record for SA Query. (15.2.5.4)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_slvl_table_record
+{
+       ib_net16_t              lid; // for CA: lid of port, for switch lid of port 0
+       uint8_t                 in_port_num;    // reserved for CA's
+       uint8_t                 out_port_num;   // reserved for CA's
+       uint32_t                resv;
+       ib_slvl_table_t slvl_tbl;
+
+}      PACK_SUFFIX ib_slvl_table_record_t;
+#include <complib/cl_packoff.h>
+/************/
+
+/****f* IBA Base: Types/ib_slvl_table_set
+* NAME
+*      ib_slvl_table_set
+*
+* DESCRIPTION
+*      Set slvl table entry.
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_slvl_table_set(
+  IN           ib_slvl_table_t*        p_slvl_tbl,
+  IN           uint8_t                 sl_index,
+  IN     uint8_t                 vl )
+{
+  uint8_t idx = sl_index/2;
+  CL_ASSERT(vl <= 15);
+  CL_ASSERT(sl_index <= 15);
+
+  if (sl_index%2)
+  {
+    /* this is an odd sl. Need to update the ls bits */
+    p_slvl_tbl->raw_vl_by_sl[idx] = ( p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0 ) | vl ;
+  }
+  else
+  {
+    /* this is an even sl. Need to update the ms bits */
+    p_slvl_tbl->raw_vl_by_sl[idx] = ( vl << 4 ) | ( p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F );
+  }
+}
+/*
+* PARAMETERS
+*      p_slvl_tbl
+*              [in] pointer to ib_slvl_table_t object.
+*
+*      sl_index
+*              [in] the sl index in the table to be updated.
+*
+*      vl
+*              [in] the vl value to update for that sl.
+*
+* RETURN VALUES
+*      None
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_slvl_table_t
+*********/
+
+/****f* IBA Base: Types/ib_slvl_table_get
+* NAME
+*      ib_slvl_table_get
+*
+* DESCRIPTION
+*      Get slvl table entry.
+*
+* SYNOPSIS
+*/
+OSM_INLINE uint8_t     AL_API
+ib_slvl_table_get(
+  IN           const ib_slvl_table_t*        p_slvl_tbl,
+  IN           uint8_t                 sl_index )
+{
+  uint8_t idx = sl_index/2;
+  CL_ASSERT(sl_index <= 15);
+
+  if (sl_index%2)
+  {
+    /* this is an odd sl. Need to return the ls bits. */
+    return ( p_slvl_tbl->raw_vl_by_sl[idx] & 0x0F );
+  }
+  else
+  {
+    /* this is an even sl. Need to return the ms bits. */
+    return ( (p_slvl_tbl->raw_vl_by_sl[idx] & 0xF0) >> 4 );
+  }
+}
+/*
+* PARAMETERS
+*      p_slvl_tbl
+*              [in] pointer to ib_slvl_table_t object.
+*
+*      sl_index
+*              [in] the sl index in the table whose value should be returned.
+*
+* RETURN VALUES
+*      vl that is updated for that sl.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_slvl_table_t
+*********/
+
+/****s* IBA Base: Types/ib_vl_arb_element_t
+* NAME
+*      ib_vl_arb_element_t
+*
+* DESCRIPTION
+*      IBA defined VL Arbitration Table Element. (14.2.5.9)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_vl_arb_element
+{
+  uint8_t vl;
+  uint8_t weight;
+
+}      PACK_SUFFIX ib_vl_arb_element_t;
+#include <complib/cl_packoff.h>
+/************/
+
+#define IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK 32
+/****s* IBA Base: Types/ib_vl_arb_table_t
+* NAME
+*      ib_vl_arb_table_t
+*
+* DESCRIPTION
+*      IBA defined VL Arbitration Table. (14.2.5.9)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_vl_arb_table
+{
+       ib_vl_arb_element_t vl_entry[IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK];
+
+}      PACK_SUFFIX ib_vl_arb_table_t;
+#include <complib/cl_packoff.h>
+/************/
+
+/****s* IBA Base: Types/ib_vl_arb_table_record_t
+* NAME
+*      ib_vl_arb_table_record_t
+*
+* DESCRIPTION
+*      IBA defined VL Arbitration Table Record for SA Query. (15.2.5.9)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_vl_arb_table_record
+{
+       ib_net16_t                      lid; // for CA: lid of port, for switch lid of port 0
+       uint8_t                         port_num;
+       uint8_t                         block_num;
+       uint32_t                        reserved;
+       ib_vl_arb_table_t       vl_arb_tbl;
+
+}      PACK_SUFFIX ib_vl_arb_table_record_t;
+#include <complib/cl_packoff.h>
+/************/
+
+/*
+ *     Global route header information received with unreliable datagram messages
+ */
+#include <complib/cl_packon.h>
+typedef struct _ib_grh
+{
+       ib_net32_t                              ver_class_flow;
+       ib_net16_t                              resv1;
+       uint8_t                                 resv2;
+       uint8_t                                 hop_limit;
+       ib_gid_t                                src_gid;
+       ib_gid_t                                dest_gid;
+
+}      PACK_SUFFIX ib_grh_t;
+#include <complib/cl_packoff.h>
+
+/****f* IBA Base: Types/ib_grh_get_ver_class_flow
+* NAME
+*      ib_grh_get_ver_class_flow
+*
+* DESCRIPTION
+*      Get encoded version, traffic class and flow label in grh
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_grh_get_ver_class_flow(
+       IN              const   ib_net32_t                                      ver_class_flow,
+               OUT                     uint8_t* const                          p_ver,
+               OUT                     uint8_t* const                          p_tclass,
+               OUT                     uint32_t* const                         p_flow_lbl )
+{
+       ib_net32_t tmp_ver_class_flow;
+
+       if (p_ver)
+               *p_ver = (uint8_t)(ver_class_flow & 0x0f);
+
+       tmp_ver_class_flow = ver_class_flow >> 4;
+
+       if (p_tclass)
+               *p_tclass = (uint8_t)(tmp_ver_class_flow & 0xff);
+
+       tmp_ver_class_flow = tmp_ver_class_flow >> 8;
+
+       if (p_flow_lbl)
+               *p_flow_lbl = tmp_ver_class_flow & 0xfffff;
+}
+/*
+* PARAMETERS
+*      ver_class_flow
+*              [in] the version, traffic class and flow label info.
+*
+* RETURN VALUES
+*      p_ver
+*              [out] pointer to the version info.
+*
+*      p_tclass
+*              [out] pointer to the traffic class info.
+*
+*      p_flow_lbl
+*              [out] pointer to the flow label info
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_grh_t
+*********/
+
+/****f* IBA Base: Types/ib_grh_set_ver_class_flow
+* NAME
+*      ib_grh_set_ver_class_flow
+*
+* DESCRIPTION
+*      Set encoded version, traffic class and flow label in grh
+*
+* SYNOPSIS
+*/
+AL_INLINE ib_net32_t     AL_API
+ib_grh_set_ver_class_flow(
+       IN              const   uint8_t                                         ver,
+       IN              const   uint8_t                                         tclass,
+       IN              const   uint32_t                                        flow_lbl )
+{
+       ib_net32_t              ver_class_flow;
+
+       ver_class_flow = flow_lbl;
+       ver_class_flow = ver_class_flow << 8;
+       ver_class_flow = ver_class_flow | tclass;
+       ver_class_flow = ver_class_flow << 4;
+       ver_class_flow = ver_class_flow | ver;
+       return (ver_class_flow);
+}
+/*
+* PARAMETERS
+*      ver
+*              [in] the version info.
+*
+*      tclass
+*              [in] the traffic class info.
+*
+*      flow_lbl
+*              [in] the flow label info
+*
+* RETURN VALUES
+*      ver_class_flow
+*              [out] the version, traffic class and flow label info.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_grh_t
+*********/
+
+/****s* IBA Base: Types/ib_member_rec_t
+* NAME
+*      ib_member_rec_t
+*
+* DESCRIPTION
+*      Multicast member record, used to create, join, and leave multicast
+*      groups.
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_member_rec
+{
+       ib_gid_t                                mgid;
+       ib_gid_t                                port_gid;
+       ib_net32_t                              qkey;
+       ib_net16_t                              mlid;
+       uint8_t                                 mtu;
+       uint8_t                                 tclass;
+       ib_net16_t                              pkey;
+       uint8_t                                 rate;
+       uint8_t                                 pkt_life;
+       ib_net32_t                              sl_flow_hop;
+       uint8_t                                 scope_state;
+/*     uint8_t                                 proxy_join:1; */
+/* TODO : Under DDK got C4214 which note that using bitfield can cause problems 
+    in porting to other compilers  */
+    uint8_t                 proxy_join;
+       uint8_t                                 reserved[2];
+       uint8_t                                 pad[4];
+
+}      PACK_SUFFIX ib_member_rec_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      mgid
+*              Multicast GID address for this multicast group.
+*
+*      port_gid
+*              Valid GID of the endpoint joining this multicast group.
+*
+*      requestor_gid
+*              GID of the endpoint making this request on hehave of port_gid.
+*
+*      qkey
+*              Q_Key to be sued by this multicast group.
+*
+*      mlid
+*              Multicast LID for this multicast group.
+*
+*      mtu
+*              MTU and MTU selector fields to use on this path
+*
+*      tclass
+*              Another global routing parameter.
+*
+*      pkey
+*              Partition key (P_Key) to use for this member.
+*
+*      rate
+*              Rate and rate selector fields to use on this path.
+*
+*      pkt_life
+*              Packet lifetime
+*
+*      sl_flow_hop
+*              Global routing parameters: service level, hop count, and flow label.
+*
+*      scope_state
+*              MGID scope and JoinState of multicast request.
+*
+*      proxy_join
+*              Enables others in the Partition to proxy add/remove from the group
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_member_get_sl_flow_hop
+* NAME
+*      ib_member_get_sl_flow_hop
+*
+* DESCRIPTION
+*      Get encoded sl flow label and hop limit
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_member_get_sl_flow_hop(
+       IN              const   ib_net32_t                                      sl_flow_hop,
+               OUT                     uint8_t* const                          p_sl,
+               OUT                     uint32_t* const                         p_flow_lbl,
+               OUT                     uint8_t* const                          p_hop )
+{
+       ib_net32_t tmp_sl_flow_hop;
+
+       if (p_sl)
+               *p_sl = (uint8_t)(sl_flow_hop & 0x0f);
+
+       tmp_sl_flow_hop = sl_flow_hop >> 4;
+
+       if (p_flow_lbl)
+               *p_flow_lbl = (uint32_t)(tmp_sl_flow_hop & 0xfffff);
+
+       tmp_sl_flow_hop = tmp_sl_flow_hop >> 20;
+
+       if (p_hop)
+               *p_hop = (uint8_t)(tmp_sl_flow_hop & 0xff);
+}
+/*
+* PARAMETERS
+*      sl_flow_hop
+*              [in] the sl flow label and hop limit of MC Group
+*
+* RETURN VALUES
+*      p_sl
+*              [out] pointer to the service level
+*
+*      p_flow_lbl
+*              [out] pointer to the flow label info
+*
+*      p_hop
+*              [out] pointer to the hop count limit.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_member_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_member_set_sl_flow_hop
+* NAME
+*      ib_member_set_sl_flow_hop
+*
+* DESCRIPTION
+*      Set encoded version, sl flow and hop
+*
+* SYNOPSIS
+*/
+AL_INLINE ib_net32_t     AL_API
+ib_member_set_sl_flow_hop(
+       IN              const   uint8_t                                         sl,
+       IN              const   uint32_t                                        flow_label,
+       IN              const   uint8_t                                         hop_limit )
+{
+       ib_net32_t              sl_flow_hop;
+
+       sl_flow_hop = hop_limit;
+       sl_flow_hop = sl_flow_hop << 20;
+       sl_flow_hop = sl_flow_hop | flow_label;
+       sl_flow_hop = sl_flow_hop << 2;
+       sl_flow_hop = sl_flow_hop | sl;
+       return (sl_flow_hop);
+}
+/*
+* PARAMETERS
+*      sl
+*              [in] the service level.
+*
+*      flow_lbl
+*              [in] the flow label info
+*
+*      hop_limit
+*              [in] the hop limit.
+*
+* RETURN VALUES
+*      sl_flow_hop
+*              [out] the sl flow label and hop limit
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_member_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_member_get_scope_state
+* NAME
+*      ib_member_get_scope_state
+*
+* DESCRIPTION
+*      Get encoded MGID scope and JoinState
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_member_get_scope_state(
+       IN              const   uint8_t                                         scope_state,
+               OUT                     uint8_t* const                          p_scope,
+               OUT                     uint8_t* const                          p_state )
+{
+       uint8_t         tmp_scope_state;
+
+       if (p_state)
+               *p_state = (uint8_t)(scope_state & 0x0f);
+
+       tmp_scope_state = scope_state >> 4;
+
+       if (p_scope)
+               *p_scope = (uint8_t)(tmp_scope_state & 0x0f);
+
+}
+/*
+* PARAMETERS
+*      scope_state
+*              [in] the scope and state
+*
+* RETURN VALUES
+*      p_scope
+*              [out] pointer to the MGID scope
+*
+*      p_state
+*              [out] pointer to the join state
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_member_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_member_set_scope_state
+* NAME
+*      ib_member_set_scope_state
+*
+* DESCRIPTION
+*      Set encoded version, MGID scope and JoinState
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_member_set_scope_state(
+       IN              const   uint8_t                                         scope,
+       IN              const   uint8_t                                         state )
+{
+       uint8_t         scope_state;
+
+       scope_state = scope;
+       scope_state = scope_state << 4;
+       scope_state = scope_state | state;
+       return (scope_state);
+}
+/*
+* PARAMETERS
+*      scope
+*              [in] the MGID scope
+*
+*      state
+*              [in] the JoinState
+*
+* RETURN VALUES
+*      scope_state
+*              [out] the encoded one
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_member_rec_t
+*********/
+
+/****f* IBA Base: Types/ib_member_set_join_state
+* NAME
+*      ib_member_set_join_state
+*
+* DESCRIPTION
+*      Set JoinState
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_member_set_join_state(
+       IN      OUT                     ib_member_rec_t                         *p_mc_rec,
+       IN              const   uint8_t                                         state )
+{
+   /* keep the scope as it is */
+       p_mc_rec->scope_state = (p_mc_rec->scope_state & 0xF0) | (0x0f & state);
+}
+/*
+* PARAMETERS
+*      p_mc_rec
+*              [in] pointer to the member record
+*
+*      state
+*              [in] the JoinState
+*
+* RETURN VALUES
+*      NONE
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_member_rec_t
+*********/
+
+/*
+ * Join State Codes:
+ */
+#define IB_MC_REC_STATE_FULL_MEMBER 0x01
+#define IB_MC_REC_STATE_NON_MEMBER 0x02
+#define IB_MC_REC_STATE_SEND_ONLY_MEMBER 0x04
+
+/*
+ *     Generic MAD notice types
+ */
+#define IB_NOTICE_TYPE_FATAL                           0x00
+#define IB_NOTICE_TYPE_URGENT                          0x01
+#define IB_NOTICE_TYPE_SECURITY                                0x02
+#define IB_NOTICE_TYPE_SUBN_MGMT                       0x03
+#define IB_NOTICE_TYPE_INFO                                    0x04
+#define IB_NOTICE_TYPE_EMPTY                           0x7F
+
+
+#include <complib/cl_packon.h>
+typedef struct _ib_mad_notice_attr    // Total Size calc  Accumulated
+{
+  uint8_t                              generic_type;    // 1                1
+  
+  union _notice_g_or_v
+  {
+        struct _notice_generic            // 5                6
+        {
+               uint8_t         prod_type_msb;
+               ib_net16_t      prod_type_lsb;
+               ib_net16_t      trap_num;
+        }      PACK_SUFFIX generic;
+        
+        struct _notice_vend
+        {
+               uint8_t         vend_id_msb;
+               ib_net16_t      vend_id_lsb;
+               ib_net16_t      dev_id;
+        }      PACK_SUFFIX vend;
+  } g_or_v;
+  
+  ib_net16_t                   issuer_lid;    // 2                 8
+  ib_net16_t                   toggle_count;  // 2                 10
+  
+  union _data_details               // 54                64
+       {
+         struct _raw_data
+         {
+                uint8_t        details[54];
+         } PACK_SUFFIX raw_data;
+
+         struct _ntc_64_67
+         {
+                uint8_t    res[6];
+                ib_gid_t   gid;        // the Node or Multicast Group that came in/out
+         } PACK_SUFFIX ntc_64_67;
+
+         struct _ntc_128 {
+                ib_net16_t sw_lid; // the sw lid of which link state changed
+         } PACK_SUFFIX ntc_128;
+         
+         struct _ntc_129_131 {
+                ib_net16_t    pad;
+                ib_net16_t    lid;             // lid and port number of the violation
+                uint8_t     port_num;
+         } PACK_SUFFIX ntc_129_131;
+         
+         struct _ntc_144 {
+                ib_net16_t    pad1;
+                ib_net16_t    lid;             // lid where capability mask changed
+                ib_net16_t    pad2;
+                ib_net32_t    new_cap_mask; // new capability mask
+         } PACK_SUFFIX ntc_144;
+
+         struct _ntc_145 {
+                ib_net16_t    pad1;
+                ib_net16_t    lid;             // lid where sys guid changed
+                ib_net16_t    pad2;
+                ib_net64_t    new_sys_guid; // new system image guid
+         } PACK_SUFFIX ntc_145;
+
+         struct _ntc_256 {                       // total: 54
+                ib_net16_t    pad1;                   // 2
+                ib_net16_t    lid;                    // 2
+                ib_net16_t    pad2;                   // 2
+                uint8_t       method;                 // 1
+                uint8_t       pad3;                   // 1
+                ib_net16_t    attr_id;                // 2
+                ib_net32_t    attr_mod;               // 4
+                ib_net64_t    mkey;                   // 8
+                uint8_t       dr_slid;                // 1
+                uint8_t       dr_trunc_hop;           // 1
+                uint8_t       dr_rtn_path[30];        // 30
+         } PACK_SUFFIX ntc_256;
+
+         struct _ntc_257_258 // violation of p/q_key // 49
+         {
+                ib_net16_t    pad1;                   // 2
+                ib_net16_t    lid1;                   // 2
+                ib_net16_t    lid2;                   // 2
+                ib_net32_t    key;                    // 2
+                uint8_t       sl;                     // 1
+                ib_net32_t    qp1;                    // 4
+                ib_net32_t    qp2;                    // 4
+                ib_gid_t      gid1;                   // 16
+                ib_gid_t      gid2;                   // 16
+         } PACK_SUFFIX ntc_257_258;
+
+         struct _ntc_259 // p/q_key violation with sw info 53
+         {
+                ib_net16_t    data_valid;   // 2
+                ib_net16_t    lid1;         // 2
+                ib_net16_t    lid2;         // 2
+                ib_net32_t    key;          // 4
+                uint8_t       sl;           // 1
+                ib_net32_t    qp1;          // 4
+                uint8_t       qp2_msb;      // 1
+                ib_net16_t    qp2_lsb;      // 2
+                ib_gid_t      gid1;         // 16
+                ib_gid_t      gid2;         // 16
+                ib_net16_t    sw_lid;       // 2
+                uint8_t       port_no;      // 1
+         } PACK_SUFFIX ntc_259;
+
+       } data_details;
+
+  ib_gid_t                     issuer_gid;    // 16          80
+
+}      PACK_SUFFIX ib_mad_notice_attr_t;
+#include <complib/cl_packoff.h>
+
+/****f* IBA Base: Types/ib_notice_is_generic
+* NAME
+*      ib_notice_is_generic
+*
+* DESCRIPTION
+*      Check if the notice is generic
+*
+* SYNOPSIS
+*/
+OSM_INLINE boolean_t     AL_API
+ib_notice_is_generic(
+  IN              const        ib_mad_notice_attr_t *p_ntc)
+{
+  return (p_ntc->generic_type & 0x80);
+}
+/*
+* PARAMETERS
+*      p_ntc
+*              [in] Pointer to  the notice MAD attribute
+*
+* RETURN VALUES
+*      TRUE if mad is generic
+*
+* SEE ALSO
+*      ib_mad_notice_attr_t
+*********/
+
+/****f* IBA Base: Types/ib_notice_get_type
+* NAME
+*      ib_notice_get_type
+*
+* DESCRIPTION
+*      Get the notice type
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_notice_get_type(
+  IN              const        ib_mad_notice_attr_t *p_ntc)
+{
+  return p_ntc->generic_type & 0x7f;
+}
+/*
+* PARAMETERS
+*      p_ntc
+*              [in] Pointer to  the notice MAD attribute
+*
+* RETURN VALUES
+*      TRUE if mad is generic
+*
+* SEE ALSO
+*      ib_mad_notice_attr_t
+*********/
+
+/****f* IBA Base: Types/ib_notice_get_prod_type
+* NAME
+*      ib_notice_get_prod_type
+*
+* DESCRIPTION
+*      Get the notice Producer Type of Generic Notice
+*
+* SYNOPSIS
+*/
+AL_INLINE ib_net32_t     AL_API
+ib_notice_get_prod_type(
+  IN              const        ib_mad_notice_attr_t *p_ntc)
+{
+  uint32_t pt;
+  pt = cl_ntoh16(p_ntc->g_or_v.generic.prod_type_lsb) |
+    (p_ntc->g_or_v.generic.prod_type_msb << 16);
+  return cl_hton32(pt);
+}
+/*
+* PARAMETERS
+*      p_ntc
+*              [in] Pointer to the notice MAD attribute
+*
+* RETURN VALUES
+*      The producer type
+*
+* SEE ALSO
+*      ib_mad_notice_attr_t
+*********/
+
+/****f* IBA Base: Types/ib_notice_set_prod_type
+* NAME
+*      ib_notice_set_prod_type
+*
+* DESCRIPTION
+*      Set the notice Producer Type of Generic Notice
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_notice_set_prod_type(
+  IN ib_mad_notice_attr_t *p_ntc,
+  IN ib_net32_t prod_type_val)
+{
+  uint32_t ptv = cl_ntoh32(prod_type_val);
+  p_ntc->g_or_v.generic.prod_type_lsb = cl_hton16( (uint16_t)(ptv & 0x0000ffff));
+  p_ntc->g_or_v.generic.prod_type_msb = (uint8_t)( (ptv & 0x00ff0000) >> 16);
+}
+/*
+* PARAMETERS
+*      p_ntc
+*              [in] Pointer to the notice MAD attribute
+*
+*  prod_type
+*     [in] The producer Type code
+*
+* RETURN VALUES
+*      None
+*
+* SEE ALSO
+*      ib_mad_notice_attr_t
+*********/
+
+/****f* IBA Base: Types/ib_notice_get_vend_id
+* NAME
+*      ib_notice_get_vend_id
+*
+* DESCRIPTION
+*      Get the Vendor Id of Vendor type Notice
+*
+* SYNOPSIS
+*/
+AL_INLINE ib_net32_t     AL_API
+ib_notice_get_vend_id(
+  IN              const        ib_mad_notice_attr_t *p_ntc)
+{
+  uint32_t vi;
+  vi = cl_ntoh16(p_ntc->g_or_v.vend.vend_id_lsb) |
+    (p_ntc->g_or_v.vend.vend_id_msb << 16);
+  return cl_hton32(vi);
+}
+/*
+* PARAMETERS
+*      p_ntc
+*              [in] Pointer to  the notice MAD attribute
+*
+* RETURN VALUES
+*      The Vendor Id of Vendor type Notice
+*
+* SEE ALSO
+*      ib_mad_notice_attr_t
+*********/
+
+/****f* IBA Base: Types/ib_notice_set_vend_id
+* NAME
+*      ib_notice_set_vend_id
+*
+* DESCRIPTION
+*      Set the notice Producer Type of Generic Notice
+*
+* SYNOPSIS
+*/
+AL_INLINE void     AL_API
+ib_notice_set_vend_id(
+  IN ib_mad_notice_attr_t *p_ntc,
+  IN ib_net32_t vend_id)
+{
+  uint32_t vi = cl_ntoh32(vend_id);
+  p_ntc->g_or_v.vend.vend_id_lsb = cl_hton16((uint16_t)(vi & 0x0000ffff));
+  p_ntc->g_or_v.vend.vend_id_msb = (uint8_t)((vi & 0x00ff0000) >> 16);
+}
+/*
+* PARAMETERS
+*      p_ntc
+*              [in] Pointer to the notice MAD attribute
+*
+*  vend_id
+*     [in] The producer Type code
+*
+* RETURN VALUES
+*      None
+*
+* SEE ALSO
+*      ib_mad_notice_attr_t
+*********/
+
+#include <complib/cl_packon.h>
+typedef struct _ib_inform_info
+{
+  ib_gid_t                                gid;
+  ib_net16_t                           lid_range_begin;
+  ib_net16_t                           lid_range_end;
+  ib_net16_t                           reserved1;
+  uint8_t                                      is_generic;
+  uint8_t                                      subscribe;
+  ib_net16_t                           trap_type;
+  union _inform_g_or_v
+  {
+        struct _inform_generic
+        {
+               ib_net16_t              trap_num;
+               ib_net32_t              qpn_resp_time_val;
+      uint8_t        reserved2;
+               uint8_t                 node_type_msb;
+               ib_net16_t              node_type_lsb;
+        } PACK_SUFFIX generic;
+        
+        struct _inform_vend
+        {
+               ib_net16_t              dev_id;
+               ib_net32_t              qpn_resp_time_val;
+      uint8_t        reserved2;
+               uint8_t                 vendor_id_msb;
+               ib_net16_t              vendor_id_lsb;
+        } PACK_SUFFIX vend;
+        
+  }    PACK_SUFFIX g_or_v;
+  
+}      PACK_SUFFIX ib_inform_info_t;
+#include <complib/cl_packoff.h>
+
+/****f* IBA Base: Types/ib_inform_info_get_qpn_resp_time
+* NAME
+*      ib_inform_info_get_qpn_resp_time
+*
+* DESCRIPTION
+*      Get QPN of the inform info
+*
+* SYNOPSIS
+*/
+OSM_INLINE void     AL_API
+ib_inform_info_get_qpn_resp_time(
+  IN              const        ib_net32_t                      qpn_resp_time_val,
+  OUT                  ib_net32_t* const                       p_qpn,
+  OUT                  uint8_t* const                          p_resp_time_val )
+{
+  uint32_t tmp = cl_ntoh32(qpn_resp_time_val);
+
+  if (p_qpn)
+    *p_qpn = cl_hton32((tmp & 0xffffff00) >> 8);
+       
+       if (p_resp_time_val)
+               *p_resp_time_val = (uint8_t)(tmp & 0x0000001f);
+}
+/*
+* PARAMETERS
+*      qpn_resp_time_val
+*              [in] the  qpn and resp time val from the mad
+*
+* RETURN VALUES
+*      p_qpn
+*              [out] pointer to the qpn
+*
+*      p_state
+*              [out] pointer to the resp time val
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_inform_info_t
+*********/
+
+/****f* IBA Base: Types/ib_inform_info_set_qpn
+* NAME
+*      ib_inform_info_set_qpn
+*
+* DESCRIPTION
+*      Set the QPN of the inform info
+*
+* SYNOPSIS
+*/
+OSM_INLINE void     AL_API
+ib_inform_info_set_qpn(
+  IN   ib_inform_info_t        *p_ii,
+  IN   ib_net32_t const        qpn)
+{
+  uint32_t tmp = cl_ntoh32(p_ii->g_or_v.generic.qpn_resp_time_val);
+  p_ii->g_or_v.generic.qpn_resp_time_val = 
+    cl_hton32(
+      (tmp & 0x000000ff) |
+      ((cl_ntoh32(qpn) << 8) & 0xffffff00)
+      );
+}
+/*
+* PARAMETERS
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_inform_info_t
+*********/
+
+/****f* IBA Base: Types/ib_inform_info_get_node_type
+* NAME
+*      ib_inform_info_get_node_type
+*
+* DESCRIPTION
+*      Get Node Type of the Inform Info
+*
+* SYNOPSIS
+*/
+OSM_INLINE ib_net32_t     AL_API
+ib_inform_info_get_node_type(
+  IN              const        ib_inform_info_t  *p_inf)
+{
+  uint32_t nt;
+  nt = cl_ntoh16(p_inf->g_or_v.generic.node_type_lsb) |
+    (p_inf->g_or_v.generic.node_type_msb << 16);
+  return cl_hton32(nt);
+}
+/*
+* PARAMETERS
+*      p_inf
+*              [in] pointer to an inform info
+*
+* RETURN VALUES
+*     The node type
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_inform_info_t
+*********/
+
+/****f* IBA Base: Types/ib_inform_info_get_vend_id
+* NAME
+*      ib_inform_info_get_vend_id
+*
+* DESCRIPTION
+*      Get Node Type of the Inform Info
+*
+* SYNOPSIS
+*/
+OSM_INLINE ib_net32_t     AL_API
+ib_inform_info_get_vend_id(
+  IN   const   ib_inform_info_t  *p_inf)
+{
+  uint32_t vi;
+  vi = cl_ntoh16(p_inf->g_or_v.vend.vendor_id_lsb) |
+    (p_inf->g_or_v.vend.vendor_id_msb << 16);
+  return cl_hton32(vi);
+}
+/*
+* PARAMETERS
+*      p_inf
+*              [in] pointer to an inform info
+*
+* RETURN VALUES
+*     The node type
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_inform_info_t
+*********/
+
+/****s* IBA Base: Types/ib_inform_info_record_t
+* NAME
+*      ib_inform_info_record_t
+*
+* DESCRIPTION
+*      IBA defined InformInfo Record. (15.2.5.12)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_inform_info_record
+{
+       ib_gid_t                                subscriber_gid;
+       ib_net16_t                      subscriber_enum;
+       uint8_t                                 reserved[6];
+       ib_inform_info_t        inform_info;
+
+}      PACK_SUFFIX ib_inform_info_record_t;
+#include <complib/cl_packoff.h>
+
+/****d* IBA Base: Types/DM_SVC_NAME
+* NAME
+*      DM_SVC_NAME
+*
+* DESCRIPTION
+*      IBA defined Device Management service name (16.3)
+*
+* SYNOPSIS
+*/
+#define        DM_SVC_NAME                             "DeviceManager.IBTA"
+/*
+* SEE ALSO
+*********/
+
+/****s* IBA Base: Types/ib_dm_mad_t
+* NAME
+*      ib_dm_mad_t
+*
+* DESCRIPTION
+*      IBA defined Device Management MAD (16.3.1)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_dm_mad
+{
+       ib_mad_t                header;
+       uint8_t                 resv[40];
+
+#define        IB_DM_DATA_SIZE                 192
+       uint8_t                 data[IB_DM_DATA_SIZE];
+
+}      PACK_SUFFIX ib_dm_mad_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      header
+*              Common MAD header.
+*
+*      resv
+*              Reserved.
+*
+*      data
+*              Device Management payload.  The structure and content of this field
+*              depend upon the method, attr_id, and attr_mod fields in the header.
+*
+* SEE ALSO
+* ib_mad_t
+*********/
+
+/****s* IBA Base: Types/ib_iou_info_t
+* NAME
+*      ib_iou_info_t
+*
+* DESCRIPTION
+*      IBA defined IO Unit information structure (16.3.3.3)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_iou_info
+{
+       ib_net16_t              change_id;
+       uint8_t                 max_controllers;
+       uint8_t                 diag_rom;
+
+#define        IB_DM_CTRL_LIST_SIZE    128
+
+       uint8_t                 controller_list[IB_DM_CTRL_LIST_SIZE];
+#define        IOC_NOT_INSTALLED               0x0
+#define        IOC_INSTALLED                   0x1
+//             Reserved values                         0x02-0xE
+#define        SLOT_DOES_NOT_EXIST             0xF
+
+}      PACK_SUFFIX ib_iou_info_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      change_id
+*              Value incremented, with rollover, by any change to the controller_list.
+*
+*      max_controllers
+*              Number of slots in controller_list.
+*
+*      diag_rom
+*              A byte containing two fields: DiagDeviceID and OptionROM.
+*              These fields may be read using the ib_iou_info_diag_dev_id
+*              and ib_iou_info_option_rom functions.
+*
+*      controller_list
+*              A series of 4-bit nibbles, with each nibble representing a slot
+*              in the IO Unit.  Individual nibbles may be read using the
+*              ioc_at_slot function.
+*
+* SEE ALSO
+* ib_dm_mad_t, ib_iou_info_diag_dev_id, ib_iou_info_option_rom, ioc_at_slot
+*********/
+
+/****f* IBA Base: Types/ib_iou_info_diag_dev_id
+* NAME
+*      ib_iou_info_diag_dev_id
+*
+* DESCRIPTION
+*      Returns the DiagDeviceID.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_iou_info_diag_dev_id(
+       IN              const   ib_iou_info_t* const            p_iou_info )
+{
+       return( (uint8_t)(p_iou_info->diag_rom >> 6 & 1) );
+}
+/*
+* PARAMETERS
+*      p_iou_info
+*              [in] Pointer to the IO Unit information structure.
+*
+* RETURN VALUES
+*      DiagDeviceID field of the IO Unit information.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_iou_info_t
+*********/
+
+/****f* IBA Base: Types/ib_iou_info_option_rom
+* NAME
+*      ib_iou_info_option_rom
+*
+* DESCRIPTION
+*      Returns the OptionROM.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ib_iou_info_option_rom(
+       IN              const   ib_iou_info_t*  const   p_iou_info )
+{
+       return( (uint8_t)(p_iou_info->diag_rom >> 7) );
+}
+/*
+* PARAMETERS
+*      p_iou_info
+*              [in] Pointer to the IO Unit information structure.
+*
+* RETURN VALUES
+*      OptionROM field of the IO Unit information.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_iou_info_t
+*********/
+
+/****f* IBA Base: Types/ioc_at_slot
+* NAME
+*      ioc_at_slot
+*
+* DESCRIPTION
+*      Returns the IOC value at the specified slot.
+*
+* SYNOPSIS
+*/
+AL_INLINE uint8_t     AL_API
+ioc_at_slot(
+       IN              const   ib_iou_info_t*  const   p_iou_info,
+       IN                              uint8_t                                 slot )
+{
+       if( slot >= IB_DM_CTRL_LIST_SIZE ) return SLOT_DOES_NOT_EXIST;
+       else return (int8_t)
+               ( (slot%2) ?
+                       ((p_iou_info->controller_list[slot/2] & 0xf0) >> 4 ):
+                       (p_iou_info->controller_list[slot/2] & 0x0f) );
+}
+/*
+* PARAMETERS
+*      p_iou_info
+*              [in] Pointer to the IO Unit information structure.
+*
+*      slot
+*              [in] Pointer to the IO Unit information structure.
+*
+* RETURN VALUES
+*      OptionROM field of the IO Unit information.
+*
+* NOTES
+*
+* SEE ALSO
+*      ib_iou_info_t
+*********/
+
+/****s* IBA Base: Types/ib_ioc_profile_t
+* NAME
+*      ib_ioc_profile_t
+*
+* DESCRIPTION
+*      IBA defined IO Controller profile structure (16.3.3.4)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_ioc_profile
+{
+       ib_net64_t                              ioc_guid;
+
+       ib_net32_t                              vend_id;
+
+       ib_net32_t                              dev_id;
+       ib_net16_t                              dev_ver;
+       ib_net16_t                              resv2;
+
+       ib_net32_t                              subsys_vend_id;
+       ib_net32_t                              subsys_id;
+
+       ib_net16_t                              io_class;
+       ib_net16_t                              io_subclass;
+       ib_net16_t                              protocol;
+       ib_net16_t                              protocol_ver;
+
+       ib_net32_t                              resv3;
+       ib_net16_t                              send_msg_depth;
+       uint8_t                                 resv4;
+       uint8_t                                 rdma_read_depth;
+       ib_net32_t                              send_msg_size;
+       ib_net32_t                              rdma_size;
+
+       uint8_t                                 ctrl_ops_cap;
+#define        CTRL_OPS_CAP_ST         0x01
+#define        CTRL_OPS_CAP_SF         0x02
+#define        CTRL_OPS_CAP_RT         0x04
+#define        CTRL_OPS_CAP_RF         0x08
+#define        CTRL_OPS_CAP_WT         0x10
+#define        CTRL_OPS_CAP_WF         0x20
+#define        CTRL_OPS_CAP_AT         0x40
+#define        CTRL_OPS_CAP_AF         0x80
+
+       uint8_t                                 resv5;
+
+       uint8_t                                 num_svc_entries;
+#define        MAX_NUM_SVC_ENTRIES     0xff
+
+       uint8_t                                 resv6[9];
+
+#define        CTRL_ID_STRING_LEN      64
+       char                                    id_string[CTRL_ID_STRING_LEN];
+
+}      PACK_SUFFIX ib_ioc_profile_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      ioc_guid
+*              An EUI-64 GUID used to uniquely identify the IO controller.
+*
+*      vend_id
+*              IO controller vendor ID, IEEE format.
+*
+*      dev_id
+*              A number assigned by the vendor to identify the type of controller.
+*
+*      dev_ver
+*              A number assigned by the vendor to identify the divice version.
+*
+*      subsys_vend_id
+*              ID of the vendor of the enclosure, if any, in which the IO controller
+*              resides in IEEE format; otherwise zero.
+*
+*      subsys_id
+*              A number identifying the subsystem where the controller resides.
+*
+*      io_class
+*              0x0000 - 0xfffe = reserved for IO classes encompased by InfiniBand
+*              Architecture.  0xffff = Vendor specific.
+*
+*      io_subclass
+*              0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand
+*              Architecture.  0xffff = Vendor specific.  This shall be set to 0xfff
+*              if the io_class component is 0xffff.
+*
+*      protocol
+*              0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand
+*              Architecture.  0xffff = Vendor specific.  This shall be set to 0xfff
+*              if the io_class component is 0xffff.
+*
+*      protocol_ver
+*              Protocol specific.
+*
+*      send_msg_depth
+*              Maximum depth of the send message queue.
+*
+*      rdma_read_depth
+*              Maximum depth of the per-channel RDMA read queue.
+*
+*      send_msg_size
+*              Maximum size of send messages.
+*
+*      ctrl_ops_cap
+*              Supported operation types of this IO controller.  A bit set to one
+*              for affirmation of supported capability.
+*
+*      num_svc_entries
+*              Number of entries in the service entries table.
+*
+*      id_string
+*              UTF-8 encoded string for identifying the controller to an operator.
+*
+* SEE ALSO
+* ib_dm_mad_t
+*********/
+
+
+AL_INLINE uint32_t     AL_API
+ib_ioc_profile_get_vend_id(
+       IN              const   ib_ioc_profile_t* const         p_ioc_profile )
+{
+       return( cl_ntoh32(p_ioc_profile->vend_id) >> 8 );
+}
+
+
+AL_INLINE void     AL_API
+ib_ioc_profile_set_vend_id(
+       IN                              ib_ioc_profile_t* const         p_ioc_profile,
+       IN              const   uint32_t                                        vend_id )
+{
+       p_ioc_profile->vend_id = (cl_hton32(vend_id) << 8);
+}
+
+
+/****s* IBA Base: Types/ib_svc_entry_t
+* NAME
+*      ib_svc_entry_t
+*
+* DESCRIPTION
+*      IBA defined IO Controller service entry structure (16.3.3.5)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_svc_entry
+{
+#define        MAX_SVC_ENTRY_NAME_LEN          40
+       char                                    name[MAX_SVC_ENTRY_NAME_LEN];
+
+       ib_net64_t                              id;
+
+}      PACK_SUFFIX ib_svc_entry_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      name
+*              UTF-8 encoded, null-terminated name of the service.
+*
+*      id
+*              An identifier of the associated Service.
+*
+* SEE ALSO
+* ib_svc_entries_t
+*********/
+
+
+/****s* IBA Base: Types/ib_svc_entries_t
+* NAME
+*      ib_svc_entries_t
+*
+* DESCRIPTION
+*      IBA defined IO Controller service entry array (16.3.3.5)
+*
+* SYNOPSIS
+*/
+#include <complib/cl_packon.h>
+typedef struct _ib_svc_entries
+{
+#define        SVC_ENTRY_COUNT                         4
+       ib_svc_entry_t                  service_entry[SVC_ENTRY_COUNT];
+
+}      PACK_SUFFIX ib_svc_entries_t;
+#include <complib/cl_packoff.h>
+/*
+* FIELDS
+*      service_entry
+*              An array of IO controller service entries.
+*
+* SEE ALSO
+* ib_dm_mad_t, ib_svc_entry_t
+*********/
+
+
+AL_INLINE void     AL_API
+ib_dm_get_slot_lo_hi(
+       IN              const   ib_net32_t                      slot_lo_hi,
+               OUT                     uint8_t         *const  p_slot,
+               OUT                     uint8_t         *const  p_lo,
+               OUT                     uint8_t         *const  p_hi )
+{
+       ib_net32_t              tmp_slot_lo_hi = CL_NTOH32( slot_lo_hi );
+
+       if( p_slot )
+               *p_slot = (uint8_t)( ( tmp_slot_lo_hi >> 16 ) & 0x0f );
+
+       if( p_hi )
+               *p_hi   = (uint8_t)( ( tmp_slot_lo_hi >> 8 ) & 0xff );
+
+       if( p_lo )
+               *p_lo   = (uint8_t)( ( tmp_slot_lo_hi >> 0 ) & 0xff );
+}
+
+
+/*
+ *     IBA defined information describing an I/O controller
+ */
+#include <complib/cl_packon.h>
+typedef struct _ib_ioc_info
+{
+       ib_net64_t                              module_guid;
+       ib_net64_t                              iou_guid;
+       ib_ioc_profile_t                ioc_profile;
+       ib_net64_t                              access_key;
+       uint16_t                                initiators_conf;
+       uint8_t                                 resv[38];
+
+}      PACK_SUFFIX ib_ioc_info_t;
+#include <complib/cl_packoff.h>
+
+/*
+ * Defines known Communication management class versions
+ */
+#define IB_MCLASS_CM_VER_2                                     2
+#define IB_MCLASS_CM_VER_1                                     1
+
+/*
+ *     Defines the size of user available data in communication management MADs
+ */
+#define IB_REQ_PDATA_SIZE_VER2                         92
+#define IB_MRA_PDATA_SIZE_VER2                         222
+#define IB_REJ_PDATA_SIZE_VER2                         148
+#define IB_REP_PDATA_SIZE_VER2                         196
+#define IB_RTU_PDATA_SIZE_VER2                         224
+#define IB_LAP_PDATA_SIZE_VER2                         168
+#define IB_APR_PDATA_SIZE_VER2                         148
+#define IB_DREQ_PDATA_SIZE_VER2                                220
+#define IB_DREP_PDATA_SIZE_VER2                                224
+#define IB_SIDR_REQ_PDATA_SIZE_VER2                    216
+#define IB_SIDR_REP_PDATA_SIZE_VER2                    136
+
+#define IB_REQ_PDATA_SIZE_VER1                         92
+#define IB_MRA_PDATA_SIZE_VER1                         222
+#define IB_REJ_PDATA_SIZE_VER1                         148
+#define IB_REP_PDATA_SIZE_VER1                         204
+#define IB_RTU_PDATA_SIZE_VER1                         224
+#define IB_LAP_PDATA_SIZE_VER1                         168
+#define IB_APR_PDATA_SIZE_VER1                         151
+#define IB_DREQ_PDATA_SIZE_VER1                                220
+#define IB_DREP_PDATA_SIZE_VER1                                224
+#define IB_SIDR_REQ_PDATA_SIZE_VER1                    216
+#define IB_SIDR_REP_PDATA_SIZE_VER1                    140
+
+#define IB_ARI_SIZE                                                    72              // redefine
+#define IB_APR_INFO_SIZE                                       72
+
+
+/****d* Access Layer/ib_rej_status_t
+* NAME
+*      ib_rej_status_t
+*
+* DESCRIPTION
+*      Rejection reasons.
+*
+* SYNOPSIS
+*/
+typedef        ib_net16_t                                                      ib_rej_status_t;
+/*
+* SEE ALSO
+*      ib_cm_rej, ib_cm_rej_rec_t
+*
+* SOURCE
+ */
+#define IB_REJ_INSUF_QP                                                CL_HTON16(1)
+#define IB_REJ_INSUF_EEC                                       CL_HTON16(2)
+#define IB_REJ_INSUF_RESOURCES                         CL_HTON16(3)
+#define IB_REJ_TIMEOUT                                         CL_HTON16(4)
+#define IB_REJ_UNSUPPORTED                                     CL_HTON16(5)
+#define IB_REJ_INVALID_COMM_ID                         CL_HTON16(6)
+#define IB_REJ_INVALID_COMM_INSTANCE           CL_HTON16(7)
+#define IB_REJ_INVALID_SID                                     CL_HTON16(8)
+#define IB_REJ_INVALID_XPORT                           CL_HTON16(9)
+#define IB_REJ_STALE_CONN                                      CL_HTON16(10)
+#define IB_REJ_RDC_NOT_EXIST                           CL_HTON16(11)
+#define IB_REJ_INVALID_GID                                     CL_HTON16(12)
+#define IB_REJ_INVALID_LID                                     CL_HTON16(13)
+#define IB_REJ_INVALID_SL                                      CL_HTON16(14)
+#define IB_REJ_INVALID_TRAFFIC_CLASS           CL_HTON16(15)
+#define IB_REJ_INVALID_HOP_LIMIT                       CL_HTON16(16)
+#define IB_REJ_INVALID_PKT_RATE                                CL_HTON16(17)
+#define IB_REJ_INVALID_ALT_GID                         CL_HTON16(18)
+#define IB_REJ_INVALID_ALT_LID                         CL_HTON16(19)
+#define IB_REJ_INVALID_ALT_SL                          CL_HTON16(20)
+#define IB_REJ_INVALID_ALT_TRAFFIC_CLASS       CL_HTON16(21)
+#define IB_REJ_INVALID_ALT_HOP_LIMIT           CL_HTON16(22)
+#define IB_REJ_INVALID_ALT_PKT_RATE                    CL_HTON16(23)
+#define IB_REJ_PORT_REDIRECT                           CL_HTON16(24)
+#define IB_REJ_INVALID_MTU                                     CL_HTON16(26)
+#define IB_REJ_INSUFFICIENT_RESP_RES           CL_HTON16(27)
+#define IB_REJ_USER_DEFINED                                    CL_HTON16(28)
+#define IB_REJ_INVALID_RNR_RETRY                       CL_HTON16(29)
+#define IB_REJ_DUPLICATE_LOCAL_COMM_ID         CL_HTON16(30)
+#define IB_REJ_INVALID_CLASS_VER                       CL_HTON16(31)
+#define IB_REJ_INVALID_FLOW_LBL                                CL_HTON16(32)
+#define IB_REJ_INVALID_ALT_FLOW_LBL                    CL_HTON16(33)
+
+#define IB_REJ_SERVICE_HANDOFF                         CL_HTON16(65535)
+/******/
+
+
+/****d* Access Layer/ib_apr_status_t
+* NAME
+*      ib_apr_status_t
+*
+* DESCRIPTION
+*      Automatic path migration status information.
+*
+* SYNOPSIS
+*/
+typedef uint8_t                                                                ib_apr_status_t;
+/*
+* SEE ALSO
+*      ib_cm_apr, ib_cm_apr_rec_t
+*
+* SOURCE
+ */
+#define IB_AP_SUCCESS                                          0
+#define IB_AP_INVALID_COMM_ID                          1
+#define IB_AP_UNSUPPORTED                                      2
+#define IB_AP_REJECT                                           3
+#define IB_AP_REDIRECT                                         4
+#define IB_AP_IS_CURRENT                                       5
+#define IB_AP_INVALID_QPN_EECN                         6
+#define IB_AP_INVALID_LID                                      7
+#define IB_AP_INVALID_GID                                      8
+#define IB_AP_INVALID_FLOW_LBL                         9
+#define IB_AP_INVALID_TCLASS                           10
+#define IB_AP_INVALID_HOP_LIMIT                                11
+#define IB_AP_INVALID_PKT_RATE                         12
+#define IB_AP_INVALID_SL                                       13
+/******/
+
+/****d* Access Layer/ib_cm_cap_mask_t
+* NAME
+*      ib_cm_cap_mask_t
+*
+* DESCRIPTION
+*      Capability mask values in ClassPortInfo.
+*
+* SYNOPSIS
+*/
+#define IB_CM_RELIABLE_CONN_CAPABLE                    CL_HTON16(9)
+#define IB_CM_RELIABLE_DGRM_CAPABLE                    CL_HTON16(10)
+#define IB_CM_RDGRM_CAPABLE                                    CL_HTON16(11)
+#define IB_CM_UNRELIABLE_CONN_CAPABLE          CL_HTON16(12)
+#define IB_CM_SIDR_CAPABLE                                     CL_HTON16(13)
+/*
+* SEE ALSO
+*      ib_cm_rep, ib_class_port_info_t
+*
+* SOURCE
+*
+*******/
+
+
+/*
+ *     Service ID resolution status
+ */
+typedef uint16_t                                                       ib_sidr_status_t;
+#define IB_SIDR_SUCCESS                                                0
+#define IB_SIDR_UNSUPPORTED                                    1
+#define IB_SIDR_REJECT                                         2
+#define IB_SIDR_NO_QP                                          3
+#define IB_SIDR_REDIRECT                                       4
+#define IB_SIDR_UNSUPPORTED_VER                                5
+
+
+/*
+ *     The following definitions are shared between the Access Layer and VPD
+ */
+
+
+typedef struct _ib_ca* __ptr64                 ib_ca_handle_t;
+typedef struct _ib_pd* __ptr64                 ib_pd_handle_t;
+typedef struct _ib_rdd* __ptr64                        ib_rdd_handle_t;
+typedef struct _ib_mr* __ptr64                 ib_mr_handle_t;
+typedef struct _ib_mw* __ptr64                 ib_mw_handle_t;
+typedef struct _ib_qp* __ptr64                 ib_qp_handle_t;
+typedef struct _ib_eec* __ptr64         ib_eec_handle_t;
+typedef struct _ib_cq* __ptr64                 ib_cq_handle_t;
+typedef struct _ib_av* __ptr64                 ib_av_handle_t;
+typedef struct _ib_mcast* __ptr64              ib_mcast_handle_t;
+
+/* Currently for windows branch we use the extended version of ib special verbs struct 
+       in order to be compliant with Infinicon ib_types , later we'll change it to support 
+       OpenSM ib_types.h */
+#ifndef WIN32
+
+/****d* Access Layer/ib_api_status_t
+* NAME
+*      ib_api_status_t
+*
+* DESCRIPTION
+*      Function return codes indicating the success or failure of an API call.
+*      Note that success is indicated by the return value IB_SUCCESS, which
+*      is always zero.
+*
+* NOTES
+*      IB_VERBS_PROCESSING_DONE is used by UVP library to terminate a verbs call
+*      in the pre-ioctl step itself.
+*
+* SYNOPSIS
+*/
+typedef enum _ib_api_status_t
+{
+       IB_SUCCESS,
+       IB_INSUFFICIENT_RESOURCES,
+       IB_INSUFFICIENT_MEMORY,
+       IB_INVALID_PARAMETER,
+       IB_INVALID_SETTING,
+       IB_NOT_FOUND,
+       IB_TIMEOUT,
+       IB_CANCELED,
+       IB_INTERRUPTED,
+       IB_INVALID_PERMISSION,
+       IB_UNSUPPORTED,
+       IB_OVERFLOW,
+       IB_MAX_MCAST_QPS_REACHED,
+       IB_INVALID_QP_STATE,
+       IB_INVALID_EEC_STATE,
+       IB_INVALID_APM_STATE,
+       IB_INVALID_PORT_STATE,
+       IB_INVALID_STATE,
+       IB_RESOURCE_BUSY,
+       IB_INVALID_PKEY,
+       IB_INVALID_LKEY,
+       IB_INVALID_RKEY,
+       IB_INVALID_MAX_WRS,
+       IB_INVALID_MAX_SGE,
+       IB_INVALID_CQ_SIZE,
+       IB_INVALID_SERVICE_TYPE,
+       IB_INVALID_GID,
+       IB_INVALID_LID,
+       IB_INVALID_GUID,
+       IB_INVALID_CA_HANDLE,
+       IB_INVALID_AV_HANDLE,
+       IB_INVALID_CQ_HANDLE,
+       IB_INVALID_EEC_HANDLE,
+       IB_INVALID_QP_HANDLE,
+       IB_INVALID_PD_HANDLE,
+       IB_INVALID_MR_HANDLE,
+       IB_INVALID_MW_HANDLE,
+       IB_INVALID_RDD_HANDLE,
+       IB_INVALID_MCAST_HANDLE,
+       IB_INVALID_CALLBACK,
+       IB_INVALID_AL_HANDLE,                                   /* InfiniBand Access Layer */
+       IB_INVALID_HANDLE,                                              /* InfiniBand Access Layer */
+       IB_ERROR,                                                               /* InfiniBand Access Layer */
+       IB_REMOTE_ERROR,                                                /* Infiniband Access Layer */
+       IB_VERBS_PROCESSING_DONE,                               /* See Notes above                 */
+       IB_INVALID_WR_TYPE,
+       IB_QP_IN_TIMEWAIT,
+       IB_EE_IN_TIMEWAIT,
+       IB_INVALID_PORT,
+       IB_NOT_DONE,
+       IB_UNKNOWN_ERROR                                                /* ALWAYS LAST ENUM VALUE! */
+
+}      ib_api_status_t;
+/*****/
+
+AL_EXPORT const char* ib_error_str[];
+
+/****f* IBA Base: Types/ib_get_err_str
+* NAME
+*      ib_get_err_str
+*
+* DESCRIPTION
+*      Returns a string for the specified status value.
+*
+* SYNOPSIS
+*/
+AL_INLINE const char*    AL_API
+ib_get_err_str(
+       IN                              ib_api_status_t                         status )
+{
+       if( status > IB_UNKNOWN_ERROR )
+               status = IB_UNKNOWN_ERROR;
+       return( ib_error_str[status] );
+}
+/*
+* PARAMETERS
+*      status
+*              [in] status value
+*
+* RETURN VALUES
+*      Pointer to the status description string.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+
+/****d* Verbs/ib_async_event_t
+* NAME
+*      ib_async_event_t -- Async event types
+*
+* DESCRIPTION
+*      This type indicates the reason the async callback was called.
+*      The context in the ib_event_rec_t indicates the resource context
+*      that associated with the callback.  For example, for IB_AE_CQ_ERROR
+*      the context provided during the ib_create_cq is returned in the event.
+*
+* SYNOPSIS
+*/
+typedef enum _ib_async_event_t
+{
+       IB_AE_SQ_ERROR = 1,
+       IB_AE_SQ_DRAINED,
+       IB_AE_RQ_ERROR,
+       IB_AE_CQ_ERROR,
+       IB_AE_QP_FATAL,
+       IB_AE_QP_COMM,
+       IB_AE_QP_APM,
+       IB_AE_EEC_FATAL,
+       IB_AE_EEC_COMM,
+       IB_AE_EEC_APM,
+       IB_AE_LOCAL_FATAL,
+       IB_AE_PKEY_TRAP,
+       IB_AE_QKEY_TRAP,
+       IB_AE_MKEY_TRAP,
+       IB_AE_PORT_TRAP,
+       IB_AE_SYSIMG_GUID_TRAP,
+       IB_AE_BUF_OVERRUN,
+       IB_AE_LINK_INTEGRITY,
+       IB_AE_FLOW_CTRL_ERROR,
+       IB_AE_BKEY_TRAP,
+       IB_AE_QP_APM_ERROR,
+       IB_AE_EEC_APM_ERROR,
+       IB_AE_WQ_REQ_ERROR,
+       IB_AE_WQ_ACCESS_ERROR,
+       IB_AE_PORT_ACTIVE,
+       IB_AE_PORT_DOWN,
+       IB_AE_UNKNOWN           /* ALWAYS LAST ENUM VALUE */
+
+}      ib_async_event_t;
+/*
+* VALUES
+*      IB_AE_SQ_ERROR
+*              An error occurred when accessing the send queue of the QP or EEC.
+*              This event is optional.
+*
+*      IB_AE_SQ_DRAINED
+*              The send queue of the specified QP has completed the outstanding
+*              messages in progress when the state change was requested and, if
+*              applicable, has received all acknowledgements for those messages.
+*
+*      IB_AE_RQ_ERROR
+*              An error occurred when accessing the receive queue of the QP or EEC.
+*              This event is optional.
+*
+*      IB_AE_CQ_ERROR
+*              An error occurred when writing an entry to the CQ.
+*
+*      IB_AE_QP_FATAL
+*              A catastrophic error occurred while accessing or processing the
+*              work queue that prevents reporting of completions.
+*
+*      IB_AE_QP_COMM
+*              The first packet has arrived for the receive work queue where the
+*              QP is still in the RTR state.
+*
+*      IB_AE_QP_APM
+*              If alternate path migration is supported, this event indicates that
+*              the QP connection has migrated to the alternate path.
+*
+*      IB_AE_EEC_FATAL
+*              If reliable datagram service is supported, this event indicates that
+*              a catastrophic error occurred while accessing or processing the EEC
+*              that prevents reporting of completions.
+*
+*      IB_AE_EEC_COMM
+*              If reliable datagram service is supported, this event indicates that
+*              the first packet has arrived for the receive work queue where the
+*              EEC is still in the RTR state.
+*
+*      IB_AE_EEC_APM
+*              If reliable datagram service and alternate path migration is supported,
+*              this event indicates that the EEC connection has migrated to the
+*              alternate path.
+*
+*      IB_AE_LOCAL_FATAL
+*              A catastrophic HCA error occurred which cannot be attributed to any
+*              resource; behavior is indeterminate.
+*
+*      IB_AE_PKEY_TRAP
+*              A PKEY violation was detected.  This event is optional.
+*
+*      IB_AE_QKEY_TRAP
+*              A QKEY violation was detected.  This event is optional.
+*
+*      IB_AE_MKEY_TRAP
+*              An MKEY violation was detected.  This event is optional.
+*
+*      IB_AE_PORT_TRAP
+*              A port capability change was detected.  This event is optional.
+*
+*      IB_AE_SYSIMG_GUID_TRAP
+*              If the system image GUID is supported, this event indicates that the
+*              system image GUID of this HCA has been changed.  This event is
+*              optional.
+*
+*      IB_AE_BUF_OVERRUN
+*              The number of consecutive flow control update periods with at least
+*              one overrun error in each period has exceeded the threshold specified
+*              in the port info attributes.  This event is optional.
+*
+*      IB_AE_LINK_INTEGRITY
+*              The detection of excessively frequent local physical errors has
+*              exceeded the threshold specified in the port info attributes.  This
+*              event is optional.
+*
+*      IB_AE_FLOW_CTRL_ERROR
+*              An HCA watchdog timer monitoring the arrival of flow control updates
+*              has expired without receiving an update.  This event is optional.
+*
+*      IB_AE_BKEY_TRAP
+*              An BKEY violation was detected.  This event is optional.
+*
+*      IB_AE_QP_APM_ERROR
+*              If alternate path migration is supported, this event indicates that
+*              an incoming path migration request to this QP was not accepted.
+*
+*      IB_AE_EEC_APM_ERROR
+*              If reliable datagram service and alternate path migration is supported,
+*              this event indicates that an incoming path migration request to this
+*              EEC was not accepted.
+*
+*      IB_AE_WQ_REQ_ERROR
+*              An OpCode violation was detected at the responder.
+*
+*      IB_AE_WQ_ACCESS_ERROR
+*              An access violation was detected at the responder.
+*
+*      IB_AE_PORT_ACTIVE
+*              If the port active event is supported, this event is generated
+*              when the link becomes active: IB_LINK_ACTIVE.
+*
+*      IB_AE_PORT_DOWN
+*              The link is declared unavailable: IB_LINK_INIT, IB_LINK_ARMED,
+*              IB_LINK_DOWN.
+*
+*      IB_AE_UNKNOWN
+*              An unknown error occurred which cannot be attributed to any
+*              resource; behavior is indeterminate.